MIF_E31222379_MOBILE/lib/screen/app/home/components/special_offers.dart

131 lines
3.7 KiB
Dart

import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
class SpecialOffers extends StatelessWidget {
const SpecialOffers({super.key});
@override
Widget build(BuildContext context) {
return Column(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
"Important!",
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Colors.black,
),
),
],
),
// child: SectionTitle(
// title: "Special for you",
// // press: () {},
// ),
),
const Gap(15),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: [
SpecialOfferCard(
image: "assets/image/Image Banner 2.png",
category: "Smartphone",
numOfBrands: 18,
press: () {
// Navigator.pushNamed(context, ProductsScreen.routeName);
},
),
SpecialOfferCard(
image: "assets/image/Image Banner 3.png",
category: "Fashion",
numOfBrands: 24,
press: () {
// Navigator.pushNamed(context, ProductsScreen.routeName);
},
),
const SizedBox(width: 20),
],
),
),
],
);
}
}
class SpecialOfferCard extends StatelessWidget {
const SpecialOfferCard({
super.key,
required this.category,
required this.image,
required this.numOfBrands,
required this.press,
});
final String category, image;
final int numOfBrands;
final GestureTapCallback press;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(left: 20),
child: GestureDetector(
onTap: press,
child: SizedBox(
width: 242,
height: 100,
child: ClipRRect(
borderRadius: BorderRadius.circular(20),
child: Stack(
children: [
Image.asset(image, fit: BoxFit.cover),
Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Colors.black54,
Colors.black38,
Colors.black26,
Colors.transparent,
],
),
),
),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 15,
vertical: 10,
),
child: Text.rich(
TextSpan(
style: const TextStyle(color: Colors.white),
children: [
TextSpan(
text: "$category\n",
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
TextSpan(text: "$numOfBrands Brands"),
],
),
),
),
],
),
),
),
),
);
}
}