From 47a2d349335f812387613225737019c34cf6f02f Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Thu, 6 Feb 2025 17:16:23 +0800 Subject: [PATCH] update --- lib/pages/login_page.dart | 2 +- lib/pages/main_page.dart | 124 +++++++++++++++++++------------------- 2 files changed, 62 insertions(+), 64 deletions(-) diff --git a/lib/pages/login_page.dart b/lib/pages/login_page.dart index 42378c9..982934d 100644 --- a/lib/pages/login_page.dart +++ b/lib/pages/login_page.dart @@ -28,7 +28,7 @@ class _LoginPageState extends State { bool _isLoading = false; void _signIn() async { - if (_isLoading) return; + // if (_isLoading) return; final email = _emailController.text; final password = _passwordController.text; diff --git a/lib/pages/main_page.dart b/lib/pages/main_page.dart index 07f048d..f7b32d0 100644 --- a/lib/pages/main_page.dart +++ b/lib/pages/main_page.dart @@ -6,6 +6,7 @@ import 'package:pharmacy_mobile/auth/auth_service.dart'; import 'package:pharmacy_mobile/widgets/button_widget.dart'; import 'package:pharmacy_mobile/widgets/menu_widget.dart'; import 'package:pharmacy_mobile/widgets/page_background_widget.dart'; +import 'package:pharmacy_mobile/widgets/snackbar_widget.dart'; import 'package:pharmacy_mobile/widgets/text_widget.dart'; import 'package:pharmacy_mobile/widgets/title_widget.dart'; @@ -17,72 +18,69 @@ class MainPage extends StatelessWidget { final authService = AuthService(); void signOut() async { - await authService.signOut().then((_) => {context.push('/')}); + await authService.signOut().then((_) => {context.push('/'), showNotification(context, 'Logged Out', true)}); } - void gotoAddMedicine() { - context.push('/addmedicines'); - } - - void gotoAddGenerics() { - context.push('/addgenerics'); - } - - return Scaffold( - resizeToAvoidBottomInset: false, - body: SingleChildScrollView( - child: PageBackgroundWidget( - page: 'menu', - child: Center( - child: Column( - children: [ - const Gap(96), - const TitleWidget(firstTextSize: 20, secondTextSize: 32), - const Gap(32), - const TextWidget(text: 'Menu'), - const Gap(16), - MenuWidget( - icon: FontAwesomeIcons.squarePlus, - text: 'Add Type', - onPressed: () => {context.push('/addtype')}, - color: 'blue'), - const Gap(16), - MenuWidget( - icon: FontAwesomeIcons.squarePlus, - text: 'Add Category', - onPressed: () => {context.push('/addcategory')}, - color: 'blue'), - const Gap(16), - MenuWidget( - icon: FontAwesomeIcons.squarePlus, text: 'Add Generics', onPressed: gotoAddGenerics, color: 'blue'), - const Gap(32), - MenuWidget( - icon: FontAwesomeIcons.squarePlus, - text: 'Add Medicine', - onPressed: gotoAddMedicine, - color: 'green'), - const Gap(16), - MenuWidget( - icon: FontAwesomeIcons.squarePlus, - text: 'Add Stock', - onPressed: () => {context.push('/addstock')}, - color: 'green'), - const Gap(32), - MenuWidget( - icon: FontAwesomeIcons.listCheck, - text: 'List of Stocks', - onPressed: () => {context.push('/liststocks')}, - color: 'yellow'), - const Gap(40), - ButtonWidget( - text: 'Logout', - onPressed: signOut, - ) - ], + return PopScope( + canPop: false, + child: Scaffold( + resizeToAvoidBottomInset: false, + body: SingleChildScrollView( + child: PageBackgroundWidget( + page: 'menu', + child: Center( + child: Column( + children: [ + const Gap(96), + const TitleWidget(firstTextSize: 20, secondTextSize: 32), + const Gap(32), + const TextWidget(text: 'Menu'), + const Gap(16), + MenuWidget( + icon: FontAwesomeIcons.squarePlus, + text: 'Add Type', + onPressed: () => {context.push('/addtype')}, + color: 'blue'), + const Gap(16), + MenuWidget( + icon: FontAwesomeIcons.squarePlus, + text: 'Add Category', + onPressed: () => {context.push('/addcategory')}, + color: 'blue'), + const Gap(16), + MenuWidget( + icon: FontAwesomeIcons.squarePlus, + text: 'Add Generics', + onPressed: () => {context.push('/addgenerics')}, + color: 'blue'), + const Gap(32), + MenuWidget( + icon: FontAwesomeIcons.squarePlus, + text: 'Add Medicine', + onPressed: () => {context.push('/addmedicines')}, + color: 'green'), + const Gap(16), + MenuWidget( + icon: FontAwesomeIcons.squarePlus, + text: 'Add Stock', + onPressed: () => {context.push('/addstock')}, + color: 'green'), + const Gap(32), + MenuWidget( + icon: FontAwesomeIcons.listCheck, + text: 'List of Stocks', + onPressed: () => {context.push('/liststocks')}, + color: 'yellow'), + const Gap(40), + ButtonWidget( + text: 'Logout', + onPressed: signOut, + ) + ], + ), + ), ), ), - ), - ), - ); + )); } }