update
This commit is contained in:
parent
e48e400e43
commit
ecc427c958
5 changed files with 76 additions and 18 deletions
|
|
@ -5,6 +5,7 @@ import 'package:pharmacy_mobile/pages/add_stock.dart';
|
||||||
import 'package:pharmacy_mobile/pages/add_type.dart';
|
import 'package:pharmacy_mobile/pages/add_type.dart';
|
||||||
// import 'package:pharmacy_mobile/auth/auth_gate.dart';
|
// import 'package:pharmacy_mobile/auth/auth_gate.dart';
|
||||||
import 'package:pharmacy_mobile/pages/index_page.dart';
|
import 'package:pharmacy_mobile/pages/index_page.dart';
|
||||||
|
import 'package:pharmacy_mobile/pages/list_stocks.dart';
|
||||||
import 'package:pharmacy_mobile/pages/login_page.dart';
|
import 'package:pharmacy_mobile/pages/login_page.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:pharmacy_mobile/pages/main_page.dart';
|
import 'package:pharmacy_mobile/pages/main_page.dart';
|
||||||
|
|
@ -73,6 +74,11 @@ final _router = GoRouter(
|
||||||
path: '/addstock',
|
path: '/addstock',
|
||||||
builder: (context, state) => AddStockPage(),
|
builder: (context, state) => AddStockPage(),
|
||||||
),
|
),
|
||||||
|
GoRoute(
|
||||||
|
name: 'liststocks',
|
||||||
|
path: '/liststocks',
|
||||||
|
builder: (context, state) => ListStocksPage(),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import 'dart:developer';
|
|
||||||
import 'package:gap/gap.dart';
|
import 'package:gap/gap.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
// import 'package:pharmacy_mobile/auth/auth_service.dart';
|
// import 'package:pharmacy_mobile/auth/auth_service.dart';
|
||||||
|
|
@ -22,6 +21,7 @@ class AddGenericsPageState extends State<AddGenericsPage> {
|
||||||
final _refCategories = RefCategories();
|
final _refCategories = RefCategories();
|
||||||
final _refGenericNames = RefGenericNames();
|
final _refGenericNames = RefGenericNames();
|
||||||
final _nameController = TextEditingController();
|
final _nameController = TextEditingController();
|
||||||
|
final _formKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
late List _categoryList = [];
|
late List _categoryList = [];
|
||||||
late String _selectedCategory = '';
|
late String _selectedCategory = '';
|
||||||
|
|
@ -80,12 +80,18 @@ class AddGenericsPageState extends State<AddGenericsPage> {
|
||||||
const Gap(32),
|
const Gap(32),
|
||||||
const TextWidget(text: 'Add Generics'),
|
const TextWidget(text: 'Add Generics'),
|
||||||
const Gap(16),
|
const Gap(16),
|
||||||
InputWidget(label: 'Name', controller: _nameController),
|
Form(
|
||||||
const Gap(16),
|
key: _formKey,
|
||||||
DropDownWidget(
|
child: Column(
|
||||||
label: 'Category', list: _categoryList, listTitle: 'category_name', onChanged: _updateCategory),
|
children: [
|
||||||
const Gap(16),
|
InputWidget(label: 'Name', controller: _nameController),
|
||||||
ButtonWidget(text: 'Add', onPressed: saveGeneric)
|
const Gap(16),
|
||||||
|
DropDownWidget(
|
||||||
|
label: 'Category', list: _categoryList, listTitle: 'category_name', onChanged: _updateCategory),
|
||||||
|
const Gap(16),
|
||||||
|
ButtonWidget(text: 'Add', onPressed: saveGeneric)
|
||||||
|
],
|
||||||
|
))
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ class AddTypePage extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AddTypePageState extends State<AddTypePage> {
|
class _AddTypePageState extends State<AddTypePage> {
|
||||||
|
final _formKey = GlobalKey<FormState>();
|
||||||
final _typeController = TextEditingController();
|
final _typeController = TextEditingController();
|
||||||
final _refTypes = RefTypes();
|
final _refTypes = RefTypes();
|
||||||
|
|
||||||
|
|
@ -58,15 +59,16 @@ class _AddTypePageState extends State<AddTypePage> {
|
||||||
const TextWidget(text: 'Add Medicine Type'),
|
const TextWidget(text: 'Add Medicine Type'),
|
||||||
const Gap(16),
|
const Gap(16),
|
||||||
Form(
|
Form(
|
||||||
|
key: _formKey,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
InputWidget(label: 'Type Name', controller: _typeController),
|
InputWidget(label: 'Type Name', controller: _typeController),
|
||||||
const Gap(16),
|
const Gap(16),
|
||||||
ButtonWidget(text: 'Save Type', onPressed: saveType)
|
ButtonWidget(text: 'Save Type', onPressed: saveType)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
))
|
))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
44
lib/pages/list_stocks.dart
Normal file
44
lib/pages/list_stocks.dart
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:gap/gap.dart';
|
||||||
|
import 'package:pharmacy_mobile/widgets/text_widget.dart';
|
||||||
|
import 'package:pharmacy_mobile/widgets/title_widget.dart';
|
||||||
|
|
||||||
|
class ListStocksPage extends StatefulWidget {
|
||||||
|
const ListStocksPage({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_ListStocksPageState createState() => _ListStocksPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ListStocksPageState extends State<ListStocksPage> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
body: Container(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
height: MediaQuery.of(context).size.height,
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
colors: [
|
||||||
|
Color.fromRGBO(34, 51, 69, 1),
|
||||||
|
Color.fromRGBO(22, 32, 44, 1),
|
||||||
|
],
|
||||||
|
begin: Alignment.topCenter,
|
||||||
|
end: Alignment.bottomCenter,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
const Gap(120),
|
||||||
|
const TitleWidget(firstTextSize: 16, secondTextSize: 32),
|
||||||
|
const Gap(32),
|
||||||
|
const TextWidget(text: 'List of Stocks'),
|
||||||
|
const Gap(16),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -71,9 +71,9 @@ class MainPage extends StatelessWidget {
|
||||||
onPressed: () => {context.push('/addtype')}),
|
onPressed: () => {context.push('/addtype')}),
|
||||||
const Gap(32),
|
const Gap(32),
|
||||||
MenuWidget(
|
MenuWidget(
|
||||||
icon: FontAwesomeIcons.listCheck,
|
icon: FontAwesomeIcons.listCheck,
|
||||||
text: 'List of Stocks',
|
text: 'List of Stocks',
|
||||||
),
|
onPressed: () => {context.push('/liststocks')}),
|
||||||
const Gap(32),
|
const Gap(32),
|
||||||
// TextButton(onPressed: () => {_signOut()}, child: const Text('Logout')),
|
// TextButton(onPressed: () => {_signOut()}, child: const Text('Logout')),
|
||||||
ButtonWidget(
|
ButtonWidget(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue