From e2825dc6cb046e10191cd1723b3bb2a777bf36c7 Mon Sep 17 00:00:00 2001 From: SINASYS Date: Fri, 24 Nov 2023 21:32:40 +0330 Subject: [PATCH] Provider version : Improve code style using lint rules v3.0.1 --- lib/main.dart | 2 +- .../presentation/animation/fade_animation.dart | 4 ++-- .../presentation/animation/page_transition.dart | 5 ++++- .../presentation/animation/scale_animation.dart | 5 ++++- lib/src/presentation/screen/cart_screen.dart | 2 +- lib/src/presentation/screen/favorite_screen.dart | 2 +- .../presentation/screen/food_detail_screen.dart | 5 ++++- .../presentation/screen/food_list_screen.dart | 2 +- lib/src/presentation/screen/home_screen.dart | 2 +- lib/src/presentation/screen/profile_screen.dart | 2 +- lib/src/presentation/widget/counter_button.dart | 4 ++-- lib/src/presentation/widget/empty_widget.dart | 4 ++-- lib/src/presentation/widget/food_list_view.dart | 4 ++-- pubspec.lock | 16 ++++++++++++++++ pubspec.yaml | 1 + 15 files changed, 43 insertions(+), 17 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 2a750c4..a84f55a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -10,7 +10,7 @@ import 'package:flutter_japanese_restaurant_app/src/business_logic/provider/cate 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/presentation/animation/fade_animation.dart b/lib/src/presentation/animation/fade_animation.dart index 9381be5..2758c61 100644 --- a/lib/src/presentation/animation/fade_animation.dart +++ b/lib/src/presentation/animation/fade_animation.dart @@ -8,10 +8,10 @@ class FadeAnimation extends StatelessWidget { final Widget child; const FadeAnimation({ - Key? key, + super.key, required this.delay, required this.child, - }) : super(key: key); + }); @override Widget build(BuildContext context) { diff --git a/lib/src/presentation/animation/page_transition.dart b/lib/src/presentation/animation/page_transition.dart index 2216bed..8f9d098 100644 --- a/lib/src/presentation/animation/page_transition.dart +++ b/lib/src/presentation/animation/page_transition.dart @@ -2,7 +2,10 @@ import 'package:animations/animations.dart'; import 'package:flutter/material.dart'; class PageTransition extends StatelessWidget { - const PageTransition({Key? key, required this.child}) : super(key: key); + const PageTransition({ + super.key, + required this.child, + }); final Widget child; diff --git a/lib/src/presentation/animation/scale_animation.dart b/lib/src/presentation/animation/scale_animation.dart index 91c1a4e..6fdf95b 100644 --- a/lib/src/presentation/animation/scale_animation.dart +++ b/lib/src/presentation/animation/scale_animation.dart @@ -1,7 +1,10 @@ import 'package:flutter/material.dart'; class ScaleAnimation extends StatefulWidget { - const ScaleAnimation({Key? key, required this.child}) : super(key: key); + const ScaleAnimation({ + super.key, + required this.child, + }); final Widget child; diff --git a/lib/src/presentation/screen/cart_screen.dart b/lib/src/presentation/screen/cart_screen.dart index fc4cd82..cf0a443 100644 --- a/lib/src/presentation/screen/cart_screen.dart +++ b/lib/src/presentation/screen/cart_screen.dart @@ -12,7 +12,7 @@ import 'package:flutter_japanese_restaurant_app/src/business_logic/provider/them import 'package:provider/provider.dart'; 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/presentation/screen/favorite_screen.dart b/lib/src/presentation/screen/favorite_screen.dart index 96c2921..1e0c1ea 100644 --- a/lib/src/presentation/screen/favorite_screen.dart +++ b/lib/src/presentation/screen/favorite_screen.dart @@ -9,7 +9,7 @@ import 'package:flutter_japanese_restaurant_app/src/business_logic/provider/food import 'package:flutter_japanese_restaurant_app/src/business_logic/provider/theme/theme_provider.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/presentation/screen/food_detail_screen.dart b/lib/src/presentation/screen/food_detail_screen.dart index e74caa0..c8af450 100644 --- a/lib/src/presentation/screen/food_detail_screen.dart +++ b/lib/src/presentation/screen/food_detail_screen.dart @@ -12,7 +12,10 @@ import 'package:flutter_japanese_restaurant_app/src/business_logic/provider/food import 'package:flutter_japanese_restaurant_app/src/business_logic/provider/theme/theme_provider.dart'; class FoodDetailScreen extends StatelessWidget { - const FoodDetailScreen({Key? key, required this.food}) : super(key: key); + const FoodDetailScreen({ + super.key, + required this.food, + }); final Food food; diff --git a/lib/src/presentation/screen/food_list_screen.dart b/lib/src/presentation/screen/food_list_screen.dart index 87866e4..44938b0 100644 --- a/lib/src/presentation/screen/food_list_screen.dart +++ b/lib/src/presentation/screen/food_list_screen.dart @@ -12,7 +12,7 @@ import 'package:flutter_japanese_restaurant_app/src/business_logic/provider/them import 'package:flutter_japanese_restaurant_app/src/business_logic/provider/category/category_provider.dart'; class FoodListScreen extends StatelessWidget { - const FoodListScreen({Key? key}) : super(key: key); + const FoodListScreen({super.key}); PreferredSizeWidget _appBar(BuildContext context) { return AppBar( diff --git a/lib/src/presentation/screen/home_screen.dart b/lib/src/presentation/screen/home_screen.dart index 497c16f..8421631 100644 --- a/lib/src/presentation/screen/home_screen.dart +++ b/lib/src/presentation/screen/home_screen.dart @@ -8,7 +8,7 @@ import 'package:flutter_japanese_restaurant_app/src/presentation/screen/food_lis import 'package:flutter_japanese_restaurant_app/src/presentation/animation/page_transition.dart'; class HomeScreen extends HookWidget { - HomeScreen({Key? key}) : super(key: key); + HomeScreen({super.key}); final List screen = [ const FoodListScreen(), diff --git a/lib/src/presentation/screen/profile_screen.dart b/lib/src/presentation/screen/profile_screen.dart index 835e59c..20f7ac9 100644 --- a/lib/src/presentation/screen/profile_screen.dart +++ b/lib/src/presentation/screen/profile_screen.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_japanese_restaurant_app/core/app_asset.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/presentation/widget/counter_button.dart b/lib/src/presentation/widget/counter_button.dart index 068e320..5be5a84 100644 --- a/lib/src/presentation/widget/counter_button.dart +++ b/lib/src/presentation/widget/counter_button.dart @@ -10,14 +10,14 @@ class CounterButton extends StatelessWidget { final double padding; const CounterButton({ - Key? key, + super.key, required this.onIncrementSelected, required this.onDecrementSelected, required this.label, this.padding = 10.0, this.size = const Size(36, 36), this.orientation = Axis.horizontal, - }) : super(key: key); + }); Widget button(Icon icon, Function() onTap) { return RawMaterialButton( diff --git a/lib/src/presentation/widget/empty_widget.dart b/lib/src/presentation/widget/empty_widget.dart index e8d8223..57f8361 100644 --- a/lib/src/presentation/widget/empty_widget.dart +++ b/lib/src/presentation/widget/empty_widget.dart @@ -10,12 +10,12 @@ class EmptyWidget extends StatelessWidget { final Widget child; const EmptyWidget({ - Key? key, + super.key, this.type = EmptyWidgetType.cart, required this.title, this.condition = false, required this.child, - }) : super(key: key); + }); @override Widget build(BuildContext context) { diff --git a/lib/src/presentation/widget/food_list_view.dart b/lib/src/presentation/widget/food_list_view.dart index e8e87fd..ce8b98d 100644 --- a/lib/src/presentation/widget/food_list_view.dart +++ b/lib/src/presentation/widget/food_list_view.dart @@ -10,10 +10,10 @@ import 'package:flutter_japanese_restaurant_app/src/business_logic/provider/them class FoodListView extends StatelessWidget { const FoodListView({ - Key? key, + super.key, required this.foods, this.isReversedList = false, - }) : super(key: key); + }); final List foods; final bool isReversedList; diff --git a/pubspec.lock b/pubspec.lock index 76f75b9..5bac5c6 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -86,6 +86,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.20.3" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: e2a421b7e59244faef694ba7b30562e489c2b489866e505074eb005cd7060db7 + url: "https://pub.dev" + source: hosted + version: "3.0.1" flutter_rating_bar: dependency: "direct main" description: @@ -107,6 +115,14 @@ packages: url: "https://pub.dev" source: hosted version: "10.6.0" + lints: + dependency: transitive + description: + name: lints + sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 + url: "https://pub.dev" + source: hosted + version: "3.0.0" matcher: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 77b2dd8..a843df1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -36,6 +36,7 @@ dependencies: provider: ^6.1.1 dev_dependencies: + flutter_lints: ^3.0.1 flutter_test: sdk: flutter