complete category issue
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'package:carousel_slider/carousel_slider.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter_animate/flutter_animate.dart';
|
||||
@@ -27,6 +28,7 @@ import 'package:grocery_app/utils/extensions/uicontext.dart';
|
||||
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:skeletonizer/skeletonizer.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class Mycart extends StatefulWidget {
|
||||
const Mycart({super.key});
|
||||
@@ -74,6 +76,7 @@ class _MycartState extends State<Mycart> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
cartItems(),
|
||||
bannerview(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
@@ -1024,6 +1027,113 @@ class _MycartState extends State<Mycart> {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget bannerview() {
|
||||
return Consumer<ProductProvider>(builder: (context, provider, child) {
|
||||
return provider.isBannerLoading
|
||||
? Skeletonizer(
|
||||
enabled: provider.isBannerLoading,
|
||||
child: Container(
|
||||
height: 180,
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey[300],
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
),
|
||||
),
|
||||
)
|
||||
: provider.banner.isEmpty
|
||||
? SizedBox.shrink()
|
||||
: CarouselSlider(
|
||||
options: CarouselOptions(
|
||||
height: 180,
|
||||
autoPlay: true,
|
||||
enlargeCenterPage: true,
|
||||
viewportFraction: 1,
|
||||
aspectRatio: 16 / 9,
|
||||
initialPage: 0,
|
||||
enableInfiniteScroll: true,
|
||||
reverse: false,
|
||||
autoPlayInterval: Duration(seconds: 3),
|
||||
autoPlayAnimationDuration: Duration(milliseconds: 800),
|
||||
autoPlayCurve: Curves.fastOutSlowIn,
|
||||
enlargeFactor: 0.3,
|
||||
),
|
||||
items: provider.banner.map((banner) {
|
||||
return Builder(
|
||||
builder: (BuildContext context) {
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.greenAccent.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
),
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
top: 15,
|
||||
left: 15,
|
||||
child: SizedBox(
|
||||
width: 200,
|
||||
child: Text(
|
||||
banner.altText ?? "Special Event",
|
||||
style: context.customExtraBold(
|
||||
Colors.black, 18),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
bottom: 15,
|
||||
left: 15,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
_launchUrl(banner.redirectUrl);
|
||||
},
|
||||
child: Container(
|
||||
height: 40,
|
||||
width: 100,
|
||||
decoration: BoxDecoration(
|
||||
color: APPCOLOR.lightGreen,
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Shop now',
|
||||
style: context.customRegular(
|
||||
Colors.white, 14),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
right: 15,
|
||||
bottom: 15,
|
||||
child: AppNetworkImage(
|
||||
height: 130,
|
||||
width: 150,
|
||||
imageUrl: banner.imageUrl ??
|
||||
'https://e7.pngegg.com/pngimages/742/816/png-clipart-coca-cola-can-illustration-coca-cola-soft-drink-surge-pepsi-coke-sweetness-cola-thumbnail.png',
|
||||
backGroundColor: Colors.transparent,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}).toList(),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _launchUrl(url) async {
|
||||
print("jdhfjkgh ${url}");
|
||||
final Uri uri = Uri.parse(url);
|
||||
if (!await launchUrl(uri, mode: LaunchMode.externalApplication)) {
|
||||
throw 'Could not launch $url';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class AddressBottomSheet extends StatefulWidget {
|
||||
|
||||
Reference in New Issue
Block a user