Skip to content

Commit 89723f4

Browse files
committed
analysis options added
1 parent 32f0810 commit 89723f4

File tree

9 files changed

+87
-53
lines changed

9 files changed

+87
-53
lines changed

analysis_options.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
include: package:flutter_lints/flutter.yaml
2+
# Additional information about this file can be found at
3+
# https://dart.dev/guides/language/analysis-options

example/analysis_options.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
include: package:flutter_lints/flutter.yaml
2+
# Additional information about this file can be found at
3+
# https://dart.dev/guides/language/analysis-options

example/lib/camera_preview.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class CameraPreview extends StatelessWidget {
2626
children: [
2727
CircleAvatar(
2828
backgroundColor: Colors.black.withOpacity(.5),
29-
child: Icon(
29+
child: const Icon(
3030
Icons.bolt,
3131
color: Colors.white,
3232
),
@@ -35,7 +35,7 @@ class CameraPreview extends StatelessWidget {
3535
)),
3636
Positioned(
3737
bottom: 50,
38-
child: Container(
38+
child: SizedBox(
3939
width: MediaQuery.of(context).size.width,
4040
child: Row(
4141
mainAxisSize: MainAxisSize.max,
@@ -49,7 +49,7 @@ class CameraPreview extends StatelessWidget {
4949
height: 100,
5050
width: 100,
5151
alignment: Alignment.center,
52-
child: CircleAvatar(
52+
child: const CircleAvatar(
5353
radius: 40,
5454
backgroundColor: Colors.white,
5555
),

example/lib/main.dart

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,69 +3,67 @@ import 'package:flutter/material.dart';
33

44
import 'camera_preview.dart';
55

6-
void main() => runApp(
7-
MyApp(),
8-
);
6+
void main() => runApp(const MyApp());
97

108
class MyApp extends StatelessWidget {
9+
const MyApp({Key? key}) : super(key: key);
10+
1111
@override
1212
Widget build(BuildContext context) {
13-
return MaterialApp(
13+
return const MaterialApp(
1414
title: "Draggable Home",
1515
home: HomePage(),
1616
);
1717
}
1818
}
1919

2020
class HomePage extends StatelessWidget {
21+
const HomePage({Key? key}) : super(key: key);
22+
2123
@override
2224
Widget build(BuildContext context) {
2325
return DraggableHome(
24-
leading: Icon(Icons.arrow_back_ios),
25-
title: Text("Draggable Home"),
26+
leading: const Icon(Icons.arrow_back_ios),
27+
title: const Text("Draggable Home"),
2628
actions: [
27-
IconButton(onPressed: () {}, icon: Icon(Icons.settings)),
29+
IconButton(onPressed: () {}, icon: const Icon(Icons.settings)),
2830
],
2931
headerWidget: headerWidget(context),
3032
headerBottomBar: headerBottomBarWidget(),
3133
body: [
3234
listView(),
3335
],
3436
fullyStretchable: true,
35-
expandedBody: CameraPreview(),
37+
expandedBody: const CameraPreview(),
3638
);
3739
}
3840

39-
Container headerBottomBarWidget() {
40-
return Container(
41-
child: Row(
42-
mainAxisSize: MainAxisSize.max,
43-
mainAxisAlignment: MainAxisAlignment.end,
44-
crossAxisAlignment: CrossAxisAlignment.center,
45-
children: [
46-
Icon(
47-
Icons.settings,
48-
color: Colors.white,
49-
),
50-
],
51-
),
41+
Row headerBottomBarWidget() {
42+
return Row(
43+
mainAxisSize: MainAxisSize.max,
44+
mainAxisAlignment: MainAxisAlignment.end,
45+
crossAxisAlignment: CrossAxisAlignment.center,
46+
children: const [
47+
Icon(
48+
Icons.settings,
49+
color: Colors.white,
50+
),
51+
],
5252
);
5353
}
5454

55-
Container headerWidget(BuildContext context) => Container(
56-
child: Center(
57-
child: Text("Title",
58-
style: Theme.of(context)
59-
.textTheme
60-
.headline2!
61-
.copyWith(color: Colors.white70)),
62-
),
55+
Widget headerWidget(BuildContext context) => Center(
56+
child: Text("Title",
57+
style: Theme.of(context)
58+
.textTheme
59+
.headline2!
60+
.copyWith(color: Colors.white70)),
6361
);
6462

6563
ListView listView() {
6664
return ListView.builder(
67-
padding: EdgeInsets.only(top: 0),
68-
physics: NeverScrollableScrollPhysics(),
65+
padding: const EdgeInsets.only(top: 0),
66+
physics: const NeverScrollableScrollPhysics(),
6967
itemCount: 20,
7068
shrinkWrap: true,
7169
itemBuilder: (context, index) => Card(
@@ -74,8 +72,8 @@ class HomePage extends StatelessWidget {
7472
leading: CircleAvatar(
7573
child: Text("$index"),
7674
),
77-
title: Text("Title"),
78-
subtitle: Text("Subtitile"),
75+
title: const Text("Title"),
76+
subtitle: const Text("Subtitile"),
7977
),
8078
),
8179
);

example/pubspec.lock

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ packages:
77
name: async
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "2.6.1"
10+
version: "2.8.1"
1111
boolean_selector:
1212
dependency: transitive
1313
description:
@@ -28,7 +28,7 @@ packages:
2828
name: charcode
2929
url: "https://pub.dartlang.org"
3030
source: hosted
31-
version: "1.2.0"
31+
version: "1.3.1"
3232
clock:
3333
dependency: transitive
3434
description:
@@ -69,11 +69,25 @@ packages:
6969
description: flutter
7070
source: sdk
7171
version: "0.0.0"
72+
flutter_lints:
73+
dependency: "direct dev"
74+
description:
75+
name: flutter_lints
76+
url: "https://pub.dartlang.org"
77+
source: hosted
78+
version: "1.0.4"
7279
flutter_test:
7380
dependency: "direct dev"
7481
description: flutter
7582
source: sdk
7683
version: "0.0.0"
84+
lints:
85+
dependency: transitive
86+
description:
87+
name: lints
88+
url: "https://pub.dartlang.org"
89+
source: hosted
90+
version: "1.0.1"
7791
matcher:
7892
dependency: transitive
7993
description:
@@ -87,7 +101,7 @@ packages:
87101
name: meta
88102
url: "https://pub.dartlang.org"
89103
source: hosted
90-
version: "1.3.0"
104+
version: "1.7.0"
91105
path:
92106
dependency: transitive
93107
description:
@@ -148,7 +162,7 @@ packages:
148162
name: test_api
149163
url: "https://pub.dartlang.org"
150164
source: hosted
151-
version: "0.3.0"
165+
version: "0.4.2"
152166
typed_data:
153167
dependency: transitive
154168
description:

example/pubspec.yaml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@ name: example
22
version: 1.0.0+1
33
publish_to: none
44
description: A new Flutter project.
5-
environment:
6-
sdk: '>=2.12.0 <3.0.0'
5+
environment:
6+
sdk: ">=2.12.0 <3.0.0"
77

8-
dependencies:
8+
dependencies:
99
cupertino_icons: ^1.0.2
1010
draggable_home:
1111
path: ../
12-
flutter:
12+
flutter:
1313
sdk: flutter
1414

15-
dev_dependencies:
16-
flutter_test:
15+
dev_dependencies:
16+
flutter_test:
1717
sdk: flutter
18+
flutter_lints: ^1.0.0
1819

19-
flutter:
20+
flutter:
2021
uses-material-design: true

example/test/widget_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import 'package:example/main.dart';
1313
void main() {
1414
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
1515
// Build our app and trigger a frame.
16-
await tester.pumpWidget(MyApp());
16+
await tester.pumpWidget(const MyApp());
1717

1818
// Verify that our counter starts at 0.
1919
expect(find.text('0'), findsOneWidget);

pubspec.lock

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ packages:
77
name: async
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "2.6.1"
10+
version: "2.8.1"
1111
boolean_selector:
1212
dependency: transitive
1313
description:
@@ -28,7 +28,7 @@ packages:
2828
name: charcode
2929
url: "https://pub.dartlang.org"
3030
source: hosted
31-
version: "1.2.0"
31+
version: "1.3.1"
3232
clock:
3333
dependency: transitive
3434
description:
@@ -55,11 +55,25 @@ packages:
5555
description: flutter
5656
source: sdk
5757
version: "0.0.0"
58+
flutter_lints:
59+
dependency: "direct dev"
60+
description:
61+
name: flutter_lints
62+
url: "https://pub.dartlang.org"
63+
source: hosted
64+
version: "1.0.4"
5865
flutter_test:
5966
dependency: "direct dev"
6067
description: flutter
6168
source: sdk
6269
version: "0.0.0"
70+
lints:
71+
dependency: transitive
72+
description:
73+
name: lints
74+
url: "https://pub.dartlang.org"
75+
source: hosted
76+
version: "1.0.1"
6377
matcher:
6478
dependency: transitive
6579
description:
@@ -73,7 +87,7 @@ packages:
7387
name: meta
7488
url: "https://pub.dartlang.org"
7589
source: hosted
76-
version: "1.3.0"
90+
version: "1.7.0"
7791
path:
7892
dependency: transitive
7993
description:
@@ -134,7 +148,7 @@ packages:
134148
name: test_api
135149
url: "https://pub.dartlang.org"
136150
source: hosted
137-
version: "0.3.0"
151+
version: "0.4.2"
138152
typed_data:
139153
dependency: transitive
140154
description:

pubspec.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ dependencies:
1616
dev_dependencies:
1717
flutter_test:
1818
sdk: flutter
19+
flutter_lints: ^1.0.0
1920

20-
flutter: null
21+
flutter: null

0 commit comments

Comments
 (0)