remove duplicate enter trigger
This commit is contained in:
@@ -46,7 +46,6 @@ class _MihBusinessHomeState extends State<MihBusinessHome>
|
|||||||
late final AnimationController _marqueeController;
|
late final AnimationController _marqueeController;
|
||||||
late final ScrollController _scrollController;
|
late final ScrollController _scrollController;
|
||||||
final FocusNode _searchFocusNode = FocusNode();
|
final FocusNode _searchFocusNode = FocusNode();
|
||||||
final FocusNode _focusNode = FocusNode();
|
|
||||||
final String maintenanceMsg =
|
final String maintenanceMsg =
|
||||||
"\tHeads up! We're doing maintenance on Thur, 15 May 2025 at 10 PM (CAT). MIH may be unavailable briefly.";
|
"\tHeads up! We're doing maintenance on Thur, 15 May 2025 at 10 PM (CAT). MIH may be unavailable briefly.";
|
||||||
|
|
||||||
@@ -204,108 +203,90 @@ class _MihBusinessHomeState extends State<MihBusinessHome>
|
|||||||
|
|
||||||
Widget getBody(double width, double height) {
|
Widget getBody(double width, double height) {
|
||||||
return MihSingleChildScroll(
|
return MihSingleChildScroll(
|
||||||
child: KeyboardListener(
|
child: Column(
|
||||||
focusNode: _focusNode,
|
children: [
|
||||||
autofocus: true,
|
const SizedBox(height: 10),
|
||||||
onKeyEvent: (event) async {
|
Padding(
|
||||||
if (event is KeyDownEvent &&
|
padding: EdgeInsets.symmetric(horizontal: width / 20),
|
||||||
event.logicalKey == LogicalKeyboardKey.enter) {
|
child: MihSearchBar(
|
||||||
Navigator.of(context).pushNamed(
|
controller: searchController,
|
||||||
'/mzansi-ai',
|
hintText: "Ask Mzansi",
|
||||||
arguments: MzansiAiArguments(
|
prefixIcon: Icons.search,
|
||||||
widget.signedInUser,
|
prefixAltIcon: MihIcons.mzansiAi,
|
||||||
searchController.text.isEmpty ? null : searchController.text,
|
fillColor:
|
||||||
),
|
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
);
|
hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
searchController.clear();
|
onPrefixIconTap: () {
|
||||||
}
|
Navigator.of(context).pushNamed(
|
||||||
},
|
'/mzansi-ai',
|
||||||
child: Column(
|
arguments: MzansiAiArguments(
|
||||||
children: [
|
widget.signedInUser,
|
||||||
const SizedBox(height: 10),
|
searchController.text.isEmpty
|
||||||
Padding(
|
? null
|
||||||
padding: EdgeInsets.symmetric(horizontal: width / 20),
|
: searchController.text,
|
||||||
child: MihSearchBar(
|
),
|
||||||
controller: searchController,
|
);
|
||||||
hintText: "Ask Mzansi",
|
searchController.clear();
|
||||||
prefixIcon: Icons.search,
|
},
|
||||||
prefixAltIcon: MihIcons.mzansiAi,
|
searchFocusNode: _searchFocusNode,
|
||||||
fillColor:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
|
||||||
hintColor:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
onPrefixIconTap: () {
|
|
||||||
Navigator.of(context).pushNamed(
|
|
||||||
'/mzansi-ai',
|
|
||||||
arguments: MzansiAiArguments(
|
|
||||||
widget.signedInUser,
|
|
||||||
searchController.text.isEmpty
|
|
||||||
? null
|
|
||||||
: searchController.text,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
searchController.clear();
|
|
||||||
},
|
|
||||||
searchFocusNode: _searchFocusNode,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
),
|
||||||
ValueListenableBuilder(
|
const SizedBox(height: 10),
|
||||||
valueListenable: searchPackageName,
|
ValueListenableBuilder(
|
||||||
builder: (context, value, child) {
|
valueListenable: searchPackageName,
|
||||||
List<Widget> filteredPackages = value
|
builder: (context, value, child) {
|
||||||
.where((package) => package.keys.first
|
List<Widget> filteredPackages = value
|
||||||
.toLowerCase()
|
.where((package) => package.keys.first
|
||||||
.contains(searchController.text.toLowerCase()))
|
.toLowerCase()
|
||||||
.map((package) => package.values.first)
|
.contains(searchController.text.toLowerCase()))
|
||||||
.toList();
|
.map((package) => package.values.first)
|
||||||
if (filteredPackages.isNotEmpty) {
|
.toList();
|
||||||
return GridView.builder(
|
if (filteredPackages.isNotEmpty) {
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
return GridView.builder(
|
||||||
shrinkWrap: true,
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
padding: getPadding(width, height),
|
shrinkWrap: true,
|
||||||
// shrinkWrap: true,
|
padding: getPadding(width, height),
|
||||||
itemCount: filteredPackages.length,
|
// shrinkWrap: true,
|
||||||
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
|
itemCount: filteredPackages.length,
|
||||||
maxCrossAxisExtent: packageSize,
|
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
|
||||||
crossAxisSpacing: 5,
|
maxCrossAxisExtent: packageSize,
|
||||||
|
crossAxisSpacing: 5,
|
||||||
|
),
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return filteredPackages[index];
|
||||||
|
},
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
MihIcons.mzansiAi,
|
||||||
|
size: 165,
|
||||||
|
color: MzanziInnovationHub.of(context)!
|
||||||
|
.theme
|
||||||
|
.secondaryColor(),
|
||||||
),
|
),
|
||||||
itemBuilder: (context, index) {
|
const SizedBox(height: 10),
|
||||||
return filteredPackages[index];
|
Text(
|
||||||
},
|
"Mzansi AI is here to help you!",
|
||||||
);
|
textAlign: TextAlign.center,
|
||||||
} else {
|
overflow: TextOverflow.visible,
|
||||||
return Column(
|
style: TextStyle(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
fontSize: 25,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
fontWeight: FontWeight.bold,
|
||||||
children: [
|
|
||||||
Icon(
|
|
||||||
MihIcons.mzansiAi,
|
|
||||||
size: 165,
|
|
||||||
color: MzanziInnovationHub.of(context)!
|
color: MzanziInnovationHub.of(context)!
|
||||||
.theme
|
.theme
|
||||||
.secondaryColor(),
|
.secondaryColor(),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
),
|
||||||
Text(
|
],
|
||||||
"Mzansi AI is here to help you!",
|
);
|
||||||
textAlign: TextAlign.center,
|
}
|
||||||
overflow: TextOverflow.visible,
|
},
|
||||||
style: TextStyle(
|
),
|
||||||
fontSize: 25,
|
],
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
color: MzanziInnovationHub.of(context)!
|
|
||||||
.theme
|
|
||||||
.secondaryColor(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ class _MihPersonalHomeState extends State<MihPersonalHome>
|
|||||||
late final AnimationController _marqueeController;
|
late final AnimationController _marqueeController;
|
||||||
late final ScrollController _scrollController;
|
late final ScrollController _scrollController;
|
||||||
final FocusNode _searchFocusNode = FocusNode();
|
final FocusNode _searchFocusNode = FocusNode();
|
||||||
final FocusNode _focusNode = FocusNode();
|
|
||||||
final String maintenanceMsg =
|
final String maintenanceMsg =
|
||||||
"\tHeads up! We're doing maintenance on Thur, 15 May 2025 at 10 PM (CAT). MIH may be unavailable briefly.";
|
"\tHeads up! We're doing maintenance on Thur, 15 May 2025 at 10 PM (CAT). MIH may be unavailable briefly.";
|
||||||
|
|
||||||
@@ -247,109 +246,91 @@ class _MihPersonalHomeState extends State<MihPersonalHome>
|
|||||||
|
|
||||||
Widget getBody(double width, double height) {
|
Widget getBody(double width, double height) {
|
||||||
return MihSingleChildScroll(
|
return MihSingleChildScroll(
|
||||||
child: KeyboardListener(
|
child: Column(
|
||||||
focusNode: _focusNode,
|
children: [
|
||||||
autofocus: true,
|
const SizedBox(height: 10),
|
||||||
onKeyEvent: (event) async {
|
Padding(
|
||||||
if (event is KeyDownEvent &&
|
padding: EdgeInsets.symmetric(horizontal: width / 20),
|
||||||
event.logicalKey == LogicalKeyboardKey.enter) {
|
child: MihSearchBar(
|
||||||
Navigator.of(context).pushNamed(
|
controller: searchController,
|
||||||
'/mzansi-ai',
|
hintText: "Ask Mzansi",
|
||||||
arguments: MzansiAiArguments(
|
prefixIcon: Icons.search,
|
||||||
widget.signedInUser,
|
prefixAltIcon: MihIcons.mzansiAi,
|
||||||
searchController.text.isEmpty ? null : searchController.text,
|
fillColor:
|
||||||
),
|
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
);
|
hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
searchController.clear();
|
onPrefixIconTap: () {
|
||||||
}
|
Navigator.of(context).pushNamed(
|
||||||
},
|
'/mzansi-ai',
|
||||||
child: Column(
|
arguments: MzansiAiArguments(
|
||||||
children: [
|
widget.signedInUser,
|
||||||
const SizedBox(height: 10),
|
searchController.text.isEmpty
|
||||||
Padding(
|
? null
|
||||||
padding: EdgeInsets.symmetric(horizontal: width / 20),
|
: searchController.text,
|
||||||
child: MihSearchBar(
|
),
|
||||||
controller: searchController,
|
);
|
||||||
hintText: "Ask Mzansi",
|
searchController.clear();
|
||||||
prefixIcon: Icons.search,
|
},
|
||||||
prefixAltIcon: MihIcons.mzansiAi,
|
searchFocusNode: _searchFocusNode,
|
||||||
fillColor:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
|
||||||
hintColor:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
onPrefixIconTap: () {
|
|
||||||
Navigator.of(context).pushNamed(
|
|
||||||
'/mzansi-ai',
|
|
||||||
arguments: MzansiAiArguments(
|
|
||||||
widget.signedInUser,
|
|
||||||
searchController.text.isEmpty
|
|
||||||
? null
|
|
||||||
: searchController.text,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
searchController.clear();
|
|
||||||
},
|
|
||||||
searchFocusNode: _searchFocusNode,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
),
|
||||||
ValueListenableBuilder(
|
const SizedBox(height: 10),
|
||||||
valueListenable: searchPackageName,
|
ValueListenableBuilder(
|
||||||
builder: (context, value, child) {
|
valueListenable: searchPackageName,
|
||||||
List<Widget> filteredPackages = value
|
builder: (context, value, child) {
|
||||||
.where((package) => package.keys.first
|
List<Widget> filteredPackages = value
|
||||||
.toLowerCase()
|
.where((package) => package.keys.first
|
||||||
.contains(searchController.text.toLowerCase()))
|
.toLowerCase()
|
||||||
.map((package) => package.values.first)
|
.contains(searchController.text.toLowerCase()))
|
||||||
.toList();
|
.map((package) => package.values.first)
|
||||||
if (filteredPackages.isNotEmpty) {
|
.toList();
|
||||||
return GridView.builder(
|
if (filteredPackages.isNotEmpty) {
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
return GridView.builder(
|
||||||
shrinkWrap: true,
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
padding: getPadding(width, height),
|
shrinkWrap: true,
|
||||||
// shrinkWrap: true,
|
padding: getPadding(width, height),
|
||||||
itemCount: filteredPackages.length,
|
// shrinkWrap: true,
|
||||||
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
|
itemCount: filteredPackages.length,
|
||||||
maxCrossAxisExtent: packageSize,
|
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
|
||||||
crossAxisSpacing: 5,
|
maxCrossAxisExtent: packageSize,
|
||||||
|
crossAxisSpacing: 5,
|
||||||
|
),
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return filteredPackages[index];
|
||||||
|
// return personalPackages[index];
|
||||||
|
},
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
MihIcons.mzansiAi,
|
||||||
|
size: 165,
|
||||||
|
color: MzanziInnovationHub.of(context)!
|
||||||
|
.theme
|
||||||
|
.secondaryColor(),
|
||||||
),
|
),
|
||||||
itemBuilder: (context, index) {
|
const SizedBox(height: 10),
|
||||||
return filteredPackages[index];
|
Text(
|
||||||
// return personalPackages[index];
|
"Mzansi AI is here to help you!",
|
||||||
},
|
textAlign: TextAlign.center,
|
||||||
);
|
overflow: TextOverflow.visible,
|
||||||
} else {
|
style: TextStyle(
|
||||||
return Column(
|
fontSize: 25,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
fontWeight: FontWeight.bold,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Icon(
|
|
||||||
MihIcons.mzansiAi,
|
|
||||||
size: 165,
|
|
||||||
color: MzanziInnovationHub.of(context)!
|
color: MzanziInnovationHub.of(context)!
|
||||||
.theme
|
.theme
|
||||||
.secondaryColor(),
|
.secondaryColor(),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
),
|
||||||
Text(
|
],
|
||||||
"Mzansi AI is here to help you!",
|
);
|
||||||
textAlign: TextAlign.center,
|
}
|
||||||
overflow: TextOverflow.visible,
|
},
|
||||||
style: TextStyle(
|
),
|
||||||
fontSize: 25,
|
],
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
color: MzanziInnovationHub.of(context)!
|
|
||||||
.theme
|
|
||||||
.secondaryColor(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ class MihBusinessUserSearch extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _MihBusinessUserSearchState extends State<MihBusinessUserSearch> {
|
class _MihBusinessUserSearchState extends State<MihBusinessUserSearch> {
|
||||||
final FocusNode _focusNode = FocusNode();
|
|
||||||
final TextEditingController searchController = TextEditingController();
|
final TextEditingController searchController = TextEditingController();
|
||||||
late Future<List<AppUser>> userSearchResults;
|
late Future<List<AppUser>> userSearchResults;
|
||||||
final FocusNode _searchFocusNode = FocusNode();
|
final FocusNode _searchFocusNode = FocusNode();
|
||||||
@@ -101,72 +100,60 @@ class _MihBusinessUserSearchState extends State<MihBusinessUserSearch> {
|
|||||||
|
|
||||||
Widget getBody(double width) {
|
Widget getBody(double width) {
|
||||||
return MihSingleChildScroll(
|
return MihSingleChildScroll(
|
||||||
child: KeyboardListener(
|
child: Column(mainAxisSize: MainAxisSize.max, children: [
|
||||||
focusNode: _focusNode,
|
Padding(
|
||||||
autofocus: true,
|
padding: EdgeInsets.symmetric(horizontal: width / 20),
|
||||||
onKeyEvent: (event) async {
|
child: MihSearchBar(
|
||||||
if (event is KeyDownEvent &&
|
controller: searchController,
|
||||||
event.logicalKey == LogicalKeyboardKey.enter) {
|
hintText: "Search Users",
|
||||||
submitUserForm();
|
prefixIcon: Icons.search,
|
||||||
}
|
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
},
|
hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
child: Column(mainAxisSize: MainAxisSize.max, children: [
|
onPrefixIconTap: () {
|
||||||
Padding(
|
submitUserForm();
|
||||||
padding: EdgeInsets.symmetric(horizontal: width / 20),
|
|
||||||
child: MihSearchBar(
|
|
||||||
controller: searchController,
|
|
||||||
hintText: "Search Users",
|
|
||||||
prefixIcon: Icons.search,
|
|
||||||
fillColor:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
|
||||||
hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
onPrefixIconTap: () {
|
|
||||||
submitUserForm();
|
|
||||||
},
|
|
||||||
onClearIconTap: () {
|
|
||||||
setState(() {
|
|
||||||
searchController.clear();
|
|
||||||
userSearch = "";
|
|
||||||
});
|
|
||||||
submitUserForm();
|
|
||||||
},
|
|
||||||
searchFocusNode: _searchFocusNode,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
FutureBuilder(
|
|
||||||
future: userSearchResults,
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
//print("patient Liust ${snapshot.data}");
|
|
||||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
|
||||||
return const Mihloadingcircle();
|
|
||||||
} else if (snapshot.connectionState == ConnectionState.done &&
|
|
||||||
snapshot.hasData) {
|
|
||||||
List<AppUser> patientsList;
|
|
||||||
if (userSearch == "") {
|
|
||||||
patientsList = [];
|
|
||||||
} else {
|
|
||||||
patientsList = snapshot.data!;
|
|
||||||
//print(patientsList);
|
|
||||||
}
|
|
||||||
return displayUserList(patientsList);
|
|
||||||
} else {
|
|
||||||
return Center(
|
|
||||||
child: Text(
|
|
||||||
"$errorCode: Error pulling Patients Data\n/patients/search/$userSearch\n$errorBody",
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 25,
|
|
||||||
color: MzanziInnovationHub.of(context)!
|
|
||||||
.theme
|
|
||||||
.errorColor()),
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
onClearIconTap: () {
|
||||||
|
setState(() {
|
||||||
|
searchController.clear();
|
||||||
|
userSearch = "";
|
||||||
|
});
|
||||||
|
submitUserForm();
|
||||||
|
},
|
||||||
|
searchFocusNode: _searchFocusNode,
|
||||||
),
|
),
|
||||||
]),
|
),
|
||||||
),
|
const SizedBox(height: 10),
|
||||||
|
FutureBuilder(
|
||||||
|
future: userSearchResults,
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
//print("patient Liust ${snapshot.data}");
|
||||||
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||||
|
return const Mihloadingcircle();
|
||||||
|
} else if (snapshot.connectionState == ConnectionState.done &&
|
||||||
|
snapshot.hasData) {
|
||||||
|
List<AppUser> patientsList;
|
||||||
|
if (userSearch == "") {
|
||||||
|
patientsList = [];
|
||||||
|
} else {
|
||||||
|
patientsList = snapshot.data!;
|
||||||
|
//print(patientsList);
|
||||||
|
}
|
||||||
|
return displayUserList(patientsList);
|
||||||
|
} else {
|
||||||
|
return Center(
|
||||||
|
child: Text(
|
||||||
|
"$errorCode: Error pulling Patients Data\n/patients/search/$userSearch\n$errorBody",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 25,
|
||||||
|
color:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.errorColor()),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,82 +42,66 @@ class _MyPatientListState extends State<MyPatientList> {
|
|||||||
|
|
||||||
Widget myPatientListTool(double width) {
|
Widget myPatientListTool(double width) {
|
||||||
return MihSingleChildScroll(
|
return MihSingleChildScroll(
|
||||||
child: KeyboardListener(
|
child: Column(mainAxisSize: MainAxisSize.max, children: [
|
||||||
focusNode: _focusNode,
|
Padding(
|
||||||
autofocus: true,
|
padding: EdgeInsets.symmetric(horizontal: width / 20),
|
||||||
onKeyEvent: (event) async {
|
child: MihSearchBar(
|
||||||
if (event is KeyDownEvent &&
|
controller: _myPatientSearchController,
|
||||||
event.logicalKey == LogicalKeyboardKey.enter) {
|
hintText: "Search Patient ID",
|
||||||
setState(() {
|
prefixIcon: Icons.search,
|
||||||
_myPatientIdSearchString = _myPatientSearchController.text;
|
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
_myPatientList = MIHApiCalls.getPatientAccessListOfBusiness(
|
hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
widget.business!.business_id);
|
onPrefixIconTap: () {
|
||||||
});
|
setState(() {
|
||||||
}
|
_myPatientIdSearchString = _myPatientSearchController.text;
|
||||||
},
|
_myPatientList = MIHApiCalls.getPatientAccessListOfBusiness(
|
||||||
child: Column(mainAxisSize: MainAxisSize.max, children: [
|
widget.business!.business_id);
|
||||||
Padding(
|
});
|
||||||
padding: EdgeInsets.symmetric(horizontal: width / 20),
|
|
||||||
child: MihSearchBar(
|
|
||||||
controller: _myPatientSearchController,
|
|
||||||
hintText: "Search Patient ID",
|
|
||||||
prefixIcon: Icons.search,
|
|
||||||
fillColor:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
|
||||||
hintColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
onPrefixIconTap: () {
|
|
||||||
setState(() {
|
|
||||||
_myPatientIdSearchString = _myPatientSearchController.text;
|
|
||||||
_myPatientList = MIHApiCalls.getPatientAccessListOfBusiness(
|
|
||||||
widget.business!.business_id);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
onClearIconTap: () {
|
|
||||||
setState(() {
|
|
||||||
_myPatientSearchController.clear();
|
|
||||||
_myPatientIdSearchString = "";
|
|
||||||
});
|
|
||||||
getMyPatientList();
|
|
||||||
},
|
|
||||||
searchFocusNode: _searchFocusNode,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
//spacer
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
FutureBuilder(
|
|
||||||
future: _myPatientList,
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
//print("patient Liust ${snapshot.data}");
|
|
||||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
|
||||||
return const Mihloadingcircle();
|
|
||||||
} else if (snapshot.connectionState == ConnectionState.done &&
|
|
||||||
snapshot.hasData) {
|
|
||||||
List<PatientAccess> patientsAccessList;
|
|
||||||
if (_myPatientIdSearchString == "") {
|
|
||||||
patientsAccessList = snapshot.data!;
|
|
||||||
} else {
|
|
||||||
patientsAccessList = filterAccessResults(
|
|
||||||
snapshot.data!, _myPatientIdSearchString);
|
|
||||||
//print(patientsList);
|
|
||||||
}
|
|
||||||
return displayMyPatientList(patientsAccessList);
|
|
||||||
} else {
|
|
||||||
return Center(
|
|
||||||
child: Text(
|
|
||||||
"Error pulling Patient Access Data\n$baseUrl/access-requests/business/patient/${widget.business!.business_id}",
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 25,
|
|
||||||
color: MzanziInnovationHub.of(context)!
|
|
||||||
.theme
|
|
||||||
.errorColor()),
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
onClearIconTap: () {
|
||||||
|
setState(() {
|
||||||
|
_myPatientSearchController.clear();
|
||||||
|
_myPatientIdSearchString = "";
|
||||||
|
});
|
||||||
|
getMyPatientList();
|
||||||
|
},
|
||||||
|
searchFocusNode: _searchFocusNode,
|
||||||
),
|
),
|
||||||
]),
|
),
|
||||||
),
|
//spacer
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
FutureBuilder(
|
||||||
|
future: _myPatientList,
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
//print("patient Liust ${snapshot.data}");
|
||||||
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||||
|
return const Mihloadingcircle();
|
||||||
|
} else if (snapshot.connectionState == ConnectionState.done &&
|
||||||
|
snapshot.hasData) {
|
||||||
|
List<PatientAccess> patientsAccessList;
|
||||||
|
if (_myPatientIdSearchString == "") {
|
||||||
|
patientsAccessList = snapshot.data!;
|
||||||
|
} else {
|
||||||
|
patientsAccessList = filterAccessResults(
|
||||||
|
snapshot.data!, _myPatientIdSearchString);
|
||||||
|
//print(patientsList);
|
||||||
|
}
|
||||||
|
return displayMyPatientList(patientsAccessList);
|
||||||
|
} else {
|
||||||
|
return Center(
|
||||||
|
child: Text(
|
||||||
|
"Error pulling Patient Access Data\n$baseUrl/access-requests/business/patient/${widget.business!.business_id}",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 25,
|
||||||
|
color:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.errorColor()),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user