Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable sort_child_properties_last lint #91585

Merged
merged 1 commit into from Oct 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion analysis_options.yaml
Expand Up @@ -186,7 +186,7 @@ linter:
- recursive_getters
- sized_box_for_whitespace
- slash_for_doc_comments
# - sort_child_properties_last # not yet tested
- sort_child_properties_last
- sort_constructors_first
# - sort_pub_dependencies # prevents separating pinned transitive dependencies
- sort_unnamed_constructors_first
Expand Down
Expand Up @@ -16,14 +16,14 @@ class LogoScreen extends StatelessWidget {
Widget build(BuildContext context) {
print(_testSentinel);
return Container(
padding: const EdgeInsets.all(25),
color: Colors.blue,
child: Column(
children: <Widget>[
const Text('DeferredWidget', key: Key('DeferredWidget')),
Image.asset('customassets/flutter_logo.png', key: const Key('DeferredImage')),
]
),
padding: const EdgeInsets.all(25),
color: Colors.blue,
);
}
const Text('DeferredWidget', key: Key('DeferredWidget')),
Image.asset('customassets/flutter_logo.png', key: const Key('DeferredImage')),
],
),
);
}
}
6 changes: 3 additions & 3 deletions dev/manual_tests/lib/drag_and_drop.dart
Expand Up @@ -132,18 +132,18 @@ class ExampleDragSource extends StatelessWidget {
if (heavy) {
return LongPressDraggable<Color>(
data: color,
child: contents,
feedback: feedback,
feedbackOffset: feedbackOffset,
dragAnchorStrategy: dragAnchorStrategy,
child: contents,
);
} else {
return Draggable<Color>(
data: color,
child: contents,
feedback: feedback,
feedbackOffset: feedbackOffset,
dragAnchorStrategy: dragAnchorStrategy,
child: contents,
);
}
}
Expand Down Expand Up @@ -208,10 +208,10 @@ class MovableBall extends StatelessWidget {
if (position == ballPosition) {
return Draggable<bool>(
data: true,
child: ball,
childWhenDragging: dashedBall,
feedback: ball,
maxSimultaneousDrags: 1,
child: ball,
);
} else {
return DragTarget<bool>(
Expand Down
Expand Up @@ -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'),
Expand All @@ -52,6 +49,9 @@ class MyStatelessWidget extends StatelessWidget {
},
),
],
child: Container(
color: Colors.red,
),
),
),
),
Expand Down
4 changes: 2 additions & 2 deletions examples/api/lib/material/banner/material_banner.0.dart
Expand Up @@ -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'),
),
],
),
Expand Down
2 changes: 1 addition & 1 deletion examples/api/lib/material/banner/material_banner.1.dart
Expand Up @@ -42,8 +42,8 @@ class MyStatelessWidget extends StatelessWidget {
backgroundColor: Colors.green,
actions: <Widget>[
TextButton(
child: Text('DISMISS'),
onPressed: null,
child: Text('DISMISS'),
),
],
),
Expand Down
Expand Up @@ -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,
Expand Down
Expand Up @@ -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(),
),
Expand Down
Expand Up @@ -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),
),
);
}
Expand Down
Expand Up @@ -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,
Expand Down
Expand Up @@ -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'),
),
],
),
Expand Down
2 changes: 1 addition & 1 deletion examples/api/lib/material/tooltip/tooltip.1.dart
Expand Up @@ -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:
Expand All @@ -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.'),
);
}
}
Expand Up @@ -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'),
),
),
);
Expand Down
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion examples/api/lib/widgets/async/future_builder.0.dart
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion examples/api/lib/widgets/async/stream_builder.0.dart
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion examples/api/lib/widgets/basic/fitted_box.0.dart
Expand Up @@ -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,
),
);
}
Expand Down
15 changes: 8 additions & 7 deletions examples/api/lib/widgets/basic/physical_shape.0.dart
Expand Up @@ -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!',
Expand All @@ -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,
),
),
);
Expand Down
10 changes: 5 additions & 5 deletions examples/api/lib/widgets/dismissible/dismissible.0.dart
Expand Up @@ -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,
),
Expand All @@ -56,6 +51,11 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
items.removeAt(index);
});
},
child: ListTile(
title: Text(
'Item ${items[index]}',
),
),
);
},
);
Expand Down
16 changes: 8 additions & 8 deletions examples/api/lib/widgets/drag_target/draggable.0.dart
Expand Up @@ -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,
Expand All @@ -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: (
Expand Down
2 changes: 1 addition & 1 deletion examples/api/lib/widgets/image/image.frame_builder.0.dart
Expand Up @@ -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,
);
},
),
Expand Down
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion examples/api/lib/widgets/page_storage/page_storage.0.dart
Expand Up @@ -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,
Expand Down
Expand Up @@ -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}'),
);
}
}
10 changes: 5 additions & 5 deletions examples/api/lib/widgets/scrollbar/raw_scrollbar.shape.0.dart
Expand Up @@ -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())),
),
),
);
}
Expand Down