largeFormatAwareAppBar function

AppBar largeFormatAwareAppBar(
  1. BuildContext context,
  2. String title,
  3. {Color? background,
  4. List<Widget>? actions,
  5. VoidCallback? onDismiss}
)

Wraps an AppBar and configures the automaticallyImplyLeading flag based on isLargeFormatLayout

Implementation

AppBar largeFormatAwareAppBar(BuildContext context, String title,
    {Color? background, List<Widget>? actions, VoidCallback? onDismiss}) {
  return AppBar(
    backgroundColor: background,
    shadowColor: background,
    automaticallyImplyLeading: !isLargeFormatLayout(context),
    title: Text(title),
    actions: actions,
    leading: isLargeFormatLayout(context)
        ? CloseButton(
            onPressed: onDismiss ??
                () => Navigator.of(context, rootNavigator: true).maybePop(),
          )
        : null,
  );
}