mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
Upgrading samples to flutter_lints, part 1 of n (#804)
This commit is contained in:
@@ -26,7 +26,7 @@ class PlatformWidget extends StatelessWidget {
|
||||
return iosBuilder(context);
|
||||
default:
|
||||
assert(false, 'Unexpected platform $defaultTargetPlatform');
|
||||
return SizedBox.shrink();
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,8 +107,9 @@ class _PressableCardState extends State<PressableCard>
|
||||
// in your own app.
|
||||
scale: 1 - elevationAnimation.value * 0.03,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 16, horizontal: 16) *
|
||||
flatten,
|
||||
padding:
|
||||
const EdgeInsets.symmetric(vertical: 16, horizontal: 16) *
|
||||
flatten,
|
||||
child: PhysicalModel(
|
||||
elevation:
|
||||
((1 - elevationAnimation.value) * 10 + 10) * flatten,
|
||||
@@ -134,7 +135,7 @@ class _PressableCardState extends State<PressableCard>
|
||||
/// This is an example of a custom widget that an app developer might create for
|
||||
/// use on both iOS and Android as part of their brand's unique design.
|
||||
class HeroAnimatingSongCard extends StatelessWidget {
|
||||
HeroAnimatingSongCard({
|
||||
const HeroAnimatingSongCard({
|
||||
required this.song,
|
||||
required this.color,
|
||||
required this.heroAnimation,
|
||||
@@ -177,10 +178,10 @@ class HeroAnimatingSongCard extends StatelessWidget {
|
||||
height: 80,
|
||||
color: Colors.black12,
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: EdgeInsets.symmetric(horizontal: 12),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
child: Text(
|
||||
song,
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 21,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
@@ -189,12 +190,12 @@ class HeroAnimatingSongCard extends StatelessWidget {
|
||||
),
|
||||
// The play button grows in the hero animation.
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsets.only(bottom: 45) * (1 - heroAnimation.value),
|
||||
padding: const EdgeInsets.only(bottom: 45) *
|
||||
(1 - heroAnimation.value),
|
||||
child: Container(
|
||||
height: playButtonSize,
|
||||
width: playButtonSize,
|
||||
decoration: BoxDecoration(
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black12,
|
||||
),
|
||||
@@ -222,14 +223,14 @@ class SongPlaceholderTile extends StatelessWidget {
|
||||
return SizedBox(
|
||||
height: 95,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 15, vertical: 8),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 8),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
color: Theme.of(context).textTheme.bodyText2!.color,
|
||||
width: 130,
|
||||
),
|
||||
Padding(
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(left: 12),
|
||||
),
|
||||
Expanded(
|
||||
@@ -238,27 +239,27 @@ class SongPlaceholderTile extends StatelessWidget {
|
||||
children: [
|
||||
Container(
|
||||
height: 9,
|
||||
margin: EdgeInsets.only(right: 60),
|
||||
margin: const EdgeInsets.only(right: 60),
|
||||
color: Theme.of(context).textTheme.bodyText2!.color,
|
||||
),
|
||||
Container(
|
||||
height: 9,
|
||||
margin: EdgeInsets.only(right: 20, top: 8),
|
||||
margin: const EdgeInsets.only(right: 20, top: 8),
|
||||
color: Theme.of(context).textTheme.bodyText2!.color,
|
||||
),
|
||||
Container(
|
||||
height: 9,
|
||||
margin: EdgeInsets.only(right: 40, top: 8),
|
||||
margin: const EdgeInsets.only(right: 40, top: 8),
|
||||
color: Theme.of(context).textTheme.bodyText2!.color,
|
||||
),
|
||||
Container(
|
||||
height: 9,
|
||||
margin: EdgeInsets.only(right: 80, top: 8),
|
||||
margin: const EdgeInsets.only(right: 80, top: 8),
|
||||
color: Theme.of(context).textTheme.bodyText2!.color,
|
||||
),
|
||||
Container(
|
||||
height: 9,
|
||||
margin: EdgeInsets.only(right: 50, top: 8),
|
||||
margin: const EdgeInsets.only(right: 50, top: 8),
|
||||
color: Theme.of(context).textTheme.bodyText2!.color,
|
||||
),
|
||||
],
|
||||
@@ -289,7 +290,7 @@ void showChoices(BuildContext context, List<String> choices) {
|
||||
builder: (context) {
|
||||
int? selectedRadio = 1;
|
||||
return AlertDialog(
|
||||
contentPadding: EdgeInsets.only(top: 12),
|
||||
contentPadding: const EdgeInsets.only(top: 12),
|
||||
content: StatefulBuilder(
|
||||
builder: (context, setState) {
|
||||
return Column(
|
||||
@@ -309,11 +310,11 @@ void showChoices(BuildContext context, List<String> choices) {
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: Text('OK'),
|
||||
child: const Text('OK'),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
TextButton(
|
||||
child: Text('CANCEL'),
|
||||
child: const Text('CANCEL'),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
],
|
||||
@@ -337,7 +338,7 @@ void showChoices(BuildContext context, List<String> choices) {
|
||||
return Center(
|
||||
child: Text(
|
||||
choices[index],
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 21,
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user