Merge pull request #74 from yaso-meth/BUG-Loyalty-Card-Dropdown-click-fix

BUG-Loyalty-Card-Dropdown-click-fix
This commit is contained in:
yaso-meth
2025-02-05 10:21:54 +02:00
committed by GitHub
16 changed files with 37 additions and 3 deletions

View File

@@ -1,5 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import '../mih_env/env.dart'; import '../mih_env/env.dart';
import '../mih_router/routeGenerator.dart'; import '../mih_router/routeGenerator.dart';
import '../mih_theme/mih_theme.dart'; import '../mih_theme/mih_theme.dart';
@@ -53,8 +52,8 @@ class _MzanziInnovationHubState extends State<MzanziInnovationHub> {
@override @override
void initState() { void initState() {
theme = MihTheme(); theme = MihTheme();
var systemTheme = // var systemTheme =
SchedulerBinding.instance.platformDispatcher.platformBrightness; // SchedulerBinding.instance.platformDispatcher.platformBrightness;
// bool isDarkMode = systemTheme == Brightness.dark; // bool isDarkMode = systemTheme == Brightness.dark;
// if (isDarkMode) { // if (isDarkMode) {
// theme.mode = "Dark"; // theme.mode = "Dark";

View File

@@ -8,6 +8,7 @@ class MIHDropdownField extends StatefulWidget {
final List<String> dropdownOptions; final List<String> dropdownOptions;
// final void Function(String?)? onSelect; // final void Function(String?)? onSelect;
final bool editable; final bool editable;
final bool enableSearch;
const MIHDropdownField({ const MIHDropdownField({
super.key, super.key,
@@ -16,6 +17,7 @@ class MIHDropdownField extends StatefulWidget {
required this.dropdownOptions, required this.dropdownOptions,
required this.required, required this.required,
required this.editable, required this.editable,
required this.enableSearch,
// this.onSelect, // this.onSelect,
}); });
@@ -99,6 +101,7 @@ class _MIHDropdownFieldState extends State<MIHDropdownField> {
void initState() { void initState() {
menu = buidMenueOptions(widget.dropdownOptions); menu = buidMenueOptions(widget.dropdownOptions);
_focus.addListener(_onFocusChange); _focus.addListener(_onFocusChange);
_focus.canRequestFocus = widget.enableSearch;
super.initState(); super.initState();
} }
@@ -106,6 +109,9 @@ class _MIHDropdownFieldState extends State<MIHDropdownField> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return DropdownMenu( return DropdownMenu(
enableSearch: widget.enableSearch,
enableFilter: widget.enableSearch,
// requestFocusOnTap: true,
initialSelection: widget.controller.text, initialSelection: widget.controller.text,
enabled: widget.editable, enabled: widget.editable,
trailingIcon: Icon( trailingIcon: Icon(

View File

@@ -149,6 +149,7 @@ class _PatientAccessRequestState extends State<PatientAccessRequest> {
], ],
required: true, required: true,
editable: true, editable: true,
enableSearch: false,
), ),
), ),
IconButton( IconButton(

View File

@@ -138,6 +138,7 @@ class _PatientAccessRequestState extends State<Appointments> {
dropdownOptions: const ["All", "Approved", "Pending", "Declined"], dropdownOptions: const ["All", "Approved", "Pending", "Declined"],
required: true, required: true,
editable: true, editable: true,
enableSearch: false,
), ),
), ),
const SizedBox(height: 10), const SizedBox(height: 10),

View File

@@ -296,6 +296,7 @@ class _TipCalcState extends State<TipCalc> {
dropdownOptions: const ["Yes", "No"], dropdownOptions: const ["Yes", "No"],
required: true, required: true,
editable: true, editable: true,
enableSearch: false,
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
ValueListenableBuilder( ValueListenableBuilder(

View File

@@ -189,6 +189,7 @@ class _BuildEmployeeListState extends State<BuildEmployeeList> {
dropdownOptions: const ["Doctor", "Assistant"], dropdownOptions: const ["Doctor", "Assistant"],
required: true, required: true,
editable: true, editable: true,
enableSearch: false,
), ),
const SizedBox(height: 10.0), const SizedBox(height: 10.0),
MIHDropdownField( MIHDropdownField(
@@ -197,6 +198,7 @@ class _BuildEmployeeListState extends State<BuildEmployeeList> {
dropdownOptions: const ["Full", "Partial"], dropdownOptions: const ["Full", "Partial"],
required: true, required: true,
editable: true, editable: true,
enableSearch: false,
), ),
const SizedBox(height: 15.0), const SizedBox(height: 15.0),
SizedBox( SizedBox(

View File

@@ -150,6 +150,7 @@ class _BuildUserListState extends State<BuildUserList> {
dropdownOptions: const ["Doctor", "Assistant"], dropdownOptions: const ["Doctor", "Assistant"],
required: true, required: true,
editable: true, editable: true,
enableSearch: false,
), ),
const SizedBox(height: 10.0), const SizedBox(height: 10.0),
MIHDropdownField( MIHDropdownField(
@@ -158,6 +159,7 @@ class _BuildUserListState extends State<BuildUserList> {
dropdownOptions: const ["Full", "Partial"], dropdownOptions: const ["Full", "Partial"],
required: true, required: true,
editable: true, editable: true,
enableSearch: false,
), ),
const SizedBox(height: 15.0), const SizedBox(height: 15.0),
SizedBox( SizedBox(

View File

@@ -369,6 +369,7 @@ class _BusinessAboutState extends State<BusinessAbout> {
dropdownOptions: const ["Doctors Office", "Other"], dropdownOptions: const ["Doctors Office", "Other"],
required: true, required: true,
editable: true, editable: true,
enableSearch: false,
), ),
const SizedBox(height: 10.0), const SizedBox(height: 10.0),
MIHTextField( MIHTextField(
@@ -431,6 +432,7 @@ class _BusinessAboutState extends State<BusinessAbout> {
dropdownOptions: const ["Doctor", "Assistant"], dropdownOptions: const ["Doctor", "Assistant"],
required: true, required: true,
editable: true, editable: true,
enableSearch: false,
), ),
const SizedBox(height: 10.0), const SizedBox(height: 10.0),
MIHTextField( MIHTextField(
@@ -475,6 +477,7 @@ class _BusinessAboutState extends State<BusinessAbout> {
dropdownOptions: const ["Full", "Partial"], dropdownOptions: const ["Full", "Partial"],
required: true, required: true,
editable: false, editable: false,
enableSearch: false,
), ),
// const SizedBox(height: 15.0), // const SizedBox(height: 15.0),
// const Text( // const Text(

View File

@@ -364,6 +364,7 @@ class _BusinessDetailsState extends State<BusinessDetails> {
dropdownOptions: const ["Doctors Office", "Other"], dropdownOptions: const ["Doctors Office", "Other"],
required: true, required: true,
editable: true, editable: true,
enableSearch: false,
), ),
const SizedBox(height: 10.0), const SizedBox(height: 10.0),
ValueListenableBuilder( ValueListenableBuilder(
@@ -488,6 +489,7 @@ class _BusinessDetailsState extends State<BusinessDetails> {
dropdownOptions: const ["Doctor", "Assistant"], dropdownOptions: const ["Doctor", "Assistant"],
required: true, required: true,
editable: true, editable: true,
enableSearch: false,
), ),
const SizedBox(height: 10.0), const SizedBox(height: 10.0),
MIHTextField( MIHTextField(
@@ -532,6 +534,7 @@ class _BusinessDetailsState extends State<BusinessDetails> {
dropdownOptions: const ["Full", "Partial"], dropdownOptions: const ["Full", "Partial"],
required: true, required: true,
editable: false, editable: false,
enableSearch: false,
), ),
// const SizedBox(height: 15.0), // const SizedBox(height: 15.0),
// const Text( // const Text(

View File

@@ -293,6 +293,7 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
dropdownOptions: const ["Doctors Office", "Other"], dropdownOptions: const ["Doctors Office", "Other"],
required: true, required: true,
editable: true, editable: true,
enableSearch: false,
), ),
const SizedBox(height: 10.0), const SizedBox(height: 10.0),
ValueListenableBuilder( ValueListenableBuilder(
@@ -416,6 +417,7 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
dropdownOptions: const ["Doctor", "Assistant"], dropdownOptions: const ["Doctor", "Assistant"],
required: true, required: true,
editable: true, editable: true,
enableSearch: false,
), ),
const SizedBox(height: 10.0), const SizedBox(height: 10.0),
MIHTextField( MIHTextField(
@@ -460,6 +462,7 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
dropdownOptions: const ["Full", "Partial"], dropdownOptions: const ["Full", "Partial"],
required: true, required: true,
editable: false, editable: false,
enableSearch: false,
), ),
const SizedBox(height: 30.0), const SizedBox(height: 30.0),
SizedBox( SizedBox(

View File

@@ -336,6 +336,7 @@ class _AiChatState extends State<AiChat> {
], ],
required: true, required: true,
editable: true, editable: true,
enableSearch: false,
), ),
), ),
), ),

View File

@@ -132,6 +132,7 @@ class _LoyaltyCardsState extends State<LoyaltyCards> {
], ],
required: true, required: true,
editable: true, editable: true,
enableSearch: false,
), ),
ValueListenableBuilder( ValueListenableBuilder(
valueListenable: shopName, valueListenable: shopName,

View File

@@ -83,6 +83,7 @@ class _ClaimStatementWindowState extends State<ClaimStatementWindow> {
dropdownOptions: const ["Claim", "Statement"], dropdownOptions: const ["Claim", "Statement"],
required: true, required: true,
editable: true, editable: true,
enableSearch: false,
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
// Text( // Text(
@@ -216,6 +217,7 @@ class _ClaimStatementWindowState extends State<ClaimStatementWindow> {
], ],
required: true, required: true,
editable: true, editable: true,
enableSearch: false,
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
ValueListenableBuilder( ValueListenableBuilder(
@@ -237,6 +239,7 @@ class _ClaimStatementWindowState extends State<ClaimStatementWindow> {
], ],
required: true, required: true,
editable: true, editable: true,
enableSearch: false,
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
], ],

View File

@@ -229,6 +229,7 @@ class _AddPatientState extends State<AddPatient> {
controller: medAidController, controller: medAidController,
hintText: "Medical Aid", hintText: "Medical Aid",
editable: true, editable: true,
enableSearch: false,
// onSelect: (_) { // onSelect: (_) {
// isRequired(); // isRequired();
// }, // },
@@ -248,6 +249,7 @@ class _AddPatientState extends State<AddPatient> {
hintText: "Main Member", hintText: "Main Member",
editable: value, editable: value,
required: value, required: value,
enableSearch: false,
dropdownOptions: const ["Yes", "No"], dropdownOptions: const ["Yes", "No"],
), ),
const SizedBox(height: 10.0), const SizedBox(height: 10.0),

View File

@@ -468,6 +468,7 @@ class _EditPatientState extends State<EditPatient> {
// }, // },
editable: true, editable: true,
required: true, required: true,
enableSearch: false,
dropdownOptions: const ["Yes", "No"], dropdownOptions: const ["Yes", "No"],
), ),
ValueListenableBuilder( ValueListenableBuilder(
@@ -483,6 +484,7 @@ class _EditPatientState extends State<EditPatient> {
hintText: "Main Member.", hintText: "Main Member.",
editable: value, editable: value,
required: value, required: value,
enableSearch: false,
dropdownOptions: const ["Yes", "No"], dropdownOptions: const ["Yes", "No"],
), ),
const SizedBox(height: 10.0), const SizedBox(height: 10.0),

View File

@@ -384,6 +384,7 @@ class _PrescripInputState extends State<PrescripInput> {
dropdownOptions: numberOptions, dropdownOptions: numberOptions,
required: true, required: true,
editable: true, editable: true,
enableSearch: false,
), ),
const SizedBox(height: 10.0), const SizedBox(height: 10.0),
MIHDropdownField( MIHDropdownField(
@@ -392,6 +393,7 @@ class _PrescripInputState extends State<PrescripInput> {
dropdownOptions: numberOptions, dropdownOptions: numberOptions,
required: true, required: true,
editable: true, editable: true,
enableSearch: false,
), ),
const SizedBox(height: 10.0), const SizedBox(height: 10.0),
MIHDropdownField( MIHDropdownField(
@@ -400,6 +402,7 @@ class _PrescripInputState extends State<PrescripInput> {
dropdownOptions: numberOptions, dropdownOptions: numberOptions,
required: true, required: true,
editable: true, editable: true,
enableSearch: false,
), ),
const SizedBox(height: 10.0), const SizedBox(height: 10.0),
MIHDropdownField( MIHDropdownField(
@@ -408,6 +411,7 @@ class _PrescripInputState extends State<PrescripInput> {
dropdownOptions: numberOptions, dropdownOptions: numberOptions,
required: true, required: true,
editable: true, editable: true,
enableSearch: false,
), ),
const SizedBox(height: 15.0), const SizedBox(height: 15.0),
SizedBox( SizedBox(