mirror of
https://github.com/flutter/samples.git
synced 2026-05-05 22:46:57 +00:00
Upgrading samples to flutter_lints, part 1 of n (#804)
This commit is contained in:
@@ -22,7 +22,7 @@ class FrostedBox extends StatelessWidget {
|
||||
return BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
decoration: const BoxDecoration(
|
||||
color: Styles.frostedBackground,
|
||||
),
|
||||
child: child,
|
||||
@@ -117,7 +117,7 @@ class CloseButtonState extends State<CloseButton> {
|
||||
child: Center(
|
||||
child: ColorChangingIcon(
|
||||
CupertinoIcons.clear_thick,
|
||||
duration: Duration(milliseconds: 300),
|
||||
duration: const Duration(milliseconds: 300),
|
||||
color: tapInProgress
|
||||
? Styles.closeButtonPressed
|
||||
: Styles.closeButtonUnpressed,
|
||||
|
||||
@@ -21,7 +21,7 @@ class SettingsGroupHeader extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 15,
|
||||
right: 15,
|
||||
bottom: 6,
|
||||
@@ -42,7 +42,7 @@ class SettingsGroupFooter extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 15,
|
||||
right: 15,
|
||||
top: 7.5,
|
||||
|
||||
@@ -20,7 +20,7 @@ class SettingsNavigationIndicator extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Icon(
|
||||
return const Icon(
|
||||
CupertinoIcons.forward,
|
||||
color: Styles.settingsMediumGray,
|
||||
size: 21,
|
||||
@@ -99,7 +99,7 @@ class SettingsItemState extends State<SettingsItem> {
|
||||
});
|
||||
await widget.onPress();
|
||||
Future.delayed(
|
||||
Duration(milliseconds: 150),
|
||||
const Duration(milliseconds: 150),
|
||||
() {
|
||||
setState(() {
|
||||
pressed = false;
|
||||
@@ -133,10 +133,10 @@ class SettingsItemState extends State<SettingsItem> {
|
||||
? Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
SizedBox(height: 8.5),
|
||||
const SizedBox(height: 8.5),
|
||||
Text(widget.label,
|
||||
style: themeData.textTheme.textStyle),
|
||||
SizedBox(height: 4),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
widget.subtitle,
|
||||
style: Styles.settingsItemSubtitleText(themeData),
|
||||
@@ -144,7 +144,7 @@ class SettingsItemState extends State<SettingsItem> {
|
||||
],
|
||||
)
|
||||
: Padding(
|
||||
padding: EdgeInsets.only(top: 1.5),
|
||||
padding: const EdgeInsets.only(top: 1.5),
|
||||
child: Text(widget.label,
|
||||
style: themeData.textTheme.textStyle),
|
||||
),
|
||||
|
||||
@@ -135,7 +135,7 @@ class _TriviaViewState extends State<TriviaView> with RestorationMixin {
|
||||
'All done!',
|
||||
style: Styles.triviaFinishedTitleText(themeData),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
const SizedBox(height: 16),
|
||||
Text('You answered', style: themeData.textTheme.textStyle),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -157,9 +157,9 @@ class _TriviaViewState extends State<TriviaView> with RestorationMixin {
|
||||
],
|
||||
),
|
||||
Text('questions correctly!', style: themeData.textTheme.textStyle),
|
||||
SizedBox(height: 16),
|
||||
const SizedBox(height: 16),
|
||||
CupertinoButton(
|
||||
child: Text('Try Again'),
|
||||
child: const Text('Try Again'),
|
||||
onPressed: () => _resetGame(),
|
||||
),
|
||||
],
|
||||
@@ -173,12 +173,12 @@ class _TriviaViewState extends State<TriviaView> with RestorationMixin {
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 16),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
currentTrivia.question,
|
||||
style: CupertinoTheme.of(context).textTheme.textStyle,
|
||||
),
|
||||
SizedBox(height: 32),
|
||||
const SizedBox(height: 32),
|
||||
for (int i = 0; i < currentTrivia.answers.length; i++)
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
@@ -209,9 +209,9 @@ class _TriviaViewState extends State<TriviaView> with RestorationMixin {
|
||||
: 'Sorry, that wasn\'t the right answer.',
|
||||
style: CupertinoTheme.of(context).textTheme.textStyle,
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
const SizedBox(height: 16),
|
||||
CupertinoButton(
|
||||
child: Text('Next Question'),
|
||||
child: const Text('Next Question'),
|
||||
onPressed: () => setState(() {
|
||||
triviaIndex.value++;
|
||||
status.value = PlayerStatus.readyToAnswer;
|
||||
|
||||
@@ -105,7 +105,7 @@ class _PressableCardState extends State<PressableCard> {
|
||||
}
|
||||
|
||||
class VeggieCard extends StatelessWidget {
|
||||
VeggieCard(this.veggie, this.isInSeason, this.isPreferredCategory);
|
||||
const VeggieCard(this.veggie, this.isInSeason, this.isPreferredCategory);
|
||||
|
||||
/// Veggie to be displayed by the card.
|
||||
final Veggie veggie;
|
||||
@@ -120,7 +120,7 @@ class VeggieCard extends StatelessWidget {
|
||||
Widget _buildDetails(BuildContext context) {
|
||||
final themeData = CupertinoTheme.of(context);
|
||||
return FrostyBackground(
|
||||
color: Color(0x90ffffff),
|
||||
color: const Color(0x90ffffff),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
|
||||
@@ -49,7 +49,7 @@ class VeggieHeadline extends StatelessWidget {
|
||||
var widgets = <Widget>[];
|
||||
|
||||
for (var season in seasons) {
|
||||
widgets.add(SizedBox(width: 4));
|
||||
widgets.add(const SizedBox(width: 4));
|
||||
widgets.add(
|
||||
Container(
|
||||
height: 10,
|
||||
@@ -80,7 +80,7 @@ class VeggieHeadline extends StatelessWidget {
|
||||
height: 72,
|
||||
width: 72,
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
const SizedBox(width: 8),
|
||||
Flexible(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
|
||||
Reference in New Issue
Block a user