show<T> static method
- BuildContext context, {
- required GlobalKey<
State< avatarKey,StatefulWidget> > - required GlobalKey<
State< panelKey,StatefulWidget> >
Displays an AccountsSwitcherView via separate RawDialogRoute.
Implementation
static Future<T?> show<T>(
BuildContext context, {
required GlobalKey avatarKey,
required GlobalKey panelKey,
}) async {
final style = Theme.of(context).style;
final route = RawDialogRoute<T>(
barrierColor: style.barrierColor.withValues(alpha: .1),
barrierDismissible: true,
pageBuilder: (_, _, _) =>
AccountsSwitcherView(avatarKey: avatarKey, panelKey: panelKey),
fullscreenDialog: true,
barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel,
transitionDuration: const Duration(milliseconds: 300),
transitionBuilder: (_, Animation<double> animation, _, Widget child) {
return AnimatedBuilder(
animation: animation,
builder: (context, child) {
return BackdropFilter(
filter: ui.ImageFilter.blur(
sigmaX: animation.value * 10,
sigmaY: animation.value * 10,
),
child: FadeTransition(opacity: animation, child: child),
);
},
child: child,
);
},
);
router.obscuring.add(route);
try {
return await Navigator.of(context, rootNavigator: true).push<T>(route);
} finally {
router.obscuring.remove(route);
}
}