|
2 | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | 3 | // found in the LICENSE file. |
4 | 4 |
|
5 | | -import 'package:flutter/foundation.dart' |
6 | | - show FlutterError, FlutterErrorDetails, FlutterExceptionHandler; |
7 | | -import 'package:flutter/painting.dart' |
8 | | - show |
9 | | - Axis, |
10 | | - Color, |
11 | | - FontWeight, |
12 | | - Offset, |
13 | | - Rect, |
14 | | - TextDecoration, |
15 | | - TextDecorationStyle, |
16 | | - TextDirection, |
17 | | - TextStyle; |
18 | | -import 'package:flutter/rendering.dart' show TreeSliverIndentationType; |
19 | | -import 'package:flutter/widgets.dart' |
20 | | - show |
21 | | - AnimationStyle, |
22 | | - Container, |
23 | | - Curves, |
24 | | - CustomScrollView, |
25 | | - DefaultTextStyle, |
26 | | - Directionality, |
27 | | - Icon, |
28 | | - ScrollController, |
29 | | - TreeSliver, |
30 | | - TreeSliverNode, |
31 | | - Widget; |
| 5 | +import 'package:flutter/foundation.dart'; |
| 6 | +import 'package:flutter/rendering.dart'; |
| 7 | +import 'package:flutter/widgets.dart'; |
32 | 8 | import 'package:flutter_test/flutter_test.dart'; |
33 | 9 |
|
34 | | -/// The fallback text style used by MaterialApp when no other style is provided. |
35 | | -/// |
36 | | -/// This is used in tests to ensure consistent text metrics without a dependency |
37 | | -/// on the Material library. |
38 | | -const TextStyle _materialAppFallbackTextStyle = TextStyle( |
39 | | - color: Color(0xD0FF0000), |
40 | | - fontFamily: 'monospace', |
41 | | - fontSize: 48.0, |
42 | | - fontWeight: FontWeight.w900, |
43 | | - decoration: TextDecoration.underline, |
44 | | - decorationColor: Color(0xFFFFFF00), |
45 | | - decorationStyle: TextDecorationStyle.double, |
46 | | - debugLabel: 'fallback style; consider putting your text in a Material', |
47 | | -); |
48 | | - |
49 | 10 | /// Wraps the [child] in a [Directionality] and [DefaultTextStyle] to provide |
50 | 11 | /// the necessary context for rendering tests. |
51 | 12 | Widget _buildTestWidget(Widget child) { |
52 | 13 | return Directionality( |
53 | 14 | textDirection: TextDirection.ltr, |
54 | | - child: DefaultTextStyle(style: _materialAppFallbackTextStyle, child: child), |
| 15 | + child: DefaultTextStyle( |
| 16 | + style: const TextStyle( |
| 17 | + color: Color(0xFF000000), |
| 18 | + fontFamily: 'monospace', |
| 19 | + fontSize: 48.0, |
| 20 | + fontWeight: FontWeight.w900, |
| 21 | + decoration: TextDecoration.underline, |
| 22 | + decorationColor: Color(0xFFFFFF00), |
| 23 | + decorationStyle: TextDecorationStyle.double, |
| 24 | + debugLabel: 'fallback style', |
| 25 | + ), |
| 26 | + child: child, |
| 27 | + ), |
55 | 28 | ); |
56 | 29 | } |
57 | 30 |
|
|
0 commit comments