This commit is contained in:
Patrick Alvin Alcala 2025-02-03 11:00:42 +08:00
parent b5151a053d
commit cf2ce36f87
14 changed files with 92 additions and 74 deletions

View file

@ -78,7 +78,7 @@ class _AddGenericsPageState extends State<AddGenericsPage> {
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),

View file

@ -112,7 +112,7 @@ class _AddMedicinePageState extends State<AddMedicinePage> {
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),

View file

@ -84,7 +84,7 @@ class _AddStockPageState extends State<AddStockPage> {
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),

View file

@ -43,7 +43,7 @@ class _AddTypePageState extends State<AddTypePage> {
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),

View file

@ -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),
],
),

View file

@ -66,7 +66,7 @@ class _ListStocksPageState extends State<ListStocksPage> {
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),

View file

@ -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<LoginPage> {
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<LoginPage> {
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),

View file

@ -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),

View file

@ -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<RegisterPage> {
@override
Widget build(BuildContext context) {
return Container(
child: null,
return Scaffold(
body: PageBackgroundWidget(
child: Column(
children: [],
)),
);
}
}

View file

@ -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)),
),
);
}
}

View file

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

View file

@ -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))),
]);
}

View file

@ -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:

View file

@ -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