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.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

@@ -30,7 +30,7 @@ class MyHomePage extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Infinite List Sample'),
title: const Text('Infinite List Sample'),
),
body: Selector<Catalog, int?>(
// Selector is a widget from package:provider. It allows us to listen
@@ -54,7 +54,7 @@ class MyHomePage extends StatelessWidget {
var item = catalog.getByIndex(index);
if (item.isLoading) {
return LoadingItemTile();
return const LoadingItemTile();
}
return ItemTile(item: item);

View File

@@ -11,7 +11,7 @@ import 'api/item.dart';
class ItemTile extends StatelessWidget {
final Item item;
ItemTile({required this.item, Key? key}) : super(key: key);
const ItemTile({required this.item, Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
@@ -41,12 +41,12 @@ class LoadingItemTile extends StatelessWidget {
return Padding(
padding: const EdgeInsets.all(8.0),
child: ListTile(
leading: AspectRatio(
leading: const AspectRatio(
aspectRatio: 1,
child: Placeholder(),
),
title: Text('...', style: Theme.of(context).textTheme.headline6),
trailing: Text('\$ ...'),
trailing: const Text('\$ ...'),
),
);
}

View File

@@ -49,7 +49,7 @@ packages:
name: cupertino_icons
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
version: "1.0.3"
fake_async:
dependency: transitive
description:
@@ -62,11 +62,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:
@@ -87,7 +101,7 @@ packages:
name: nested
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.5-nullsafety.1"
version: "1.0.0"
path:
dependency: transitive
description:
@@ -95,20 +109,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.3"
version: "5.0.0"
sky_engine:
dependency: transitive
description: flutter

View File

@@ -5,7 +5,7 @@ description: >
version: 1.0.0+1
environment:
sdk: '>=2.12.0-0 <3.0.0'
sdk: ">=2.12.0 <3.0.0"
dependencies:
flutter:
@@ -18,8 +18,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
pedantic: ^1.10.0
flutter_lints: ^1.0.0
flutter:
uses-material-design: true

View File

@@ -25,7 +25,7 @@ void main() {
expect(find.text('Color #1'), findsOneWidget);
// Flinging up quickly (i.e. scrolling down).
await tester.fling(find.byType(ListView), Offset(0, -2000), 5000);
await tester.fling(find.byType(ListView), const Offset(0, -2000), 5000);
// As we scroll down, we should see more items loading.
expect(find.text('...'), findsWidgets);