Skip to content

Commit 91d4c9e

Browse files
committed
Pedantic to flutter_lints
1 parent 99798ae commit 91d4c9e

15 files changed

+183
-165
lines changed

Libraries.txt

+17-17
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,15 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
9898
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9999

100100
//-------------------------------------------------------------
101-
pedantic
101+
flutter_lints
102102

103-
version 1.11.0
103+
version 1.0.4
104104

105-
Copyright 2017, the Dart project authors. All rights reserved.
106-
Redistribution and use in source and binary forms, with or without
107-
modification, are permitted provided that the following conditions are
108-
met:
105+
106+
Copyright 2013 The Flutter Authors. All rights reserved.
107+
108+
Redistribution and use in source and binary forms, with or without modification,
109+
are permitted provided that the following conditions are met:
109110

110111
* Redistributions of source code must retain the above copyright
111112
notice, this list of conditions and the following disclaimer.
@@ -117,17 +118,16 @@ met:
117118
contributors may be used to endorse or promote products derived
118119
from this software without specific prior written permission.
119120

120-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
121-
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
122-
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
123-
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
124-
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
125-
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
126-
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
127-
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
128-
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
129-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
130-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
121+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
122+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
123+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
124+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
125+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
126+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
127+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
128+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
129+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
130+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
131131

132132

133133
//-------------------------------------------------------------

analysis_options.yaml

+10-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1-
include: package:pedantic/analysis_options.yaml
1+
include: package:flutter_lints/flutter.yaml
2+
3+
linter:
4+
rules:
5+
constant_identifier_names: false
6+
non_constant_identifier_names: false
7+
avoid_print: false
8+
prefer_const_constructors_in_immutables: false
9+
use_key_in_widget_constructors: false
10+
no_logic_in_create_state: false

ios/Podfile.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ SPEC CHECKSUMS:
5050

5151
PODFILE CHECKSUM: 7368163408c647b7eb699d0d788ba6718e18fb8d
5252

53-
COCOAPODS: 1.10.1
53+
COCOAPODS: 1.10.2

