Enable sort_child_properties_last lint (#91585)

This commit is contained in:
Ian Hickson
2021-10-11 21:23:02 -07:00
committed by GitHub
parent ee07b0eafc
commit 6d5fc420b6
42 changed files with 171 additions and 169 deletions

View File

@@ -35,9 +35,6 @@ class MyStatelessWidget extends StatelessWidget {
width: 100,
height: 100,
child: CupertinoContextMenu(
child: Container(
color: Colors.red,
),
actions: <Widget>[
CupertinoContextMenuAction(
child: const Text('Action one'),
@@ -52,6 +49,9 @@ class MyStatelessWidget extends StatelessWidget {
},
),
],
child: Container(
color: Colors.red,
),
),
),
),

View File

@@ -38,12 +38,12 @@ class MyStatelessWidget extends StatelessWidget {
backgroundColor: Color(0xFFE0E0E0),
actions: <Widget>[
TextButton(
child: Text('OPEN'),
onPressed: null,
child: Text('OPEN'),
),
TextButton(
child: Text('DISMISS'),
onPressed: null,
child: Text('DISMISS'),
),
],
),

View File

@@ -42,8 +42,8 @@ class MyStatelessWidget extends StatelessWidget {
backgroundColor: Colors.green,
actions: <Widget>[
TextButton(
child: Text('DISMISS'),
onPressed: null,
child: Text('DISMISS'),
),
],
),

View File

@@ -97,8 +97,8 @@ class _BottomAppBarDemoState extends State<BottomAppBarDemo> {
floatingActionButton: _showFab
? FloatingActionButton(
onPressed: () {},
child: const Icon(Icons.add),
tooltip: 'Create',
child: const Icon(Icons.add),
)
: null,
floatingActionButtonLocation: _fabLocation,

View File

@@ -50,8 +50,8 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
},
items: items.map((String item) {
return DropdownMenuItem<String>(
child: Text('Log $item'),
value: item,
child: Text('Log $item'),
);
}).toList(),
),

View File

@@ -36,8 +36,8 @@ class MyStatelessWidget extends StatelessWidget {
onPressed: () {
// Add your onPressed code here!
},
child: const Icon(Icons.navigation),
backgroundColor: Colors.green,
child: const Icon(Icons.navigation),
),
);
}

View File

@@ -105,8 +105,8 @@ class MyNavigationRailFab extends StatelessWidget {
),
child: animation.value == 0
? FloatingActionButton(
child: const Icon(Icons.add),
onPressed: onPressed,
child: const Icon(Icons.add),
)
: Align(
alignment: AlignmentDirectional.centerStart,

View File

@@ -39,8 +39,8 @@ class MyStatelessWidget extends StatelessWidget {
content: Text('This is a MaterialBanner'),
actions: <Widget>[
TextButton(
child: Text('DISMISS'),
onPressed: null,
child: Text('DISMISS'),
),
],
),

View File

@@ -34,7 +34,6 @@ class MyStatelessWidget extends StatelessWidget {
Widget build(BuildContext context) {
return Tooltip(
message: 'I am a Tooltip',
child: const Text('Tap this text and hold down to show a tooltip.'),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25),
gradient:
@@ -48,6 +47,7 @@ class MyStatelessWidget extends StatelessWidget {
),
showDuration: const Duration(seconds: 2),
waitDuration: const Duration(seconds: 1),
child: const Text('Tap this text and hold down to show a tooltip.'),
);
}
}

View File

@@ -56,8 +56,8 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
value: _currentStyle,
child: Center(
child: ElevatedButton(
child: const Text('Change Color'),
onPressed: _changeColor,
child: const Text('Change Color'),
),
),
);

View File

