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

@@ -32,14 +32,12 @@ class _TextFieldPageState extends State<TextFieldPage> {
TextField(
key: normalTextFieldKey,
controller: _normalController,
autofocus: false,
),
const Spacer(),
TextField(
key: passwordTextFieldKey,
controller: _passwordController,
obscureText: true,
autofocus: false,
),
],
),

View File

@@ -227,7 +227,7 @@ class MotionEventsBodyState extends State<MotionEventsBody> {
setState(() {});
break;
}
return Future<dynamic>.value(null);
return Future<dynamic>.value();
}
Future<dynamic> onViewMethodChannelCall(MethodCall call) {
@@ -240,7 +240,7 @@ class MotionEventsBodyState extends State<MotionEventsBody> {
setState(() {});
break;
}
return Future<dynamic>.value(null);
return Future<dynamic>.value();
}
Widget buildEventTile(BuildContext context, int index) {

View File

@@ -10,8 +10,7 @@ import 'test_step.dart';
Future<TestStepResult> methodCallJsonSuccessHandshake(dynamic payload) async {
const MethodChannel channel =
MethodChannel('json-method', JSONMethodCodec());
return _methodCallSuccessHandshake(
'JSON success($payload)', channel, payload);
return _methodCallSuccessHandshake('JSON success($payload)', channel, payload);
}
Future<TestStepResult> methodCallJsonErrorHandshake(dynamic payload) async {
@@ -32,8 +31,7 @@ Future<TestStepResult> methodCallStandardSuccessHandshake(
'std-method',
StandardMethodCodec(ExtendedStandardMessageCodec()),
);
return _methodCallSuccessHandshake(
'Standard success($payload)', channel, payload);
return _methodCallSuccessHandshake('Standard success($payload)', channel, payload);
}
Future<TestStepResult> methodCallStandardErrorHandshake(dynamic payload) async {
@@ -41,8 +39,7 @@ Future<TestStepResult> methodCallStandardErrorHandshake(dynamic payload) async {
'std-method',
StandardMethodCodec(ExtendedStandardMessageCodec()),
);
return _methodCallErrorHandshake(
'Standard error($payload)', channel, payload);
return _methodCallErrorHandshake('Standard error($payload)', channel, payload);
}
Future<TestStepResult> methodCallStandardNotImplementedHandshake() async {
@@ -50,8 +47,7 @@ Future<TestStepResult> methodCallStandardNotImplementedHandshake() async {
'std-method',
StandardMethodCodec(ExtendedStandardMessageCodec()),
);
return _methodCallNotImplementedHandshake(
'Standard notImplemented()', channel);
return _methodCallNotImplementedHandshake('Standard notImplemented()', channel);
}
Future<TestStepResult> _methodCallSuccessHandshake(
@@ -89,8 +85,7 @@ Future<TestStepResult> _methodCallErrorHandshake(
final List<dynamic> received = <dynamic>[];
channel.setMethodCallHandler((MethodCall call) async {
received.add(call.arguments);
throw PlatformException(
code: 'error', message: null, details: arguments);
throw PlatformException(code: 'error', details: arguments);
});
dynamic errorDetails = nothing;
dynamic error = nothing;

View File

@@ -23,8 +23,6 @@ class SectionCard extends StatelessWidget {
child: DecoratedBox(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: <Color>[
section.leftColor!,
section.rightColor!,
@@ -132,7 +130,6 @@ class SectionDetailView extends StatelessWidget {
package: detail.imageAssetPackage,
),
fit: BoxFit.cover,
alignment: Alignment.center,
),
),
);

View File

@@ -136,7 +136,7 @@ class CalcExpression {
/// in the calculator's display panel.
@override
String toString() {
final StringBuffer buffer = StringBuffer('');
final StringBuffer buffer = StringBuffer();
buffer.writeAll(_list);
return buffer.toString();
}

View File

@@ -67,7 +67,6 @@ class ColorItem extends StatelessWidget {
bottom: false,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text('$prefix$index'),
Text(colorString()),

View File

@@ -327,7 +327,6 @@ class Tab1ItemPageState extends State<Tab1ItemPage> {
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Row(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Container(
height: 128.0,

View File

@@ -247,7 +247,6 @@ class _CupertinoPickerDemoState extends State<CupertinoPickerDemo> {
return _BottomPicker(
child: CupertinoDatePicker(
backgroundColor: CupertinoColors.systemBackground.resolveFrom(context),
mode: CupertinoDatePickerMode.dateAndTime,
initialDateTime: dateTime,
onDateTimeChanged: (DateTime newDateTime) {
setState(() => dateTime = newDateTime);

View File

@@ -117,13 +117,11 @@ class _CupertinoSegmentedControlDemoState extends State<CupertinoSegmentedContro
BoxShadow(
offset: Offset(0.0, 6.0),
blurRadius: 10.0,
spreadRadius: 0.0,
color: _kKeyPenumbraOpacity,
),
BoxShadow(
offset: Offset(0.0, 1.0),
blurRadius: 18.0,
spreadRadius: 0.0,
color: _kAmbientShadowOpacity,
),
],

View File

@@ -42,7 +42,6 @@ class _CupertinoSliderDemoState extends State<CupertinoSliderDemo> {
children: <Widget> [
CupertinoSlider(
value: _value,
min: 0.0,
max: 100.0,
onChanged: (double value) {
setState(() {
@@ -58,7 +57,6 @@ class _CupertinoSliderDemoState extends State<CupertinoSliderDemo> {
children: <Widget> [
CupertinoSlider(
value: _discreteValue,
min: 0.0,
max: 100.0,
divisions: 5,
onChanged: (double value) {

View File

@@ -27,7 +27,6 @@ class _BottomAppBarDemoState extends State<BottomAppBarDemo> {
static const _ChoiceValue<Widget> kNoFab = _ChoiceValue<Widget>(
title: 'None',
label: 'do not show a floating action button',
value: null,
);
static const _ChoiceValue<Widget> kCircularFab = _ChoiceValue<Widget>(

View File

@@ -275,7 +275,6 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
return Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
ListTile(
title: const Text('Simple dropdown:'),

View File

@@ -344,7 +344,7 @@ class _ChipDemoState extends State<ChipDemo> {
data: _showShapeBorder
? theme.chipTheme.copyWith(
shape: BeveledRectangleBorder(
side: const BorderSide(width: 0.66, style: BorderStyle.solid, color: Colors.grey),
side: const BorderSide(width: 0.66, color: Colors.grey),
borderRadius: BorderRadius.circular(10.0),
))
: theme.chipTheme,

View File

@@ -33,8 +33,6 @@ class DialogDemoItem extends StatelessWidget {
return SimpleDialogOption(
onPressed: onPressed,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Icon(icon, size: 36.0, color: color),
Padding(

View File

@@ -308,7 +308,6 @@ class _ExpansionPanelsDemoState extends State<ExpansionPanelsDemo> {
// Allow room for the value indicator.
padding: const EdgeInsets.only(top: 44.0),
child: Slider(
min: 0.0,
max: 100.0,
divisions: 5,
activeColor: Colors.orange[100 + (field.value! * 5.0).round()],

View File

@@ -284,7 +284,6 @@ class _SlidersState extends State<_Sliders> {
Slider.adaptive(
label: _continuousValue.toStringAsFixed(6),
value: _continuousValue,
min: 0.0,
max: 100.0,
onChanged: (double value) {
setState(() {
@@ -307,7 +306,6 @@ class _SlidersState extends State<_Sliders> {
children: <Widget>[
Slider.adaptive(
value: _discreteValue,
min: 0.0,
max: 200.0,
divisions: 5,
label: '${_discreteValue.round()}',
@@ -338,7 +336,6 @@ class _SlidersState extends State<_Sliders> {
),
child: Slider(
value: _discreteCustomValue,
min: 0.0,
max: 200.0,
divisions: 5,
semanticFormatterCallback: (double value) => value.round().toString(),
@@ -381,7 +378,6 @@ class _RangeSlidersState extends State<_RangeSliders> {
children: <Widget>[
RangeSlider(
values: _continuousValues,
min: 0.0,
max: 100.0,
onChanged: (RangeValues values) {
setState(() {
@@ -404,7 +400,6 @@ class _RangeSlidersState extends State<_RangeSliders> {
children: <Widget>[
RangeSlider(
values: _discreteValues,
min: 0.0,
max: 200.0,
divisions: 5,
labels: RangeLabels('${_discreteValues.start.round()}', '${_discreteValues.end.round()}'),
@@ -433,7 +428,6 @@ class _RangeSlidersState extends State<_RangeSliders> {
),
child: RangeSlider(
values: _discreteCustomValues,
min: 0.0,
max: 200.0,
divisions: 5,
labels: RangeLabels('${_discreteCustomValues.start.round()}', '${_discreteCustomValues.end.round()}'),

View File

@@ -107,7 +107,6 @@ class _CardDataItem extends StatelessWidget {
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Align(
alignment: page!.id == 'H'

View File

@@ -252,7 +252,6 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> {
suffixText: 'USD',
suffixStyle: TextStyle(color: Colors.green),
),
maxLines: 1,
),
const SizedBox(height: 24.0),
PasswordField(

View File

@@ -171,7 +171,7 @@ class ExpandingBottomSheetState extends State<ExpandingBottomSheet> with TickerP
).animate(
CurvedAnimation(
parent: _controller.view,
curve: const Interval(0.434, 1.0, curve: Curves.linear), // not used
curve: const Interval(0.434, 1.0), // not used
// only the reverseCurve will be used
reverseCurve: Interval(0.434, 1.0, curve: Curves.fastOutSlowIn.flipped),
),
@@ -448,7 +448,7 @@ class _ProductThumbnailRowState extends State<ProductThumbnailRow> {
);
final Animation<double> opacity = CurvedAnimation(
curve: const Interval(0.33, 1.0, curve: Curves.linear),
curve: const Interval(0.33, 1.0),
parent: animation,
);

View File

@@ -124,7 +124,6 @@ class ShoppingCartSummary extends StatelessWidget {
child: Column(
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
const Expanded(
child: Text('TOTAL'),

View File

@@ -45,7 +45,6 @@ class ProductCard extends StatelessWidget {
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
AspectRatio(
aspectRatio: imageAspectRatio,
@@ -56,7 +55,6 @@ class ProductCard extends StatelessWidget {
width: 121.0,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
product == null ? '' : product!.name,

View File

@@ -253,7 +253,6 @@ class GridLists {
// loaded from the web.
GridView.count(
crossAxisCount: 3,
childAspectRatio: 1.0,
padding: const EdgeInsets.all(4.0),
mainAxisSpacing: 4.0,
crossAxisSpacing: 4.0,

View File

@@ -58,14 +58,12 @@ class _CategoryItem extends StatelessWidget {
// repainted when the button's ink splash animates.
return RepaintBoundary(
child: RawMaterialButton(
padding: EdgeInsets.zero,
hoverColor: theme.primaryColor.withOpacity(0.05),
splashColor: theme.primaryColor.withOpacity(0.12),
highlightColor: Colors.transparent,
onPressed: onTap,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Padding(
padding: const EdgeInsets.all(6.0),
@@ -184,7 +182,6 @@ class _DemoItem extends StatelessWidget {
final bool isDark = theme.brightness == Brightness.dark;
final double textScaleFactor = MediaQuery.textScaleFactorOf(context);
return RawMaterialButton(
padding: EdgeInsets.zero,
splashColor: theme.primaryColor.withOpacity(0.12),
highlightColor: Colors.transparent,
onPressed: () {

View File

@@ -162,7 +162,7 @@ Future<void> smokeGallery(WidgetTester tester) async {
await tester.tap(find.text(category.name));
await tester.pumpAndSettle();
for (final GalleryDemo demo in kGalleryCategoryToDemos[category]!) {
await Scrollable.ensureVisible(tester.element(find.text(demo.title)), alignment: 0.0);
await Scrollable.ensureVisible(tester.element(find.text(demo.title)));
await smokeDemo(tester, demo);
tester.binding.debugAssertNoTransientCallbacks('A transient callback was still active after running $demo');
}

View File

@@ -45,7 +45,7 @@ Future<void> runDemos(List<String> demos, WidgetController controller) async {
await controller.pumpAndSettle();
// Scroll back to the top
await controller.drag(demoList, const Offset(0.0, 10000.0));
await controller.pumpAndSettle(const Duration(milliseconds: 100));
await controller.pumpAndSettle();
}
currentDemoCategory = demoCategory;

View File

@@ -31,7 +31,7 @@ void main([List<String> args = const <String>[]]) {
await tester.pumpAndSettle();
final int id = tester.getSemantics(find.bySemanticsLabel('Material')).id;
expect(id, greaterThan(-1));
}, skip: !withSemantics, semanticsEnabled: true);
}, skip: !withSemantics);
testWidgets(
'all demos',

View File

@@ -31,7 +31,6 @@ Future<void> main() async {
},
behavior: HitTestBehavior.opaque,
child: const IgnorePointer(
ignoring: true,
child: GalleryApp(testMode: true),
),
));

View File

@@ -199,7 +199,7 @@ class MotionEventsBodyState extends State<MotionEventsBody> {
setState(() {});
break;
}
return Future<dynamic>.value(null);
return Future<dynamic>.value();
}
Future<dynamic> onViewMethodChannelCall(MethodCall call) {
@@ -212,7 +212,7 @@ class MotionEventsBodyState extends State<MotionEventsBody> {
setState(() {});
break;
}
return Future<dynamic>.value(null);
return Future<dynamic>.value();
}
Widget buildEventTile(BuildContext context, int index) {

View File

@@ -105,6 +105,5 @@ void dispatchMouseWheelEvent(int mouseX, int mouseY,
deltaMode: deltaMode,
deltaX : deltaX,
deltaY : deltaY,
shiftKey: false,
));
}