mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
Enforce use_key_in_widget_constructors and file_names lints (#913)
* Start enforcing use_key_in_widget_constructors and file_names lints * dart format * analysis fixes * analysis fixes, pt2 * analysis fixes, part 3 * Revert platform_design (test failure) * More reverts * Notate why we aren't enforcing a lint
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
name: federated_plugin_platform_interface
|
||||
description: A platform interface for federated_plugin.
|
||||
version: 0.0.1
|
||||
author:
|
||||
homepage:
|
||||
publish_to: none
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
name: federated_plugin_windows
|
||||
description: Windows implementation of federated_plugin to retrieve current battery level.
|
||||
version: 0.0.1
|
||||
author:
|
||||
homepage:
|
||||
publish_to: none
|
||||
|
||||
|
||||
@@ -15,10 +15,8 @@ linter:
|
||||
cancel_subscriptions: true
|
||||
close_sinks: true
|
||||
directives_ordering: true
|
||||
file_names: false
|
||||
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
|
||||
|
||||
@@ -17,4 +17,3 @@ linter:
|
||||
test_types_in_equals: true
|
||||
throw_in_finally: true
|
||||
unnecessary_statements: true
|
||||
use_key_in_widget_constructors: false
|
||||
|
||||
@@ -39,14 +39,16 @@ class DashboardApp extends StatefulWidget {
|
||||
final ApiBuilder apiBuilder;
|
||||
|
||||
/// Runs the app using Firebase
|
||||
DashboardApp.firebase()
|
||||
DashboardApp.firebase({Key key})
|
||||
: auth = FirebaseAuthService(),
|
||||
apiBuilder = _apiBuilder;
|
||||
apiBuilder = _apiBuilder,
|
||||
super(key: key);
|
||||
|
||||
/// Runs the app using mock data
|
||||
DashboardApp.mock()
|
||||
DashboardApp.mock({Key key})
|
||||
: auth = MockAuthService(),
|
||||
apiBuilder = _mockApiBuilder;
|
||||
apiBuilder = _mockApiBuilder,
|
||||
super(key: key);
|
||||
|
||||
@override
|
||||
_DashboardAppState createState() => _DashboardAppState();
|
||||
@@ -84,7 +86,8 @@ class SignInSwitcher extends StatefulWidget {
|
||||
const SignInSwitcher({
|
||||
this.appState,
|
||||
this.apiBuilder,
|
||||
});
|
||||
Key key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_SignInSwitcherState createState() => _SignInSwitcherState();
|
||||
|
||||
@@ -10,6 +10,8 @@ import '../app.dart';
|
||||
import '../widgets/category_chart.dart';
|
||||
|
||||
class DashboardPage extends StatelessWidget {
|
||||
const DashboardPage({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var appState = Provider.of<AppState>(context);
|
||||
@@ -41,7 +43,7 @@ class DashboardPage extends StatelessWidget {
|
||||
class Dashboard extends StatelessWidget {
|
||||
final List<Category> categories;
|
||||
|
||||
const Dashboard(this.categories);
|
||||
const Dashboard(this.categories, {Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -12,6 +12,8 @@ import '../widgets/categories_dropdown.dart';
|
||||
import '../widgets/dialogs.dart';
|
||||
|
||||
class EntriesPage extends StatefulWidget {
|
||||
const EntriesPage({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_EntriesPageState createState() => _EntriesPageState();
|
||||
}
|
||||
@@ -100,7 +102,8 @@ class EntryTile extends StatelessWidget {
|
||||
const EntryTile({
|
||||
this.category,
|
||||
this.entry,
|
||||
});
|
||||
Key key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -14,7 +14,8 @@ class HomePage extends StatefulWidget {
|
||||
|
||||
const HomePage({
|
||||
@required this.onSignOut,
|
||||
});
|
||||
Key key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_HomePageState createState() => _HomePageState();
|
||||
@@ -70,7 +71,7 @@ class _HomePageState extends State<HomePage> {
|
||||
if (_pageIndex == 0) {
|
||||
showDialog<NewCategoryDialog>(
|
||||
context: context,
|
||||
builder: (context) => NewCategoryDialog(),
|
||||
builder: (context) => const NewCategoryDialog(),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -78,7 +79,7 @@ class _HomePageState extends State<HomePage> {
|
||||
if (_pageIndex == 1) {
|
||||
showDialog<NewEntryDialog>(
|
||||
context: context,
|
||||
builder: (context) => NewEntryDialog(),
|
||||
builder: (context) => const NewEntryDialog(),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -115,11 +116,11 @@ class _HomePageState extends State<HomePage> {
|
||||
|
||||
static Widget _pageAtIndex(int index) {
|
||||
if (index == 0) {
|
||||
return DashboardPage();
|
||||
return const DashboardPage();
|
||||
}
|
||||
|
||||
if (index == 1) {
|
||||
return EntriesPage();
|
||||
return const EntriesPage();
|
||||
}
|
||||
|
||||
return const Center(child: Text('Settings page'));
|
||||
|
||||
@@ -13,7 +13,8 @@ class SignInPage extends StatelessWidget {
|
||||
const SignInPage({
|
||||
@required this.auth,
|
||||
@required this.onSuccess,
|
||||
});
|
||||
Key key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -32,7 +33,8 @@ class SignInButton extends StatefulWidget {
|
||||
const SignInButton({
|
||||
@required this.auth,
|
||||
@required this.onSuccess,
|
||||
});
|
||||
Key key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_SignInButtonState createState() => _SignInButtonState();
|
||||
|
||||
@@ -16,7 +16,8 @@ class CategoryDropdown extends StatefulWidget {
|
||||
const CategoryDropdown({
|
||||
@required this.api,
|
||||
@required this.onSelected,
|
||||
});
|
||||
Key key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_CategoryDropdownState createState() => _CategoryDropdownState();
|
||||
|
||||
@@ -20,7 +20,8 @@ class CategoryChart extends StatelessWidget {
|
||||
const CategoryChart({
|
||||
@required this.category,
|
||||
@required this.api,
|
||||
});
|
||||
Key key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -8,6 +8,8 @@ import 'package:web_dashboard/src/api/api.dart';
|
||||
import 'package:web_dashboard/src/app.dart';
|
||||
|
||||
class NewCategoryForm extends StatefulWidget {
|
||||
const NewCategoryForm({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_NewCategoryFormState createState() => _NewCategoryFormState();
|
||||
}
|
||||
@@ -37,7 +39,8 @@ class EditCategoryForm extends StatefulWidget {
|
||||
const EditCategoryForm({
|
||||
@required this.category,
|
||||
@required this.onDone,
|
||||
});
|
||||
Key key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_EditCategoryFormState createState() => _EditCategoryFormState();
|
||||
|
||||
@@ -11,10 +11,12 @@ import '../app.dart';
|
||||
import 'edit_entry.dart';
|
||||
|
||||
class NewCategoryDialog extends StatelessWidget {
|
||||
const NewCategoryDialog({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SimpleDialog(
|
||||
title: const Text('New Category'),
|
||||
return const SimpleDialog(
|
||||
title: Text('New Category'),
|
||||
children: <Widget>[
|
||||
NewCategoryForm(),
|
||||
],
|
||||
@@ -27,7 +29,8 @@ class EditCategoryDialog extends StatelessWidget {
|
||||
|
||||
const EditCategoryDialog({
|
||||
@required this.category,
|
||||
});
|
||||
Key key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -51,6 +54,8 @@ class EditCategoryDialog extends StatelessWidget {
|
||||
}
|
||||
|
||||
class NewEntryDialog extends StatefulWidget {
|
||||
const NewEntryDialog({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_NewEntryDialogState createState() => _NewEntryDialogState();
|
||||
}
|
||||
@@ -58,8 +63,8 @@ class NewEntryDialog extends StatefulWidget {
|
||||
class _NewEntryDialogState extends State<NewEntryDialog> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SimpleDialog(
|
||||
title: const Text('New Entry'),
|
||||
return const SimpleDialog(
|
||||
title: Text('New Entry'),
|
||||
children: [
|
||||
NewEntryForm(),
|
||||
],
|
||||
@@ -74,7 +79,8 @@ class EditEntryDialog extends StatelessWidget {
|
||||
const EditEntryDialog({
|
||||
this.category,
|
||||
this.entry,
|
||||
});
|
||||
Key key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -11,6 +11,8 @@ import '../app.dart';
|
||||
import 'categories_dropdown.dart';
|
||||
|
||||
class NewEntryForm extends StatefulWidget {
|
||||
const NewEntryForm({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_NewEntryFormState createState() => _NewEntryFormState();
|
||||
}
|
||||
@@ -58,7 +60,8 @@ class EditEntryForm extends StatefulWidget {
|
||||
const EditEntryForm({
|
||||
@required this.entry,
|
||||
@required this.onDone,
|
||||
});
|
||||
Key key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_EditEntryFormState createState() => _EditEntryFormState();
|
||||
|
||||
@@ -43,7 +43,8 @@ class AdaptiveScaffold extends StatefulWidget {
|
||||
@required this.destinations,
|
||||
this.onNavigationIndexChange,
|
||||
this.floatingActionButton,
|
||||
});
|
||||
Key key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_AdaptiveScaffoldState createState() => _AdaptiveScaffoldState();
|
||||
|
||||
Reference in New Issue
Block a user