77 lines
2.2 KiB
Dart
77 lines
2.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
import '../providers/user_profile_provider.dart';
|
|
import '../screens/main_bottom_nav.dart';
|
|
import '../config/app_config.dart';
|
|
|
|
class MainAppBar extends StatelessWidget implements PreferredSizeWidget {
|
|
const MainAppBar({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final profileProvider = Provider.of<UserProfileProvider>(context);
|
|
final profileUrl = profileProvider.profile?.profileImage;
|
|
|
|
return AppBar(
|
|
backgroundColor: Colors.white,
|
|
elevation: 0.8,
|
|
surfaceTintColor: Colors.transparent,
|
|
automaticallyImplyLeading: false,
|
|
|
|
title: Row(
|
|
children: [
|
|
ClipRRect(
|
|
borderRadius: BorderRadius.circular(4),
|
|
child: Image.network(
|
|
AppConfig.logoUrl,
|
|
height: 60,
|
|
width: 100,
|
|
fit: BoxFit.cover,
|
|
errorBuilder: (context, error, stackTrace) =>
|
|
const Icon(Icons.business, size: 32, color: Colors.indigo),
|
|
),
|
|
),
|
|
const SizedBox(width: 10),
|
|
const Text(
|
|
"Kent Logistics",
|
|
style: TextStyle(
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.w600,
|
|
color: Colors.indigo,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
|
|
actions: [
|
|
IconButton(
|
|
icon: const Icon(Icons.notifications_none, color: Colors.indigo),
|
|
onPressed: () {},
|
|
),
|
|
|
|
GestureDetector(
|
|
onTap: () {
|
|
final bottomNav = context.findAncestorStateOfType<MainBottomNavState>();
|
|
bottomNav?.setIndex(4);
|
|
},
|
|
|
|
child: Padding(
|
|
padding: const EdgeInsets.only(right: 12),
|
|
child: CircleAvatar(
|
|
radius: 18,
|
|
backgroundColor: Colors.grey.shade200,
|
|
backgroundImage: profileUrl != null ? NetworkImage(profileUrl) : null,
|
|
child: profileUrl == null
|
|
? const Icon(Icons.person, color: Colors.grey)
|
|
: null,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
@override
|
|
Size get preferredSize => const Size.fromHeight(56);
|
|
}
|