improvement.

main_production_asset_tracking
Sikander Saleem 4 days ago
parent ac917818fb
commit 266fb12773

@ -51,6 +51,16 @@ class _AssetTrackingPageState extends State<AssetTrackingPage> with SingleTicker
await assetTrackingProvider.getAssetsFromPenguin(loadMore: loadMore, searchModel: searchModel ?? _searchModel);
}
void _refreshIfReturningToAssets(int previousIndex, int newIndex) {
final isAssetsView = newIndex == 1 || newIndex == 2;
final wasAssetsView = previousIndex == 1 || previousIndex == 2;
if (!isAssetsView || wasAssetsView) return;
assetTrackingProvider.reset(); // clears paging + any map selections left by MapTrackingPage
_animationController.forward(from: 0); // replay the list/grid entrance animation
getAssetsFromPenguin();
}
@override
Widget build(BuildContext context) {
return Scaffold(
@ -131,9 +141,12 @@ class _AssetTrackingPageState extends State<AssetTrackingPage> with SingleTicker
],
selected: <int>{selectedIndex},
onSelectionChanged: (Set<int> newSelection) {
final previousIndex = selectedIndex;
final newIndex = newSelection.first;
setState(() {
selectedIndex = newSelection.first;
selectedIndex = newIndex;
});
_refreshIfReturningToAssets(previousIndex, newIndex);
},
),
),

Loading…
Cancel
Save