This commit is contained in:
Patrick Alvin Alcala 2025-03-03 13:38:06 +08:00
parent b21ee2ee82
commit ecccd4a9bf
16 changed files with 232 additions and 193 deletions

View file

@ -12,6 +12,7 @@ import 'package:pharmacy_mobile/tables/ref_medicines.dart';
import 'package:pharmacy_mobile/tables/ref_types.dart';
import 'package:pharmacy_mobile/tables/storage.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';
@ -240,74 +241,69 @@ class _AddMedicinePageState extends State<AddMedicinePage> {
color: 'green',
child: Form(
key: _formKey,
child: Center(
child: Column(
children: [
InputWidget(label: 'Name', controller: _nameController),
const Gap(16),
DropdownWrapperMultiWidget(list: _genericNameList, text: 'Data', children: [
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
DropDownWidget(
label: 'Generic Name',
list: _genericNameList,
listTitle: 'generic_name',
onChanged: _updateGeneric,
// value: _selectedGeneric,
),
const Gap(8),
Padding(
padding: const EdgeInsets.only(left: 12),
child: TextWidget(text: _selectedCategory, size: 18),
),
const Gap(16),
DropDownWidget(
label: 'Type',
list: _typeList,
listTitle: 'type_name',
onChanged: _updateType,
// value: _selectedType,
),
const Gap(16),
DropDownWidget(
label: 'Manufactorer',
list: _manufactorerList,
listTitle: 'manufactorer_name',
onChanged: _updateManufactorer,
// value: _selectedManufactorer,
),
const Gap(16),
InputWidget(label: 'Barcode', controller: _barcodeController),
ScanbarcodeWidget(onTap: _scanBarcode),
const Gap(16),
if (imageUrl.isNotEmpty)
Center(
child: ClipRRect(
borderRadius:
BorderRadius.circular(12), // Add your desired border radius here
child: ImageWidget(
imagePath: imageUrl,
size: 250,
measureByHeight: false,
network: true,
))
// Image.network(imageUrl, fit: BoxFit.cover, width: 250, height: 250)),
)
else
ButtonWidget(
text: 'Add Image',
onPressed: _addImage,
outline: true,
),
const Gap(32),
if (_isLoading)
const Center(child: CircularProgressIndicator(color: Colors.white))
else
ButtonWidget(text: 'Save Medicine', onPressed: _saveMedicine)
])
]),
],
),
)))
child: DropdownWrapperMultiWidget(list: _genericNameList, text: 'Data', children: [
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
InputWidget(label: 'Name', controller: _nameController),
const Gap(16),
DropDownWidget(
label: 'Generic Name',
list: _genericNameList,
listTitle: 'generic_name',
onChanged: _updateGeneric,
),
const Gap(8),
Padding(
padding: const EdgeInsets.only(left: 12),
child: TextWidget(text: _selectedCategory, size: 18),
),
const Gap(16),
DropDownWidget(
label: 'Type',
list: _typeList,
listTitle: 'type_name',
onChanged: _updateType,
),
const Gap(16),
DropDownWidget(
label: 'Manufactorer',
list: _manufactorerList,
listTitle: 'manufactorer_name',
onChanged: _updateManufactorer,
),
const Gap(16),
InputWidget(label: 'Barcode', controller: _barcodeController),
ScanbarcodeWidget(onTap: _scanBarcode),
const Gap(16),
if (imageUrl.isNotEmpty)
Center(
child: ClipRRect(
borderRadius: BorderRadius.circular(12), // Add your desired border radius here
child: ImageWidget(
imagePath: imageUrl,
size: 250,
measureByHeight: false,
network: true,
))
// Image.network(imageUrl, fit: BoxFit.cover, width: 250, height: 250)),
)
else
ButtonWidget(
text: 'Add Image',
onPressed: _addImage,
outline: true,
),
const Gap(32),
// if (_isLoading)
// const Center(child: CircularProgressIndicator(color: Colors.white))
// else
// ButtonWidget(text: 'Save Medicine', onPressed: _saveMedicine)
ButtonWithProgressWidget(
trigger: _isLoading,
progressText: 'Adding Medicine',
buttonText: 'Save',
onPressed: _saveMedicine)
])
])))
]))));
}
}