Skip to content

Commit

Permalink
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 11, 2023
1 parent fb3fb00 commit 94c1306
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 27 deletions.
4 changes: 2 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
6 changes: 4 additions & 2 deletions lib/src/view/animation/animated_switcher_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/view/animation/open_container_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/view/screen/cart_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion lib/src/view/screen/favorite_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/view/screen/home_screen.dart
Original file line number Diff line number Diff line change
@@ -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<Widget> screens = [
ProductListScreen(),
Expand Down
2 changes: 1 addition & 1 deletion lib/src/view/screen/product_detail_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion lib/src/view/screen/product_list_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/view/screen/profile_screen.dart
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/view/widget/carousel_slider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> items;

Expand Down
6 changes: 4 additions & 2 deletions lib/src/view/widget/empty_cart.dart
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
6 changes: 3 additions & 3 deletions lib/src/view/widget/list_item_selector.dart
Original file line number Diff line number Diff line change
@@ -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<ProductCategory> categories;
final Function(int) onItemPressed;
Expand Down
4 changes: 2 additions & 2 deletions lib/src/view/widget/product_grid_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<Product> items;
final bool Function(Product product) isPriceOff;
Expand Down
8 changes: 4 additions & 4 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 94c1306

Please sign in to comment.