flutter-freaccess-hub/lib/components/atomic_components/shared_components_atoms/appbar.dart

52 lines
1.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:hub/flutter_flow/flutter_flow_icon_button.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/shared/utils/style_util.dart';
class AppBarUtil extends StatelessWidget implements PreferredSizeWidget {
final String title;
final VoidCallback? onBackButtonPressed;
final Widget? actionButton;
const AppBarUtil({
super.key,
required this.title,
this.onBackButtonPressed,
this.actionButton,
});
@override
Widget build(BuildContext context) {
return AppBar(
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
automaticallyImplyLeading: false,
forceMaterialTransparency: true,
elevation: 0.0,
leading: FlutterFlowIconButton(
borderColor: Colors.transparent,
borderRadius: 30.0,
borderWidth: 1.0,
buttonSize: 60.0,
icon: Icon(
Icons.keyboard_arrow_left,
color: FlutterFlowTheme.of(context).primaryText,
size: 30.0,
),
onPressed: onBackButtonPressed ?? () => Navigator.of(context).pop(),
),
title: Text(
title,
style: DesignUtil.appbarStyle(),
),
actions: [
if (actionButton != null) actionButton!,
],
centerTitle: true,
);
}
@override
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
}