update
This commit is contained in:
parent
b5151a053d
commit
cf2ce36f87
14 changed files with 92 additions and 74 deletions
|
|
@ -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),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue