nc-photos/app/lib/widget/dialog_scaffold.dart

37 lines
769 B
Dart
Raw Normal View History

2022-01-28 21:06:19 +01:00
import 'package:flutter/material.dart';
/// A Scaffold that can be used with dialogs
///
/// Scaffold is needed for [SnackBar] to show correctly on top of a dialog
class DialogScaffold extends StatelessWidget {
const DialogScaffold({
2024-05-28 17:10:33 +02:00
super.key,
2022-01-28 21:06:19 +01:00
required this.body,
this.canPop = true,
2024-05-28 17:10:33 +02:00
});
2022-01-28 21:06:19 +01:00
@override
build(BuildContext context) {
return GestureDetector(
onTap: () {
if (canPop) {
Navigator.of(context).pop();
}
},
child: PopScope(
canPop: canPop,
2022-01-28 21:06:19 +01:00
child: Scaffold(
backgroundColor: Colors.transparent,
body: GestureDetector(
onTap: () {},
child: body,
),
),
),
);
}
final Widget body;
final bool canPop;
}