|
|
|
|
@ -7,6 +7,7 @@ import 'package:test_sa/extensions/widget_extensions.dart';
|
|
|
|
|
import 'package:test_sa/modules/asset_tracking/asset_tracking_provider.dart';
|
|
|
|
|
import 'package:test_sa/new_views/app_style/app_color.dart';
|
|
|
|
|
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/loaders/app_loading.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/loaders/no_data_found.dart';
|
|
|
|
|
import 'asset_tracking_item_view.dart';
|
|
|
|
|
import 'map_tracking_page.dart';
|
|
|
|
|
@ -131,7 +132,7 @@ class _AssetTrackingPageState extends State<AssetTrackingPage> with SingleTicker
|
|
|
|
|
if (itemIndex >= provider.assetsList.length) {
|
|
|
|
|
return const Padding(
|
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 16),
|
|
|
|
|
child: Center(child: CircularProgressIndicator()),
|
|
|
|
|
child: ALoading(),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
final delay = itemIndex * 0.08;
|
|
|
|
|
@ -162,7 +163,7 @@ class _AssetTrackingPageState extends State<AssetTrackingPage> with SingleTicker
|
|
|
|
|
|
|
|
|
|
return FadeTransition(
|
|
|
|
|
opacity: animation,
|
|
|
|
|
child: SlideTransition(position: slideAnimation, child: AssetTrackingListItemView(provider.assetsList[itemIndex])).onPress(() {
|
|
|
|
|
child: SlideTransition(position: slideAnimation, child: AssetTrackingListItemView(provider.assetsList[itemIndex], false)).onPress(() {
|
|
|
|
|
Navigator.push(context, MaterialPageRoute(builder: (context) => MapTrackingPage(assetTrackingData: provider.assetsList[itemIndex])));
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
@ -176,17 +177,9 @@ class _AssetTrackingPageState extends State<AssetTrackingPage> with SingleTicker
|
|
|
|
|
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),
|
|
|
|
|
|
|
|
|
|
NotificationListener<ScrollNotification>(
|
|
|
|
|
: NotificationListener<ScrollNotification>(
|
|
|
|
|
onNotification: (scrollInfo) {
|
|
|
|
|
if (!provider.isLoading &&
|
|
|
|
|
!provider.isNextPageLoading &&
|
|
|
|
|
provider.nextPage &&
|
|
|
|
|
scrollInfo.metrics.pixels >= (scrollInfo.metrics.maxScrollExtent - 200)) {
|
|
|
|
|
if (!provider.isLoading && !provider.isNextPageLoading && provider.nextPage && scrollInfo.metrics.pixels >= (scrollInfo.metrics.maxScrollExtent - 200)) {
|
|
|
|
|
getAssetsFromPenguin(loadMore: true);
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
@ -199,7 +192,7 @@ class _AssetTrackingPageState extends State<AssetTrackingPage> with SingleTicker
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
|
crossAxisCount: 2,
|
|
|
|
|
childAspectRatio: .8,
|
|
|
|
|
childAspectRatio: 1.2, // need to fix this it's not flexiable with content..
|
|
|
|
|
crossAxisSpacing: 12,
|
|
|
|
|
mainAxisSpacing: 12,
|
|
|
|
|
),
|
|
|
|
|
@ -239,7 +232,7 @@ class _AssetTrackingPageState extends State<AssetTrackingPage> with SingleTicker
|
|
|
|
|
|
|
|
|
|
return FadeTransition(
|
|
|
|
|
opacity: animation,
|
|
|
|
|
child: SlideTransition(position: slideAnimation, child: AssetTrackingListItemView(provider.assetsList[itemIndex])).onPress(() {
|
|
|
|
|
child: SlideTransition(position: slideAnimation, child: AssetTrackingListItemView(provider.assetsList[itemIndex], true)).onPress(() {
|
|
|
|
|
Navigator.push(context, MaterialPageRoute(builder: (context) => MapTrackingPage(assetTrackingData: provider.assetsList[itemIndex])));
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
@ -249,7 +242,7 @@ class _AssetTrackingPageState extends State<AssetTrackingPage> with SingleTicker
|
|
|
|
|
if (provider.isNextPageLoading)
|
|
|
|
|
const Padding(
|
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 16),
|
|
|
|
|
child: Center(child: CircularProgressIndicator()),
|
|
|
|
|
child: ALoading(),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
|