lib/main.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -491,11 +491,11 @@ class _MainPageWidgetState extends State<MainPageWidget> {
491491
void showResultTextDialog(result) {
492492
Widget okButton = TextButton(
493493
onPressed: () => Navigator.pop(context),
494-
child: Text('OK'),
494+
child: const Text('OK'),
495495
);
496496
// set up the AlertDialog
497497
var alert = AlertDialog(
498-
title: Text('Result'),
498+
title: const Text('Result'),
499499
content: Text(result),
500500
actions: [
501501
okButton,

lib/ui/barcode_preview.dart

+6-6
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ class BarcodesResultPreviewWidget extends StatelessWidget {
1515
Widget build(BuildContext context) {
1616
return Scaffold(
1717
appBar: AppBar(
18-
iconTheme: IconThemeData(),
18+
iconTheme: const IconThemeData(),
1919
leading: GestureDetector(
2020
onTap: () {
2121
Navigator.of(context).pop();
2222
},
23-
child: Icon(
23+
child: const Icon(
2424
Icons.arrow_back,
2525
color: Colors.black,
2626
),
@@ -58,12 +58,12 @@ class BarcodesResultPreviewWidget extends StatelessWidget {
5858
var file = File.fromUri(imageUri);
5959
if (file.existsSync() == true) {
6060
if (shouldInitWithEncryption) {
61-
return Container(
61+
return SizedBox(
6262
height: 200,
6363
child: EncryptedPageWidget(imageUri),
6464
);
6565
} else {
66-
return Container(
66+
return SizedBox(
6767
height: 200,
6868
child: PageWidget(imageUri),
6969
);
@@ -89,7 +89,7 @@ class BarcodeItemWidget extends StatelessWidget {
8989
padding: const EdgeInsets.all(8.0),
9090
child: Text(
9191
barcodeFormatEnumMap[item.barcodeFormat] ?? 'UNKNOWN',
92-
style: TextStyle(
92+
style: const TextStyle(
9393
inherit: true,
9494
color: Colors.black,
9595
),
@@ -99,7 +99,7 @@ class BarcodeItemWidget extends StatelessWidget {
9999
padding: const EdgeInsets.all(8.0),
100100
child: Text(
101101
item.text ?? '',
102-
style: TextStyle(
102+
style: const TextStyle(
103103
inherit: true,
104104
color: Colors.black,
105105
),

lib/ui/filter_all_pages_widget.dart

+9-9
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ class MultiPageFiltering extends StatelessWidget {
2323
onTap: () {
2424
filterPreviewWidget.applyFilter();
2525
},
26-
child: Center(
26+
child: const Center(
2727
child: Padding(
28-
padding: const EdgeInsets.all(16.0),
29-
child: const Text(
28+
padding: EdgeInsets.all(16.0),
29+
child: Text(
3030
'APPLY',
3131
style: TextStyle(
3232
inherit: true,
@@ -37,7 +37,7 @@ class MultiPageFiltering extends StatelessWidget {
3737
),
3838
),
3939
],
40-
iconTheme: IconThemeData(
40+
iconTheme: const IconThemeData(
4141
color: Colors.black, //change your color here
4242
),
4343
backgroundColor: Colors.white,
@@ -85,8 +85,8 @@ class MultiFilterPreviewWidgetState extends State<MultiFilterPreviewWidget> {
8585
return ListView(
8686
shrinkWrap: true,
8787
children: <Widget>[
88-
Padding(
89-
padding: const EdgeInsets.all(16.0),
88+
const Padding(
89+
padding: EdgeInsets.all(16.0),
9090
child: Text('Select filter',
9191
style: TextStyle(
9292
inherit: true,
@@ -110,7 +110,7 @@ class MultiFilterPreviewWidgetState extends State<MultiFilterPreviewWidget> {
110110
Text titleFromFilterType(ImageFilterType filterType) {
111111
return Text(
112112
filterType.toString().replaceAll('ImageFilterType.', ''),
113-
style: TextStyle(
113+
style: const TextStyle(
114114
inherit: true,
115115
color: Colors.black,
116116
fontStyle: FontStyle.normal,
@@ -142,9 +142,9 @@ class MultiFilterPreviewWidgetState extends State<MultiFilterPreviewWidget> {
142142

143143
try {
144144
final pages = await Future.wait(futures);
145-
pages.forEach((page) {
145+
for(var page in pages){
146146
_pageRepository.updatePage(page);
147-
});
147+
}
148148
} catch (e) {
149149
print(e);
150150
}

lib/ui/filter_page_widget.dart

+8-8
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ class PageFiltering extends StatelessWidget {
2323
onTap: () {
2424
filterPreviewWidget.applyFilter();
2525
},
26-
child: Center(
26+
child: const Center(
2727
child: Padding(
28-
padding: const EdgeInsets.all(16.0),
29-
child: const Text('APPLY',
28+
padding: EdgeInsets.all(16.0),
29+
child: Text('APPLY',
3030
style: TextStyle(inherit: true, color: Colors.black)),
3131
),
3232
),
3333
),
3434
],
35-
iconTheme: IconThemeData(
35+
iconTheme: const IconThemeData(
3636
color: Colors.black, //change your color here
3737
),
3838
backgroundColor: Colors.white,
@@ -90,7 +90,7 @@ class FilterPreviewWidgetState extends State<FilterPreviewWidget> {
9090
shrinkWrap: true,
9191
children: <Widget>[
9292
buildContainer(image),
93-
Text('Select filter',
93+
const Text('Select filter',
9494
style: TextStyle(
9595
inherit: true,
9696
color: Colors.black,
@@ -112,9 +112,9 @@ class FilterPreviewWidgetState extends State<FilterPreviewWidget> {
112112
Container buildContainer(Widget image) {
113113
return Container(
114114
height: 400,
115-
padding: EdgeInsets.fromLTRB(0, 8, 0, 8),
115+
padding: const EdgeInsets.fromLTRB(0, 8, 0, 8),
116116
child: Center(
117-
child: Container(
117+
child: SizedBox(
118118
height: double.infinity,
119119
width: double.infinity,
120120
child: Center(child: image),
@@ -126,7 +126,7 @@ class FilterPreviewWidgetState extends State<FilterPreviewWidget> {
126126
Text titleFromFilterType(c.ImageFilterType filterType) {
127127
return Text(
128128
filterType.toString().replaceAll('ImageFilterType.', ''),
129-
style: TextStyle(
129+
style: const TextStyle(
130130
inherit: true,
131131
color: Colors.black,
132132
fontStyle: FontStyle.normal,

lib/ui/menu_items.dart

+4-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ class MenuItemWidget extends StatelessWidget {
1818
trailing: endIcon != null ? Icon(endIcon) : null,
1919
title: Text(
2020
title,
21-
style: TextStyle(inherit: true, fontSize: 16.0, color: Colors.black87),
21+
style: const
22+
TextStyle(inherit: true, fontSize: 16.0, color: Colors.black87),
2223
),
2324
onTap: onTap,
2425
);
@@ -27,7 +28,7 @@ class MenuItemWidget extends StatelessWidget {
2728
crossAxisAlignment: CrossAxisAlignment.start,
2829
children: <Widget>[
2930
listTile,
30-
Divider(
31+
const Divider(
3132
color: Colors.black26,
3233
height: 0,
3334
endIndent: 16,
@@ -51,7 +52,7 @@ class TitleItemWidget extends StatelessWidget {
5152
height: 52,
5253
child: Text(
5354
title.toUpperCase(),
54-
style: TextStyle(inherit: true, fontSize: 16.0, color: Colors.black),
55+
style: const TextStyle(inherit: true, fontSize: 16.0, color: Colors.black),
5556
),
5657
);
5758
}

lib/ui/operations_page_widget.dart

+10-11
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import 'package:scanbot_sdk/common_data.dart' as sdk;
66
import 'package:scanbot_sdk/cropping_screen_data.dart';
77
import 'package:scanbot_sdk/scanbot_sdk.dart';
88
import 'package:scanbot_sdk/scanbot_sdk_ui.dart';
9-
import 'package:scanbot_sdk_example_flutter/ui/progress_dialog.dart';
109
import 'package:scanbot_sdk_example_flutter/ui/utils.dart';
1110

1211
import '../main.dart';
@@ -51,7 +50,7 @@ class _PageOperationsState extends State<PageOperations> {
5150
}
5251
return Scaffold(
5352
appBar: AppBar(
54-
iconTheme: IconThemeData(
53+
iconTheme: const IconThemeData(
5554
color: Colors.black, //change your color here
5655
),
5756
backgroundColor: Colors.white,
@@ -61,12 +60,12 @@ class _PageOperationsState extends State<PageOperations> {
6160
),
6261
actions: [
6362
Padding(
64-
padding: EdgeInsets.only(right: 20.0),
63+
padding: const EdgeInsets.only(right: 20.0),
6564
child: GestureDetector(
6665
onTap: () {
6766
_estimateBlurriness(_page);
6867
},
69-
child: Icon(
68+
child: const Icon(
7069
Icons.image_search,
7170
size: 26.0,
7271
),
@@ -78,7 +77,7 @@ class _PageOperationsState extends State<PageOperations> {
7877
children: <Widget>[
7978
Expanded(
8079
child: Container(
81-
padding: EdgeInsets.fromLTRB(0, 8, 0, 8),
80+
padding: const EdgeInsets.fromLTRB(0, 8, 0, 8),
8281
child: Center(child: pageView))),
8382
BottomAppBar(
8483
child: Row(
@@ -91,9 +90,9 @@ class _PageOperationsState extends State<PageOperations> {
9190
},
9291
child: Row(
9392
children: <Widget>[
94-
Icon(Icons.crop),
93+
const Icon(Icons.crop),
9594
Container(width: 4),
96-
Text(
95+
const Text(
9796
'Crop & Rotate',
9897
style: TextStyle(inherit: true, color: Colors.black),
9998
),
@@ -106,9 +105,9 @@ class _PageOperationsState extends State<PageOperations> {
106105
},
107106
child: Row(
108107
children: <Widget>[
109-
Icon(Icons.filter),
108+
const Icon(Icons.filter),
110109
Container(width: 4),
111-
Text(
110+
const Text(
112111
'Filter',
113112
style: TextStyle(inherit: true, color: Colors.black),
114113
),
@@ -121,9 +120,9 @@ class _PageOperationsState extends State<PageOperations> {
121120
},
122121
child: Row(
123122
children: <Widget>[
124-
Icon(Icons.delete, color: Colors.red),
123+
const Icon(Icons.delete, color: Colors.red),
125124
Container(width: 4),
126-
Text(
125+
const Text(
127126
'Delete',
128127
style: TextStyle(inherit: true, color: Colors.red),
129128
),

lib/ui/pages_widget.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class PageWidget extends StatelessWidget {
2121
// width: double.infinity,
2222
// );
2323
final image = Image.memory(bytes);
24-
return Container(
24+
return SizedBox(
2525
height: double.infinity,
2626
width: double.infinity,
2727
child: Center(child: image),
@@ -46,7 +46,7 @@ class EncryptedPageWidget extends StatelessWidget {
4646
// width: double.infinity,
4747
// );
4848
final imageData = ScanbotEncryptionHandler.getDecryptedDataFromFile(path);
49-
return Container(
49+
return SizedBox(
5050
height: double.infinity,
5151
width: double.infinity,
5252
child: FutureBuilder(

0 commit comments

Comments
 (0)