Files

111 lines
3.1 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:provider/provider.dart';
import 'package:tm_app/core/constants/assets.dart';
import 'package:tm_app/core/theme/colors.dart';
import 'package:tm_app/core/utils/size_config.dart';
import '../../core/routes/app_routes.dart';
import '../../core/services/tab_navigation_service.dart';
PreferredSizeWidget tenderMobileAppBar({required String title}) {
return PreferredSize(
preferredSize: const Size.fromHeight(56),
child: AppBar(
backgroundColor: AppColors.backgroundColor,
elevation: 0,
titleSpacing: 0,
automaticallyImplyLeading: false,
actions: [
SvgPicture.asset(AssetsManager.logoSmall),
SizedBox(width: 24.0.w()),
],
title: Padding(
padding: EdgeInsetsDirectional.only(start: 24.0.w()),
child: Text(
title,
style: TextStyle(
color: AppColors.grey70,
fontWeight: FontWeight.w600,
fontSize: 20.0.sp(),
),
),
),
),
);
}
PreferredSizeWidget appBar({
required BuildContext context,
required String title,
}) {
final isRtl = Directionality.of(context) == TextDirection.rtl;
return PreferredSize(
preferredSize: const Size.fromHeight(60),
child: AppBar(
backgroundColor: AppColors.backgroundColor,
elevation: 0,
titleSpacing: 0,
leading: IconButton(
icon: SvgPicture.asset(
isRtl ? AssetsManager.arrowRight : AssetsManager.arrowLeft,
height: 24.0.w(),
width: 24.0.w(),
),
onPressed: () => Navigator.pop(context),
),
title: Text(
title,
style: TextStyle(
color: AppColors.grey70,
fontWeight: FontWeight.w600,
fontSize: 20.0.sp(),
),
),
),
);
}
PreferredSizeWidget tabletAppBar({
required String title,
required GlobalKey<ScaffoldState> key,
required BuildContext context,
}) {
return PreferredSize(
preferredSize: const Size.fromHeight(64),
child: AppBar(
scrolledUnderElevation: 0,
backgroundColor: AppColors.backgroundColor,
elevation: 0,
titleSpacing: 0,
leading: Padding(
padding: EdgeInsetsDirectional.only(start: 24.0.w()),
child: InkWell(
splashColor: Colors.transparent,
highlightColor: AppColors.green0,
borderRadius: BorderRadius.circular(50),
onTap: () {
Router.neglect(context, () => const HomeRouteData().go(context));
context.read<TabNavigationService>().onTabSelected(0);
},
child: SvgPicture.asset(AssetsManager.logoSmall),
),
),
actions: [
IconButton(
icon: Padding(
padding: EdgeInsetsDirectional.only(end: 24.0.w()),
child: SvgPicture.asset(
AssetsManager.menu,
height: 32.0.w(),
width: 32.0.w(),
),
),
onPressed: () => key.currentState!.openDrawer(),
),
],
),
);
}