From cf2ce36f87fd01a6424d62b291ba71ddb91a1721 Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Mon, 3 Feb 2025 11:00:42 +0800 Subject: [PATCH] update --- lib/pages/add_generics.dart | 2 +- lib/pages/add_medicine.dart | 2 +- lib/pages/add_stock.dart | 2 +- lib/pages/add_type.dart | 2 +- lib/pages/index_page.dart | 11 ++++-- lib/pages/list_stocks.dart | 2 +- lib/pages/login_page.dart | 61 +++++++++++++++++----------------- lib/pages/main_page.dart | 2 +- lib/pages/register_page.dart | 8 +++-- lib/widgets/button_widget.dart | 45 +++++++++++++++---------- lib/widgets/text_widget.dart | 18 ++++++---- lib/widgets/title_widget.dart | 2 +- pubspec.lock | 8 ----- pubspec.yaml | 1 - 14 files changed, 92 insertions(+), 74 deletions(-) diff --git a/lib/pages/add_generics.dart b/lib/pages/add_generics.dart index 7fbe750..396ae92 100644 --- a/lib/pages/add_generics.dart +++ b/lib/pages/add_generics.dart @@ -78,7 +78,7 @@ class _AddGenericsPageState extends State { child: Column( children: [ const Gap(104), - const TitleWidget(firstTextSize: 16, secondTextSize: 32), + const TitleWidget(firstTextSize: 20, secondTextSize: 32), const Gap(32), const TextWidget(text: 'Add Generics'), const Gap(16), diff --git a/lib/pages/add_medicine.dart b/lib/pages/add_medicine.dart index bb1a0fd..4f572df 100644 --- a/lib/pages/add_medicine.dart +++ b/lib/pages/add_medicine.dart @@ -112,7 +112,7 @@ class _AddMedicinePageState extends State { child: Column( children: [ const Gap(104), - const TitleWidget(firstTextSize: 16, secondTextSize: 32), + const TitleWidget(firstTextSize: 20, secondTextSize: 32), const Gap(32), const TextWidget(text: 'Add Medicine'), const Gap(16), diff --git a/lib/pages/add_stock.dart b/lib/pages/add_stock.dart index 996c92d..9fde646 100644 --- a/lib/pages/add_stock.dart +++ b/lib/pages/add_stock.dart @@ -84,7 +84,7 @@ class _AddStockPageState extends State { child: Column( children: [ const Gap(104), - const TitleWidget(firstTextSize: 16, secondTextSize: 32), + const TitleWidget(firstTextSize: 20, secondTextSize: 32), const Gap(32), const TextWidget(text: 'Add Stock'), const Gap(16), diff --git a/lib/pages/add_type.dart b/lib/pages/add_type.dart index d7198d6..0e92afc 100644 --- a/lib/pages/add_type.dart +++ b/lib/pages/add_type.dart @@ -43,7 +43,7 @@ class _AddTypePageState extends State { child: Column( children: [ const Gap(104), - const TitleWidget(firstTextSize: 16, secondTextSize: 32), + const TitleWidget(firstTextSize: 20, secondTextSize: 32), const Gap(32), const TextWidget(text: 'Add Medicine Type'), const Gap(16), diff --git a/lib/pages/index_page.dart b/lib/pages/index_page.dart index e6abafe..9b9da2d 100644 --- a/lib/pages/index_page.dart +++ b/lib/pages/index_page.dart @@ -16,6 +16,10 @@ class IndexPage extends StatelessWidget { context.push('/login'); } + void gotoRegister() { + context.push('/register'); + } + return Scaffold( resizeToAvoidBottomInset: false, body: PageBackgroundWidget( @@ -33,13 +37,16 @@ class IndexPage extends StatelessWidget { ), const Gap(32), ButtonWidget(text: 'Login', onPressed: gotoLogin), + const Gap(8), + ButtonWidget(text: 'Register', onPressed: gotoRegister, outline: true), const MaxGap(500), const TextWidget( text: 'Copyright © 2025 - Ofelia Franco-Alcala Pharmacy', - size: 12, + size: 10, bold: true, + footer: true, ), - const TextWidget(text: 'Developed By: Pat Alcala', size: 10, opacity: 0.8), + const TextWidget(text: 'Developed By: Pat Alcala', size: 8, opacity: 0.8, footer: true), const Gap(8), ], ), diff --git a/lib/pages/list_stocks.dart b/lib/pages/list_stocks.dart index abeead5..3c586ee 100644 --- a/lib/pages/list_stocks.dart +++ b/lib/pages/list_stocks.dart @@ -66,7 +66,7 @@ class _ListStocksPageState extends State { body: PageBackgroundWidget( child: Column(children: [ const Gap(104), - const TitleWidget(firstTextSize: 16, secondTextSize: 32), + const TitleWidget(firstTextSize: 20, secondTextSize: 32), const Gap(32), const TextWidget(text: 'List of Stocks'), const Gap(16), diff --git a/lib/pages/login_page.dart b/lib/pages/login_page.dart index 5d8a816..dcc9f68 100644 --- a/lib/pages/login_page.dart +++ b/lib/pages/login_page.dart @@ -8,7 +8,6 @@ import 'package:pharmacy_mobile/widgets/input_widget.dart'; import 'package:pharmacy_mobile/widgets/page_background_widget.dart'; import 'package:pharmacy_mobile/widgets/text_widget.dart'; import 'package:pharmacy_mobile/widgets/title_widget.dart'; -import 'package:quickalert/quickalert.dart'; import 'package:internet_connection_checker/internet_connection_checker.dart'; class LoginPage extends StatefulWidget { @@ -38,38 +37,40 @@ class _LoginPageState extends State { if (await InternetConnectionChecker.instance.hasConnection) { await _authService.signIn(email, password); if (mounted) { - QuickAlert.show( - context: context, - type: QuickAlertType.success, - text: 'Login Successful', - autoCloseDuration: const Duration(seconds: 2), - showConfirmBtn: false, - ).then((value) => { - if (mounted && context.mounted) {context.push('/main')} - }); + ScaffoldMessenger.of(context).showSnackBar(SnackBar( + content: Text('Login Successful'), + backgroundColor: const Color.fromRGBO(37, 106, 32, 1), + elevation: 4.0, + behavior: SnackBarBehavior.floating, + duration: Duration(seconds: 5), + )); + + WidgetsBinding.instance.addPostFrameCallback((_) { + if (mounted) { + context.push('/main'); + } + }); } } else { if (mounted) { - QuickAlert.show( - context: context, - type: QuickAlertType.error, - text: 'No Internet Connection', - autoCloseDuration: const Duration(seconds: 2), - showConfirmBtn: false, - ); - // ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Error: $e'))); + ScaffoldMessenger.of(context).showSnackBar(SnackBar( + content: Text('No Internet Connection'), + backgroundColor: const Color.fromRGBO(188, 59, 50, 1), + elevation: 4.0, + behavior: SnackBarBehavior.floating, + duration: Duration(seconds: 5), + )); } } } catch (e) { if (mounted) { - QuickAlert.show( - context: context, - type: QuickAlertType.error, - text: 'Error: $e', - autoCloseDuration: const Duration(seconds: 5), - showConfirmBtn: false, - ); - // ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Error: $e'))); + ScaffoldMessenger.of(context).showSnackBar(SnackBar( + content: Text('Error: $e'), + backgroundColor: const Color.fromRGBO(188, 59, 50, 1), + elevation: 4.0, + behavior: SnackBarBehavior.floating, + duration: Duration(seconds: 5), + )); } } finally { setState(() => _isLoading = false); @@ -100,20 +101,20 @@ class _LoginPageState extends State { mainAxisAlignment: MainAxisAlignment.start, children: [ const Gap(104), - const TitleWidget(firstTextSize: 16, secondTextSize: 32), + const TitleWidget(firstTextSize: 20, secondTextSize: 32), const Gap(32), const TextWidget(text: 'Login'), const Gap(16), Padding( - padding: const EdgeInsets.only(left: 16, right: 16), + padding: const EdgeInsets.only(left: 32, right: 32), child: Container( - padding: EdgeInsets.all(32), + padding: EdgeInsets.fromLTRB(32, 32, 32, 40), decoration: BoxDecoration( color: const Color.fromRGBO(38, 17, 46, 0.859), borderRadius: BorderRadius.all(Radius.circular(16)), boxShadow: [ BoxShadow( - color: const Color.fromRGBO(0, 0, 0, 1).withOpacity(0.4), // Subtle shadow to give depth + color: const Color.fromRGBO(0, 0, 0, 0.4), // Subtle shadow to give depth spreadRadius: 0, blurRadius: 4, offset: Offset(0, 2), diff --git a/lib/pages/main_page.dart b/lib/pages/main_page.dart index ee55cf1..8fb1717 100644 --- a/lib/pages/main_page.dart +++ b/lib/pages/main_page.dart @@ -36,7 +36,7 @@ class MainPage extends StatelessWidget { child: Column( children: [ const Gap(104), - const TitleWidget(firstTextSize: 16, secondTextSize: 32), + const TitleWidget(firstTextSize: 20, secondTextSize: 32), const Gap(32), const TextWidget(text: 'Menu'), const Gap(16), diff --git a/lib/pages/register_page.dart b/lib/pages/register_page.dart index 5bcb150..17f1cdb 100644 --- a/lib/pages/register_page.dart +++ b/lib/pages/register_page.dart @@ -3,6 +3,7 @@ import 'package:google_fonts/google_fonts.dart'; import 'package:gap/gap.dart'; import 'package:pharmacy_mobile/auth/auth_service.dart'; import 'package:pharmacy_mobile/main.dart'; +import 'package:pharmacy_mobile/widgets/page_background_widget.dart'; class RegisterPage extends StatefulWidget { const RegisterPage({super.key}); @@ -51,8 +52,11 @@ class _RegisterPageState extends State { @override Widget build(BuildContext context) { - return Container( - child: null, + return Scaffold( + body: PageBackgroundWidget( + child: Column( + children: [], + )), ); } } diff --git a/lib/widgets/button_widget.dart b/lib/widgets/button_widget.dart index b1efb67..bce40d3 100644 --- a/lib/widgets/button_widget.dart +++ b/lib/widgets/button_widget.dart @@ -1,30 +1,41 @@ import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; -// import 'package:google_fonts/google_fonts.dart'; class ButtonWidget extends StatelessWidget { final String text; final VoidCallback onPressed; + final bool? outline; - const ButtonWidget({super.key, required this.text, required this.onPressed}); + const ButtonWidget({super.key, required this.text, required this.onPressed, this.outline}); @override Widget build(BuildContext context) { return ElevatedButton( - style: ElevatedButton.styleFrom( - foregroundColor: Color.fromRGBO(0, 0, 0, 1), // text color - backgroundColor: const Color.fromRGBO(198, 133, 232, 1), // background color - side: const BorderSide(color: Color.fromRGBO(79, 51, 94, 1)), // border color - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(26), // rounded corners - ), - minimumSize: Size(MediaQuery.of(context).size.width - 96, 40), // minimum size - padding: EdgeInsets.symmetric(vertical: 10, horizontal: 16), // padding - ), - onPressed: onPressed, - child: Text( - text, - style: GoogleFonts.outfit(textStyle: const TextStyle(fontSize: 16)), - )); + style: outline == true + ? OutlinedButton.styleFrom( + foregroundColor: Color.fromRGBO(0, 0, 0, 1), // text color + side: const BorderSide(color: Color.fromRGBO(79, 51, 94, 1)), // border color + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), // rounded corners + ), + minimumSize: Size(MediaQuery.of(context).size.width - 96, 44), // minimum size + padding: EdgeInsets.symmetric(vertical: 10, horizontal: 16), + ) + : ElevatedButton.styleFrom( + foregroundColor: Color.fromRGBO(0, 0, 0, 1), // text color + backgroundColor: const Color.fromRGBO(198, 133, 232, 1), // background color + side: const BorderSide(color: Color.fromRGBO(79, 51, 94, 1)), // border color + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), // rounded corners + ), + minimumSize: Size(MediaQuery.of(context).size.width - 96, 44), // minimum size + padding: EdgeInsets.symmetric(vertical: 10, horizontal: 16), + ), + onPressed: onPressed, + child: Text( + text, + style: GoogleFonts.outfit(textStyle: const TextStyle(fontSize: 14)), + ), + ); } } diff --git a/lib/widgets/text_widget.dart b/lib/widgets/text_widget.dart index 28a0c48..c08c2a3 100644 --- a/lib/widgets/text_widget.dart +++ b/lib/widgets/text_widget.dart @@ -6,16 +6,20 @@ class TextWidget extends StatelessWidget { final double? size; final double? opacity; final bool? bold; + final bool? footer; - const TextWidget({super.key, required this.text, this.size, this.opacity, this.bold}); + const TextWidget({super.key, required this.text, this.size, this.opacity, this.bold, this.footer}); @override Widget build(BuildContext context) { - return Text(text, - style: GoogleFonts.outfit( - textStyle: TextStyle( - color: Color.fromRGBO(255, 255, 255, opacity ?? 1), - fontSize: size ?? 28, - fontWeight: bold == true ? FontWeight.bold : FontWeight.normal))); + final textStyle = TextStyle( + color: Color.fromRGBO(255, 255, 255, opacity ?? 1), + fontSize: size ?? 28, + fontWeight: bold == true ? FontWeight.bold : FontWeight.normal, + ); + + return footer == true + ? Text(text, style: GoogleFonts.inter(textStyle: textStyle)) + : Text(text, style: GoogleFonts.outfit(textStyle: textStyle)); } } diff --git a/lib/widgets/title_widget.dart b/lib/widgets/title_widget.dart index 0ad9176..fe0a6e8 100644 --- a/lib/widgets/title_widget.dart +++ b/lib/widgets/title_widget.dart @@ -14,7 +14,7 @@ class TitleWidget extends StatelessWidget { style: GoogleFonts.outfit( textStyle: TextStyle(color: Color.fromRGBO(255, 255, 255, 1), fontSize: firstTextSize))), Text('Pharmacy', - style: GoogleFonts.outfit( + style: GoogleFonts.poppins( textStyle: TextStyle(color: Color.fromRGBO(255, 255, 255, 1), fontSize: secondTextSize))), ]); } diff --git a/pubspec.lock b/pubspec.lock index 1470e3b..539b222 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -456,14 +456,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.4.1" - quickalert: - dependency: "direct main" - description: - name: quickalert - sha256: b5d62b1e20b08cc0ff5f40b6da519bdc7a5de6082f13d90572cf4e72eea56c5e - url: "https://pub.dev" - source: hosted - version: "1.1.0" realtime_client: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 8cf9df7..934538a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,6 @@ dependencies: gap: ^3.0.1 go_router: ^14.6.3 supabase_flutter: ^2.8.3 - quickalert: ^1.1.0 font_awesome_flutter: ^10.8.0 uuid: ^4.5.1 bottom_picker: ^2.10.1