|
|
|
@ -99,16 +99,22 @@ class _AssetTrackingPageState extends State<AssetTrackingPage> with SingleTicker
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SafeArea(
|
|
|
|
SafeArea(
|
|
|
|
child: AnimatedSwitcher(
|
|
|
|
child: AnimatedSwitcher(
|
|
|
|
duration: const Duration(milliseconds: 300),
|
|
|
|
duration: const Duration(milliseconds: 300),
|
|
|
|
child: selectedIndex == 3 ? MapTrackingPage() : listView(),
|
|
|
|
child: selectedIndex == 1
|
|
|
|
),
|
|
|
|
? assetsListView()
|
|
|
|
|
|
|
|
: selectedIndex == 2
|
|
|
|
|
|
|
|
? assetsGridView()
|
|
|
|
|
|
|
|
: MapTrackingPage()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// selectedIndex == 3 ? MapTrackingPage() : assetsListView(),
|
|
|
|
|
|
|
|
),
|
|
|
|
).expanded,
|
|
|
|
).expanded,
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Widget listView() {
|
|
|
|
Widget assetsListView() {
|
|
|
|
return Consumer<AssetTrackingProvider>(builder: (context, provider, _) {
|
|
|
|
return Consumer<AssetTrackingProvider>(builder: (context, provider, _) {
|
|
|
|
return (provider.assetsList.isEmpty && !provider.isLoading)
|
|
|
|
return (provider.assetsList.isEmpty && !provider.isLoading)
|
|
|
|
? NoDataFound(message: context.translation.noDataFound).center
|
|
|
|
? NoDataFound(message: context.translation.noDataFound).center
|
|
|
|
@ -157,4 +163,67 @@ class _AssetTrackingPageState extends State<AssetTrackingPage> with SingleTicker
|
|
|
|
);
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget assetsGridView() {
|
|
|
|
|
|
|
|
return Consumer<AssetTrackingProvider>(builder: (context, provider, _) {
|
|
|
|
|
|
|
|
return (provider.assetsList.isEmpty && !provider.isLoading)
|
|
|
|
|
|
|
|
? NoDataFound(message: context.translation.noDataFound).center
|
|
|
|
|
|
|
|
:
|
|
|
|
|
|
|
|
// ListView.separated(
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// padding: const EdgeInsets.all(16),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GridView.builder(
|
|
|
|
|
|
|
|
key: const ValueKey('asset-grid_view'),
|
|
|
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
|
|
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
|
|
|
|
crossAxisCount: 2,
|
|
|
|
|
|
|
|
childAspectRatio: .8,
|
|
|
|
|
|
|
|
crossAxisSpacing: 12,
|
|
|
|
|
|
|
|
mainAxisSpacing: 12,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
itemCount: provider.isLoading ? 6 : provider.assetsList.length,
|
|
|
|
|
|
|
|
// separatorBuilder: (listContext, itemIndex) => 12.height,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
itemBuilder: (listContext, itemIndex) {
|
|
|
|
|
|
|
|
if (provider.isLoading) return const SizedBox().toAssetListShimmer(listContext, provider.isLoading);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Calculate staggered animation delay
|
|
|
|
|
|
|
|
final delay = itemIndex * 0.08;
|
|
|
|
|
|
|
|
final animation = Tween<double>(begin: 0.0, end: 1.0).animate(
|
|
|
|
|
|
|
|
CurvedAnimation(
|
|
|
|
|
|
|
|
parent: _animationController,
|
|
|
|
|
|
|
|
curve: Interval(
|
|
|
|
|
|
|
|
delay.clamp(0.0, 0.7),
|
|
|
|
|
|
|
|
(delay + 0.4).clamp(0.0, 1.0),
|
|
|
|
|
|
|
|
curve: Curves.easeOut,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final slideAnimation = Tween<Offset>(
|
|
|
|
|
|
|
|
begin: const Offset(0.0, 0.15),
|
|
|
|
|
|
|
|
end: Offset.zero,
|
|
|
|
|
|
|
|
).animate(
|
|
|
|
|
|
|
|
CurvedAnimation(
|
|
|
|
|
|
|
|
parent: _animationController,
|
|
|
|
|
|
|
|
curve: Interval(
|
|
|
|
|
|
|
|
delay.clamp(0.0, 0.7),
|
|
|
|
|
|
|
|
(delay + 0.4).clamp(0.0, 1.0),
|
|
|
|
|
|
|
|
curve: Curves.easeOutCubic,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return FadeTransition(
|
|
|
|
|
|
|
|
opacity: animation,
|
|
|
|
|
|
|
|
child: SlideTransition(position: slideAnimation, child: AssetTrackingListItemView(provider.assetsList[itemIndex])).onPress(() {
|
|
|
|
|
|
|
|
Navigator.push(context, MaterialPageRoute(builder: (context) => MapTrackingPage(assetTrackingData: provider.assetsList[itemIndex])));
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|