From 94c130631ae05787bcc13d12f59c147b748000c6 Mon Sep 17 00:00:00 2001 From: SINASYS Date: Sat, 11 Nov 2023 21:22:05 +0330 Subject: [PATCH] Improve code style using lint rules v3.0.1 --- lib/main.dart | 4 ++-- lib/src/view/animation/animated_switcher_wrapper.dart | 6 ++++-- lib/src/view/animation/open_container_wrapper.dart | 4 ++-- lib/src/view/screen/cart_screen.dart | 2 +- lib/src/view/screen/favorite_screen.dart | 2 +- lib/src/view/screen/home_screen.dart | 4 ++-- lib/src/view/screen/product_detail_screen.dart | 2 +- lib/src/view/screen/product_list_screen.dart | 2 +- lib/src/view/screen/profile_screen.dart | 2 +- lib/src/view/widget/carousel_slider.dart | 4 ++-- lib/src/view/widget/empty_cart.dart | 6 ++++-- lib/src/view/widget/list_item_selector.dart | 6 +++--- lib/src/view/widget/product_grid_view.dart | 4 ++-- pubspec.lock | 8 ++++---- pubspec.yaml | 2 +- 15 files changed, 31 insertions(+), 27 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 5dd9693..df7b528 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,12 +1,12 @@ -import 'dart:ui' show PointerDeviceKind; import 'package:flutter/material.dart'; +import 'dart:ui' show PointerDeviceKind; import 'package:e_commerce_flutter/core/app_theme.dart'; import 'package:e_commerce_flutter/src/view/screen/home_screen.dart'; void main() => runApp(const MyApp()); class MyApp extends StatelessWidget { - const MyApp({Key? key}) : super(key: key); + const MyApp({super.key}); @override Widget build(BuildContext context) { diff --git a/lib/src/view/animation/animated_switcher_wrapper.dart b/lib/src/view/animation/animated_switcher_wrapper.dart index 0967ab7..e6f7858 100644 --- a/lib/src/view/animation/animated_switcher_wrapper.dart +++ b/lib/src/view/animation/animated_switcher_wrapper.dart @@ -3,8 +3,10 @@ import 'package:flutter/material.dart'; class AnimatedSwitcherWrapper extends StatelessWidget { final Widget child; - const AnimatedSwitcherWrapper({Key? key, required this.child}) - : super(key: key); + const AnimatedSwitcherWrapper({ + super.key, + required this.child, + }); @override Widget build(BuildContext context) { diff --git a/lib/src/view/animation/open_container_wrapper.dart b/lib/src/view/animation/open_container_wrapper.dart index 4629846..9be8185 100644 --- a/lib/src/view/animation/open_container_wrapper.dart +++ b/lib/src/view/animation/open_container_wrapper.dart @@ -5,10 +5,10 @@ import 'package:e_commerce_flutter/src/view/screen/product_detail_screen.dart'; class OpenContainerWrapper extends StatelessWidget { const OpenContainerWrapper({ - Key? key, + super.key, required this.child, required this.product, - }) : super(key: key); + }); final Widget child; final Product product; diff --git a/lib/src/view/screen/cart_screen.dart b/lib/src/view/screen/cart_screen.dart index 4d6fe75..fb30888 100644 --- a/lib/src/view/screen/cart_screen.dart +++ b/lib/src/view/screen/cart_screen.dart @@ -9,7 +9,7 @@ import 'package:e_commerce_flutter/src/view/animation/animated_switcher_wrapper. final ProductController controller = Get.put(ProductController()); class CartScreen extends StatelessWidget { - const CartScreen({Key? key}) : super(key: key); + const CartScreen({super.key}); PreferredSizeWidget _appBar(BuildContext context) { return AppBar( diff --git a/lib/src/view/screen/favorite_screen.dart b/lib/src/view/screen/favorite_screen.dart index 2926dfd..f1f1802 100644 --- a/lib/src/view/screen/favorite_screen.dart +++ b/lib/src/view/screen/favorite_screen.dart @@ -5,7 +5,7 @@ import 'package:e_commerce_flutter/src/controller/product_controller.dart'; import 'package:e_commerce_flutter/src/view/widget/product_grid_view.dart'; class FavoriteScreen extends StatelessWidget { - const FavoriteScreen({Key? key}) : super(key: key); + const FavoriteScreen({super.key}); @override Widget build(BuildContext context) { diff --git a/lib/src/view/screen/home_screen.dart b/lib/src/view/screen/home_screen.dart index c2f7156..cfa0f42 100644 --- a/lib/src/view/screen/home_screen.dart +++ b/lib/src/view/screen/home_screen.dart @@ -1,15 +1,15 @@ -import 'package:e_commerce_flutter/src/view/widget/page_wrapper.dart'; import 'package:flutter/material.dart'; import 'package:animations/animations.dart'; import 'package:bottom_navy_bar/bottom_navy_bar.dart'; import 'package:e_commerce_flutter/core/app_data.dart'; import 'package:e_commerce_flutter/src/view/screen/cart_screen.dart'; +import 'package:e_commerce_flutter/src/view/widget/page_wrapper.dart'; import 'package:e_commerce_flutter/src/view/screen/profile_screen.dart'; import 'package:e_commerce_flutter/src/view/screen/favorite_screen.dart'; import 'package:e_commerce_flutter/src/view/screen/product_list_screen.dart'; class HomeScreen extends StatefulWidget { - const HomeScreen({Key? key}) : super(key: key); + const HomeScreen({super.key}); static const List screens = [ ProductListScreen(), diff --git a/lib/src/view/screen/product_detail_screen.dart b/lib/src/view/screen/product_detail_screen.dart index 0238972..ce87f52 100644 --- a/lib/src/view/screen/product_detail_screen.dart +++ b/lib/src/view/screen/product_detail_screen.dart @@ -12,7 +12,7 @@ final ProductController controller = Get.put(ProductController()); class ProductDetailScreen extends StatelessWidget { final Product product; - const ProductDetailScreen(this.product, {Key? key}) : super(key: key); + const ProductDetailScreen(this.product, {super.key}); PreferredSizeWidget _appBar(BuildContext context) { return AppBar( diff --git a/lib/src/view/screen/product_list_screen.dart b/lib/src/view/screen/product_list_screen.dart index 52001cd..9c906d8 100644 --- a/lib/src/view/screen/product_list_screen.dart +++ b/lib/src/view/screen/product_list_screen.dart @@ -11,7 +11,7 @@ enum AppbarActionType { leading, trailing } final ProductController controller = Get.put(ProductController()); class ProductListScreen extends StatelessWidget { - const ProductListScreen({Key? key}) : super(key: key); + const ProductListScreen({super.key}); Widget appBarActionButton(AppbarActionType type) { IconData icon = Icons.ac_unit_outlined; diff --git a/lib/src/view/screen/profile_screen.dart b/lib/src/view/screen/profile_screen.dart index 3f2a760..4526578 100644 --- a/lib/src/view/screen/profile_screen.dart +++ b/lib/src/view/screen/profile_screen.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; class ProfileScreen extends StatelessWidget { - const ProfileScreen({Key? key}) : super(key: key); + const ProfileScreen({super.key}); @override Widget build(BuildContext context) { diff --git a/lib/src/view/widget/carousel_slider.dart b/lib/src/view/widget/carousel_slider.dart index 4acb405..00481dd 100644 --- a/lib/src/view/widget/carousel_slider.dart +++ b/lib/src/view/widget/carousel_slider.dart @@ -4,9 +4,9 @@ import 'package:smooth_page_indicator/smooth_page_indicator.dart'; class CarouselSlider extends StatefulWidget { const CarouselSlider({ - Key? key, + super.key, required this.items, - }) : super(key: key); + }); final List items; diff --git a/lib/src/view/widget/empty_cart.dart b/lib/src/view/widget/empty_cart.dart index ecb8057..372b26a 100644 --- a/lib/src/view/widget/empty_cart.dart +++ b/lib/src/view/widget/empty_cart.dart @@ -1,14 +1,16 @@ import 'package:flutter/material.dart'; class EmptyCart extends StatelessWidget { - const EmptyCart({Key? key}) : super(key: key); + const EmptyCart({super.key}); @override Widget build(BuildContext context) { return Column( children: [ Expanded( - child: Center(child: Image.asset('assets/images/empty_cart.png')), + child: Center( + child: Image.asset('assets/images/empty_cart.png'), + ), ), const Text( "Empty cart", diff --git a/lib/src/view/widget/list_item_selector.dart b/lib/src/view/widget/list_item_selector.dart index 4c9a254..a7bf31d 100644 --- a/lib/src/view/widget/list_item_selector.dart +++ b/lib/src/view/widget/list_item_selector.dart @@ -1,14 +1,14 @@ +import 'package:get/get.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:e_commerce_flutter/src/model/product_category.dart'; -import 'package:get/get.dart'; class ListItemSelector extends StatefulWidget { const ListItemSelector({ - Key? key, + super.key, required this.categories, required this.onItemPressed, - }) : super(key: key); + }); final List categories; final Function(int) onItemPressed; diff --git a/lib/src/view/widget/product_grid_view.dart b/lib/src/view/widget/product_grid_view.dart index 9c5d04b..c1bae43 100644 --- a/lib/src/view/widget/product_grid_view.dart +++ b/lib/src/view/widget/product_grid_view.dart @@ -4,11 +4,11 @@ import 'package:e_commerce_flutter/src/view/animation/open_container_wrapper.dar class ProductGridView extends StatelessWidget { const ProductGridView({ - Key? key, + super.key, required this.items, required this.isPriceOff, required this.likeButtonPressed, - }) : super(key: key); + }); final List items; final bool Function(Product product) isPriceOff; diff --git a/pubspec.lock b/pubspec.lock index bef794b..6e6039a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -74,10 +74,10 @@ packages: dependency: "direct dev" description: name: flutter_lints - sha256: aeb0b80a8b3709709c9cc496cdc027c5b3216796bc0af0ce1007eaf24464fd4c + sha256: e2a421b7e59244faef694ba7b30562e489c2b489866e505074eb005cd7060db7 url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "3.0.1" flutter_rating_bar: dependency: "direct main" description: @@ -111,10 +111,10 @@ packages: dependency: transitive description: name: lints - sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" + sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "3.0.0" matcher: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 0c3108f..1b9e179 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -22,7 +22,7 @@ dependencies: animations: ^2.0.8 dev_dependencies: - flutter_lints: ^2.0.1 + flutter_lints: ^3.0.1 flutter_test: sdk: flutter