codigo actual del servidor, con avances de joan
This commit is contained in:
106
source_code/lib/helpers/shimmer_helper.dart
Normal file
106
source_code/lib/helpers/shimmer_helper.dart
Normal file
@@ -0,0 +1,106 @@
|
||||
import 'package:active_ecommerce_seller_app/my_theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shimmer/shimmer.dart';
|
||||
|
||||
|
||||
class ShimmerHelper {
|
||||
buildBasicShimmer(
|
||||
{double height = double.infinity, double width = double.infinity}) {
|
||||
return Shimmer.fromColors(
|
||||
baseColor: MyTheme.shimmer_base,
|
||||
highlightColor: MyTheme.shimmer_highlighted,
|
||||
child: Container(
|
||||
height: height,
|
||||
width: width,
|
||||
color: Colors.white,
|
||||
),
|
||||
);
|
||||
}
|
||||
buildBoxShimmer(
|
||||
{double height = double.infinity, double width = double.infinity}) {
|
||||
return Shimmer.fromColors(
|
||||
baseColor: MyTheme.app_accent_color_extra_light,
|
||||
highlightColor: MyTheme.shimmer_highlighted,
|
||||
child: Container(
|
||||
height: height,
|
||||
width: width,
|
||||
color: Colors.white,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
buildListShimmer({item_count = 10,item_height = 100.0}) {
|
||||
return ListView.builder(
|
||||
itemCount: item_count,
|
||||
scrollDirection: Axis.vertical,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (context, index) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 0.0, left: 16.0, right: 16.0, bottom: 16.0),
|
||||
child: ShimmerHelper().buildBasicShimmer(height: item_height),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
buildProductGridShimmer({scontroller, item_count = 10}) {
|
||||
return GridView.builder(
|
||||
itemCount: item_count,
|
||||
controller: scontroller,
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
crossAxisSpacing: 10,
|
||||
mainAxisSpacing: 10,
|
||||
childAspectRatio: 0.7),
|
||||
padding: EdgeInsets.all(8),
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (context, index) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Shimmer.fromColors(
|
||||
baseColor: MyTheme.shimmer_base,
|
||||
highlightColor: MyTheme.shimmer_highlighted,
|
||||
child: Container(
|
||||
height: 120,
|
||||
width: double.infinity,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
buildSquareGridShimmer({scontroller, item_count = 10}) {
|
||||
return GridView.builder(
|
||||
itemCount: item_count,
|
||||
controller: scontroller,
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
crossAxisSpacing: 10,
|
||||
mainAxisSpacing: 10,
|
||||
childAspectRatio: 1),
|
||||
padding: EdgeInsets.all(8),
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (context, index) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Shimmer.fromColors(
|
||||
baseColor: MyTheme.shimmer_base,
|
||||
highlightColor: MyTheme.shimmer_highlighted,
|
||||
child: Container(
|
||||
height: 120,
|
||||
width: double.infinity,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user