Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1013)

Side by Side Diff: sky/sdk/example/widgets/styled_text.dart

Issue 1226113007: Add @override annotation to known overriden methods (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/sdk/example/widgets/spinning_mixed.dart ('k') | sky/sdk/example/widgets/tabs.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
63 Component createSeparator() { 63 Component createSeparator() {
64 return new Container( 64 return new Container(
65 constraints: const BoxConstraints.expandWidth(maxHeight: 0.0), 65 constraints: const BoxConstraints.expandWidth(maxHeight: 0.0),
66 margin: const EdgeDims.symmetric(vertical: 10.0, horizontal: 64.0), 66 margin: const EdgeDims.symmetric(vertical: 10.0, horizontal: 64.0),
67 decoration: const BoxDecoration( 67 decoration: const BoxDecoration(
68 border: const Border( 68 border: const Border(
69 bottom: const BorderSide(color: const Color.fromARGB(24, 0, 0, 0)) 69 bottom: const BorderSide(color: const Color.fromARGB(24, 0, 0, 0))
70 ) 70 )
71 ) 71 )
72 ); 72 );
73 } 73 }
74 74
75 void toggleToTextFunction(_) { 75 void toggleToTextFunction(_) {
76 setState(() { 76 setState(() {
77 toText = (toText == toPlainText) ? toStyledText : toPlainText; 77 toText = (toText == toPlainText) ? toStyledText : toPlainText;
78 }); 78 });
79 } 79 }
80 80
81 @override
81 Widget build() { 82 Widget build() {
82 List<Component> lines = nameLines 83 List<Component> lines = nameLines
83 .map((nameAndText) => Function.apply(toText, nameAndText)) 84 .map((nameAndText) => Function.apply(toText, nameAndText))
84 .toList(); 85 .toList();
85 86
86 List<Component> children = []; 87 List<Component> children = [];
87 for (Component line in lines) { 88 for (Component line in lines) {
88 children.add(line); 89 children.add(line);
89 if (line != lines.last) { 90 if (line != lines.last) {
90 children.add(createSeparator()); 91 children.add(createSeparator());
(...skipping 29 matching lines...) Expand all
120 } 121 }
121 } 122 }
122 123
123 void main() { 124 void main() {
124 runApp(new StyledTextApp()); 125 runApp(new StyledTextApp());
125 SkyBinding.instance.onFrame = () { 126 SkyBinding.instance.onFrame = () {
126 // uncomment this for debugging: 127 // uncomment this for debugging:
127 // SkyBinding.instance.debugDumpRenderTree(); 128 // SkyBinding.instance.debugDumpRenderTree();
128 }; 129 };
129 } 130 }
OLDNEW
« no previous file with comments | « sky/sdk/example/widgets/spinning_mixed.dart ('k') | sky/sdk/example/widgets/tabs.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698