mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Use super parameters in templates (#101157)
This commit is contained in:
parent
cc4cc699f8
commit
329ceaef66
@ -17,7 +17,7 @@ void main() {
|
|||||||
|
|
||||||
{{^withPluginHook}}
|
{{^withPluginHook}}
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
const MyApp({Key? key}) : super(key: key);
|
const MyApp({super.key});
|
||||||
|
|
||||||
// This widget is the root of your application.
|
// This widget is the root of your application.
|
||||||
@override
|
@override
|
||||||
@ -42,7 +42,7 @@ class MyApp extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class MyHomePage extends StatefulWidget {
|
class MyHomePage extends StatefulWidget {
|
||||||
const MyHomePage({Key? key, required this.title}) : super(key: key);
|
const MyHomePage({super.key, required this.title});
|
||||||
|
|
||||||
// This widget is the home page of your application. It is stateful, meaning
|
// This widget is the home page of your application. It is stateful, meaning
|
||||||
// that it has a State object (defined below) that contains fields that affect
|
// that it has a State object (defined below) that contains fields that affect
|
||||||
@ -128,7 +128,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
{{/withPluginHook}}
|
{{/withPluginHook}}
|
||||||
{{#withPlatformChannelPluginHook}}
|
{{#withPlatformChannelPluginHook}}
|
||||||
class MyApp extends StatefulWidget {
|
class MyApp extends StatefulWidget {
|
||||||
const MyApp({Key? key}) : super(key: key);
|
const MyApp({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<MyApp> createState() => _MyAppState();
|
State<MyApp> createState() => _MyAppState();
|
||||||
@ -183,7 +183,7 @@ class _MyAppState extends State<MyApp> {
|
|||||||
{{/withPlatformChannelPluginHook}}
|
{{/withPlatformChannelPluginHook}}
|
||||||
{{#withFfiPluginHook}}
|
{{#withFfiPluginHook}}
|
||||||
class MyApp extends StatefulWidget {
|
class MyApp extends StatefulWidget {
|
||||||
const MyApp({Key? key}) : super(key: key);
|
const MyApp({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_MyAppState createState() => _MyAppState();
|
_MyAppState createState() => _MyAppState();
|
||||||
|
@ -10,7 +10,7 @@ void main() => runApp(const MyApp());
|
|||||||
|
|
||||||
{{^withPlatformChannelPluginHook}}
|
{{^withPlatformChannelPluginHook}}
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
const MyApp({Key? key}) : super(key: key);
|
const MyApp({super.key});
|
||||||
|
|
||||||
// This widget is the root of your application.
|
// This widget is the root of your application.
|
||||||
@override
|
@override
|
||||||
@ -34,7 +34,7 @@ class MyApp extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class MyHomePage extends StatefulWidget {
|
class MyHomePage extends StatefulWidget {
|
||||||
const MyHomePage({Key? key, required this.title}) : super(key: key);
|
const MyHomePage({super.key, required this.title});
|
||||||
|
|
||||||
// This widget is the home page of your application. It is stateful, meaning
|
// This widget is the home page of your application. It is stateful, meaning
|
||||||
// that it has a State object (defined below) that contains fields that affect
|
// that it has a State object (defined below) that contains fields that affect
|
||||||
@ -120,7 +120,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
{{/withPlatformChannelPluginHook}}
|
{{/withPlatformChannelPluginHook}}
|
||||||
{{#withPlatformChannelPluginHook}}
|
{{#withPlatformChannelPluginHook}}
|
||||||
class MyApp extends StatefulWidget {
|
class MyApp extends StatefulWidget {
|
||||||
const MyApp({Key? key}) : super(key: key);
|
const MyApp({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<MyApp> createState() => _MyAppState();
|
State<MyApp> createState() => _MyAppState();
|
||||||
|
@ -10,9 +10,9 @@ import 'settings/settings_view.dart';
|
|||||||
/// The Widget that configures your application.
|
/// The Widget that configures your application.
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
const MyApp({
|
const MyApp({
|
||||||
Key? key,
|
super.key,
|
||||||
required this.settingsController,
|
required this.settingsController,
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
final SettingsController settingsController;
|
final SettingsController settingsController;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
|
|
||||||
/// Displays detailed information about a SampleItem.
|
/// Displays detailed information about a SampleItem.
|
||||||
class SampleItemDetailsView extends StatelessWidget {
|
class SampleItemDetailsView extends StatelessWidget {
|
||||||
const SampleItemDetailsView({Key? key}) : super(key: key);
|
const SampleItemDetailsView({super.key});
|
||||||
|
|
||||||
static const routeName = '/sample_item';
|
static const routeName = '/sample_item';
|
||||||
|
|
||||||
|
@ -7,9 +7,9 @@ import 'sample_item_details_view.dart';
|
|||||||
/// Displays a list of SampleItems.
|
/// Displays a list of SampleItems.
|
||||||
class SampleItemListView extends StatelessWidget {
|
class SampleItemListView extends StatelessWidget {
|
||||||
const SampleItemListView({
|
const SampleItemListView({
|
||||||
Key? key,
|
super.key,
|
||||||
this.items = const [SampleItem(1), SampleItem(2), SampleItem(3)],
|
this.items = const [SampleItem(1), SampleItem(2), SampleItem(3)],
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
static const routeName = '/';
|
static const routeName = '/';
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import 'settings_controller.dart';
|
|||||||
/// When a user changes a setting, the SettingsController is updated and
|
/// When a user changes a setting, the SettingsController is updated and
|
||||||
/// Widgets that listen to the SettingsController are rebuilt.
|
/// Widgets that listen to the SettingsController are rebuilt.
|
||||||
class SettingsView extends StatelessWidget {
|
class SettingsView extends StatelessWidget {
|
||||||
const SettingsView({Key? key, required this.controller}) : super(key: key);
|
const SettingsView({super.key, required this.controller});
|
||||||
|
|
||||||
static const routeName = '/settings';
|
static const routeName = '/settings';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user