| // Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| |
| import 'package:analyzer_testing/src/mock_packages/mock_library.dart'; |
| |
| final widgetsTextLibrary = MockLibraryUnit('lib/src/widgets/text.dart', r''' |
| import 'package:flutter/foundation.dart'; |
| import 'package:flutter/painting.dart'; |
| |
| import 'basic.dart'; |
| import 'framework.dart'; |
| |
| class DefaultTextStyle extends InheritedTheme { |
| const DefaultTextStyle({ |
| super.key, |
| required TextStyle style, |
| TextAlign? textAlign, |
| bool softWrap = true, |
| TextOverflow overflow = TextOverflow.clip, |
| int? maxLines, |
| TextWidthBasis textWidthBasis = TextWidthBasis.parent, |
| TextHeightBehavior? textHeightBehavior, |
| required super.child, |
| }) : assert(maxLines == null || maxLines > 0); |
| } |
| |
| class Text extends StatelessWidget { |
| final String? data; |
| |
| final TextStyle? style; |
| |
| final TextAlign? textAlign; |
| |
| final TextDirection? textDirection; |
| |
| final bool? softWrap; |
| |
| final TextOverflow? overflow; |
| |
| @Deprecated( |
| 'Use textScaler instead. ' |
| 'Use of textScaleFactor was deprecated in preparation for the upcoming nonlinear text scaling support. ' |
| 'This feature was deprecated after v3.12.0-2.0.pre.', |
| ) |
| final double? textScaleFactor; |
| |
| final int? maxLines; |
| |
| final String? semanticsLabel; |
| |
| final TextWidthBasis? textWidthBasis; |
| |
| const Text( |
| String this.data, { |
| super.key, |
| this.style, |
| StrutStyle? strutStyle, |
| this.textAlign, |
| this.textDirection, |
| Locale? locale, |
| this.softWrap, |
| this.overflow, |
| @Deprecated( |
| 'Use textScaler instead. ' |
| 'Use of textScaleFactor was deprecated in preparation for the upcoming nonlinear text scaling support. ' |
| 'This feature was deprecated after v3.12.0-2.0.pre.', |
| ) |
| this.textScaleFactor, |
| TextScaler? textScaler, |
| this.maxLines, |
| this.semanticsLabel, |
| String? semanticsIdentifier, |
| this.textWidthBasis, |
| TextHeightBehavior? textHeightBehavior, |
| Color? selectionColor, |
| }) : textSpan = null, |
| assert( |
| textScaler == null || textScaleFactor == null, |
| 'textScaleFactor is deprecated and cannot be specified when textScaler is specified.', |
| ); |
| } |
| '''); |