1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 13:58:47 +00:00

Upgrading samples to flutter_lints, part 1 of n (#804)

This commit is contained in:
Brett Morgan
2021-06-05 12:24:28 +10:00
committed by GitHub
parent 14921d0c06
commit 936d1fdaae
230 changed files with 2361 additions and 2444 deletions

View File

@@ -1,4 +1,4 @@
include: package:pedantic/analysis_options.1.9.0.yaml
include: package:flutter_lints/flutter.yaml
analyzer:
strong-mode:
@@ -7,25 +7,14 @@ analyzer:
linter:
rules:
- avoid_types_on_closure_parameters
- avoid_void_async
- await_only_futures
- camel_case_types
- cancel_subscriptions
- close_sinks
- constant_identifier_names
- control_flow_in_finally
- directives_ordering
- empty_statements
- hash_and_equals
- implementation_imports
- non_constant_identifier_names
- package_api_docs
- package_names
- package_prefixed_library_names
- test_types_in_equals
- throw_in_finally
- unnecessary_brace_in_string_interps
- unnecessary_getters_setters
- unnecessary_new
- unnecessary_statements
avoid_types_on_closure_parameters: true
avoid_void_async: true
cancel_subscriptions: true
close_sinks: true
directives_ordering: true
package_api_docs: true
package_prefixed_library_names: true
test_types_in_equals: true
throw_in_finally: true
unnecessary_statements: true
use_key_in_widget_constructors: false

View File

@@ -43,7 +43,7 @@ class DataTransferPage extends StatelessWidget {
'Number Generator Progress',
style: Theme.of(context).textTheme.headline6,
),
padding: EdgeInsets.all(8),
padding: const EdgeInsets.all(8),
),
LinearProgressIndicator(
value: controller.progressPercent,
@@ -213,7 +213,7 @@ class RunningList extends StatelessWidget {
),
color: Colors.lightGreenAccent,
),
Divider(
const Divider(
color: Colors.blue,
height: 3,
),

View File

@@ -76,7 +76,7 @@ class InfiniteProcessPage extends StatelessWidget {
inactiveTrackColor: Colors.deepOrangeAccent,
inactiveThumbColor: Colors.black,
),
Text('Pause/Resume'),
const Text('Pause/Resume'),
],
),
Row(
@@ -207,7 +207,7 @@ class RunningList extends StatelessWidget {
? Colors.lightGreenAccent
: Colors.deepOrangeAccent,
),
Divider(
const Divider(
color: Colors.blue,
height: 3,
),

View File

@@ -34,7 +34,7 @@ class HomePage extends StatelessWidget {
length: 3,
child: Scaffold(
appBar: AppBar(
bottom: TabBar(
bottom: const TabBar(
tabs: [
Tab(
icon: Icon(Icons.flash_on),
@@ -50,7 +50,7 @@ class HomePage extends StatelessWidget {
),
],
),
title: Text('Isolate Example'),
title: const Text('Isolate Example'),
),
body: TabBarView(
children: [

View File

@@ -46,7 +46,7 @@ class _PerformancePageState extends State<PerformancePage> {
SmoothAnimationWidget(),
Container(
alignment: Alignment.bottomCenter,
padding: EdgeInsets.only(top: 150),
padding: const EdgeInsets.only(top: 150),
child: Column(
children: [
FutureBuilder(
@@ -85,7 +85,7 @@ class _PerformancePageState extends State<PerformancePage> {
void handleComputeOnMain(BuildContext context) {
var future = computeOnMainIsolate()
..then((_) {
var snackBar = SnackBar(
var snackBar = const SnackBar(
content: Text('Main Isolate Done!'),
);
ScaffoldMessenger.of(context).showSnackBar(snackBar);
@@ -99,7 +99,7 @@ class _PerformancePageState extends State<PerformancePage> {
void handleComputeOnSecondary(BuildContext context) {
var future = computeOnSecondaryIsolate()
..then((_) {
var snackBar = SnackBar(
var snackBar = const SnackBar(
content: Text('Secondary Isolate Done!'),
);
ScaffoldMessenger.of(context).showSnackBar(snackBar);
@@ -114,7 +114,7 @@ class _PerformancePageState extends State<PerformancePage> {
// A delay is added here to give Flutter the chance to redraw the UI at
// least once before the computation (which, since it's run on the main
// isolate, will lock up the app) begins executing.
await Future<void>.delayed(Duration(milliseconds: 100));
await Future<void>.delayed(const Duration(milliseconds: 100));
fib(45);
}
@@ -156,14 +156,14 @@ class SmoothAnimationWidgetState extends State<SmoothAnimationWidget>
animation: _borderAnimation,
builder: (context, child) {
return Container(
child: FlutterLogo(
child: const FlutterLogo(
size: 200,
),
alignment: Alignment.bottomCenter,
width: 350,
height: 200,
decoration: BoxDecoration(
gradient: LinearGradient(
gradient: const LinearGradient(
begin: Alignment.topLeft,
colors: [
Colors.blueAccent,

View File

@@ -55,11 +55,25 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
lints:
dependency: transitive
description:
name: lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
matcher:
dependency: transitive
description:
@@ -88,20 +102,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
pedantic:
dependency: "direct dev"
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0"
provider:
dependency: "direct main"
description:
name: provider
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.0-nullsafety.5"
version: "5.0.0"
sky_engine:
dependency: transitive
description: flutter

View File

@@ -3,18 +3,17 @@ description: A Flutter sample to demonstrate isolates
version: 1.0.0+1
environment:
sdk: ">=2.12.0-0 <3.0.0"
sdk: ">=2.12.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
provider: ^5.0.0-0
provider: ^5.0.0
dev_dependencies:
flutter_test:
sdk: flutter
pedantic: ^1.10.0
flutter_lints: ^1.0.0
flutter:
uses-material-design: true