show<T> static method
Future<T?>
show<T>(
- BuildContext context, {
- required String title,
- required Widget body,
- List<
Widget> actions = const <Widget>[],
Presents a modal side sheet and completes with the popped result.
Implementation
static Future<T?> show<T>(
BuildContext context, {
required String title,
required Widget body,
List<Widget> actions = const <Widget>[],
}) {
final M3EThemeData theme =
M3EThemeScope.resolveOf(context) ?? M3ETheme.of(context);
final sheetTheme = theme.sideSheetTheme;
return showGeneralDialog<T>(
context: context,
barrierDismissible: true,
barrierLabel: 'Dismiss',
barrierColor: sheetTheme.scrimColor(theme.colorScheme),
transitionDuration: M3EMotion.long1,
pageBuilder: (BuildContext context, _, _) {
return M3EComponentTheme(
builder: (context) => Align(
alignment: Alignment.centerRight,
child: M3ESideSheet(title: title, body: body, actions: actions),
),
);
},
transitionBuilder:
(BuildContext context, Animation<double> a, _, Widget c) {
return SlideTransition(
position:
Tween<Offset>(
begin: const Offset(1, 0),
end: Offset.zero,
).animate(
CurvedAnimation(
parent: a,
curve: M3EMotion.emphasizedDecelerate,
),
),
child: c,
);
},
);
}