presentView<T> static method
void
presentView<T>({
- String title = "Popup",
- bool isFullScreen = true,
- bool useRootContext = false,
- bool hasInsetBottom = true,
- bool enableDrag = true,
- Color? contentColor,
- EdgeInsets? contentPadding,
- dynamic onChanged(
- T result
- GtdCallback<
T?> ? onCompleted, - required BuildContext context,
- required Builder builder,
Implementation
static void presentView<T>({
String title = "Popup",
bool isFullScreen = true,
bool useRootContext = false,
bool hasInsetBottom = true,
bool enableDrag = true,
Color? contentColor,
EdgeInsets? contentPadding,
Function(T result)? onChanged,
GtdCallback<T?>? onCompleted,
required BuildContext context,
required Builder builder,
}) async {
final result = await showModalBottomSheet<T>(
context: context,
useSafeArea: true,
enableDrag: enableDrag,
isScrollControlled: isFullScreen,
// backgroundColor: contentColor,
builder: (BuildContext context) {
return SafeArea(
bottom: hasInsetBottom,
child: LayoutBuilder(builder: (context, constraints) {
return Column(
children: [
Expanded(
child: SizedBox(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 16),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
AppBar(
title: Padding(
padding: const EdgeInsets.all(0),
child: Text(
title,
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
),
),
automaticallyImplyLeading: false,
actions: [
IconButton(
onPressed: () {
Navigator.of(context).pop();
},
icon: const Icon(Icons.close))
],
),
Expanded(
child: ColoredBox(
color: contentColor ?? Colors.white,
child: Padding(
padding: contentPadding ?? const EdgeInsets.all(16),
child: useRootContext ? builder.build(context) : builder,
),
),
// child:
),
],
),
),
),
),
SizedBox(
height: MediaQuery.viewInsetsOf(context).bottom,
)
],
);
}),
);
}).then((result) {
onCompleted?.call(result);
});
if (result != null && onChanged != null) {
onChanged(result);
}
}