barcode_scanner/lib/components/main_appbar_component.dart
mandreshope 4682be5b62 feat: Adds operation pages and refactors navigation
Introduces dedicated pages and routes for Delivery and Inventory operations.

Refactors the application drawer to include navigation links for these new operations, ensuring proper route transitions and closing the drawer on tap. Enhances the drawer's active state styling for list and expansion tiles, providing better visual feedback.

Extracts common app bar logic into a reusable `MainAppbarComponent` and integrates it into operation pages, starting with Reception, to standardize the application's header.

Standardizes routing paths for operation pages and ensures consistent page transitions across them.
2025-07-24 11:07:10 +03:00

58 lines
1.6 KiB
Dart

import 'package:barcode_scanner/themes/app_theme.dart';
import 'package:flutter/material.dart';
class MainAppbarComponent extends StatelessWidget
implements PreferredSizeWidget {
const MainAppbarComponent({
super.key,
this.title,
this.subTitle,
this.scaffoledKey,
});
final GlobalKey<ScaffoldState>? scaffoledKey;
final String? title;
final String? subTitle;
@override
Widget build(BuildContext context) {
return AppBar(
leading: IconButton(
icon: Icon(Icons.menu, color: AppTheme.of(context).white),
onPressed: () {
scaffoledKey?.currentState?.openDrawer();
},
),
title: title == null || subTitle == null
? null
: Row(
children: [
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title ?? '',
style: AppTheme.of(
context,
).titleMedium.copyWith(color: AppTheme.of(context).white),
),
Text(
subTitle ?? '',
style: AppTheme.of(
context,
).bodyMedium.copyWith(color: AppTheme.of(context).white),
),
],
),
],
),
toolbarHeight: 60,
backgroundColor: AppTheme.of(context).primary,
elevation: 4,
);
}
@override
Size get preferredSize => Size.fromHeight(kToolbarHeight);
}