update
This commit is contained in:
parent
3efdee4fe6
commit
4657e34046
46 changed files with 109 additions and 115 deletions
|
|
@ -11,7 +11,6 @@ import 'package:pharmacy_mobile/tables/storage.dart';
|
|||
import 'package:pharmacy_mobile/widgets/button_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_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';
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import 'package:pharmacy_mobile/tables/stocks.dart';
|
|||
import 'package:pharmacy_mobile/widgets/button_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/datepicker_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/dropdown_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/form_border_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';
|
||||
|
|
@ -27,6 +26,8 @@ class _AddStockPageState extends State<AddStockPage> {
|
|||
final _dateController = TextEditingController();
|
||||
final _stocks = Stocks();
|
||||
|
||||
final bool _isLoading = false;
|
||||
|
||||
late List _medicineList = [];
|
||||
late String _selectedMedicine = '';
|
||||
late DateTime selectedDate = DateTime.now();
|
||||
|
|
@ -99,7 +100,7 @@ class _AddStockPageState extends State<AddStockPage> {
|
|||
controller: _dateController,
|
||||
value: selectedDate,
|
||||
),
|
||||
const Gap(16),
|
||||
const Gap(32),
|
||||
ButtonWidget(text: 'Add Stock', onPressed: _saveStock)
|
||||
],
|
||||
),
|
||||
|
|
|
|||
|
|
@ -3,21 +3,27 @@ import 'package:google_fonts/google_fonts.dart';
|
|||
import 'package:gap/gap.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class DatePickerWidget extends StatelessWidget {
|
||||
class DatePickerWidget extends StatefulWidget {
|
||||
final String label;
|
||||
final TextEditingController controller;
|
||||
// final VoidCallback onPressed;
|
||||
late DateTime value = DateTime.now();
|
||||
DateTime value;
|
||||
|
||||
DatePickerWidget({super.key, required this.label, required this.controller, required this.value});
|
||||
|
||||
@override
|
||||
State<DatePickerWidget> createState() => _DatePickerWidgetState();
|
||||
}
|
||||
|
||||
class _DatePickerWidgetState extends State<DatePickerWidget> {
|
||||
Future<void> _selectDate(BuildContext context) async {
|
||||
final DateTime? picked = await showDatePicker(
|
||||
context: context, initialDate: value, firstDate: DateTime(2015, 8), lastDate: DateTime(2101));
|
||||
if (picked != null && picked != value) {
|
||||
value = picked;
|
||||
final DateFormat formatter = DateFormat('MMMM dd, yyyy');
|
||||
controller.text = formatter.format(value);
|
||||
context: context, initialDate: widget.value, firstDate: DateTime(2015, 8), lastDate: DateTime(2101));
|
||||
if (picked != null && picked != widget.value) {
|
||||
setState(() {
|
||||
widget.value = picked;
|
||||
final DateFormat formatter = DateFormat('MMMM dd, yyyy');
|
||||
widget.controller.text = formatter.format(widget.value);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -26,39 +32,26 @@ class DatePickerWidget extends StatelessWidget {
|
|||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('$label:',
|
||||
Text('${widget.label}:',
|
||||
style: GoogleFonts.outfit(
|
||||
textStyle: const TextStyle(color: Colors.white, fontSize: 16),
|
||||
textStyle: const TextStyle(color: Colors.white, fontSize: 12),
|
||||
)),
|
||||
const Gap(8),
|
||||
TextField(
|
||||
controller: controller,
|
||||
decoration: InputDecoration(
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(10)),
|
||||
),
|
||||
readOnly: true,
|
||||
style: GoogleFonts.outfit(textStyle: const TextStyle(color: Color.fromRGBO(255, 255, 255, 1), fontSize: 16)),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: const Color.fromRGBO(255, 255, 255, 1), width: 1),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: TextButton(
|
||||
onPressed: () => {_selectDate(context)},
|
||||
child: Text('Select Date',
|
||||
style: GoogleFonts.outfit(
|
||||
textStyle: const TextStyle(color: Colors.white, fontSize: 14, height: 2),
|
||||
)),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () => {_selectDate(context)},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 16),
|
||||
decoration: BoxDecoration(
|
||||
// border: OutlineInputBorder(borderRadius: BorderRadius.circular(8)),
|
||||
border: Border.all(color: Colors.white),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: Colors.transparent,
|
||||
),
|
||||
],
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(widget.controller.text.isNotEmpty ? widget.controller.text : 'Select Date',
|
||||
style: GoogleFonts.outfit(
|
||||
textStyle: const TextStyle(color: Color.fromRGBO(255, 255, 255, 1), fontSize: 16))),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
|
|
|||
|
|
@ -25,13 +25,13 @@ class DropDownWidget extends StatelessWidget {
|
|||
Text(
|
||||
'$label:',
|
||||
style: GoogleFonts.outfit(
|
||||
textStyle: const TextStyle(color: Colors.white, fontSize: 16),
|
||||
textStyle: const TextStyle(color: Colors.white, fontSize: 12),
|
||||
),
|
||||
),
|
||||
const Gap(8),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12), // Set the desired border radius
|
||||
borderRadius: BorderRadius.circular(8), // Set the desired border radius
|
||||
border: Border.all(color: const Color.fromRGBO(255, 255, 255, 1)), // Set the border color
|
||||
),
|
||||
child: DropdownMenu(
|
||||
|
|
@ -42,19 +42,20 @@ class DropDownWidget extends StatelessWidget {
|
|||
label: item[listTitle].toString(),
|
||||
value: item[listTitle],
|
||||
style: ButtonStyle(
|
||||
foregroundColor: WidgetStateProperty.all<Color>(const Color.fromRGBO(255, 255, 255, 1)),
|
||||
foregroundColor: WidgetStateProperty.all<Color>(const Color.fromRGBO(230, 230, 230, 1)),
|
||||
textStyle: WidgetStateProperty.all<TextStyle>(
|
||||
GoogleFonts.outfit(fontSize: 16, fontWeight: FontWeight.w500)))),
|
||||
GoogleFonts.inter(fontSize: 16, fontWeight: FontWeight.w500)))),
|
||||
],
|
||||
onSelected: onChanged,
|
||||
width: MediaQuery.of(context).size.width * 0.8,
|
||||
width: MediaQuery.of(context).size.width * 0.9,
|
||||
menuHeight: MediaQuery.of(context).size.height * 0.8,
|
||||
textStyle: GoogleFonts.outfit(textStyle: const TextStyle(color: Color.fromRGBO(255, 255, 255, 1))),
|
||||
textStyle:
|
||||
GoogleFonts.outfit(textStyle: const TextStyle(color: Color.fromRGBO(255, 255, 255, 1), fontSize: 16)),
|
||||
menuStyle: MenuStyle(
|
||||
backgroundColor: WidgetStateProperty.all<Color>(const Color.fromRGBO(23, 37, 62, 0.8)),
|
||||
padding: WidgetStateProperty.all(const EdgeInsets.symmetric(vertical: 16)),
|
||||
backgroundColor: WidgetStateProperty.all<Color>(const Color.fromRGBO(13, 21, 42, 0.663)),
|
||||
padding: WidgetStateProperty.all(const EdgeInsets.symmetric(vertical: 16, horizontal: 8)),
|
||||
shape: WidgetStateProperty.all(RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20), // Set the border radius for the dropdown menu
|
||||
borderRadius: BorderRadius.circular(8), // Set the border radius for the dropdown menu
|
||||
)),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue