Add Text and button on banner

This commit is contained in:
Kelvin Samuel 2022-05-15 23:52:34 +07:00
parent e2e788b68c
commit cae095f701
5 changed files with 111 additions and 59 deletions

BIN
assets/slider_1.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

View file

@ -7,13 +7,55 @@ class Bannerimage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.all(0.0),
child: new Image.asset(
'assets/Carousel_1.webp',
width: 600.0,
height: 200.0,
fit: BoxFit.fill,
return ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(5.0)),
child: Stack(
children: [
Container(
padding: EdgeInsets.all(0.0),
child: new Image.asset(
'assets/slider_1.webp',
width: 600.0,
height: 180.0,
fit: BoxFit.fill,
)),
Padding(
padding: EdgeInsets.only(top: 25.0, left: 10.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'SPRING / SUMMER COLLECTION 2022',
style: TextStyle(
color: Colors.black,
fontSize: 10.5,
fontWeight: FontWeight.bold),
),
SizedBox(
height: 8.0,
),
Text(
'Get up to 30% off \nNow Arrivals',
style: TextStyle(
color: Colors.black,
fontSize: 20.0,
fontWeight: FontWeight.bold),
),
SizedBox(
height: 8.0,
),
ElevatedButton(
child: Text('SHOP NOW'),
onPressed: () {},
style: ElevatedButton.styleFrom(
primary: Colors.red,
textStyle: TextStyle(
fontSize: 14, fontWeight: FontWeight.bold)),
),
]),
)
],
));
}
}

View file

@ -18,68 +18,70 @@ class PopularProducts extends StatelessWidget {
Padding(
padding: const EdgeInsets.symmetric(vertical: defaultPadding),
child: SectionTitle(
title: "Popular",
title: "Best Seller",
pressSeeAll: () {},
),
),
FutureBuilder<dynamic>(
future: getProducts(),
builder: (context, snapshot) {
if (snapshot.hasData) {
var sourceData = snapshot.data;
sourceData.shuffle();
var data = sourceData.take(6).toList();
return SingleChildScrollView(
physics: const BouncingScrollPhysics(
parent: AlwaysScrollableScrollPhysics()),
scrollDirection: Axis.horizontal,
child: Row(
children: List.generate(
data.length,
(index) => Padding(
padding: const EdgeInsets.only(right: defaultPadding),
child: ProductCard(
title: data[index]['TITLE'],
imageUrl: "https://nekoya.moe.team/img/${data[index]['IMAGE']}",
price: 99,
bgColor: const Color(0xFFFEFBF9),
press: () {
showModalBottomSheet(
isScrollControlled: true,
backgroundColor: Colors.transparent,
context: context,
builder: (context) => productDetail(context, data[index]['ID']),
);
},
future: getProducts(),
builder: (context, snapshot) {
if (snapshot.hasData) {
var sourceData = snapshot.data;
sourceData.shuffle();
var data = sourceData.take(6).toList();
return SingleChildScrollView(
physics: const BouncingScrollPhysics(
parent: AlwaysScrollableScrollPhysics()),
scrollDirection: Axis.horizontal,
child: Row(
children: List.generate(
data.length,
(index) => Padding(
padding: const EdgeInsets.only(right: defaultPadding),
child: ProductCard(
title: data[index]['TITLE'],
imageUrl:
"https://nekoya.moe.team/img/${data[index]['IMAGE']}",
price: 99,
bgColor: const Color(0xFFFEFBF9),
press: () {
showModalBottomSheet(
isScrollControlled: true,
backgroundColor: Colors.transparent,
context: context,
builder: (context) =>
productDetail(context, data[index]['ID']),
);
},
),
),
),
),
),
);
} else {
return SingleChildScrollView(
physics: const BouncingScrollPhysics(
parent: AlwaysScrollableScrollPhysics()),
scrollDirection: Axis.horizontal,
child: Row(
children: List.generate(
6,
(index) => Padding(
padding: const EdgeInsets.only(right: defaultPadding),
child: ProductCard(
title: 'Loading...',
imageUrl: "https://i.ibb.co/QJFLZC4/La-Darknesss-Portrait.webp",
price: 99,
bgColor: const Color(0xFFFEFBF9),
press: () {},
);
} else {
return SingleChildScrollView(
physics: const BouncingScrollPhysics(
parent: AlwaysScrollableScrollPhysics()),
scrollDirection: Axis.horizontal,
child: Row(
children: List.generate(
6,
(index) => Padding(
padding: const EdgeInsets.only(right: defaultPadding),
child: ProductCard(
title: 'Loading...',
imageUrl:
"https://i.ibb.co/QJFLZC4/La-Darknesss-Portrait.webp",
price: 99,
bgColor: const Color(0xFFFEFBF9),
press: () {},
),
),
),
),
),
);
}
}
)
);
}
})
],
);
}

View file

@ -8,6 +8,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
app:
dependency: "direct main"
description:
name: app
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.3"
archive:
dependency: transitive
description:

View file

@ -44,6 +44,7 @@ dependencies:
shared_preferences: ^2.0.13
universal_html: ^2.0.8
carousel_slider: ^4.1.1
app: ^0.0.3
dev_dependencies:
flutter_lints: ^2.0.1