From 6829342c99cd70fab16b7ad62b3a5dbe2214c50d Mon Sep 17 00:00:00 2001
From: Moe <moe@chocola.dev>
Date: Sat, 14 May 2022 23:44:03 +0700
Subject: [PATCH] Cleanup code

---
 lib/components/_category.dart            |  2 +-
 lib/components/categories.dart           |  8 ++---
 lib/components/details_screen.dart       |  2 +-
 lib/components/new_arrival_products.dart | 12 +++----
 lib/components/otp_body.dart             | 46 ++++++++++++------------
 lib/components/popular_products.dart     | 10 +++---
 lib/components/product_card.dart         |  2 +-
 lib/screens/home_screen.dart             |  4 +--
 lib/screens/productcoba.dart             |  2 +-
 9 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/lib/components/_category.dart b/lib/components/_category.dart
index b72aa6a..0ccb5e6 100644
--- a/lib/components/_category.dart
+++ b/lib/components/_category.dart
@@ -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",
diff --git a/lib/components/categories.dart b/lib/components/categories.dart
index 535911a..5eefab9 100644
--- a/lib/components/categories.dart
+++ b/lib/components/categories.dart
@@ -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) =>
diff --git a/lib/components/details_screen.dart b/lib/components/details_screen.dart
index 065172e..c0d9422 100644
--- a/lib/components/details_screen.dart
+++ b/lib/components/details_screen.dart
@@ -61,7 +61,7 @@ class DetailsScreen extends StatelessWidget {
                       ),
                       const SizedBox(width: defaultPadding),
                       Text(
-                        "\$" + product.price.toString(),
+                        "\$${product.price}",
                         style: Theme.of(context).textTheme.headline6,
                       ),
                     ],
diff --git a/lib/components/new_arrival_products.dart b/lib/components/new_arrival_products.dart
index 11dddb4..47f5b12 100644
--- a/lib/components/new_arrival_products.dart
+++ b/lib/components/new_arrival_products.dart
@@ -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]),
                         ));
                   },
                 ),
diff --git a/lib/components/otp_body.dart b/lib/components/otp_body.dart
index 291d8a9..7ae8aa6 100644
--- a/lib/components/otp_body.dart
+++ b/lib/components/otp_body.dart
@@ -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),
               ),
diff --git a/lib/components/popular_products.dart b/lib/components/popular_products.dart
index f22d170..a2a3336 100644
--- a/lib/components/popular_products.dart
+++ b/lib/components/popular_products.dart
@@ -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: () {},
                 ),
               ),
diff --git a/lib/components/product_card.dart b/lib/components/product_card.dart
index 90d7f3f..36a1254 100644
--- a/lib/components/product_card.dart
+++ b/lib/components/product_card.dart
@@ -52,7 +52,7 @@ class ProductCard extends StatelessWidget {
                 ),
                 const SizedBox(width: defaultPadding / 4),
                 Text(
-                  "\$" + price.toString(),
+                  "\$$price",
                   style: Theme.of(context).textTheme.subtitle2,
                 ),
               ],
diff --git a/lib/screens/home_screen.dart b/lib/screens/home_screen.dart
index bc5707f..a270c74 100644
--- a/lib/screens/home_screen.dart
+++ b/lib/screens/home_screen.dart
@@ -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),
diff --git a/lib/screens/productcoba.dart b/lib/screens/productcoba.dart
index 3de3428..0e6bb91 100644
--- a/lib/screens/productcoba.dart
+++ b/lib/screens/productcoba.dart
@@ -13,7 +13,7 @@ class Product {
   });
 }
 
-List<Product> demo_product = [
+List<Product> demoProduct = [
   Product(
     image: "assets/Product_2.webp",
     title: "Long Sleeve Shirts",