Skip to content

Commit b04fb87

Browse files
authored
chore: flutter_lints (aagarwal1012#104)
1 parent 0f9b1d4 commit b04fb87

19 files changed

+96
-35
lines changed

analysis_options.yaml

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,29 @@
1-
include: package:pedantic/analysis_options.yaml
1+
# This file configures the analyzer, which statically analyzes Dart code to
2+
# check for errors, warnings, and lints.
3+
#
4+
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5+
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6+
# invoked from the command line by running `flutter analyze`.
7+
8+
# The following line activates a set of recommended lints for Flutter apps,
9+
# packages, and plugins designed to encourage good coding practices.
10+
include: package:flutter_lints/flutter.yaml
211

312
linter:
13+
# The lint rules applied to this project can be customized in the
14+
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
15+
# included above or to enable additional rules. A list of all available lints
16+
# and their documentation is published at
17+
# https://dart-lang.github.io/linter/lints/index.html.
18+
#
19+
# Instead of disabling a lint rule for the entire project in the
20+
# section below, it can also be suppressed for a single line of code
21+
# or a specific dart file by using the `// ignore: name_of_lint` and
22+
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
23+
# producing the lint.
424
rules:
5-
# - public_member_api_docs
6-
# - package_api_docs
7-
- sort_constructors_first
8-
- prefer_const_constructors
9-
- prefer_const_constructors_in_immutables
10-
# - prefer_null_aware_method_calls
11-
# - require_trailing_comma
25+
# avoid_print: false # Uncomment to disable the `avoid_print` rule
26+
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27+
28+
# Additional information about this file can be found at
29+
# https://dart.dev/guides/language/analysis-options

example/analysis_options.yaml

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,29 @@
1-
include: package:pedantic/analysis_options.yaml
1+
# This file configures the analyzer, which statically analyzes Dart code to
2+
# check for errors, warnings, and lints.
3+
#
4+
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5+
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6+
# invoked from the command line by running `flutter analyze`.
7+
8+
# The following line activates a set of recommended lints for Flutter apps,
9+
# packages, and plugins designed to encourage good coding practices.
10+
include: package:flutter_lints/flutter.yaml
211

312
linter:
13+
# The lint rules applied to this project can be customized in the
14+
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
15+
# included above or to enable additional rules. A list of all available lints
16+
# and their documentation is published at
17+
# https://dart-lang.github.io/linter/lints/index.html.
18+
#
19+
# Instead of disabling a lint rule for the entire project in the
20+
# section below, it can also be suppressed for a single line of code
21+
# or a specific dart file by using the `// ignore: name_of_lint` and
22+
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
23+
# producing the lint.
424
rules:
5-
# - public_member_api_docs
6-
# - package_api_docs
7-
- sort_constructors_first
8-
- prefer_const_constructors
9-
- prefer_const_constructors_in_immutables
10-
# - prefer_null_aware_method_calls
11-
# - require_trailing_comma
25+
# avoid_print: false # Uncomment to disable the `avoid_print` rule
26+
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27+
28+
# Additional information about this file can be found at
29+
# https://dart.dev/guides/language/analysis-options

example/lib/main.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ void main() => runApp(App());
66

77
/// App widget class.
88
class App extends StatelessWidget {
9+
App({Key? key}) : super(key: key);
10+
911
// Making list of pages needed to pass in IntroViewsFlutter constructor.
1012
final pages = [
1113
PageViewModel(
@@ -110,6 +112,9 @@ class App extends StatelessWidget {
110112

111113
/// Home Page of our example app.
112114
class HomePage extends StatelessWidget {
115+
// ignore: prefer_const_constructors_in_immutables
116+
HomePage({Key? key}) : super(key: key);
117+
113118
@override
114119
Widget build(BuildContext context) {
115120
return Scaffold(

example/linux/flutter/generated_plugin_registrant.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Generated file. Do not edit.
33
//
44

5+
// clang-format off
6+
57
#include "generated_plugin_registrant.h"
68

79

example/linux/flutter/generated_plugin_registrant.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Generated file. Do not edit.
33
//
44

5+
// clang-format off
6+
57
#ifndef GENERATED_PLUGIN_REGISTRANT_
68
#define GENERATED_PLUGIN_REGISTRANT_
79

example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ dependencies:
1717
dev_dependencies:
1818
flutter_test:
1919
sdk: flutter
20-
pedantic: ^1.11.0
20+
flutter_lints: ^1.0.3
2121

2222

2323
# For information on the generic Dart part of this file, see the

example/windows/flutter/generated_plugin_registrant.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Generated file. Do not edit.
33
//
44

5+
// clang-format off
6+
57
#include "generated_plugin_registrant.h"
68

79

example/windows/flutter/generated_plugin_registrant.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Generated file. Do not edit.
33
//
44

5+
// clang-format off
6+
57
#ifndef GENERATED_PLUGIN_REGISTRANT_
68
#define GENERATED_PLUGIN_REGISTRANT_
79

example/winuwp/flutter/generated_plugin_registrant.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Generated file. Do not edit.
33
//
44

5+
// clang-format off
6+
57
#include "generated_plugin_registrant.h"
68

79

example/winuwp/flutter/generated_plugin_registrant.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Generated file. Do not edit.
33
//
44

5+
// clang-format off
6+
57
#ifndef GENERATED_PLUGIN_REGISTRANT_
68
#define GENERATED_PLUGIN_REGISTRANT_
79

lib/src/animation_gesture/page_dragger.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ import 'package:intro_views_flutter/src/models/slide_update_model.dart';
77
/// This class is used to get user gesture and work according to it.
88
class PageDragger extends StatefulWidget {
99
const PageDragger({
10+
Key? key,
1011
required this.canDragLeftToRight,
1112
required this.canDragRightToLeft,
1213
required this.slideUpdateStream,
1314
this.fullTransitionPX = FULL_TRANSITION_PX,
14-
});
15+
}) : super(key: key);
1516

1617
// These bool variables are used to check whether user can
1718
// drag left or right or none.

lib/src/animation_gesture/page_reveal.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ import 'package:intro_views_flutter/src/clipper/circular_reveal_clipper.dart';
44
/// This class reveals the next page in the circular form.
55
class PageReveal extends StatelessWidget {
66
const PageReveal({
7+
Key? key,
78
required this.revealPercent,
89
required this.child,
9-
});
10+
}) : super(key: key);
1011

1112
final double revealPercent;
1213
final Widget child;

lib/src/helpers/constants.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// ignore_for_file: constant_identifier_names
12
/// This package contains all the constants used.
23
34
const BUBBLE_WIDTH = 55.0;

lib/src/ui/page.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import 'package:intro_views_flutter/src/models/page_view_model.dart';
44
/// This is the class which contains the Page UI.
55
class Page extends StatelessWidget {
66
const Page({
7+
Key? key,
78
required this.pageViewModel,
89
this.percentVisible = 1.0,
910
this.columnMainAxisAlignment = MainAxisAlignment.spaceAround,
10-
});
11+
}) : super(key: key);
1112

1213
/// Page details.
1314
final PageViewModel pageViewModel;

lib/src/ui/page_bubble.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@ import 'package:intro_views_flutter/src/models/page_bubble_view_model.dart';
66
/// This class contains the UI for page bubble.
77
class PageBubble extends StatelessWidget {
88
const PageBubble({
9+
Key? key,
910
required this.viewModel,
1011
required this.width,
11-
});
12+
}) : super(key: key);
1213

1314
final PageBubbleViewModel viewModel;
1415
final double width;
1516

1617
@override
1718
Widget build(BuildContext context) {
18-
return Container(
19+
return SizedBox(
1920
width: width,
2021
height: 65.0,
2122
child: Center(

lib/src/ui/page_indicator_buttons.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ import 'package:intro_views_flutter/src/models/page_button_view_model.dart';
55
/// Skip, Next, and Back button class.
66
class DefaultButton extends StatelessWidget {
77
const DefaultButton({
8+
Key? key,
89
required this.onTap,
910
required this.pageButtonViewModel,
1011
required this.child,
11-
});
12+
}) : super(key: key);
1213

1314
/// Callback for skip button.
1415
final VoidCallback? onTap;
@@ -48,10 +49,11 @@ class DefaultButton extends StatelessWidget {
4849
/// Done Button class.
4950
class DoneButton extends StatelessWidget {
5051
const DoneButton({
52+
Key? key,
5153
required this.onTap,
5254
required this.pageButtonViewModel,
5355
required this.child,
54-
});
56+
}) : super(key: key);
5557

5658
final VoidCallback? onTap;
5759

@@ -84,6 +86,7 @@ class DoneButton extends StatelessWidget {
8486

8587
class PageIndicatorButtons extends StatelessWidget {
8688
const PageIndicatorButtons({
89+
Key? key,
8790
required this.activePageIndex,
8891
required this.totalPages,
8992
this.onPressedDoneButton,
@@ -101,7 +104,7 @@ class PageIndicatorButtons extends StatelessWidget {
101104
this.showNextButton = true,
102105
this.showBackButton = true,
103106
required this.backText,
104-
});
107+
}) : super(key: key);
105108

106109
final int activePageIndex;
107110
final int totalPages;

lib/src/ui/pager_indicator.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ import 'package:intro_views_flutter/src/ui/page_bubble.dart';
88
/// This class contains the UI elements associated with bottom page indicator.
99
class PagerIndicator extends StatelessWidget {
1010
const PagerIndicator({
11+
Key? key,
1112
required this.viewModel,
12-
});
13+
}) : super(key: key);
1314

1415
final PagerIndicatorViewModel viewModel;
1516

@@ -28,7 +29,7 @@ class PagerIndicator extends StatelessWidget {
2829
final page = viewModel.pages[i];
2930

3031
// calculating percent active
31-
var percentActive;
32+
double percentActive;
3233
if (i == viewModel.activeIndex) {
3334
percentActive = 1.0 - viewModel.slidePercent;
3435
} else if (i == viewModel.activeIndex - 1 &&

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ dependencies:
1313
dev_dependencies:
1414
flutter_test:
1515
sdk: flutter
16-
pedantic: ^1.11.0
16+
flutter_lints: ^1.0.3

test/widget_test.dart renamed to test/intro_views_flutter_test.dart

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
// This is a basic Flutter widget test.
2-
// To perform an interaction with a widget in your test, use the WidgetTester utility that Flutter
3-
// provides. For example, you can send tap and scroll gestures. You can also use WidgetTester to
4-
// find child widgets in the widget tree, read text, and verify that the values of widget properties
5-
// are correct.
6-
1+
/// Tests are run from the example directory in order to have access to
2+
/// the app's asset images.
3+
///
4+
/// cd example
5+
/// flutter test ..
6+
// ignore_for_file: avoid_relative_lib_imports, constant_identifier_names
77
import 'package:flutter/material.dart';
88
import 'package:flutter_test/flutter_test.dart';
99
import 'package:intro_views_flutter/intro_views_flutter.dart';
1010

11-
// ignore: avoid_relative_lib_imports
1211
import '../example/lib/main.dart';
1312

1413
const double PORTRAIT_WIDTH = 1800.0;

0 commit comments

Comments
 (0)