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