Unverified Commit 254c9f17 authored by Abhishek Ghaskata's avatar Abhishek Ghaskata Committed by GitHub

Enable use_named_constants_lint (#82426)

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