update
This commit is contained in:
parent
b21ee2ee82
commit
ecccd4a9bf
16 changed files with 232 additions and 193 deletions
|
|
@ -4,8 +4,9 @@ import 'package:internet_connection_checker/internet_connection_checker.dart';
|
|||
import 'package:pharmacy_mobile/functions/checkexisting_function.dart';
|
||||
import 'package:pharmacy_mobile/tables/ref_categories.dart';
|
||||
import 'package:pharmacy_mobile/tables/ref_generic_names.dart';
|
||||
import 'package:pharmacy_mobile/widgets/button_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/buttonwithprogress_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/dropdown_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/dropdown_wrappermulti_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/form_border_widget2.dart';
|
||||
import 'package:pharmacy_mobile/widgets/input_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/page_background_widget.dart';
|
||||
|
|
@ -71,7 +72,7 @@ class _AddGenericsPageState extends State<AddGenericsPage> {
|
|||
_selectedCategory = category;
|
||||
}
|
||||
|
||||
void saveGeneric() async {
|
||||
void _saveGeneric() async {
|
||||
setState(() => _isLoading = true);
|
||||
|
||||
try {
|
||||
|
|
@ -153,47 +154,26 @@ class _AddGenericsPageState extends State<AddGenericsPage> {
|
|||
color: 'blue',
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: Column(
|
||||
children: [
|
||||
InputWidget(label: 'Name', controller: _nameController),
|
||||
const Gap(16),
|
||||
if (_categoryList.isEmpty)
|
||||
const Column(
|
||||
children: [
|
||||
Gap(8),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
spacing: 16,
|
||||
children: [
|
||||
CircularProgressIndicator(color: Colors.white),
|
||||
TextWidget(
|
||||
text: 'Fetching Categories',
|
||||
size: 16,
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
else
|
||||
Column(
|
||||
children: [
|
||||
DropDownWidget(
|
||||
label: 'Category',
|
||||
list: _categoryList,
|
||||
listTitle: 'category_name',
|
||||
onChanged: _updateCategory,
|
||||
// value: _selectedCategory,
|
||||
),
|
||||
const Gap(32),
|
||||
if (_isLoading)
|
||||
const Center(child: CircularProgressIndicator(color: Colors.white))
|
||||
else
|
||||
ButtonWidget(text: 'Add', onPressed: saveGeneric)
|
||||
],
|
||||
child: DropdownWrapperMultiWidget(list: _categoryList, text: 'List', children: [
|
||||
Column(
|
||||
children: [
|
||||
InputWidget(label: 'Name', controller: _nameController),
|
||||
const Gap(16),
|
||||
DropDownWidget(
|
||||
label: 'Category',
|
||||
list: _categoryList,
|
||||
listTitle: 'category_name',
|
||||
onChanged: _updateCategory,
|
||||
),
|
||||
],
|
||||
)),
|
||||
const Gap(32),
|
||||
ButtonWithProgressWidget(
|
||||
trigger: _isLoading,
|
||||
progressText: 'Adding Generics',
|
||||
buttonText: 'Save',
|
||||
onPressed: _saveGeneric)
|
||||
],
|
||||
),
|
||||
])),
|
||||
)
|
||||
],
|
||||
)),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue