Enable avoid_redundant_argument_values lint (#91409)

This commit is contained in:
Ian Hickson
2021-10-07 20:13:02 -07:00
committed by GitHub
parent 4bf7179e51
commit 5fd259be24
667 changed files with 1693 additions and 3385 deletions

View File

@@ -39,7 +39,6 @@ final CatmullRomSpline path = CatmullRomSpline(
],
startHandle: const Offset(0.93, 0.93),
endHandle: const Offset(0.18, 0.23),
tension: 0.0,
);
class FollowCurve2D extends StatefulWidget {
@@ -74,7 +73,7 @@ class _FollowCurve2DState extends State<FollowCurve2D>
animation = CurvedAnimation(parent: controller, curve: widget.curve);
// Have the controller repeat indefinitely. If you want it to "bounce" back
// and forth, set the reverse parameter to true.
controller.repeat(reverse: false);
controller.repeat();
controller.addListener(() => setState(() {}));
}
@@ -107,7 +106,6 @@ class MyStatelessWidget extends StatelessWidget {
alignment: Alignment.center,
child: FollowCurve2D(
path: path,
curve: Curves.easeInOut,
duration: const Duration(seconds: 3),
child: CircleAvatar(
backgroundColor: Colors.yellow,

View File

@@ -53,8 +53,6 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
largeTitle: Text('Scroll down'),
),
CupertinoSliverRefreshControl(
refreshTriggerPullDistance: 100.0,
refreshIndicatorExtent: 60.0,
onRefresh: () async {
await Future<void>.delayed(
const Duration(milliseconds: 1000),

View File

@@ -116,7 +116,6 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
Align(
alignment: Alignment.topLeft,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Switch(
value: useResolver,

View File

@@ -64,8 +64,8 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget>
restorationId: 'date_picker_dialog',
initialEntryMode: DatePickerEntryMode.calendarOnly,
initialDate: DateTime.fromMillisecondsSinceEpoch(arguments! as int),
firstDate: DateTime(2021, 1, 1),
lastDate: DateTime(2022, 1, 1),
firstDate: DateTime(2021),
lastDate: DateTime(2022),
);
},
);

View File

@@ -41,7 +41,7 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget>
String? get restorationId => widget.restorationId;
final RestorableDateTimeN _startDate =
RestorableDateTimeN(DateTime(2021, 1, 1));
RestorableDateTimeN(DateTime(2021));
final RestorableDateTimeN _endDate =
RestorableDateTimeN(DateTime(2021, 1, 5));
late final RestorableRouteFuture<DateTimeRange?>
@@ -85,9 +85,9 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget>
restorationId: 'date_picker_dialog',
initialDateRange:
_initialDateTimeRange(arguments! as Map<dynamic, dynamic>),
firstDate: DateTime(2021, 1, 1),
firstDate: DateTime(2021),
currentDate: DateTime(2021, 1, 25),
lastDate: DateTime(2022, 1, 1),
lastDate: DateTime(2022),
);
},
);

View File

@@ -42,7 +42,6 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
return DropdownButton<String>(
value: dropdownValue,
icon: const Icon(Icons.arrow_downward),
iconSize: 24,
elevation: 16,
style: const TextStyle(color: Colors.deepPurple),
underline: Container(

View File

@@ -47,7 +47,6 @@ class _ArticleDescription extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
flex: 1,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
@@ -73,7 +72,6 @@ class _ArticleDescription extends StatelessWidget {
),
),
Expanded(
flex: 1,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.end,

View File

@@ -49,7 +49,7 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
},
side: MaterialStateBorderSide.resolveWith((Set<MaterialState> states) {
if (states.contains(MaterialState.selected)) {
return const BorderSide(width: 1, color: Colors.red);
return const BorderSide(color: Colors.red);
}
return null; // Defer to default value on the theme or widget.
}),

View File

@@ -49,7 +49,6 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
itemBuilder: (BuildContext context, int index) {
return Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Radio<int>(
value: index,

View File

@@ -39,7 +39,6 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
Widget build(BuildContext context) {
return RangeSlider(
values: _currentRangeValues,
min: 0,
max: 100,
divisions: 5,
labels: RangeLabels(

View File

@@ -39,7 +39,6 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
Widget build(BuildContext context) {
return Slider(
value: _currentSliderValue,
min: 0,
max: 100,
divisions: 5,
label: _currentSliderValue.round().toString(),

View File

@@ -122,42 +122,39 @@ class _SimpleUSPhoneNumberEntryState extends State<SimpleUSPhoneNumberEntry> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
const Expanded(
child: Text(
'(',
textAlign: TextAlign.center,
),
flex: 1),
child: Text('(', textAlign: TextAlign.center),
),
Expanded(
child: DigitInput(
focusNode: areaCodeFocusNode,
controller: areaCodeController,
maxLength: 3),
flex: 3),
flex: 3,
child: DigitInput(
focusNode: areaCodeFocusNode,
controller: areaCodeController,
maxLength: 3,
),
),
const Expanded(
child: Text(
')',
textAlign: TextAlign.center,
),
flex: 1),
child: Text(')', textAlign: TextAlign.center),
),
Expanded(
child: DigitInput(
focusNode: prefixFocusNode,
controller: prefixController,
maxLength: 3),
flex: 3),
flex: 3,
child: DigitInput(
focusNode: prefixFocusNode,
controller: prefixController,
maxLength: 3,
),
),
const Expanded(
child: Text(
'-',
textAlign: TextAlign.center,
),
flex: 1),
child: Text('-', textAlign: TextAlign.center),
),
Expanded(
child: DigitInput(
focusNode: lineNumberFocusNode,
controller: lineNumberController,
textInputAction: TextInputAction.done,
maxLength: 4),
flex: 4),
flex: 4,
child: DigitInput(
focusNode: lineNumberFocusNode,
controller: lineNumberController,
textInputAction: TextInputAction.done,
maxLength: 4,
),
),
],
),
);

View File

@@ -53,7 +53,6 @@ class _ActionListenerExampleState extends State<ActionListenerExample> {
@override
Widget build(BuildContext context) {
return Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Padding(

View File

@@ -62,7 +62,6 @@ class _AnimatedListSampleState extends State<AnimatedListSample> {
return CardItem(
animation: animation,
item: item,
selected: false,
// No gesture detector here: we don't want removed items to be interactive.
);
}
@@ -196,7 +195,6 @@ class CardItem extends StatelessWidget {
return Padding(
padding: const EdgeInsets.all(2.0),
child: SizeTransition(
axis: Axis.vertical,
sizeFactor: animation,
child: GestureDetector(
behavior: HitTestBehavior.opaque,

View File

@@ -65,7 +65,6 @@ class _SliverAnimatedListSampleState extends State<SliverAnimatedListSample> {
return CardItem(
animation: animation,
item: item,
selected: false,
);
}
@@ -213,10 +212,8 @@ class CardItem extends StatelessWidget {
left: 2.0,
right: 2.0,
top: 2.0,
bottom: 0.0,
),
child: SizeTransition(
axis: Axis.vertical,
sizeFactor: animation,
child: GestureDetector(
onTap: onTap,

View File

@@ -84,7 +84,6 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: children,
),
);

View File

@@ -123,7 +123,6 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: children,
);
},

View File

@@ -56,7 +56,6 @@ class AutocompleteFormExampleState extends State<AutocompleteFormExample> {
value: _dropdownValue,
icon: const Icon(Icons.arrow_downward),
hint: const Text('This is a regular DropdownButtonFormField'),
iconSize: 24,
elevation: 16,
style: const TextStyle(color: Colors.deepPurple),
onChanged: (String? newValue) {

View File

@@ -47,7 +47,6 @@ class MyStatelessWidget extends StatelessWidget {
width: 100.0,
height: 200.0,
child: AbsorbPointer(
absorbing: true,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.blue.shade200,

View File

@@ -47,7 +47,6 @@ class MyStatelessWidget extends StatelessWidget {
width: 50,
),
Expanded(
flex: 1,
child: Container(
color: Colors.amber,
height: 100,

View File

@@ -30,11 +30,10 @@ class MyStatelessWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
final PageController controller = PageController(initialPage: 0);
final PageController controller = PageController();
return PageView(
/// [PageView.scrollDirection] defaults to [Axis.horizontal].
/// Use [Axis.vertical] to scroll vertically.
scrollDirection: Axis.horizontal,
controller: controller,
children: const <Widget>[
Center(

View File

@@ -37,7 +37,6 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget>
color: const Color(0xFFFFFFFF),
border: Border.all(style: BorderStyle.none),
borderRadius: BorderRadius.circular(60.0),
shape: BoxShape.rectangle,
boxShadow: const <BoxShadow>[
BoxShadow(
color: Color(0x66666666),
@@ -74,7 +73,6 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget>
color: Colors.white,
child: Center(
child: DecoratedBoxTransition(
position: DecorationPosition.background,
decoration: decorationTween.animate(_controller),
child: Container(
width: 200,