update
This commit is contained in:
parent
3aa12bfcad
commit
71a289b74c
11 changed files with 108 additions and 52 deletions
|
|
@ -5,6 +5,7 @@ import 'package:pharmacy_mobile/pages/add_generics.dart';
|
|||
import 'package:pharmacy_mobile/pages/add_medicine.dart';
|
||||
import 'package:pharmacy_mobile/pages/add_stock.dart';
|
||||
import 'package:pharmacy_mobile/pages/add_type.dart';
|
||||
import 'package:pharmacy_mobile/pages/customer_page.dart';
|
||||
import 'package:pharmacy_mobile/pages/delete_stock.dart';
|
||||
import 'package:pharmacy_mobile/pages/list_stocks.dart';
|
||||
import 'package:pharmacy_mobile/pages/login_page.dart';
|
||||
|
|
@ -86,6 +87,11 @@ final _router = GoRouter(
|
|||
path: '/deletestock',
|
||||
builder: (context, state) => const DeleteStockPage(),
|
||||
),
|
||||
GoRoute(
|
||||
name: 'customer',
|
||||
path: '/customer',
|
||||
builder: (context, state) => const CustomerPage(),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
|
|
|
|||
32
lib/pages/customer_page.dart
Normal file
32
lib/pages/customer_page.dart
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:gap/gap.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';
|
||||
|
||||
class CustomerPage extends StatelessWidget {
|
||||
const CustomerPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
child: Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: PageBackgroundWidget(
|
||||
height: MediaQuery.of(context).size.height + 400,
|
||||
child: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
const Gap(96),
|
||||
const TitleWidget(firstTextSize: 20, secondTextSize: 32),
|
||||
const Gap(32),
|
||||
const TextWidget(text: 'Menu'),
|
||||
const Gap(16),
|
||||
],
|
||||
))),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -26,6 +26,9 @@ class IndexPage extends StatelessWidget {
|
|||
child: Column(
|
||||
children: [
|
||||
const Gap(88),
|
||||
Image.asset('assets/ofa_logo.webp',
|
||||
width: 90, cacheWidth: (90 * MediaQuery.of(context).devicePixelRatio).round()),
|
||||
const Gap(8),
|
||||
const TitleWidget(firstTextSize: 24, secondTextSize: 32),
|
||||
const Gap(32),
|
||||
Padding(
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
|
@ -60,8 +62,10 @@ class _LoginPageState extends State<LoginPage> {
|
|||
showNotification(context, 'Login Successful', true);
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (mounted) {
|
||||
context.push('/main');
|
||||
if (user.contains('admin')) {
|
||||
if (mounted) context.push('/main');
|
||||
} else {
|
||||
if (mounted) context.push('/customer');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,8 +31,6 @@ class _RegisterPageState extends State<RegisterPage> {
|
|||
final password = _passwordController.text;
|
||||
final confirmPassword = _confirmPasswordController.text;
|
||||
|
||||
setState(() => _isLoading = true);
|
||||
|
||||
if (email.isEmpty) {
|
||||
if (mounted) {
|
||||
showNotification(context, 'Error: Please enter a valid email', false);
|
||||
|
|
@ -59,9 +57,21 @@ class _RegisterPageState extends State<RegisterPage> {
|
|||
return;
|
||||
}
|
||||
|
||||
setState(() => _isLoading = true);
|
||||
|
||||
try {
|
||||
if (await InternetConnectionChecker.instance.hasConnection) {
|
||||
await _authService.signUp(email, password);
|
||||
|
||||
if (mounted) {
|
||||
showNotification(context, 'Registration Successful', true);
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (mounted) {
|
||||
context.push('/login');
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (mounted) {
|
||||
showNotification(context, 'Error: No Internet Connection', false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue