Skip to content

Commit

Permalink
Bloc version : Improve code style using lint rules v3.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
SinaSys committed Nov 24, 2023
1 parent 372c37e commit ce6c5fe
Show file tree
Hide file tree
Showing 16 changed files with 48 additions and 22 deletions.
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:flutter_japanese_restaurant_app/src/business_logic/blocs/categor
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) {
Expand Down
10 changes: 5 additions & 5 deletions lib/src/business_logic/blocs/food/food_event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ abstract class FoodEvent extends Equatable {
}

class IncreaseQuantityEvent extends FoodEvent {
const IncreaseQuantityEvent(Food food) : super(food);
const IncreaseQuantityEvent(super.food);
}

class DecreaseQuantityEvent extends FoodEvent {
const DecreaseQuantityEvent(Food food) : super(food);
const DecreaseQuantityEvent(super.food);
}

class RemoveItemEvent extends FoodEvent {
const RemoveItemEvent(Food food) : super(food);
const RemoveItemEvent(super.food);
}

class AddToCartEvent extends FoodEvent {
const AddToCartEvent(Food food) : super(food);
const AddToCartEvent(super.food);
}

class FavoriteItemEvent extends FoodEvent {
const FavoriteItemEvent(Food food) : super(food);
const FavoriteItemEvent(super.food);
}
4 changes: 2 additions & 2 deletions lib/src/presentation/animation/fade_animation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 4 additions & 1 deletion lib/src/presentation/animation/page_transition.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
5 changes: 4 additions & 1 deletion lib/src/presentation/animation/scale_animation.dart
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
2 changes: 1 addition & 1 deletion lib/src/presentation/screen/cart_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'package:flutter_japanese_restaurant_app/src/business_logic/blocs/food/fo
import 'package:flutter_japanese_restaurant_app/src/business_logic/blocs/theme/theme_bloc.dart';

class CartScreen extends StatelessWidget {
const CartScreen({Key? key}) : super(key: key);
const CartScreen({super.key});

PreferredSizeWidget _appBar(BuildContext context) {
return AppBar(
Expand Down
2 changes: 1 addition & 1 deletion lib/src/presentation/screen/favorite_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:flutter_japanese_restaurant_app/src/business_logic/blocs/food/fo
import 'package:flutter_japanese_restaurant_app/src/presentation/widget/empty_widget.dart';

class FavoriteScreen extends StatelessWidget {
const FavoriteScreen({Key? key}) : super(key: key);
const FavoriteScreen({super.key});

@override
Widget build(BuildContext context) {
Expand Down
5 changes: 4 additions & 1 deletion lib/src/presentation/screen/food_detail_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import 'package:flutter_japanese_restaurant_app/src/business_logic/blocs/theme/t
import 'package:flutter_japanese_restaurant_app/src/presentation/animation/scale_animation.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;

Expand Down
2 changes: 1 addition & 1 deletion lib/src/presentation/screen/food_list_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import 'package:flutter_japanese_restaurant_app/src/business_logic/blocs/theme/t
import 'package:flutter_japanese_restaurant_app/src/business_logic/blocs/category/category_bloc.dart';

class FoodListScreen extends StatelessWidget {
const FoodListScreen({Key? key}) : super(key: key);
const FoodListScreen({super.key});

PreferredSizeWidget _appBar(BuildContext context) {
return AppBar(
Expand Down
2 changes: 1 addition & 1 deletion lib/src/presentation/screen/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<Widget> screen = [
const FoodListScreen(),
Expand Down
2 changes: 1 addition & 1 deletion lib/src/presentation/screen/profile_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/presentation/widget/counter_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions lib/src/presentation/widget/empty_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/presentation/widget/food_list_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import 'package:flutter_japanese_restaurant_app/src/presentation/widget/custom_p

class FoodListView extends StatelessWidget {
const FoodListView({
Key? key,
super.key,
required this.foods,
this.isReversedList = false,
}) : super(key: key);
});

final List<Food> foods;
final bool isReversedList;
Expand Down
16 changes: 16 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,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:
Expand All @@ -131,6 +139,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:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ dependencies:
flutter_hooks: ^0.20.3

dev_dependencies:
flutter_lints: ^3.0.1
flutter_test:
sdk: flutter

Expand Down

0 comments on commit ce6c5fe

Please sign in to comment.