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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ClipRRect( return ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(5.0)), borderRadius: const BorderRadius.all(Radius.circular(5.0)),
child: Stack( child: Stack(
children: [ children: [
Container( Container(
padding: EdgeInsets.all(0.0), padding: const EdgeInsets.all(0.0),
child: new Image.asset( child: Image.asset(
'assets/slider_1.webp', 'assets/slider_1.webp',
width: 600.0, width: 600.0,
height: 180.0, height: 180.0,
fit: BoxFit.fill, fit: BoxFit.fill,
)), )),
Padding( Padding(
padding: EdgeInsets.only(top: 25.0, left: 10.0), padding: const EdgeInsets.only(top: 25.0, left: 10.0),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( const Text(
'SPRING / SUMMER COLLECTION 2022', 'SPRING / SUMMER COLLECTION 2022',
style: TextStyle( style: TextStyle(
color: Colors.black, color: Colors.black,
fontSize: 10.5, fontSize: 10.5,
fontWeight: FontWeight.bold), fontWeight: FontWeight.bold),
), ),
SizedBox( const SizedBox(
height: 8.0, height: 8.0,
), ),
Text( const Text(
'Get up to 30% off \nNow Arrivals', 'Get up to 30% off \nNow Arrivals',
style: TextStyle( style: TextStyle(
color: Colors.black, color: Colors.black,
fontSize: 20.0, fontSize: 20.0,
fontWeight: FontWeight.bold), fontWeight: FontWeight.bold),
), ),
SizedBox( const SizedBox(
height: 8.0, height: 8.0,
), ),
ElevatedButton( ElevatedButton(
child: Text('SHOP NOW'),
onPressed: () {}, onPressed: () {},
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
primary: Colors.red, primary: Colors.red,
textStyle: TextStyle( textStyle: const TextStyle(
fontSize: 14, fontWeight: FontWeight.bold)), 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'; import 'package:carousel_slider/carousel_slider.dart';
class Carousel extends StatefulWidget { class Carousel extends StatefulWidget {
Carousel({Key? key}) : super(key: key); const Carousel({Key? key}) : super(key: key);
@override @override
State<Carousel> createState() => _CarouselState(); State<Carousel> createState() => _CarouselState();
@ -16,46 +16,44 @@ final List<String> imgList = [
class _CarouselState extends State<Carousel> { class _CarouselState extends State<Carousel> {
final List<Widget> imageSliders = imgList final List<Widget> imageSliders = imgList
.map((item) => Container( .map(
child: Container( (item) => Container(
margin: EdgeInsets.all(5.0), margin: const EdgeInsets.all(5.0),
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(5.0)), borderRadius: const BorderRadius.all(Radius.circular(5.0)),
child: Stack( child: Stack(
children: <Widget>[ children: <Widget>[
Image.asset(item, fit: BoxFit.cover, width: 1000.0), Image.asset(item, fit: BoxFit.cover, width: 1000.0),
Positioned( Positioned(
bottom: 0.0, bottom: 0.0,
left: 0.0, left: 0.0,
right: 0.0, right: 0.0,
child: Container( child: Container(
decoration: BoxDecoration( decoration: const BoxDecoration(
gradient: LinearGradient( gradient: LinearGradient(
colors: [ colors: [
Color.fromARGB(200, 0, 0, 0), Color.fromARGB(200, 0, 0, 0),
Color.fromARGB(0, 0, 0, 0) Color.fromARGB(0, 0, 0, 0)
], ],
begin: Alignment.bottomCenter, begin: Alignment.bottomCenter,
end: Alignment.topCenter, 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(); .toList();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return CarouselSlider(
child: CarouselSlider(
options: CarouselOptions( options: CarouselOptions(
aspectRatio: 2.0, aspectRatio: 2.0,
enlargeCenterPage: true, enlargeCenterPage: true,
@ -64,6 +62,6 @@ class _CarouselState extends State<Carousel> {
autoPlay: true, autoPlay: true,
), ),
items: imageSliders, items: imageSliders,
)); );
} }
} }

View file

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

View file

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

View file

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

View file

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

View file

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