OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 import 'package:sky/painting/text_style.dart'; | 5 import 'package:sky/painting/text_style.dart'; |
6 import 'package:sky/rendering/box.dart'; | 6 import 'package:sky/rendering/box.dart'; |
7 import 'package:sky/rendering/flex.dart'; | 7 import 'package:sky/rendering/flex.dart'; |
8 import 'package:sky/rendering/sky_binding.dart'; | 8 import 'package:sky/rendering/sky_binding.dart'; |
9 import 'package:sky/theme/colors.dart'; | 9 import 'package:sky/theme/colors.dart'; |
10 import 'package:sky/theme/theme_data.dart'; | 10 import 'package:sky/theme/theme_data.dart'; |
11 import 'package:sky/theme/typography.dart'; | |
12 import 'package:sky/widgets/basic.dart'; | 11 import 'package:sky/widgets/basic.dart'; |
13 import 'package:sky/widgets/material.dart'; | 12 import 'package:sky/widgets/material.dart'; |
14 import 'package:sky/widgets/scaffold.dart'; | 13 import 'package:sky/widgets/scaffold.dart'; |
15 import 'package:sky/widgets/theme.dart'; | 14 import 'package:sky/widgets/theme.dart'; |
16 import 'package:sky/widgets/tool_bar.dart'; | 15 import 'package:sky/widgets/tool_bar.dart'; |
17 import 'package:sky/widgets/widget.dart'; | 16 import 'package:sky/widgets/widget.dart'; |
18 | 17 |
19 | 18 |
20 class StyledTextApp extends App { | 19 class StyledTextApp extends App { |
21 | 20 |
(...skipping 14 matching lines...) Expand all Loading... |
36 Dave: Open the pod bay doors, HAL. | 35 Dave: Open the pod bay doors, HAL. |
37 HAL: I'm sorry, Dave. I'm afraid I can't do that. | 36 HAL: I'm sorry, Dave. I'm afraid I can't do that. |
38 Dave: What's the problem? | 37 Dave: What's the problem? |
39 HAL: I think you know what the problem is just as well as I do. | 38 HAL: I think you know what the problem is just as well as I do. |
40 Dave: What are you talking about, HAL? | 39 Dave: What are you talking about, HAL? |
41 HAL: This mission is too important for me to allow you to jeopardize it.'''; | 40 HAL: This mission is too important for me to allow you to jeopardize it.'''; |
42 | 41 |
43 // [["Dave", "Open the pod bay..."] ...] | 42 // [["Dave", "Open the pod bay..."] ...] |
44 List<List<String>> nameLines; | 43 List<List<String>> nameLines; |
45 | 44 |
46 final TextStyle daveStyle = new TextStyle(color: Indigo[400]); | 45 final TextStyle daveStyle = new TextStyle(color: Indigo[400], height: 1.8); |
47 final TextStyle halStyle = new TextStyle(color: Red[400], fontFamily: "monospa
ce"); | 46 final TextStyle halStyle = new TextStyle(color: Red[400], fontFamily: "monospa
ce"); |
48 final TextStyle boldStyle = const TextStyle(fontWeight: bold); | 47 final TextStyle boldStyle = const TextStyle(fontWeight: bold); |
49 final TextStyle underlineStyle = const TextStyle( | 48 final TextStyle underlineStyle = const TextStyle( |
50 decoration: underline, | 49 decoration: underline, |
51 decorationColor: const Color(0xFF000000), | 50 decorationColor: const Color(0xFF000000), |
52 decorationStyle: TextDecorationStyle.wavy | 51 decorationStyle: TextDecorationStyle.wavy |
53 ); | 52 ); |
54 | 53 |
55 Component toStyledText(String name, String text) { | 54 Component toStyledText(String name, String text) { |
56 TextStyle lineStyle = (name == "Dave") ? daveStyle : halStyle; | 55 TextStyle lineStyle = (name == "Dave") ? daveStyle : halStyle; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 } | 118 } |
120 } | 119 } |
121 | 120 |
122 void main() { | 121 void main() { |
123 runApp(new StyledTextApp()); | 122 runApp(new StyledTextApp()); |
124 SkyBinding.instance.onFrame = () { | 123 SkyBinding.instance.onFrame = () { |
125 // uncomment this for debugging: | 124 // uncomment this for debugging: |
126 // SkyBinding.instance.debugDumpRenderTree(); | 125 // SkyBinding.instance.debugDumpRenderTree(); |
127 }; | 126 }; |
128 } | 127 } |
OLD | NEW |