|
|
|
|
@ -73,81 +73,83 @@ class _SingleDevicePickerState extends State<SingleDevicePicker> {
|
|
|
|
|
_subtitle = AppLocalization.of(context).subtitle;
|
|
|
|
|
return Scaffold(
|
|
|
|
|
resizeToAvoidBottomInset: false,
|
|
|
|
|
body: LoadingManager(
|
|
|
|
|
isLoading: _devicesProvider.isLoading,
|
|
|
|
|
stateCode: _devicesProvider.stateCode,
|
|
|
|
|
isFailedLoading: _devicesProvider.devices == null,
|
|
|
|
|
onRefresh: () async {
|
|
|
|
|
_devicesProvider.reset();
|
|
|
|
|
await _devicesProvider.getEquipment(user: _userProvider.user, host: _settingProvider.host, hospitalId: _userProvider.user.clientId);
|
|
|
|
|
},
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
const SizedBox(height: 48),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
ATextFormField(
|
|
|
|
|
hintText: _subtitle.searchBySn,
|
|
|
|
|
controller: snController,
|
|
|
|
|
style: Theme.of(context).textTheme.subtitle1,
|
|
|
|
|
suffixIcon: const Icon(Icons.search_rounded),
|
|
|
|
|
textInputAction: TextInputAction.search,
|
|
|
|
|
onAction: () async {
|
|
|
|
|
_devicesProvider.reset();
|
|
|
|
|
await _devicesProvider.getEquipment(
|
|
|
|
|
user: _userProvider.user, host: _settingProvider.host, hospitalId: _userProvider.user.clientId, serialNumber: snController.text, number: numberController.text);
|
|
|
|
|
_searchableList.clear();
|
|
|
|
|
_searchableList.addAll(_devicesProvider.devices);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
|
),
|
|
|
|
|
ATextFormField(
|
|
|
|
|
hintText: "Search by Number",
|
|
|
|
|
controller: numberController,
|
|
|
|
|
style: Theme.of(context).textTheme.subtitle1,
|
|
|
|
|
suffixIcon: const Icon(Icons.search_rounded),
|
|
|
|
|
textInputAction: TextInputAction.search,
|
|
|
|
|
onAction: () async {
|
|
|
|
|
_devicesProvider.reset();
|
|
|
|
|
await _devicesProvider.getEquipment(
|
|
|
|
|
user: _userProvider.user, host: _settingProvider.host, hospitalId: _userProvider.user.clientId, serialNumber: snController.text, number: numberController.text);
|
|
|
|
|
_searchableList.clear();
|
|
|
|
|
_searchableList.addAll(_devicesProvider.devices);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
body: SafeArea(
|
|
|
|
|
child: LoadingManager(
|
|
|
|
|
isLoading: _devicesProvider.isLoading,
|
|
|
|
|
stateCode: _devicesProvider.stateCode,
|
|
|
|
|
isFailedLoading: _devicesProvider.devices == null,
|
|
|
|
|
onRefresh: () async {
|
|
|
|
|
_devicesProvider.reset();
|
|
|
|
|
await _devicesProvider.getEquipment(user: _userProvider.user, host: _settingProvider.host, hospitalId: _userProvider.user.clientId);
|
|
|
|
|
},
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
const SizedBox(height: 16),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
ATextFormField(
|
|
|
|
|
hintText: _subtitle.searchBySn,
|
|
|
|
|
controller: snController,
|
|
|
|
|
style: Theme.of(context).textTheme.subtitle1,
|
|
|
|
|
suffixIcon: const Icon(Icons.search_rounded),
|
|
|
|
|
textInputAction: TextInputAction.search,
|
|
|
|
|
onAction: () async {
|
|
|
|
|
_devicesProvider.reset();
|
|
|
|
|
await _devicesProvider.getEquipment(
|
|
|
|
|
user: _userProvider.user, host: _settingProvider.host, hospitalId: _userProvider.user.clientId, serialNumber: snController.text, number: numberController.text);
|
|
|
|
|
_searchableList.clear();
|
|
|
|
|
_searchableList.addAll(_devicesProvider.devices);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
|
),
|
|
|
|
|
ATextFormField(
|
|
|
|
|
hintText: "Search by Number",
|
|
|
|
|
controller: numberController,
|
|
|
|
|
style: Theme.of(context).textTheme.subtitle1,
|
|
|
|
|
suffixIcon: const Icon(Icons.search_rounded),
|
|
|
|
|
textInputAction: TextInputAction.search,
|
|
|
|
|
onAction: () async {
|
|
|
|
|
_devicesProvider.reset();
|
|
|
|
|
await _devicesProvider.getEquipment(
|
|
|
|
|
user: _userProvider.user, host: _settingProvider.host, hospitalId: _userProvider.user.clientId, serialNumber: snController.text, number: numberController.text);
|
|
|
|
|
_searchableList.clear();
|
|
|
|
|
_searchableList.addAll(_devicesProvider.devices);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: _searchableList.isEmpty
|
|
|
|
|
? NoItemFound(
|
|
|
|
|
message: _subtitle.noDeviceFound,
|
|
|
|
|
)
|
|
|
|
|
: LazyLoading(
|
|
|
|
|
nextPage: _devicesProvider.nextPage,
|
|
|
|
|
onLazyLoad: () async {
|
|
|
|
|
await _devicesProvider.getDevicesList(
|
|
|
|
|
user: _userProvider.user, host: _settingProvider.host, hospitalId: _userProvider.user.clientId, serialNumber: snController.text, number: numberController.text);
|
|
|
|
|
},
|
|
|
|
|
child: ListView.builder(
|
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: _searchableList.length,
|
|
|
|
|
itemBuilder: (listContext, itemIndex) {
|
|
|
|
|
return DeviceItem(
|
|
|
|
|
device: _searchableList[itemIndex],
|
|
|
|
|
onPressed: (device) {
|
|
|
|
|
Navigator.of(context).pop(device);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
Expanded(
|
|
|
|
|
child: _searchableList.isEmpty
|
|
|
|
|
? NoItemFound(
|
|
|
|
|
message: _subtitle.noDeviceFound,
|
|
|
|
|
)
|
|
|
|
|
: LazyLoading(
|
|
|
|
|
nextPage: _devicesProvider.nextPage,
|
|
|
|
|
onLazyLoad: () async {
|
|
|
|
|
await _devicesProvider.getDevicesList(
|
|
|
|
|
user: _userProvider.user, host: _settingProvider.host, hospitalId: _userProvider.user.clientId, serialNumber: snController.text, number: numberController.text);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
],
|
|
|
|
|
child: ListView.builder(
|
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: _searchableList.length,
|
|
|
|
|
itemBuilder: (listContext, itemIndex) {
|
|
|
|
|
return DeviceItem(
|
|
|
|
|
device: _searchableList[itemIndex],
|
|
|
|
|
onPressed: (device) {
|
|
|
|
|
Navigator.of(context).pop(device);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
floatingActionButton: FloatingActionButton(
|
|
|
|
|
|