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 22, 2023
1 parent 7ddaedb commit 0b2d0c3
Show file tree
Hide file tree
Showing 18 changed files with 58 additions and 46 deletions.
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:office_furniture_store/src/business_logic/bloc/furniture/furnitu
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
7 changes: 5 additions & 2 deletions lib/src/presentation/animation/fade_in_animation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ class FadeInAnimation extends StatelessWidget {
final double delay;
final Widget child;

const FadeInAnimation({Key? key, required this.delay, required this.child})
: super(key: key);
const FadeInAnimation({
super.key,
required this.delay,
required this.child,
});

@override
Widget build(BuildContext context) {
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 @@ -10,7 +10,7 @@ import 'package:office_furniture_store/src/presentation/widget/counter_button.da
import 'package:office_furniture_store/src/business_logic/bloc/furniture/furniture_bloc.dart';

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

@override
Widget build(BuildContext context) {
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 @@ -7,7 +7,7 @@ import 'package:office_furniture_store/src/presentation/widget/furniture_list_vi
import 'package:office_furniture_store/src/business_logic/bloc/furniture/furniture_bloc.dart';

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

@override
Widget build(BuildContext context) {
Expand Down
6 changes: 3 additions & 3 deletions lib/src/presentation/screen/home_screen.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:office_furniture_store/core/app_color.dart';
import 'package:office_furniture_store/core/app_data.dart';
import 'package:office_furniture_store/core/app_color.dart';
import 'package:office_furniture_store/src/presentation/screen/cart_screen.dart';
import 'package:office_furniture_store/src/presentation/screen/profile_screen.dart';
import 'package:office_furniture_store/src/presentation/screen/favorite_screen.dart';
import 'package:office_furniture_store/src/presentation/screen/office_furniture_list_screen.dart';
import 'package:office_furniture_store/src/presentation/screen/profile_screen.dart';

class HomeScreen extends HookWidget {
final List<Widget> screens = const [
Expand All @@ -15,7 +15,7 @@ class HomeScreen extends HookWidget {
ProfileScreen()
];

const HomeScreen({Key? key}) : super(key: key);
const HomeScreen({super.key});

@override
Widget build(BuildContext context) {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/presentation/screen/intro_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:office_furniture_store/core/app_style.dart';
import 'package:office_furniture_store/src/presentation/screen/home_screen.dart';

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

@override
Widget build(BuildContext context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ class OfficeFurnitureDetailScreen extends HookWidget {
final Furniture furniture;
final int index;

const OfficeFurnitureDetailScreen(
{Key? key, required this.furniture, required this.index})
: super(key: key);
const OfficeFurnitureDetailScreen({
super.key,
required this.furniture,
required this.index,
});

@override
Widget build(BuildContext context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:office_furniture_store/src/business_logic/bloc/furniture/furnitu
import 'package:office_furniture_store/src/presentation/screen/office_furniture_detail_screen.dart';

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

PreferredSize _appBar() {
return PreferredSize(
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:office_furniture_store/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
14 changes: 7 additions & 7 deletions lib/src/presentation/widget/bottom_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ class BottomBar extends StatelessWidget {
final String priceValue;
final String buttonLabel;

const BottomBar(
{Key? key,
this.onTap,
this.priceLabel = "Price",
required this.priceValue,
this.buttonLabel = "Add to cart"})
: super(key: key);
const BottomBar({
super.key,
this.onTap,
this.priceLabel = "Price",
required this.priceValue,
this.buttonLabel = "Add to cart",
});

@override
Widget build(BuildContext context) {
Expand Down
10 changes: 6 additions & 4 deletions lib/src/presentation/widget/cart_list_view.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import 'package:flutter/material.dart';
import 'package:office_furniture_store/core/app_extension.dart';
import 'package:office_furniture_store/core/app_style.dart';
import 'package:office_furniture_store/core/app_extension.dart';
import 'package:office_furniture_store/src/data/model/furniture.dart';

class CartListView extends StatelessWidget {
const CartListView(
{Key? key, required this.counterButton, required this.furnitureItems})
: super(key: key);
const CartListView({
super.key,
required this.counterButton,
required this.furnitureItems,
});

final Widget Function(Furniture furniture, int index) counterButton;
final List<Furniture> furnitureItems;
Expand Down
4 changes: 2 additions & 2 deletions lib/src/presentation/widget/color_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ class ColorPicker extends HookWidget {
final List<FurnitureColor> colors;

const ColorPicker({
Key? key,
super.key,
required this.colors,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down
14 changes: 7 additions & 7 deletions lib/src/presentation/widget/counter_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ class CounterButton extends StatelessWidget {
final int label;
final Axis orientation;

const CounterButton(
{Key? key,
required this.onIncrementSelected,
required this.onDecrementSelected,
required this.label,
this.orientation = Axis.horizontal})
: super(key: key);
const CounterButton({
super.key,
required this.onIncrementSelected,
required this.onDecrementSelected,
required this.label,
this.orientation = Axis.horizontal,
});

Widget button(Icon icon, Function() onTap) {
return RawMaterialButton(
Expand Down
8 changes: 5 additions & 3 deletions lib/src/presentation/widget/empty_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ class EmptyWidget extends StatelessWidget {
final EmptyWidgetType type;
final String title;

const EmptyWidget(
{Key? key, this.type = EmptyWidgetType.cart, required this.title})
: super(key: key);
const EmptyWidget({
super.key,
this.type = EmptyWidgetType.cart,
required this.title,
});

@override
Widget build(BuildContext context) {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/presentation/widget/furniture_list_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ class FurnitureListView extends StatelessWidget {
final List<Furniture> furnitureList;

const FurnitureListView({
Key? key,
super.key,
this.isHorizontal = true,
this.onTap,
required this.furnitureList,
}) : super(key: key);
});

Widget _furnitureScore(Furniture furniture) {
return Row(
Expand Down
7 changes: 5 additions & 2 deletions lib/src/presentation/widget/rating_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ class StarRatingBar extends StatelessWidget {
final double score;
final double itemSize;

const StarRatingBar({Key? key, required this.score, this.itemSize = 20})
: super(key: key);
const StarRatingBar({
super.key,
required this.score,
this.itemSize = 20,
});

@override
Widget build(BuildContext context) {
Expand Down
8 changes: 4 additions & 4 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,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:
Expand All @@ -119,10 +119,10 @@ packages:
dependency: transitive
description:
name: lints
sha256: "5e4a9cd06d447758280a8ac2405101e0e2094d2a1dbdd3756aec3fe7775ba593"
sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290
url: "https://pub.dev"
source: hosted
version: "2.0.1"
version: "3.0.0"
matcher:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ dev_dependencies:
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^2.0.1
flutter_lints: ^3.0.1

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
Expand Down

0 comments on commit 0b2d0c3

Please sign in to comment.