71 lines
2.1 KiB
Dart
71 lines
2.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
import 'package:hub/flutter_flow/index.dart';
|
|
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
|
|
|
mixin Template {
|
|
PreferredSizeWidget buildAppBar(
|
|
String title,
|
|
BuildContext context, [
|
|
dynamic Function()? backAction,
|
|
dynamic Function()? frontAction,
|
|
]) {
|
|
final theme = FlutterFlowTheme.of(context);
|
|
return AppBar(
|
|
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
|
automaticallyImplyLeading: false,
|
|
title: Text(
|
|
title,
|
|
style: FlutterFlowTheme.of(context).headlineMedium.override(
|
|
fontFamily: FlutterFlowTheme.of(context).headlineMediumFamily,
|
|
color: FlutterFlowTheme.of(context).primaryText,
|
|
fontSize: 16.0,
|
|
fontWeight: FontWeight.bold,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
FlutterFlowTheme.of(context).headlineMediumFamily),
|
|
),
|
|
),
|
|
leading: _backButton(context, theme, backAction),
|
|
centerTitle: true,
|
|
elevation: 0.0,
|
|
actions: _frontButton(context, theme, frontAction),
|
|
);
|
|
}
|
|
|
|
List<Widget> _frontButton(BuildContext context, FlutterFlowTheme theme,
|
|
dynamic Function()? action) {
|
|
if (action == null) return [];
|
|
return [
|
|
IconButton(
|
|
onPressed: () async => await showDialog(
|
|
context: context,
|
|
builder: (context) => action(),
|
|
),
|
|
icon: Icon(
|
|
Symbols.info_i_rounded,
|
|
color: Colors.black,
|
|
),
|
|
)
|
|
];
|
|
}
|
|
|
|
Widget? _backButton(BuildContext context, FlutterFlowTheme theme,
|
|
dynamic Function()? onPressed) {
|
|
if (onPressed == null) return null;
|
|
return FlutterFlowIconButton(
|
|
key: ValueKey<String>('BackNavigationAppBar'),
|
|
borderColor: Colors.transparent,
|
|
borderRadius: 30.0,
|
|
borderWidth: 1.0,
|
|
buttonSize: 60.0,
|
|
icon: Icon(
|
|
Icons.keyboard_arrow_left,
|
|
color: theme.primaryText,
|
|
size: 30.0,
|
|
),
|
|
onPressed: onPressed,
|
|
);
|
|
}
|
|
}
|