From e45836f271f15636dfe9c805774524dbe2f1b9d6 Mon Sep 17 00:00:00 2001 From: Alexandre Ardhuin Date: Wed, 13 Jun 2018 07:20:18 +0200 Subject: [PATCH] enable lint avoid_field_initializers_in_const_classes (#18415) --- analysis_options.yaml | 2 +- examples/flutter_gallery/lib/demo/pesto_demo.dart | 6 +++--- packages/flutter/lib/src/gestures/events.dart | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index a7a8b2c4db..58f4974890 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -57,7 +57,7 @@ linter: - avoid_classes_with_only_static_members # - avoid_double_and_int_checks # only useful when targeting JS runtime - avoid_empty_else - # - avoid_field_initializers_in_const_classes # not yet tested + - avoid_field_initializers_in_const_classes - avoid_function_literals_in_foreach_calls - avoid_init_to_null # - avoid_js_rounded_ints # only useful when targeting JS runtime diff --git a/examples/flutter_gallery/lib/demo/pesto_demo.dart b/examples/flutter_gallery/lib/demo/pesto_demo.dart index 1fb86b9b03..801e1fa5d8 100644 --- a/examples/flutter_gallery/lib/demo/pesto_demo.dart +++ b/examples/flutter_gallery/lib/demo/pesto_demo.dart @@ -250,14 +250,14 @@ class _PestoLogoState extends State { // A card with the recipe's image, author, and title. class RecipeCard extends StatelessWidget { - final TextStyle titleStyle = const PestoStyle(fontSize: 24.0, fontWeight: FontWeight.w600); - final TextStyle authorStyle = const PestoStyle(fontWeight: FontWeight.w500, color: Colors.black54); - const RecipeCard({ Key key, this.recipe, this.onTap }) : super(key: key); final Recipe recipe; final VoidCallback onTap; + TextStyle get titleStyle => const PestoStyle(fontSize: 24.0, fontWeight: FontWeight.w600); + TextStyle get authorStyle => const PestoStyle(fontWeight: FontWeight.w500, color: Colors.black54); + @override Widget build(BuildContext context) { return new GestureDetector( diff --git a/packages/flutter/lib/src/gestures/events.dart b/packages/flutter/lib/src/gestures/events.dart index 930be7413e..0ff1e30ff4 100644 --- a/packages/flutter/lib/src/gestures/events.dart +++ b/packages/flutter/lib/src/gestures/events.dart @@ -176,7 +176,7 @@ abstract class PointerEvent { final double distance; /// The minimum value that a distance can return for this pointer (always 0.0). - final double distanceMin = 0.0; + double get distanceMin => 0.0; /// The maximum value that a distance can return for this pointer. If this /// input device cannot detect "hover touch" input events, then this will be