Add Banner on Home Screen

This commit is contained in:
Kelvin Samuel 2022-05-15 21:51:11 +07:00
parent 4884a999d3
commit e18662a90f
3 changed files with 23 additions and 2 deletions

View file

@ -0,0 +1,18 @@
import 'package:flutter/material.dart';
class Bannerimage extends StatelessWidget {
const Bannerimage({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.all(20.0),
child: new Image.asset(
'assets/Carousel_1.webp',
width: 100.0,
height: 200.0,
));
}
}

View file

@ -15,7 +15,7 @@ class _CarouselWithIndicatorState extends State<CarouselWithIndicatorDemo> {
Container(
decoration: BoxDecoration(
image:
DecorationImage(image: AssetImage('assets/Carousel_1.webp'))))
DecorationImage(image: AssetImage("assets/Carousel_1.webp"))))
];
@override
@ -26,6 +26,7 @@ class _CarouselWithIndicatorState extends State<CarouselWithIndicatorDemo> {
items: imgList,
carouselController: _controller,
options: CarouselOptions(
height: 202,
autoPlay: true,
enlargeCenterPage: true,
aspectRatio: 2.0,
@ -48,7 +49,7 @@ class _CarouselWithIndicatorState extends State<CarouselWithIndicatorDemo> {
shape: BoxShape.circle,
color: (Theme.of(context).brightness == Brightness.dark
? Colors.white
: Colors.black)
: Colors.white)
.withOpacity(_current == entry.key ? 0.9 : 0.4)),
),
);

View file

@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:nekoya_flutter/components/bannerimage.dart';
import 'package:nekoya_flutter/components/carouselwithindicatordemo.dart';
import 'package:nekoya_flutter/utils/utils.dart';
@ -45,6 +46,7 @@ class Home extends StatelessWidget {
const Categories(),
CarouselWithIndicatorDemo(),
const NewArrivalProducts(),
const Bannerimage(),
const PopularProducts(),
],
),