You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mohemm-flutter-app/lib/widgets/app_bar_widget.dart

71 lines
2.3 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
AppBar AppBarWidget(BuildContext context,
{required String title,
bool showHomeButton = true,
bool showNotificationButton = false,
bool showMemberButton = false,
String? image}) {
return AppBar(
leadingWidth: 0,
// leading: GestureDetector(
// behavior: HitTestBehavior.opaque,
// onTap: Feedback.wrapForTap(() => Navigator.maybePop(context), context),
// child: const Icon(Icons.arrow_back_ios, color: MyColors.darkIconColor),
// ),
//titleSpacing: -1.44,
title: Row(
children: [
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap:
Feedback.wrapForTap(() => Navigator.maybePop(context), context),
child:
const Icon(Icons.arrow_back_ios, color: MyColors.darkIconColor),
),
4.width,
if (image != null) SvgPicture.asset(
image,
height: 40,
width: 40,
),
if (image != null) 14.width,
title.toText24(color: MyColors.darkTextColor, isBold: true).expanded,
],
),
centerTitle: false,
elevation: 0,
backgroundColor: Colors.white,
actions: [
if (showHomeButton)
IconButton(
onPressed: () {
Navigator.popUntil(
context, ModalRoute.withName(AppRoutes.dashboard));
},
icon: const Icon(Icons.home, color: MyColors.darkIconColor),
),
3 years ago
if (showNotificationButton)
IconButton(
onPressed: () {
Navigator.pushNamed(context, AppRoutes.worklistSettings);
3 years ago
},
icon: const Icon(Icons.notifications, color: MyColors.textMixColor),
),
3 years ago
if (showMemberButton)
3 years ago
IconButton(
onPressed: () {
Navigator.pushNamed(context, AppRoutes.subordinateLeave);
},
icon: const Icon(Icons.people, color: MyColors.textMixColor),
),
],
);
}