From e3d59949afb4ad1fb849f03b505b63547a80419b Mon Sep 17 00:00:00 2001 From: MooN <56061215+MgKyawLay@users.noreply.github.com> Date: Sun, 15 Feb 2026 01:04:16 +0630 Subject: [PATCH] add some colors --- lib/core/theme/app_colors.dart | 7 ++ lib/main.dart | 29 ++++- lib/presentation/home/home_screen.dart | 104 +++++++++++++++--- .../terminal/terminal_selection_screen.dart | 2 +- 4 files changed, 124 insertions(+), 18 deletions(-) create mode 100644 lib/core/theme/app_colors.dart diff --git a/lib/core/theme/app_colors.dart b/lib/core/theme/app_colors.dart new file mode 100644 index 0000000..3d13ea8 --- /dev/null +++ b/lib/core/theme/app_colors.dart @@ -0,0 +1,7 @@ +import 'package:flutter/material.dart'; + +class AppColors { + const AppColors._(); + + static const Color primary = Color(0xFF2A60AF); +} diff --git a/lib/main.dart b/lib/main.dart index cd20a8c..7c2504e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,8 +1,23 @@ +import 'package:e_receipt_mobile/core/theme/app_colors.dart'; import 'package:e_receipt_mobile/presentation/login/login_page.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; void main() { + WidgetsFlutterBinding.ensureInitialized(); + + SystemChrome.setEnabledSystemUIMode( + SystemUiMode.manual, + overlays: SystemUiOverlay.values, + ); + SystemChrome.setSystemUIOverlayStyle( + const SystemUiOverlayStyle( + statusBarColor: AppColors.primary, + statusBarIconBrightness: Brightness.light, + statusBarBrightness: Brightness.dark, + ), + ); runApp(const ProviderScope(child: EReceiptApp())); } @@ -15,7 +30,19 @@ class EReceiptApp extends StatelessWidget { title: 'E-Receipt', debugShowCheckedModeBanner: false, theme: ThemeData( - colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue), + colorScheme: ColorScheme.fromSeed( + seedColor: AppColors.primary, + ), + primaryColor: AppColors.primary, + appBarTheme: const AppBarTheme( + backgroundColor: AppColors.primary, + foregroundColor: Colors.white, + systemOverlayStyle: SystemUiOverlayStyle( + statusBarColor: AppColors.primary, + statusBarIconBrightness: Brightness.light, + statusBarBrightness: Brightness.dark, + ), + ), useMaterial3: true, ), home: const LoginPage(), diff --git a/lib/presentation/home/home_screen.dart b/lib/presentation/home/home_screen.dart index 1be3c33..bc8d12a 100644 --- a/lib/presentation/home/home_screen.dart +++ b/lib/presentation/home/home_screen.dart @@ -1,3 +1,4 @@ +import 'package:e_receipt_mobile/core/theme/app_colors.dart'; import 'package:e_receipt_mobile/domain/entities/login_user.dart'; import 'package:e_receipt_mobile/presentation/auth/session_controller.dart'; import 'package:e_receipt_mobile/presentation/home/home_view_model.dart'; @@ -21,22 +22,41 @@ class HomeScreen extends ConsumerWidget { centerTitle: true, ), drawer: Drawer( - child: SafeArea( + backgroundColor: Colors.white, + child: Column( children: [ UserAccountsDrawerHeader( - accountName: Text(user.username), - accountEmail: Text('Role: ${user.role}'), + decoration: const BoxDecoration(color: AppColors.primary), + accountName: Text( + user.username, + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.w600, + ), + ), + accountEmail: Text( + 'Role: ${user.role}', + style: const TextStyle(color: Colors.white70), + ), currentAccountPicture: CircleAvatar( + backgroundColor: Colors.white, child: Text( (user.username.isNotEmpty ? user.username[0] : 'U') .toUpperCase(), + style: const TextStyle(color: AppColors.primary), ), ), ), ListTile( - leading: const Icon(Icons.person_outline), - title: const Text('Profile'), + leading: const Icon(Icons.person_outline, color: Colors.black87), + title: const Text( + 'Profile', + style: TextStyle( + color: Colors.black87, + fontWeight: FontWeight.w500, + ), + ), onTap: () { Navigator.of(context).pop(); _showProfile(context); @@ -48,35 +68,88 @@ class HomeScreen extends ConsumerWidget { // onTap: () => Navigator.of(context).pop(), // ), ListTile( - leading: const Icon(Icons.analytics_outlined), - title: const Text('Reports'), + leading: const Icon(Icons.analytics_outlined, color: Colors.black87), + title: const Text( + 'Reports', + style: TextStyle( + color: Colors.black87, + fontWeight: FontWeight.w500, + ), + ), onTap: () { Navigator.of(context).pop(); _showComingSoon(context, 'Reports'); }, ), ListTile( - leading: const Icon(Icons.settings_outlined), - title: const Text('Settings'), + leading: const Icon(Icons.settings_outlined, color: Colors.black87), + title: const Text( + 'Settings', + style: TextStyle( + color: Colors.black87, + fontWeight: FontWeight.w500, + ), + ), onTap: () { Navigator.of(context).pop(); _showComingSoon(context, 'Settings'); }, ), ListTile( - leading: const Icon(Icons.help_outline), - title: const Text('Help'), + leading: const Icon(Icons.help_outline, color: Colors.black87), + title: const Text( + 'Help', + style: TextStyle( + color: Colors.black87, + fontWeight: FontWeight.w500, + ), + ), onTap: () { Navigator.of(context).pop(); _showComingSoon(context, 'Help'); }, ), const Spacer(), - const Divider(height: 1), + const Divider(height: 1, color: Colors.black12), ListTile( - leading: const Icon(Icons.logout), - title: const Text('Logout'), - onTap: () { + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 8, + ), + minTileHeight: 64, + leading: const Icon(Icons.logout, color: Colors.black87), + title: const Text( + 'Logout', + style: TextStyle( + color: Colors.black87, + fontWeight: FontWeight.w600, + ), + ), + onTap: () async { + final shouldLogout = await showDialog( + context: context, + builder: (context) { + return AlertDialog( + title: const Text('Logout'), + content: const Text('Are you sure want to logout?'), + actions: [ + TextButton( + onPressed: () => Navigator.of(context).pop(false), + child: const Text('Cancel'), + ), + TextButton( + onPressed: () => Navigator.of(context).pop(true), + child: const Text('Logout'), + ), + ], + ); + }, + ); + + if (shouldLogout != true || !context.mounted) { + return; + } + ref.read(sessionControllerProvider.notifier).clearUser(); Navigator.of(context).pushAndRemoveUntil( MaterialPageRoute( @@ -88,7 +161,6 @@ class HomeScreen extends ConsumerWidget { ), ], ), - ), ), body: Padding( padding: const EdgeInsets.all(16), diff --git a/lib/presentation/terminal/terminal_selection_screen.dart b/lib/presentation/terminal/terminal_selection_screen.dart index a7dfecc..01f572d 100644 --- a/lib/presentation/terminal/terminal_selection_screen.dart +++ b/lib/presentation/terminal/terminal_selection_screen.dart @@ -27,7 +27,7 @@ class _TerminalSelectionScreenState return Scaffold( appBar: AppBar( - title: Text('Select Terminals - ${widget.merchantName}'), + title: Text(widget.merchantName), ), body: terminalsAsync.when( loading: () => const Center(child: CircularProgressIndicator()),