108 lines
4.3 KiB
Dart
108 lines
4.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|
import 'package:gap/gap.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
import 'package:pharmacy_mobile/auth/auth_service.dart';
|
|
import 'package:pharmacy_mobile/widgets/button_widget.dart';
|
|
import 'package:pharmacy_mobile/widgets/menu_widget2.dart';
|
|
import 'package:pharmacy_mobile/widgets/page_background_widget.dart';
|
|
import 'package:pharmacy_mobile/widgets/snackbar_widget.dart';
|
|
import 'package:pharmacy_mobile/widgets/text_widget.dart';
|
|
import 'package:pharmacy_mobile/widgets/title_widget.dart';
|
|
|
|
class MainPage extends StatefulWidget {
|
|
const MainPage({super.key});
|
|
|
|
@override
|
|
State<MainPage> createState() => _MainPageState();
|
|
}
|
|
|
|
class _MainPageState extends State<MainPage> {
|
|
final _authService = AuthService();
|
|
|
|
void signOut() async {
|
|
// ignore: use_build_context_synchronously
|
|
await _authService.signOut().then((_) => {context.go('/'), showNotification(context, 'Logged Out', true)});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return PopScope(
|
|
canPop: false,
|
|
child: Scaffold(
|
|
resizeToAvoidBottomInset: false,
|
|
body: SingleChildScrollView(
|
|
child: PageBackgroundWidget(
|
|
height: MediaQuery.of(context).size.height + 400,
|
|
page: 'menu',
|
|
child: Center(
|
|
child: Column(
|
|
children: [
|
|
const Gap(96),
|
|
const TitleWidget(firstTextSize: 20, secondTextSize: 32),
|
|
const Gap(32),
|
|
const TextWidget(text: 'Menu'),
|
|
const Gap(16),
|
|
MenuWidget2(
|
|
icon: FontAwesomeIcons.circlePlus,
|
|
text: 'Add Type',
|
|
description: 'Create a new medical type',
|
|
onPressed: () => {context.push('/addtype')},
|
|
color: 'blue',
|
|
),
|
|
const Gap(16),
|
|
MenuWidget2(
|
|
icon: FontAwesomeIcons.circlePlus,
|
|
text: 'Add Category',
|
|
description: 'Create a new medicine category',
|
|
onPressed: () => {context.push('/addcategory')},
|
|
color: 'blue',
|
|
),
|
|
const Gap(16),
|
|
MenuWidget2(
|
|
icon: FontAwesomeIcons.circlePlus,
|
|
text: 'Add Generics',
|
|
description: 'Add generic name on the list',
|
|
onPressed: () => {context.push('/addgenerics')},
|
|
color: 'blue'),
|
|
const Gap(32),
|
|
MenuWidget2(
|
|
icon: FontAwesomeIcons.circlePlus,
|
|
text: 'Add Medicine',
|
|
description: 'Add generic name on the list',
|
|
onPressed: () => {context.push('/addmedicines')},
|
|
color: 'green'),
|
|
const Gap(16),
|
|
MenuWidget2(
|
|
icon: FontAwesomeIcons.circlePlus,
|
|
text: 'Add Stock',
|
|
description: 'Add generic name on the list',
|
|
onPressed: () => {context.push('/addstock')},
|
|
color: 'green'),
|
|
const Gap(32),
|
|
MenuWidget2(
|
|
icon: Icons.delete,
|
|
text: 'Remove Stock',
|
|
description: 'Add generic name on the list',
|
|
onPressed: () => {context.push('/deletestock')},
|
|
color: 'red'),
|
|
const Gap(32),
|
|
MenuWidget2(
|
|
icon: FontAwesomeIcons.listCheck,
|
|
text: 'List of Stocks',
|
|
description: 'Add generic name on the list',
|
|
onPressed: () => {context.push('/liststocks')},
|
|
color: 'yellow'),
|
|
const Gap(40),
|
|
ButtonWidget(
|
|
text: 'Logout',
|
|
onPressed: signOut,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
));
|
|
}
|
|
}
|