add some colors

This commit is contained in:
MooN 2026-02-15 01:04:16 +06:30
parent 6a04ad02a1
commit e3d59949af
4 changed files with 124 additions and 18 deletions

View File

@ -0,0 +1,7 @@
import 'package:flutter/material.dart';
class AppColors {
const AppColors._();
static const Color primary = Color(0xFF2A60AF);
}

View File

@ -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:e_receipt_mobile/presentation/login/login_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
void main() { 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())); runApp(const ProviderScope(child: EReceiptApp()));
} }
@ -15,7 +30,19 @@ class EReceiptApp extends StatelessWidget {
title: 'E-Receipt', title: 'E-Receipt',
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
theme: ThemeData( 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, useMaterial3: true,
), ),
home: const LoginPage(), home: const LoginPage(),

View File

@ -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/domain/entities/login_user.dart';
import 'package:e_receipt_mobile/presentation/auth/session_controller.dart'; import 'package:e_receipt_mobile/presentation/auth/session_controller.dart';
import 'package:e_receipt_mobile/presentation/home/home_view_model.dart'; import 'package:e_receipt_mobile/presentation/home/home_view_model.dart';
@ -21,22 +22,41 @@ class HomeScreen extends ConsumerWidget {
centerTitle: true, centerTitle: true,
), ),
drawer: Drawer( drawer: Drawer(
child: SafeArea( backgroundColor: Colors.white,
child: Column( child: Column(
children: [ children: [
UserAccountsDrawerHeader( UserAccountsDrawerHeader(
accountName: Text(user.username), decoration: const BoxDecoration(color: AppColors.primary),
accountEmail: Text('Role: ${user.role}'), 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( currentAccountPicture: CircleAvatar(
backgroundColor: Colors.white,
child: Text( child: Text(
(user.username.isNotEmpty ? user.username[0] : 'U') (user.username.isNotEmpty ? user.username[0] : 'U')
.toUpperCase(), .toUpperCase(),
style: const TextStyle(color: AppColors.primary),
), ),
), ),
), ),
ListTile( ListTile(
leading: const Icon(Icons.person_outline), leading: const Icon(Icons.person_outline, color: Colors.black87),
title: const Text('Profile'), title: const Text(
'Profile',
style: TextStyle(
color: Colors.black87,
fontWeight: FontWeight.w500,
),
),
onTap: () { onTap: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
_showProfile(context); _showProfile(context);
@ -48,35 +68,88 @@ class HomeScreen extends ConsumerWidget {
// onTap: () => Navigator.of(context).pop(), // onTap: () => Navigator.of(context).pop(),
// ), // ),
ListTile( ListTile(
leading: const Icon(Icons.analytics_outlined), leading: const Icon(Icons.analytics_outlined, color: Colors.black87),
title: const Text('Reports'), title: const Text(
'Reports',
style: TextStyle(
color: Colors.black87,
fontWeight: FontWeight.w500,
),
),
onTap: () { onTap: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
_showComingSoon(context, 'Reports'); _showComingSoon(context, 'Reports');
}, },
), ),
ListTile( ListTile(
leading: const Icon(Icons.settings_outlined), leading: const Icon(Icons.settings_outlined, color: Colors.black87),
title: const Text('Settings'), title: const Text(
'Settings',
style: TextStyle(
color: Colors.black87,
fontWeight: FontWeight.w500,
),
),
onTap: () { onTap: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
_showComingSoon(context, 'Settings'); _showComingSoon(context, 'Settings');
}, },
), ),
ListTile( ListTile(
leading: const Icon(Icons.help_outline), leading: const Icon(Icons.help_outline, color: Colors.black87),
title: const Text('Help'), title: const Text(
'Help',
style: TextStyle(
color: Colors.black87,
fontWeight: FontWeight.w500,
),
),
onTap: () { onTap: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
_showComingSoon(context, 'Help'); _showComingSoon(context, 'Help');
}, },
), ),
const Spacer(), const Spacer(),
const Divider(height: 1), const Divider(height: 1, color: Colors.black12),
ListTile( ListTile(
leading: const Icon(Icons.logout), contentPadding: const EdgeInsets.symmetric(
title: const Text('Logout'), horizontal: 16,
onTap: () { 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<bool>(
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(); ref.read(sessionControllerProvider.notifier).clearUser();
Navigator.of(context).pushAndRemoveUntil( Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute<void>( MaterialPageRoute<void>(
@ -88,7 +161,6 @@ class HomeScreen extends ConsumerWidget {
), ),
], ],
), ),
),
), ),
body: Padding( body: Padding(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),

View File

@ -27,7 +27,7 @@ class _TerminalSelectionScreenState
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('Select Terminals - ${widget.merchantName}'), title: Text(widget.merchantName),
), ),
body: terminalsAsync.when( body: terminalsAsync.when(
loading: () => const Center(child: CircularProgressIndicator()), loading: () => const Center(child: CircularProgressIndicator()),