|
|
|
@ -13,7 +13,7 @@ import 'package:test_sa/views/widgets/equipment/predict_device_item_view.dart';
|
|
|
|
import 'package:test_sa/views/widgets/loaders/no_data_found.dart';
|
|
|
|
import 'package:test_sa/views/widgets/loaders/no_data_found.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class PredictDeviceView extends StatefulWidget {
|
|
|
|
class PredictDeviceView extends StatefulWidget {
|
|
|
|
static const String id = "/single-device-Picker";
|
|
|
|
static const String id = "/predict_device_view";
|
|
|
|
List<PredictedAsset> predictedAsset;
|
|
|
|
List<PredictedAsset> predictedAsset;
|
|
|
|
|
|
|
|
|
|
|
|
PredictDeviceView({Key? key, required this.predictedAsset}) : super(key: key);
|
|
|
|
PredictDeviceView({Key? key, required this.predictedAsset}) : super(key: key);
|
|
|
|
@ -63,13 +63,7 @@ class _PredictDeviceViewState extends State<PredictDeviceView> with SingleTicker
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
body: SafeArea(
|
|
|
|
body: Stack(
|
|
|
|
child: Column(
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Expanded(
|
|
|
|
|
|
|
|
child: widget.predictedAsset.isEmpty
|
|
|
|
|
|
|
|
? NoDataFound(message: context.translation.noDeviceFound).center
|
|
|
|
|
|
|
|
: Stack(
|
|
|
|
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
AnimatedSwitcher(
|
|
|
|
AnimatedSwitcher(
|
|
|
|
duration: const Duration(milliseconds: 500),
|
|
|
|
duration: const Duration(milliseconds: 500),
|
|
|
|
@ -114,7 +108,8 @@ class _PredictDeviceViewState extends State<PredictDeviceView> with SingleTicker
|
|
|
|
child: PredictDeviceItemView(
|
|
|
|
child: PredictDeviceItemView(
|
|
|
|
device: widget.predictedAsset[itemIndex],
|
|
|
|
device: widget.predictedAsset[itemIndex],
|
|
|
|
onPressed: (device) {
|
|
|
|
onPressed: (device) {
|
|
|
|
Navigator.of(context).pushNamed(AssetDetailPage.id, arguments: device.assetId);
|
|
|
|
//We are not getting asset id in response only have serial number
|
|
|
|
|
|
|
|
// Navigator.of(context).pushNamed(AssetDetailPage.id, arguments: device.assetId);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -123,7 +118,11 @@ class _PredictDeviceViewState extends State<PredictDeviceView> with SingleTicker
|
|
|
|
)
|
|
|
|
)
|
|
|
|
: GridView.builder(
|
|
|
|
: GridView.builder(
|
|
|
|
key: const ValueKey('grid_view'),
|
|
|
|
key: const ValueKey('grid_view'),
|
|
|
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, childAspectRatio: 188 / 261, crossAxisSpacing: 12, mainAxisSpacing: 12),
|
|
|
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
|
|
|
|
crossAxisCount: 2,
|
|
|
|
|
|
|
|
crossAxisSpacing: 12,
|
|
|
|
|
|
|
|
childAspectRatio: 1.5,
|
|
|
|
|
|
|
|
mainAxisSpacing: 12),
|
|
|
|
itemCount: widget.predictedAsset.length,
|
|
|
|
itemCount: widget.predictedAsset.length,
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
@ -161,7 +160,8 @@ class _PredictDeviceViewState extends State<PredictDeviceView> with SingleTicker
|
|
|
|
child: PredictDeviceItemGridView(
|
|
|
|
child: PredictDeviceItemGridView(
|
|
|
|
device: widget.predictedAsset[index],
|
|
|
|
device: widget.predictedAsset[index],
|
|
|
|
onPressed: (device) {
|
|
|
|
onPressed: (device) {
|
|
|
|
Navigator.of(context).pushNamed(AssetDetailPage.id, arguments: device.assetId);
|
|
|
|
//We are not getting asset id in response only have serial number
|
|
|
|
|
|
|
|
// Navigator.of(context).pushNamed(AssetDetailPage.id, arguments: device.assetId);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -169,12 +169,8 @@ class _PredictDeviceViewState extends State<PredictDeviceView> with SingleTicker
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
if (_devicesProvider.isLoading) Align(alignment: Alignment.bottomCenter, child: CircularProgressIndicator().paddingOnly(top: 16, bottom: 16)),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
)),
|
|
|
|
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|