WD: searchable dropdown added in intervention dialog

update_3.16.0_CR5439_Pharmacy_Intervention
taha.alam 1 year ago
parent b25398b97b
commit ad4c1b226c

@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/nursing_station.dart'; import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/nursing_station.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:dropdown_search/dropdown_search.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
@ -277,39 +278,75 @@ class _PharmacyInterventionDialogState
widget.station?.entityList?.isEmpty == true ? Expanded( widget.station?.entityList?.isEmpty == true ? Expanded(
child: EmptyDropDown()) child: EmptyDropDown())
: Expanded( : Expanded(
child: DropdownButtonHideUnderline( child: DropdownSearch<NursingStationEntity>(
child: DropdownButton( itemAsString:(item){
dropdownColor: Colors.white, return item.description??'';
iconEnabledColor: Colors.black, } ,
icon: Icon(Icons.keyboard_arrow_down), items: widget.station?.entityList ?? [],
isExpanded: true, popupProps: PopupProps.menu(
value: nursingStation == null showSearchBox: true,
? widget.station?.entityList?.first searchDelay: Duration(microseconds: 100),
: nursingStation, searchFieldProps: TextFieldProps(
iconSize: 25, decoration: InputDecoration(
elevation: 16, border: UnderlineInputBorder(),
onChanged: (newValue) async { hintText: TranslationBase.of(context).search
if (newValue != null) )
setState(() { )
nursingStation = newValue ;
});
},
items:
widget.station?.entityList?.map((item) {
return DropdownMenuItem(
child: AppText(
item.description ?? '',
fontSize: 14,
letterSpacing: -0.96,
color: AppGlobal.appTextColor,
fontWeight: FontWeight.normal,
textAlign: TextAlign.left,
),
value: item,
);
}).toList(),
), ),
), dropdownButtonProps: DropdownButtonProps(color: AppGlobal.appRedColor,),
dropdownDecoratorProps: DropDownDecoratorProps(
textAlignVertical: TextAlignVertical.center,
dropdownSearchDecoration: InputDecoration(
border: InputBorder.none
),
baseStyle: TextStyle(
fontSize: 14
)
),
selectedItem: nursingStation == null
? widget.station?.entityList?.first
: nursingStation,
onChanged: (newValue) async {
if (newValue != null)
setState(() {
nursingStation = newValue ;
});
},
)
// DropdownButtonHideUnderline(
// child: DropdownButton(
// dropdownColor: Colors.white,
// iconEnabledColor: Colors.black,
// icon: Icon(Icons.keyboard_arrow_down),
// isExpanded: true,
// value: nursingStation == null
// ? widget.station?.entityList?.first
// : nursingStation,
// iconSize: 25,
// elevation: 16,
// onChanged: (newValue) async {
// if (newValue != null)
// setState(() {
// nursingStation = newValue ;
// });
// },
// items:
// widget.station?.entityList?.map((item) {
// return DropdownMenuItem(
// child: AppText(
// item.description ?? '',
// fontSize: 14,
// letterSpacing: -0.96,
// color: AppGlobal.appTextColor,
// fontWeight: FontWeight.normal,
// textAlign: TextAlign.left,
// ),
// value: item,
// );
// }).toList(),
// ),
// ),
) )
]); ]);
} }
Loading…
Cancel
Save