mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 22:09:06 +00:00
platform_design: Enforce use_key_in_widget_constructors (#927)
This commit is contained in:
@@ -13,6 +13,8 @@ class ProfileTab extends StatelessWidget {
|
||||
static const androidIcon = Icon(Icons.person);
|
||||
static const iosIcon = Icon(CupertinoIcons.profile_circled);
|
||||
|
||||
const ProfileTab({Key? key}) : super(key: key);
|
||||
|
||||
Widget _buildBody(BuildContext context) {
|
||||
return SafeArea(
|
||||
child: Padding(
|
||||
@@ -55,7 +57,7 @@ class ProfileTab extends StatelessWidget {
|
||||
Expanded(
|
||||
child: Container(),
|
||||
),
|
||||
LogOutButton(),
|
||||
const LogOutButton(),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -89,7 +91,7 @@ class ProfileTab extends StatelessWidget {
|
||||
CupertinoPageRoute(
|
||||
title: SettingsTab.title,
|
||||
fullscreenDialog: true,
|
||||
builder: (context) => SettingsTab(),
|
||||
builder: (context) => const SettingsTab(),
|
||||
),
|
||||
);
|
||||
},
|
||||
@@ -113,7 +115,8 @@ class PreferenceCard extends StatelessWidget {
|
||||
required this.header,
|
||||
required this.content,
|
||||
required this.preferenceChoices,
|
||||
});
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
|
||||
final String header;
|
||||
final String content;
|
||||
@@ -171,6 +174,8 @@ class LogOutButton extends StatelessWidget {
|
||||
static const _logoutMessage = Text(
|
||||
"You can't actually log out! This is just a demo of how alerts work.");
|
||||
|
||||
const LogOutButton({Key? key}) : super(key: key);
|
||||
|
||||
// ===========================================================================
|
||||
// Non-shared code below because this tab shows different interfaces. On
|
||||
// Android, it's showing an alert dialog with 2 buttons and on iOS,
|
||||
|
||||
Reference in New Issue
Block a user