Enable use_named_constants_lint (#82426)
This commit is contained in:
committed by
GitHub
parent
63fc778f41
commit
254c9f1755
@@ -222,7 +222,7 @@ linter:
|
||||
- use_is_even_rather_than_modulo
|
||||
- use_key_in_widget_constructors
|
||||
- use_late_for_private_fields_and_variables
|
||||
# - use_named_constants # not yet tested
|
||||
- use_named_constants
|
||||
- use_raw_strings
|
||||
- use_rethrow_when_possible
|
||||
# - use_setters_to_change_properties # not yet tested
|
||||
|
||||
@@ -103,7 +103,7 @@ enum StretchMode {
|
||||
/// decoration: BoxDecoration(
|
||||
/// gradient: LinearGradient(
|
||||
/// begin: Alignment(0.0, 0.5),
|
||||
/// end: Alignment(0.0, 0.0),
|
||||
/// end: Alignment.center,
|
||||
/// colors: <Color>[
|
||||
/// Color(0x60000000),
|
||||
/// Color(0x00000000),
|
||||
|
||||
@@ -71,7 +71,7 @@ import 'restoration.dart';
|
||||
/// ```dart
|
||||
/// class RestorableDuration extends RestorableValue<Duration> {
|
||||
/// @override
|
||||
/// Duration createDefaultValue() => const Duration();
|
||||
/// Duration createDefaultValue() => Duration.zero;
|
||||
///
|
||||
/// @override
|
||||
/// void didUpdateValue(Duration? oldValue) {
|
||||
@@ -84,7 +84,7 @@ import 'restoration.dart';
|
||||
/// if (data != null) {
|
||||
/// return Duration(microseconds: data as int);
|
||||
/// }
|
||||
/// return const Duration();
|
||||
/// return Duration.zero;
|
||||
/// }
|
||||
///
|
||||
/// @override
|
||||
|
||||
@@ -45,12 +45,12 @@ void main() {
|
||||
ui.PointerData(
|
||||
change: ui.PointerChange.add,
|
||||
physicalX: 0.0,
|
||||
timeStamp: epoch + Duration.zero,
|
||||
timeStamp: epoch,
|
||||
),
|
||||
ui.PointerData(
|
||||
change: ui.PointerChange.down,
|
||||
physicalX: 0.0,
|
||||
timeStamp: epoch + const Duration(milliseconds: 0),
|
||||
timeStamp: epoch,
|
||||
),
|
||||
ui.PointerData(
|
||||
change: ui.PointerChange.move,
|
||||
|
||||
@@ -69,7 +69,7 @@ void main() {
|
||||
ui.PointerData(
|
||||
change: ui.PointerChange.add,
|
||||
physicalX: 0.0,
|
||||
timeStamp: epoch + const Duration(milliseconds: 0),
|
||||
timeStamp: epoch,
|
||||
),
|
||||
ui.PointerData(
|
||||
change: ui.PointerChange.down,
|
||||
|
||||
@@ -1142,7 +1142,7 @@ void main() {
|
||||
final Key labelKey = UniqueKey();
|
||||
final ButtonStyle style = ElevatedButton.styleFrom(
|
||||
padding: EdgeInsets.zero,
|
||||
visualDensity: const VisualDensity(), // dx=0, dy=0
|
||||
visualDensity: VisualDensity.standard, // dx=0, dy=0
|
||||
);
|
||||
|
||||
await tester.pumpWidget(
|
||||
|
||||
@@ -1318,7 +1318,7 @@ void main() {
|
||||
final Key labelKey = UniqueKey();
|
||||
final ButtonStyle style = OutlinedButton.styleFrom(
|
||||
padding: EdgeInsets.zero,
|
||||
visualDensity: const VisualDensity(), // dx=0, dy=0
|
||||
visualDensity: VisualDensity.standard, // dx=0, dy=0
|
||||
);
|
||||
|
||||
await tester.pumpWidget(
|
||||
|
||||
@@ -2314,7 +2314,7 @@ void main() {
|
||||
onPressed: () {
|
||||
showMenu<void>(
|
||||
context: navigator.currentContext!,
|
||||
position: const RelativeRect.fromLTRB(0, 0, 0, 0),
|
||||
position: RelativeRect.fill,
|
||||
items: const <PopupMenuItem<void>>[
|
||||
PopupMenuItem<void>(child: Text('foo')),
|
||||
],
|
||||
|
||||
@@ -1115,7 +1115,7 @@ void main() {
|
||||
final Key labelKey = UniqueKey();
|
||||
final ButtonStyle style = TextButton.styleFrom(
|
||||
padding: EdgeInsets.zero,
|
||||
visualDensity: const VisualDensity(), // dx=0, dy=0
|
||||
visualDensity: VisualDensity.standard, // dx=0, dy=0
|
||||
);
|
||||
|
||||
await tester.pumpWidget(
|
||||
|
||||
@@ -134,7 +134,7 @@ void main() {
|
||||
test('basic structure', () async {
|
||||
const TextInputType text = TextInputType.text;
|
||||
const TextInputType number = TextInputType.number;
|
||||
const TextInputType number2 = TextInputType.numberWithOptions();
|
||||
const TextInputType number2 = TextInputType.number;
|
||||
const TextInputType signed = TextInputType.numberWithOptions(signed: true);
|
||||
const TextInputType signed2 = TextInputType.numberWithOptions(signed: true);
|
||||
const TextInputType decimal = TextInputType.numberWithOptions(decimal: true);
|
||||
|
||||
@@ -3036,7 +3036,7 @@ void main() {
|
||||
feedback: const Text('Feedback'),
|
||||
dragAnchorStrategy: (Draggable<Object> widget, BuildContext context, Offset position) {
|
||||
dragAnchorStrategyCalled = true;
|
||||
return const Offset(0, 0);
|
||||
return Offset.zero;
|
||||
},
|
||||
),
|
||||
],
|
||||
|
||||
@@ -123,7 +123,7 @@ Future<void> main() async {
|
||||
child: DecoratedBox(
|
||||
decoration: ShapeDecoration(
|
||||
gradient: RadialGradient(
|
||||
focal: AlignmentDirectional(0, 1),
|
||||
focal: AlignmentDirectional.bottomCenter,
|
||||
focalRadius: 5,
|
||||
radius: 2,
|
||||
colors: <Color>[Colors.red, Colors.black],
|
||||
|
||||
@@ -31,11 +31,7 @@ void main() {
|
||||
|
||||
await BundleBuilder().build(
|
||||
platform: TargetPlatform.ios,
|
||||
buildInfo: const BuildInfo(
|
||||
BuildMode.debug,
|
||||
null,
|
||||
treeShakeIcons: false
|
||||
),
|
||||
buildInfo: BuildInfo.debug,
|
||||
project: FlutterProject.fromDirectoryTest(globals.fs.currentDirectory),
|
||||
mainPath: globals.fs.path.join('lib', 'main.dart'),
|
||||
assetDirPath: 'example',
|
||||
@@ -54,11 +50,7 @@ void main() {
|
||||
expect(
|
||||
() => BundleBuilder().build(
|
||||
platform: TargetPlatform.ios,
|
||||
buildInfo: const BuildInfo(
|
||||
BuildMode.debug,
|
||||
null,
|
||||
treeShakeIcons: false
|
||||
),
|
||||
buildInfo: BuildInfo.debug,
|
||||
project: FlutterProject.fromDirectoryTest(globals.fs.currentDirectory),
|
||||
mainPath: 'lib/main.dart',
|
||||
assetDirPath: 'example',
|
||||
|
||||
Reference in New Issue
Block a user