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? 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); }