@@ -42,7 +42,7 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
AnimatedSwitcher(
duration: const Duration(milliseconds: 500),
transitionBuilder: (Widget child, Animation<double> animation) {
return ScaleTransition(child: child, scale: animation);
return ScaleTransition(scale: animation, child: child);
},
child: Text(
'$_count',

View File

@@ -71,9 +71,9 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
} else {
children = const <Widget>[
SizedBox(
child: CircularProgressIndicator(),
width: 60,
height: 60,
child: CircularProgressIndicator(),
),
Padding(
padding: EdgeInsets.only(top: 16),

View File

@@ -82,9 +82,9 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
case ConnectionState.waiting:
children = const <Widget>[
SizedBox(
child: CircularProgressIndicator(),
width: 60,
height: 60,
child: CircularProgressIndicator(),
),
Padding(
padding: EdgeInsets.only(top: 16),

View File

@@ -37,9 +37,9 @@ class MyStatelessWidget extends StatelessWidget {
width: 300,
color: Colors.red,
child: FittedBox(
fit: BoxFit.fill,
child: Image.network(
'https://flutter.github.io/assets-for-api-docs/assets/widgets/owl-2.jpg'),
fit: BoxFit.fill,
),
);
}

View File

@@ -34,7 +34,15 @@ class MyStatelessWidget extends StatelessWidget {
body: Center(
child: PhysicalShape(
elevation: 5.0,
clipper: ShapeBorderClipper(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
),
color: Colors.orange,
child: const SizedBox(
height: 200.0,
width: 200.0,
child: Center(
child: Text(
'Hello, World!',
@@ -44,14 +52,7 @@ class MyStatelessWidget extends StatelessWidget {
),
),
),
height: 200.0,
width: 200.0,
),
clipper: ShapeBorderClipper(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
)),
color: Colors.orange,
),
),
);

View File

@@ -42,11 +42,6 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
padding: const EdgeInsets.symmetric(vertical: 16),
itemBuilder: (BuildContext context, int index) {
return Dismissible(
child: ListTile(
title: Text(
'Item ${items[index]}',
),
),
background: Container(
color: Colors.green,
),
@@ -56,6 +51,11 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
items.removeAt(index);
});
},
child: ListTile(
title: Text(
'Item ${items[index]}',
),
),
);
},
);

View File

@@ -43,14 +43,6 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
Draggable<int>(
// Data is the value this Draggable stores.
data: 10,
child: Container(
height: 100.0,
width: 100.0,
color: Colors.lightGreenAccent,
child: const Center(
child: Text('Draggable'),
),
),
feedback: Container(
color: Colors.deepOrange,
height: 100,
@@ -65,6 +57,14 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
child: Text('Child When Dragging'),
),
),
child: Container(
height: 100.0,
width: 100.0,
color: Colors.lightGreenAccent,
child: const Center(
child: Text('Draggable'),
),
),
),
DragTarget<int>(
builder: (

View File

@@ -42,10 +42,10 @@ class MyStatelessWidget extends StatelessWidget {
return child;
}
return AnimatedOpacity(
child: child,
opacity: frame == null ? 0 : 1,
duration: const Duration(seconds: 1),
curve: Curves.easeOut,
child: child,
);
},
),

View File

@@ -49,12 +49,12 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
mainAxisSize: MainAxisSize.min,
children: <Widget>[
ElevatedButton(
child: const Text('Slide up'),
onPressed: _slideUp,
child: const Text('Slide up'),
),
ElevatedButton(
child: const Text('Slide down'),
onPressed: _slideDown,
child: const Text('Slide down'),
),
Padding(
padding: const EdgeInsets.all(50),

View File

@@ -45,8 +45,8 @@ class _MyHomePageState extends State<MyHomePage> {
title: const Text('Persistence Example'),
),
body: PageStorage(
child: pages[currentTab],
bucket: _bucket,
child: pages[currentTab],
),
bottomNavigationBar: BottomNavigationBar(
currentIndex: currentTab,

View File

@@ -74,8 +74,8 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget>
@override
Widget build(BuildContext context) {
return OutlinedButton(
child: Text('${_answer.value}'),
onPressed: _incrementAnswer,
child: Text('${_answer.value}'),
);
}
}

View File

@@ -29,16 +29,16 @@ class MyStatelessWidget extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
body: RawScrollbar(
child: ListView(
children: List<Text>.generate(
100, (int index) => Text((index * index).toString())),
physics: const BouncingScrollPhysics(),
),
shape: const StadiumBorder(
side: BorderSide(color: Colors.brown, width: 3.0)),
thickness: 15.0,
thumbColor: Colors.blue,
isAlwaysShown: true,
child: ListView(
physics: const BouncingScrollPhysics(),
children: List<Text>.generate(
100, (int index) => Text((index * index).toString())),
),
),
);
}