|
|
|
@ -10,12 +10,9 @@ class LocationSelectionDialog extends StatelessWidget {
|
|
|
|
|
final List<HospitalsModel> data;
|
|
|
|
|
final Function(int)? onValueSelected;
|
|
|
|
|
final int? selectedIndex;
|
|
|
|
|
final bool isArabic;
|
|
|
|
|
|
|
|
|
|
const LocationSelectionDialog(
|
|
|
|
|
{super.key,
|
|
|
|
|
required this.data,
|
|
|
|
|
this.onValueSelected,
|
|
|
|
|
this.selectedIndex});
|
|
|
|
|
const LocationSelectionDialog({super.key, required this.data, this.onValueSelected, this.selectedIndex, required this.isArabic});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
@ -25,6 +22,7 @@ class LocationSelectionDialog extends StatelessWidget {
|
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
|
),
|
|
|
|
|
child: LocationDialogBody(
|
|
|
|
|
isArabic: isArabic,
|
|
|
|
|
data: data,
|
|
|
|
|
onValueSelected: onValueSelected,
|
|
|
|
|
selectedIndex: selectedIndex,
|
|
|
|
@ -36,12 +34,9 @@ class LocationDialogBody extends StatefulWidget {
|
|
|
|
|
final List<HospitalsModel> data;
|
|
|
|
|
final Function(int)? onValueSelected;
|
|
|
|
|
final int? selectedIndex;
|
|
|
|
|
final bool isArabic;
|
|
|
|
|
|
|
|
|
|
const LocationDialogBody(
|
|
|
|
|
{super.key,
|
|
|
|
|
required this.data,
|
|
|
|
|
this.onValueSelected,
|
|
|
|
|
this.selectedIndex});
|
|
|
|
|
const LocationDialogBody({super.key, required this.data, this.onValueSelected, this.selectedIndex, required this.isArabic});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
State<LocationDialogBody> createState() => _LocationDialogBodyState();
|
|
|
|
@ -55,6 +50,7 @@ class _LocationDialogBodyState extends State<LocationDialogBody> {
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return isListVisible
|
|
|
|
|
? LocationListExpandedBody(
|
|
|
|
|
isArabic: widget.isArabic,
|
|
|
|
|
data: widget.data,
|
|
|
|
|
onItemClick: (data) {
|
|
|
|
|
if (data.isEmpty) return;
|
|
|
|
@ -78,22 +74,19 @@ class _LocationDialogBodyState extends State<LocationDialogBody> {
|
|
|
|
|
isListVisible = true;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
selectedText: currentlySelected == -1
|
|
|
|
|
? ""
|
|
|
|
|
: widget.data[currentlySelected].name ?? "");
|
|
|
|
|
selectedText: currentlySelected == -1 ? "" : widget.data[currentlySelected].name ?? "");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class LocationListExpandedBody extends StatefulWidget {
|
|
|
|
|
final List<HospitalsModel> data;
|
|
|
|
|
final Function(String) onItemClick;
|
|
|
|
|
final bool isArabic;
|
|
|
|
|
|
|
|
|
|
const LocationListExpandedBody(
|
|
|
|
|
{super.key, required this.data, required this.onItemClick});
|
|
|
|
|
const LocationListExpandedBody({super.key, required this.data, required this.onItemClick, required this.isArabic});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
State<LocationListExpandedBody> createState() =>
|
|
|
|
|
_LocationListExpandedBodyState();
|
|
|
|
|
State<LocationListExpandedBody> createState() => _LocationListExpandedBodyState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _LocationListExpandedBodyState extends State<LocationListExpandedBody> {
|
|
|
|
@ -117,17 +110,16 @@ class _LocationListExpandedBodyState extends State<LocationListExpandedBody> {
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
SelectBranchHeader(),
|
|
|
|
|
SizedBox(height: 8,),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
|
),
|
|
|
|
|
TextField(
|
|
|
|
|
controller: controller,
|
|
|
|
|
onChanged: (v) {
|
|
|
|
|
tempListData.clear();
|
|
|
|
|
if (v.length > 0) {
|
|
|
|
|
for (int i = 0; i < widget.data.length; i++) {
|
|
|
|
|
if (widget.data[i].name
|
|
|
|
|
?.toLowerCase()
|
|
|
|
|
.contains(v.toLowerCase()) ==
|
|
|
|
|
true) {
|
|
|
|
|
if (widget.data[i].name?.toLowerCase().contains(v.toLowerCase()) == true) {
|
|
|
|
|
tempListData.add(widget.data[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -140,7 +132,7 @@ class _LocationListExpandedBodyState extends State<LocationListExpandedBody> {
|
|
|
|
|
hintStyle: TextStyle(fontSize: 12),
|
|
|
|
|
hintText: TranslationBase.of(context).searchByBranch,
|
|
|
|
|
suffixIcon: Icon(Icons.search),
|
|
|
|
|
contentPadding: EdgeInsets.symmetric(vertical: 9,horizontal: 14),
|
|
|
|
|
contentPadding: EdgeInsets.symmetric(vertical: 9, horizontal: 14),
|
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
|
|
|
borderSide: BorderSide(
|
|
|
|
@ -163,16 +155,11 @@ class _LocationListExpandedBodyState extends State<LocationListExpandedBody> {
|
|
|
|
|
height: 24,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
widget
|
|
|
|
|
.onItemClick(tempListData[index].name ?? "");
|
|
|
|
|
widget.onItemClick(tempListData[index].name ?? "");
|
|
|
|
|
},
|
|
|
|
|
child: Text(
|
|
|
|
|
"${tempListData[index].name ?? ""} ( ${tempListData[index].distanceInKilometers} km )",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
letterSpacing: -0.96),
|
|
|
|
|
"${widget.isArabic ? tempListData[index].nameN : tempListData[index].name ?? ""}",
|
|
|
|
|
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Colors.black, letterSpacing: -0.96),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -190,11 +177,7 @@ class LocationListWrapBody extends StatelessWidget {
|
|
|
|
|
final VoidCallback? onTextBoxClicked;
|
|
|
|
|
final String selectedText;
|
|
|
|
|
|
|
|
|
|
const LocationListWrapBody(
|
|
|
|
|
{super.key,
|
|
|
|
|
this.onConfirmClicked,
|
|
|
|
|
this.onTextBoxClicked,
|
|
|
|
|
required this.selectedText});
|
|
|
|
|
const LocationListWrapBody({super.key, this.onConfirmClicked, this.onTextBoxClicked, required this.selectedText});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
@ -203,7 +186,7 @@ class LocationListWrapBody extends StatelessWidget {
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
SelectBranchHeader(),
|
|
|
|
|
SelectBranchHeader(),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 24,
|
|
|
|
|
),
|
|
|
|
@ -213,21 +196,13 @@ class LocationListWrapBody extends StatelessWidget {
|
|
|
|
|
},
|
|
|
|
|
title: Text(
|
|
|
|
|
TranslationBase.of(context).selectBranch,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
letterSpacing: -0.96),
|
|
|
|
|
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Colors.black, letterSpacing: -0.96),
|
|
|
|
|
),
|
|
|
|
|
subtitle: selectedText.isEmpty
|
|
|
|
|
? null
|
|
|
|
|
: Text(
|
|
|
|
|
selectedText,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
letterSpacing: -0.96),
|
|
|
|
|
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w400, color: Colors.black, letterSpacing: -0.96),
|
|
|
|
|
),
|
|
|
|
|
trailing: Icon(
|
|
|
|
|
Icons.arrow_drop_down_outlined,
|
|
|
|
@ -262,19 +237,15 @@ class LocationListWrapBody extends StatelessWidget {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class SelectBranchHeader extends StatelessWidget{
|
|
|
|
|
class SelectBranchHeader extends StatelessWidget {
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Row(
|
|
|
|
|
return Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).selectBranch,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 24,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
letterSpacing: -0.96),
|
|
|
|
|
style: TextStyle(fontSize: 24, fontWeight: FontWeight.w600, color: Colors.black, letterSpacing: -0.96),
|
|
|
|
|
),
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|