Files
CityCards_Customer_Flutter/lib/common_packages/app_bar.dart
2025-10-29 19:59:11 +05:30

83 lines
2.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../core/route_constants.dart';
class CommonAppBar extends StatelessWidget {
const CommonAppBar({
super.key,
required this.isWhiteLogo,
required this.isProfilePage,
this.showCart = true,
});
final bool isWhiteLogo;
final bool isProfilePage;
final bool? showCart;
@override
Widget build(BuildContext context) {
return Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Image.asset(
isWhiteLogo
? "assets/logo/melbourne_white.png"
: "assets/logo/melbourne_logo.png",
scale: 4,
),
Row(
children: [
if(showCart!)
InkWell(
onTap: (){
Navigator.of(
context,
rootNavigator: true,
).pushNamed(RouteConstants.cartPage);
},
child: Container(
padding: const EdgeInsets.all(10),
decoration: const BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
),
child: Image.asset(
"assets/icons/shopping_cart.png",
height: 20.h,
),
),
),
SizedBox(width: 8.w),
if (!isProfilePage)
GestureDetector(
onTap: () {
Navigator.of(
context,
rootNavigator: true,
).pushNamed(RouteConstants.profile);
},
child: CircleAvatar(
backgroundColor: Color(0xffFFDFDF),
child: Image.asset( "assets/images/profile_default_img.png",),
),
),
],
),
],
),
if (!isWhiteLogo)
Column(
children: [
SizedBox(height: 12.h),
Divider(height: 1.h, color: Color(0xFFD9D9D9)),
SizedBox(height: 22.h),
],
),
],
);
}
}