cleanup code

This commit is contained in:
Moe Poi ~ 2022-05-16 07:42:29 +07:00
parent 3b10fa4fd7
commit 51622f9182
7 changed files with 53 additions and 56 deletions

View file

@ -8,50 +8,50 @@ class Bannerimage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(5.0)),
borderRadius: const BorderRadius.all(Radius.circular(5.0)),
child: Stack(
children: [
Container(
padding: EdgeInsets.all(0.0),
child: new Image.asset(
padding: const EdgeInsets.all(0.0),
child: 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),
padding: const EdgeInsets.only(top: 25.0, left: 10.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
const Text(
'SPRING / SUMMER COLLECTION 2022',
style: TextStyle(
color: Colors.black,
fontSize: 10.5,
fontWeight: FontWeight.bold),
),
SizedBox(
const SizedBox(
height: 8.0,
),
Text(
const Text(
'Get up to 30% off \nNow Arrivals',
style: TextStyle(
color: Colors.black,
fontSize: 20.0,
fontWeight: FontWeight.bold),
),
SizedBox(
const SizedBox(
height: 8.0,
),
ElevatedButton(
child: Text('SHOP NOW'),
onPressed: () {},
style: ElevatedButton.styleFrom(
primary: Colors.red,
textStyle: TextStyle(
textStyle: const TextStyle(
fontSize: 14, fontWeight: FontWeight.bold)),
child: const Text('SHOP NOW'),
),
]),
)

View file

@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:carousel_slider/carousel_slider.dart';
class Carousel extends StatefulWidget {
Carousel({Key? key}) : super(key: key);
const Carousel({Key? key}) : super(key: key);
@override
State<Carousel> createState() => _CarouselState();
@ -16,46 +16,44 @@ final List<String> imgList = [
class _CarouselState extends State<Carousel> {
final List<Widget> imageSliders = imgList
.map((item) => Container(
child: Container(
margin: EdgeInsets.all(5.0),
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(5.0)),
child: Stack(
children: <Widget>[
Image.asset(item, fit: BoxFit.cover, width: 1000.0),
Positioned(
bottom: 0.0,
left: 0.0,
right: 0.0,
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Color.fromARGB(200, 0, 0, 0),
Color.fromARGB(0, 0, 0, 0)
],
begin: Alignment.bottomCenter,
end: Alignment.topCenter,
),
.map(
(item) => Container(
margin: const EdgeInsets.all(5.0),
child: ClipRRect(
borderRadius: const BorderRadius.all(Radius.circular(5.0)),
child: Stack(
children: <Widget>[
Image.asset(item, fit: BoxFit.cover, width: 1000.0),
Positioned(
bottom: 0.0,
left: 0.0,
right: 0.0,
child: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
colors: [
Color.fromARGB(200, 0, 0, 0),
Color.fromARGB(0, 0, 0, 0)
],
begin: Alignment.bottomCenter,
end: Alignment.topCenter,
),
padding: EdgeInsets.symmetric(
vertical: 10.0, horizontal: 20.0),
child: SizedBox(
width: 1.0,
)
),
),
],
)),
),
))
padding: const EdgeInsets.symmetric(
vertical: 10.0, horizontal: 20.0),
child: const SizedBox(
width: 1.0,
)),
),
],
)),
),
)
.toList();
@override
Widget build(BuildContext context) {
return Container(
child: CarouselSlider(
return CarouselSlider(
options: CarouselOptions(
aspectRatio: 2.0,
enlargeCenterPage: true,
@ -64,6 +62,6 @@ class _CarouselState extends State<Carousel> {
autoPlay: true,
),
items: imageSliders,
));
);
}
}

View file

@ -47,7 +47,7 @@ class _ForgotPassBodyState extends State<ForgotPassBody> {
child: TextField(
controller: emailController,
keyboardType: TextInputType.emailAddress,
style: TextStyle(color: Colors.white),
style: const TextStyle(color: Colors.white),
decoration: InputDecoration(
focusedBorder: OutlineInputBorder(
borderSide: const BorderSide(

View file

@ -227,8 +227,8 @@ class _OtpBodyState extends State<OtpBody> {
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Text(
children: const [
Text(
"Didn't get it?? \t",
style: TextStyle(color: Colors.white),
),

View file

@ -25,16 +25,16 @@ class ProductCard extends StatelessWidget {
width: 154,
padding: const EdgeInsets.all(defaultPadding / 2),
decoration: const BoxDecoration(
color: const Color(0xff212226),
color: Color(0xff212226),
borderRadius: BorderRadius.all(Radius.circular(defaultBorderRadius)),
),
child: Column(
children: [
Container(
width: double.infinity,
decoration: BoxDecoration(
color: const Color(0xff212226),
borderRadius: const BorderRadius.all(
decoration: const BoxDecoration(
color: Color(0xff212226),
borderRadius: BorderRadius.all(
Radius.circular(defaultBorderRadius)),
),
// child: Image.asset(

View file

@ -22,7 +22,7 @@ class SearchForm extends StatelessWidget {
filled: true,
fillColor: const Color(0xff212226),
hintText: "Search items...",
hintStyle: TextStyle(color: Colors.white),
hintStyle: const TextStyle(color: Colors.white),
border: outlineInputBorder,
enabledBorder: outlineInputBorder,
focusedBorder: outlineInputBorder,

View file

@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:nekoya_flutter/components/bannerimage.dart';
import 'package:nekoya_flutter/utils/utils.dart';
@ -43,7 +42,7 @@ class Home extends StatelessWidget {
padding: EdgeInsets.symmetric(vertical: defaultPadding),
child: SearchForm(),
),
Carousel(),
const Carousel(),
const NewArrivalProducts(),
const SizedBox(
height: 15,