Cleanup code

This commit is contained in:
Moe Poi ~ 2022-05-14 23:44:03 +07:00
parent fe5b7cd35e
commit 6829342c99
9 changed files with 44 additions and 44 deletions

View file

@ -4,7 +4,7 @@ class Category {
Category({required this.icon, required this.title});
}
List<Category> demo_categories = [
List<Category> demoCategories = [
Category(
icon: "assets/icons/dress.svg",
title: "Dress",

View file

@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:nekoya_flutter/components/Category.dart';
import 'package:nekoya_flutter/components/_category.dart';
import '../utils/utils.dart';
@ -15,10 +15,10 @@ class Categories extends StatelessWidget {
height: 84,
child: ListView.separated(
scrollDirection: Axis.horizontal,
itemCount: demo_categories.length,
itemCount: demoCategories.length,
itemBuilder: (context, index) => CategoryCard(
icon: demo_categories[index].icon,
title: demo_categories[index].title,
icon: demoCategories[index].icon,
title: demoCategories[index].title,
press: () {},
),
separatorBuilder: (context, index) =>

View file

@ -61,7 +61,7 @@ class DetailsScreen extends StatelessWidget {
),
const SizedBox(width: defaultPadding),
Text(
"\$" + product.price.toString(),
"\$${product.price}",
style: Theme.of(context).textTheme.headline6,
),
],

View file

@ -28,20 +28,20 @@ class NewArrivalProducts extends StatelessWidget {
scrollDirection: Axis.horizontal,
child: Row(
children: List.generate(
demo_product.length,
demoProduct.length,
(index) => Padding(
padding: const EdgeInsets.only(right: defaultPadding),
child: ProductCard(
title: demo_product[index].title,
image: demo_product[index].image,
price: demo_product[index].price,
bgColor: demo_product[index].bgColor,
title: demoProduct[index].title,
image: demoProduct[index].image,
price: demoProduct[index].price,
bgColor: demoProduct[index].bgColor,
press: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
DetailsScreen(product: demo_product[index]),
DetailsScreen(product: demoProduct[index]),
));
},
),

View file

@ -19,8 +19,8 @@ class _OtpBodyState extends State<OtpBody> {
child: Lottie.asset('assets/lottieanims/otp.json'),
),
Container(
padding: EdgeInsets.only(top: 15),
child: Text(
padding: const EdgeInsets.only(top: 15),
child: const Text(
'A String of OTP Code Has Been Sent to 08080808080808',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 15, color: Colors.white),
@ -28,7 +28,7 @@ class _OtpBodyState extends State<OtpBody> {
),
Form(
child: Container(
padding: EdgeInsets.only(top: 15),
padding: const EdgeInsets.only(top: 15),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
@ -44,18 +44,18 @@ class _OtpBodyState extends State<OtpBody> {
onChanged: (value) {
if (value.length == 1) {
FocusScope.of(context).nextFocus();
} else if (value.length == 0) {
} else if (value.isEmpty) {
FocusScope.of(context).previousFocus();
}
},
onSaved: (pin1) {},
decoration: InputDecoration(
decoration: const InputDecoration(
hintText: "0",
focusColor: Colors.white,
hintStyle: TextStyle(color: Colors.white),
),
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white),
style: const TextStyle(color: Colors.white),
keyboardType: TextInputType.number,
inputFormatters: [
LengthLimitingTextInputFormatter(1),
@ -75,18 +75,18 @@ class _OtpBodyState extends State<OtpBody> {
onChanged: (value) {
if (value.length == 1) {
FocusScope.of(context).nextFocus();
} else if (value.length == 0) {
} else if (value.isEmpty) {
FocusScope.of(context).previousFocus();
}
},
onSaved: (pin1) {},
decoration: InputDecoration(
decoration: const InputDecoration(
hintText: "0",
focusColor: Colors.white,
hintStyle: TextStyle(color: Colors.white),
),
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white),
style: const TextStyle(color: Colors.white),
keyboardType: TextInputType.number,
inputFormatters: [
LengthLimitingTextInputFormatter(1),
@ -106,18 +106,18 @@ class _OtpBodyState extends State<OtpBody> {
onChanged: (value) {
if (value.length == 1) {
FocusScope.of(context).nextFocus();
} else if (value.length == 0) {
} else if (value.isEmpty) {
FocusScope.of(context).previousFocus();
}
},
onSaved: (pin1) {},
decoration: InputDecoration(
decoration: const InputDecoration(
hintText: "0",
focusColor: Colors.white,
hintStyle: TextStyle(color: Colors.white),
),
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white),
style: const TextStyle(color: Colors.white),
keyboardType: TextInputType.number,
inputFormatters: [
LengthLimitingTextInputFormatter(1),
@ -137,18 +137,18 @@ class _OtpBodyState extends State<OtpBody> {
onChanged: (value) {
if (value.length == 1) {
FocusScope.of(context).nextFocus();
} else if (value.length == 0) {
} else if (value.isEmpty) {
FocusScope.of(context).previousFocus();
}
},
onSaved: (pin1) {},
decoration: InputDecoration(
decoration: const InputDecoration(
hintText: "0",
focusColor: Colors.white,
hintStyle: TextStyle(color: Colors.white),
),
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white),
style: const TextStyle(color: Colors.white),
keyboardType: TextInputType.number,
inputFormatters: [
LengthLimitingTextInputFormatter(1),
@ -168,18 +168,18 @@ class _OtpBodyState extends State<OtpBody> {
onChanged: (value) {
if (value.length == 1) {
FocusScope.of(context).nextFocus();
} else if (value.length == 0) {
} else if (value.isEmpty) {
FocusScope.of(context).previousFocus();
}
},
onSaved: (pin1) {},
decoration: InputDecoration(
decoration: const InputDecoration(
hintText: "0",
focusColor: Colors.white,
hintStyle: TextStyle(color: Colors.white),
),
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white),
style: const TextStyle(color: Colors.white),
keyboardType: TextInputType.number,
inputFormatters: [
LengthLimitingTextInputFormatter(1),
@ -199,18 +199,18 @@ class _OtpBodyState extends State<OtpBody> {
onChanged: (value) {
if (value.length == 1) {
FocusScope.of(context).nextFocus();
} else if (value.length == 0) {
} else if (value.isEmpty) {
FocusScope.of(context).previousFocus();
}
},
onSaved: (pin1) {},
decoration: InputDecoration(
decoration: const InputDecoration(
hintText: "0",
focusColor: Colors.white,
hintStyle: TextStyle(color: Colors.white),
),
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white),
style: const TextStyle(color: Colors.white),
keyboardType: TextInputType.number,
inputFormatters: [
LengthLimitingTextInputFormatter(1),
@ -223,12 +223,12 @@ class _OtpBodyState extends State<OtpBody> {
),
)),
Container(
padding: EdgeInsets.only(top: 15, bottom: 15),
padding: const EdgeInsets.only(top: 15, bottom: 15),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
const Text(
"didn't get the code? \t",
style: TextStyle(color: Colors.white),
),

View file

@ -27,14 +27,14 @@ class PopularProducts extends StatelessWidget {
scrollDirection: Axis.horizontal,
child: Row(
children: List.generate(
demo_product.length,
demoProduct.length,
(index) => Padding(
padding: const EdgeInsets.only(right: defaultPadding),
child: ProductCard(
title: demo_product[index].title,
image: demo_product[index].image,
price: demo_product[index].price,
bgColor: demo_product[index].bgColor,
title: demoProduct[index].title,
image: demoProduct[index].image,
price: demoProduct[index].price,
bgColor: demoProduct[index].bgColor,
press: () {},
),
),

View file

@ -52,7 +52,7 @@ class ProductCard extends StatelessWidget {
),
const SizedBox(width: defaultPadding / 4),
Text(
"\$" + price.toString(),
"\$$price",
style: Theme.of(context).textTheme.subtitle2,
),
],

View file

@ -22,8 +22,8 @@ class HomeScreen extends StatelessWidget {
),
title: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(width: defaultPadding / 2),
children: const [
SizedBox(width: defaultPadding / 2),
Text(
"Nekoya",
style: TextStyle(fontSize: 20.0, color: Colors.white),

View file

@ -13,7 +13,7 @@ class Product {
});
}
List<Product> demo_product = [
List<Product> demoProduct = [
Product(
image: "assets/Product_2.webp",
title: "Long Sleeve Shirts",