From 6ad6c0f4dce189ae9a20eaeeff230dbd429e5a9d Mon Sep 17 00:00:00 2001 From: Kate Lovett Date: Tue, 22 Dec 2020 18:54:03 -0600 Subject: [PATCH] Migrate some sample code (#72558) --- .../lib/src/painting/continuous_rectangle_border.dart | 2 +- packages/flutter/lib/src/painting/gradient.dart | 2 +- packages/flutter/lib/src/painting/image_stream.dart | 9 +++------ packages/flutter/lib/src/painting/text_span.dart | 5 +---- packages/flutter/lib/src/painting/text_style.dart | 5 ++--- 5 files changed, 8 insertions(+), 15 deletions(-) diff --git a/packages/flutter/lib/src/painting/continuous_rectangle_border.dart b/packages/flutter/lib/src/painting/continuous_rectangle_border.dart index 0e380a73753..9106bfdd0f8 100644 --- a/packages/flutter/lib/src/painting/continuous_rectangle_border.dart +++ b/packages/flutter/lib/src/painting/continuous_rectangle_border.dart @@ -93,7 +93,7 @@ class ContinuousRectangleBorder extends OutlinedBorder { final double top = rrect.top; final double bottom = rrect.bottom; // Radii will be clamped to the value of the shortest side - /// of [rrect] to avoid strange tie-fighter shapes. + // of rrect to avoid strange tie-fighter shapes. final double tlRadiusX = math.max(0.0, _clampToShortest(rrect, rrect.tlRadiusX)); final double tlRadiusY = diff --git a/packages/flutter/lib/src/painting/gradient.dart b/packages/flutter/lib/src/painting/gradient.dart index 8943fd50d2e..9ae124e4ccb 100644 --- a/packages/flutter/lib/src/painting/gradient.dart +++ b/packages/flutter/lib/src/painting/gradient.dart @@ -330,7 +330,7 @@ abstract class Gradient { /// Typically this class is used with [BoxDecoration], which does the painting. /// To use a [LinearGradient] to paint on a canvas directly, see [createShader]. /// -/// {@tool dartpad --template=stateless_widget_material_no_null_safety} +/// {@tool dartpad --template=stateless_widget_material} /// This sample draws a picture that looks like vertical window shades by having /// a [Container] display a [BoxDecoration] with a [LinearGradient]. /// diff --git a/packages/flutter/lib/src/painting/image_stream.dart b/packages/flutter/lib/src/painting/image_stream.dart index cc006758f1f..4ab53f97e37 100644 --- a/packages/flutter/lib/src/painting/image_stream.dart +++ b/packages/flutter/lib/src/painting/image_stream.dart @@ -9,9 +9,6 @@ import 'dart:ui' show hashValues; import 'package:flutter/foundation.dart'; import 'package:flutter/scheduler.dart'; -// Examples can assume: -// // @dart = 2.9 - /// A [dart:ui.Image] object with its corresponding scale. /// /// ImageInfo objects are used by [ImageStream] objects to represent the @@ -69,8 +66,8 @@ class ImageInfo { /// [ImageInfo] reference refers to new image data or not. /// /// ```dart - /// ImageInfo _imageInfo; - /// set imageInfo (ImageInfo value) { + /// ImageInfo? _imageInfo; + /// set imageInfo (ImageInfo? value) { /// // If the image reference is exactly the same, do nothing. /// if (value == _imageInfo) { /// return; @@ -78,7 +75,7 @@ class ImageInfo { /// // If it is a clone of the current reference, we must dispose of it and /// // can do so immediately. Since the underlying image has not changed, /// // We don't have any additional work to do here. - /// if (value != null && _imageInfo != null && value.isCloneOf(_imageInfo)) { + /// if (value != null && _imageInfo != null && value.isCloneOf(_imageInfo!)) { /// value.dispose(); /// return; /// } diff --git a/packages/flutter/lib/src/painting/text_span.dart b/packages/flutter/lib/src/painting/text_span.dart index 9a5581ac2f0..9415c5dd199 100644 --- a/packages/flutter/lib/src/painting/text_span.dart +++ b/packages/flutter/lib/src/painting/text_span.dart @@ -13,9 +13,6 @@ import 'inline_span.dart'; import 'text_painter.dart'; import 'text_style.dart'; -// Examples can assume: -// // @dart = 2.9 - /// An immutable span of text. /// /// A [TextSpan] object can be styled using its [style] property. The style will @@ -128,7 +125,7 @@ class TextSpan extends InlineSpan { /// } /// /// class _BuzzingTextState extends State { - /// LongPressGestureRecognizer _longPressRecognizer; + /// late LongPressGestureRecognizer _longPressRecognizer; /// /// @override /// void initState() { diff --git a/packages/flutter/lib/src/painting/text_style.dart b/packages/flutter/lib/src/painting/text_style.dart index c5524f7b22b..8f3342d4859 100644 --- a/packages/flutter/lib/src/painting/text_style.dart +++ b/packages/flutter/lib/src/painting/text_style.dart @@ -25,8 +25,7 @@ const String _kColorBackgroundWarning = 'Cannot provide both a backgroundColor a const double _kDefaultFontSize = 14.0; // Examples can assume: -// // @dart = 2.9 -// BuildContext context; +// late BuildContext context; /// An immutable style describing how to format and paint text. /// @@ -205,7 +204,7 @@ const double _kDefaultFontSize = 14.0; /// foreground: Paint() /// ..style = PaintingStyle.stroke /// ..strokeWidth = 6 -/// ..color = Colors.blue[700], +/// ..color = Colors.blue[700]!, /// ), /// ), /// // Solid text as fill.