mirror of
https://github.com/flutter/samples.git
synced 2026-03-29 07:41:41 +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:
@@ -17,4 +17,3 @@ linter:
|
||||
test_types_in_equals: true
|
||||
throw_in_finally: true
|
||||
unnecessary_statements: true
|
||||
use_key_in_widget_constructors: false
|
||||
|
||||
@@ -5,7 +5,8 @@ class Cook extends StatefulWidget {
|
||||
final String? img;
|
||||
final String? nme;
|
||||
|
||||
const Cook(this.dr, this.img, this.nme);
|
||||
const Cook(this.dr, this.img, this.nme, {Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
CState createState() => CState();
|
||||
}
|
||||
|
||||
@@ -1423,7 +1423,8 @@ class SwiperPluginView extends StatelessWidget {
|
||||
final SwiperPlugin plugin;
|
||||
final SwiperPluginConfig config;
|
||||
|
||||
const SwiperPluginView(this.plugin, this.config);
|
||||
const SwiperPluginView(this.plugin, this.config, {Key? key})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -5,16 +5,17 @@ import 'package:http/http.dart' as http;
|
||||
import 'cook.dart';
|
||||
import 'flutter_swiper.dart';
|
||||
|
||||
void main() => runApp(MyApp());
|
||||
void main() => runApp(const MyApp());
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
final _themeData = ThemeData(
|
||||
brightness: Brightness.light,
|
||||
iconTheme: const IconThemeData(color: Colors.red),
|
||||
);
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(context) {
|
||||
final _themeData = ThemeData(
|
||||
brightness: Brightness.light,
|
||||
iconTheme: const IconThemeData(color: Colors.red),
|
||||
);
|
||||
return MaterialApp(
|
||||
theme: _themeData.copyWith(
|
||||
colorScheme: _themeData.colorScheme.copyWith(
|
||||
@@ -22,11 +23,13 @@ class MyApp extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
title: "Filipino Cuisine",
|
||||
home: Home());
|
||||
home: const Home());
|
||||
}
|
||||
}
|
||||
|
||||
class Home extends StatefulWidget {
|
||||
const Home({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
HState createState() => HState();
|
||||
}
|
||||
|
||||
@@ -141,7 +141,8 @@ class ParallaxColor extends StatefulWidget {
|
||||
required this.colors,
|
||||
required this.info,
|
||||
required this.child,
|
||||
});
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
@@ -159,7 +160,9 @@ class ParallaxContainer extends StatelessWidget {
|
||||
{required this.child,
|
||||
required this.position,
|
||||
this.translationFactor = 100.0,
|
||||
this.opacityFactor = 1.0});
|
||||
this.opacityFactor = 1.0,
|
||||
Key? key})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -178,13 +181,14 @@ class ParallaxImage extends StatelessWidget {
|
||||
final double imageFactor;
|
||||
|
||||
ParallaxImage.asset(String name,
|
||||
{required double position, this.imageFactor = 0.3})
|
||||
{required double position, this.imageFactor = 0.3, Key? key})
|
||||
: image = Image.asset(name,
|
||||
fit: BoxFit.cover,
|
||||
alignment: FractionalOffset(
|
||||
0.5 + position * imageFactor,
|
||||
0.5,
|
||||
));
|
||||
)),
|
||||
super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -14,7 +14,7 @@ packages:
|
||||
name: characters
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
version: "1.2.0"
|
||||
charcode:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -19,4 +19,3 @@ linter:
|
||||
test_types_in_equals: true
|
||||
throw_in_finally: true
|
||||
unnecessary_statements: true
|
||||
use_key_in_widget_constructors: false
|
||||
|
||||
Reference in New Issue
Block a user