|
|
|
|
@ -47,10 +47,7 @@ class _MyAssetsPageState extends State<MyAssetsPage> {
|
|
|
|
|
|
|
|
|
|
_getDevice(String result, {bool isQr = false}) async {
|
|
|
|
|
_devicesProvider.reset();
|
|
|
|
|
await _devicesProvider.getAssets(
|
|
|
|
|
search: DeviceSearch(assetNo: result, assetSerialNumber: ""),
|
|
|
|
|
isQr: isQr,
|
|
|
|
|
);
|
|
|
|
|
await _devicesProvider.getAssets(search: DeviceSearch(assetNo: result, assetSerialNumber: ""), isQr: isQr);
|
|
|
|
|
_searchableList.clear();
|
|
|
|
|
_searchableList.addAll(_devicesProvider.devices);
|
|
|
|
|
}
|
|
|
|
|
@ -144,7 +141,7 @@ class _MyAssetsPageState extends State<MyAssetsPage> {
|
|
|
|
|
),
|
|
|
|
|
body: SafeArea(
|
|
|
|
|
child: LoadingManager(
|
|
|
|
|
isLoading: _devicesProvider.isLoading,
|
|
|
|
|
isLoading: false,
|
|
|
|
|
stateCode: _devicesProvider.stateCode,
|
|
|
|
|
isFailedLoading: _devicesProvider.devices == null,
|
|
|
|
|
onRefresh: () async {
|
|
|
|
|
@ -155,49 +152,54 @@ class _MyAssetsPageState extends State<MyAssetsPage> {
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: _searchableList.isEmpty
|
|
|
|
|
? NoDataFound(message: context.translation.noDeviceFound)
|
|
|
|
|
? NoDataFound(message: context.translation.noDeviceFound).center
|
|
|
|
|
: LazyLoading(
|
|
|
|
|
nextPage: _devicesProvider.nextPage,
|
|
|
|
|
onLazyLoad: () async {
|
|
|
|
|
await _devicesProvider.getDevicesList(
|
|
|
|
|
user: _userProvider.user!,
|
|
|
|
|
host: _settingProvider.host!,
|
|
|
|
|
hospitalId: _userProvider.user!.clientId!,
|
|
|
|
|
search: _searchAsset?.copyWith(assetSerialNumber: snController.text, assetNo: numberController.text),
|
|
|
|
|
await _devicesProvider.getAssets(
|
|
|
|
|
// user: _userProvider.user!,
|
|
|
|
|
// host: _settingProvider.host!,
|
|
|
|
|
// hospitalId: _userProvider.user!.clientId!,
|
|
|
|
|
search: _searchAsset,
|
|
|
|
|
// serialNumber: snController.text,
|
|
|
|
|
// number: numberController.text,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
child: AnimatedSwitcher(
|
|
|
|
|
duration: const Duration(milliseconds: 500),
|
|
|
|
|
child: showListView
|
|
|
|
|
? ListView.separated(
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
itemCount: _searchableList.length,
|
|
|
|
|
separatorBuilder: (listContext, itemIndex) => 8.height,
|
|
|
|
|
itemBuilder: (listContext, itemIndex) {
|
|
|
|
|
return AssetItemListView(
|
|
|
|
|
device: _searchableList[itemIndex],
|
|
|
|
|
onPressed: (device) {
|
|
|
|
|
widget.fromBottomBar ? Navigator.of(context).pushNamed(AssetDetailPage.id, arguments: device.id) : Navigator.of(context).pop(device);
|
|
|
|
|
// Navigator.of(context).pushNamed(AssetDetailPage.id, arguments: device.id);
|
|
|
|
|
child: Stack(
|
|
|
|
|
children: [
|
|
|
|
|
AnimatedSwitcher(
|
|
|
|
|
duration: const Duration(milliseconds: 500),
|
|
|
|
|
child: showListView
|
|
|
|
|
? ListView.separated(
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
itemCount: _searchableList.length,
|
|
|
|
|
separatorBuilder: (listContext, itemIndex) => 8.height,
|
|
|
|
|
itemBuilder: (listContext, itemIndex) {
|
|
|
|
|
return AssetItemListView(
|
|
|
|
|
device: _searchableList[itemIndex],
|
|
|
|
|
onPressed: (device) {
|
|
|
|
|
widget.fromBottomBar ? Navigator.of(context).pushNamed(AssetDetailPage.id, arguments: device.id) : Navigator.of(context).pop(device);
|
|
|
|
|
// Navigator.of(context).pushNamed(AssetDetailPage.id, arguments: device.id);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
: GridView.builder(
|
|
|
|
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, childAspectRatio: 188 / 261, crossAxisSpacing: 12, mainAxisSpacing: 12),
|
|
|
|
|
itemCount: _searchableList.length,
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
return AssetItemGridView(
|
|
|
|
|
device: _searchableList[index],
|
|
|
|
|
onPressed: (device) {
|
|
|
|
|
widget.fromBottomBar ? Navigator.of(context).pushNamed(AssetDetailPage.id, arguments: device.id) : Navigator.of(context).pop(device);
|
|
|
|
|
)
|
|
|
|
|
: GridView.builder(
|
|
|
|
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, childAspectRatio: 188 / 261, crossAxisSpacing: 12, mainAxisSpacing: 12),
|
|
|
|
|
itemCount: _searchableList.length,
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
return AssetItemGridView(
|
|
|
|
|
device: _searchableList[index],
|
|
|
|
|
onPressed: (device) {
|
|
|
|
|
widget.fromBottomBar ? Navigator.of(context).pushNamed(AssetDetailPage.id, arguments: device.id) : Navigator.of(context).pop(device);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
if (_devicesProvider.isLoading) Align(alignment: Alignment.bottomCenter, child: const CircularProgressIndicator().paddingOnly(top: 16, bottom: 16)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
],
|
|
|
|
|
|