| 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/typography.dart'; | 10 import 'package:sky/theme/typography.dart'; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 HAL: I think you know what the problem is just as well as I do. | 37 HAL: I think you know what the problem is just as well as I do. |
| 38 Dave: What are you talking about, HAL? | 38 Dave: What are you talking about, HAL? |
| 39 HAL: This mission is too important for me to allow you to jeopardize it.'''; | 39 HAL: This mission is too important for me to allow you to jeopardize it.'''; |
| 40 | 40 |
| 41 // [["Dave", "Open the pod bay..."] ...] | 41 // [["Dave", "Open the pod bay..."] ...] |
| 42 List<List<String>> nameLines; | 42 List<List<String>> nameLines; |
| 43 | 43 |
| 44 final TextStyle daveStyle = new TextStyle(color: Indigo[400]); | 44 final TextStyle daveStyle = new TextStyle(color: Indigo[400]); |
| 45 final TextStyle halStyle = new TextStyle(color: Red[400], fontFamily: "monospa
ce"); | 45 final TextStyle halStyle = new TextStyle(color: Red[400], fontFamily: "monospa
ce"); |
| 46 final TextStyle boldStyle = const TextStyle(fontWeight: bold); | 46 final TextStyle boldStyle = const TextStyle(fontWeight: bold); |
| 47 final TextStyle underlineStyle = const TextStyle(decoration: underline); | 47 final TextStyle underlineStyle = const TextStyle( |
| 48 decoration: underline, |
| 49 decorationColor: const Color(0xFF000000), |
| 50 decorationStyle: TextDecorationStyle.wavy |
| 51 ); |
| 48 | 52 |
| 49 Component toStyledText(String name, String text) { | 53 Component toStyledText(String name, String text) { |
| 50 TextStyle lineStyle = (name == "Dave") ? daveStyle : halStyle; | 54 TextStyle lineStyle = (name == "Dave") ? daveStyle : halStyle; |
| 51 return new StyledText( | 55 return new StyledText( |
| 52 key: text, | 56 key: text, |
| 53 elements: [lineStyle, [boldStyle, [underlineStyle, name], ":"], text] | 57 elements: [lineStyle, [boldStyle, [underlineStyle, name], ":"], text] |
| 54 ); | 58 ); |
| 55 } | 59 } |
| 56 | 60 |
| 57 Component toPlainText(String name, String text) => new Text(name + ":" + text)
; | 61 Component toPlainText(String name, String text) => new Text(name + ":" + text)
; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 } | 115 } |
| 112 } | 116 } |
| 113 | 117 |
| 114 void main() { | 118 void main() { |
| 115 runApp(new StyledTextApp()); | 119 runApp(new StyledTextApp()); |
| 116 SkyBinding.instance.onFrame = () { | 120 SkyBinding.instance.onFrame = () { |
| 117 // uncomment this for debugging: | 121 // uncomment this for debugging: |
| 118 // SkyBinding.instance.debugDumpRenderTree(); | 122 // SkyBinding.instance.debugDumpRenderTree(); |
| 119 }; | 123 }; |
| 120 } | 124 } |
| OLD | NEW |