| 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' as colors; | 9 import 'package:sky/theme/colors.dart' as colors; |
| 10 import 'package:sky/widgets/basic.dart'; | 10 import 'package:sky/widgets/basic.dart'; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 List<List<String>> nameLines; | 42 List<List<String>> nameLines; |
| 43 | 43 |
| 44 final TextStyle daveStyle = new TextStyle(color: colors.Indigo[400], height: 1
.8); | 44 final TextStyle daveStyle = new TextStyle(color: colors.Indigo[400], height: 1
.8); |
| 45 final TextStyle halStyle = new TextStyle(color: colors.Red[400], fontFamily: "
monospace"); | 45 final TextStyle halStyle = new TextStyle(color: colors.Red[400], fontFamily: "
monospace"); |
| 46 final TextStyle boldStyle = const TextStyle(fontWeight: bold); | 46 final TextStyle boldStyle = const TextStyle(fontWeight: bold); |
| 47 final TextStyle underlineStyle = const TextStyle( | 47 final TextStyle underlineStyle = const TextStyle( |
| 48 decoration: underline, | 48 decoration: underline, |
| 49 decorationColor: const Color(0xFF000000), | 49 decorationColor: const Color(0xFF000000), |
| 50 decorationStyle: TextDecorationStyle.wavy | 50 decorationStyle: TextDecorationStyle.wavy |
| 51 ); | 51 ); |
| 52 | 52 |
| 53 Component toStyledText(String name, String text) { | 53 Component toStyledText(String name, String text) { |
| 54 TextStyle lineStyle = (name == "Dave") ? daveStyle : halStyle; | 54 TextStyle lineStyle = (name == "Dave") ? daveStyle : halStyle; |
| 55 return new StyledText( | 55 return new StyledText( |
| 56 key: text, | 56 key: text, |
| 57 elements: [lineStyle, [boldStyle, [underlineStyle, name], ":"], text] | 57 elements: [lineStyle, [boldStyle, [underlineStyle, name], ":"], text] |
| 58 ); | 58 ); |
| 59 } | 59 } |
| 60 | 60 |
| 61 Component toPlainText(String name, String text) => new Text(name + ":" + text)
; | 61 Component toPlainText(String name, String text) => new Text(name + ":" + text)
; |
| 62 | 62 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 toolbar: new ToolBar( | 115 toolbar: new ToolBar( |
| 116 center: new Text('Hal and Dave') | 116 center: new Text('Hal and Dave') |
| 117 ) | 117 ) |
| 118 ) | 118 ) |
| 119 ); | 119 ); |
| 120 } | 120 } |
| 121 } | 121 } |
| 122 | 122 |
| 123 void main() { | 123 void main() { |
| 124 runApp(new StyledTextApp()); | 124 runApp(new StyledTextApp()); |
| 125 SkyBinding.instance.onFrame = () { | |
| 126 // uncomment this for debugging: | |
| 127 // SkyBinding.instance.debugDumpRenderTree(); | |
| 128 }; | |
| 129 } | 125 } |
| OLD | NEW |