Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
4c8c420e
Commit
4c8c420e
authored
Mar 04, 2017
by
Chris Bracken
Committed by
GitHub
Mar 04, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Declare locals final where not reassigned (layers) (#8572)
parent
96eea437
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
113 additions
and
113 deletions
+113
-113
canvas.dart
examples/layers/raw/canvas.dart
+13
-13
spinning_square.dart
examples/layers/raw/spinning_square.dart
+7
-7
text.dart
examples/layers/raw/text.dart
+8
-8
touch_input.dart
examples/layers/raw/touch_input.dart
+8
-8
custom_coordinate_systems.dart
examples/layers/rendering/custom_coordinate_systems.dart
+2
-2
flex_layout.dart
examples/layers/rendering/flex_layout.dart
+7
-7
spinning_square.dart
examples/layers/rendering/spinning_square.dart
+6
-6
sector_layout.dart
examples/layers/rendering/src/sector_layout.dart
+33
-33
touch_input.dart
examples/layers/rendering/touch_input.dart
+3
-3
isolate.dart
examples/layers/services/isolate.dart
+6
-6
custom_render_box.dart
examples/layers/widgets/custom_render_box.dart
+1
-1
gestures.dart
examples/layers/widgets/gestures.dart
+5
-5
media_query.dart
examples/layers/widgets/media_query.dart
+1
-1
sectors.dart
examples/layers/widgets/sectors.dart
+3
-3
spinning_mixed.dart
examples/layers/widgets/spinning_mixed.dart
+7
-7
styled_text.dart
examples/layers/widgets/styled_text.dart
+3
-3
No files found.
examples/layers/raw/canvas.dart
View file @
4c8c420e
...
...
@@ -13,21 +13,21 @@ ui.Picture paint(ui.Rect paintBounds) {
// First we create a PictureRecorder to record the commands we're going to
// feed in the canvas. The PictureRecorder will eventually produce a Picture,
// which is an immutable record of those commands.
ui
.
PictureRecorder
recorder
=
new
ui
.
PictureRecorder
();
final
ui
.
PictureRecorder
recorder
=
new
ui
.
PictureRecorder
();
// Next, we create a canvas from the recorder. The canvas is an interface
// which can receive drawing commands. The canvas interface is modeled after
// the SkCanvas interface from Skia. The paintBounds establishes a "cull rect"
// for the canvas, which lets the implementation discard any commands that
// are entirely outside this rectangle.
ui
.
Canvas
canvas
=
new
ui
.
Canvas
(
recorder
,
paintBounds
);
final
ui
.
Canvas
canvas
=
new
ui
.
Canvas
(
recorder
,
paintBounds
);
ui
.
Paint
paint
=
new
ui
.
Paint
();
final
ui
.
Paint
paint
=
new
ui
.
Paint
();
canvas
.
drawPaint
(
new
ui
.
Paint
()..
color
=
const
ui
.
Color
(
0xFFFFFFFF
));
ui
.
Size
size
=
paintBounds
.
size
;
ui
.
Point
mid
=
size
.
center
(
ui
.
Point
.
origin
);
double
radius
=
size
.
shortestSide
/
2.0
;
final
ui
.
Size
size
=
paintBounds
.
size
;
final
ui
.
Point
mid
=
size
.
center
(
ui
.
Point
.
origin
);
final
double
radius
=
size
.
shortestSide
/
2.0
;
final
double
devicePixelRatio
=
ui
.
window
.
devicePixelRatio
;
final
ui
.
Size
logicalSize
=
ui
.
window
.
physicalSize
/
devicePixelRatio
;
...
...
@@ -41,7 +41,7 @@ ui.Picture paint(ui.Rect paintBounds) {
paint
.
color
=
const
ui
.
Color
.
fromARGB
(
128
,
255
,
0
,
255
);
canvas
.
rotate
(
math
.
PI
/
4.0
);
ui
.
Gradient
yellowBlue
=
new
ui
.
Gradient
.
linear
(
final
ui
.
Gradient
yellowBlue
=
new
ui
.
Gradient
.
linear
(
<
ui
.
Point
>[
new
ui
.
Point
(-
radius
,
-
radius
),
const
ui
.
Point
(
0.0
,
0.0
)],
<
ui
.
Color
>[
const
ui
.
Color
(
0xFFFFFF00
),
const
ui
.
Color
(
0xFF0000FF
)]
);
...
...
@@ -49,7 +49,7 @@ ui.Picture paint(ui.Rect paintBounds) {
new
ui
.
Paint
()..
shader
=
yellowBlue
);
// Scale x and y by 0.5.
Float64List
scaleMatrix
=
new
Float64List
.
fromList
(<
double
>[
final
Float64List
scaleMatrix
=
new
Float64List
.
fromList
(<
double
>[
0.5
,
0.0
,
0.0
,
0.0
,
0.0
,
0.5
,
0.0
,
0.0
,
0.0
,
0.0
,
1.0
,
0.0
,
...
...
@@ -72,12 +72,12 @@ ui.Picture paint(ui.Rect paintBounds) {
ui
.
Scene
composite
(
ui
.
Picture
picture
,
ui
.
Rect
paintBounds
)
{
final
double
devicePixelRatio
=
ui
.
window
.
devicePixelRatio
;
Float64List
deviceTransform
=
new
Float64List
(
16
)
final
Float64List
deviceTransform
=
new
Float64List
(
16
)
..[
0
]
=
devicePixelRatio
..[
5
]
=
devicePixelRatio
..[
10
]
=
1.0
..[
15
]
=
1.0
;
ui
.
SceneBuilder
sceneBuilder
=
new
ui
.
SceneBuilder
()
final
ui
.
SceneBuilder
sceneBuilder
=
new
ui
.
SceneBuilder
()
..
pushTransform
(
deviceTransform
)
..
addPicture
(
ui
.
Offset
.
zero
,
picture
)
..
pop
();
...
...
@@ -85,9 +85,9 @@ ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
}
void
beginFrame
(
Duration
timeStamp
)
{
ui
.
Rect
paintBounds
=
ui
.
Point
.
origin
&
(
ui
.
window
.
physicalSize
/
ui
.
window
.
devicePixelRatio
);
ui
.
Picture
picture
=
paint
(
paintBounds
);
ui
.
Scene
scene
=
composite
(
picture
,
paintBounds
);
final
ui
.
Rect
paintBounds
=
ui
.
Point
.
origin
&
(
ui
.
window
.
physicalSize
/
ui
.
window
.
devicePixelRatio
);
final
ui
.
Picture
picture
=
paint
(
paintBounds
);
final
ui
.
Scene
scene
=
composite
(
picture
,
paintBounds
);
ui
.
window
.
render
(
scene
);
}
...
...
examples/layers/raw/spinning_square.dart
View file @
4c8c420e
...
...
@@ -19,29 +19,29 @@ void beginFrame(Duration timeStamp) {
// PAINT
ui
.
Rect
paintBounds
=
ui
.
Point
.
origin
&
(
ui
.
window
.
physicalSize
/
ui
.
window
.
devicePixelRatio
);
ui
.
PictureRecorder
recorder
=
new
ui
.
PictureRecorder
();
ui
.
Canvas
canvas
=
new
ui
.
Canvas
(
recorder
,
paintBounds
);
final
ui
.
Rect
paintBounds
=
ui
.
Point
.
origin
&
(
ui
.
window
.
physicalSize
/
ui
.
window
.
devicePixelRatio
);
final
ui
.
PictureRecorder
recorder
=
new
ui
.
PictureRecorder
();
final
ui
.
Canvas
canvas
=
new
ui
.
Canvas
(
recorder
,
paintBounds
);
canvas
.
translate
(
paintBounds
.
width
/
2.0
,
paintBounds
.
height
/
2.0
);
// Here we determine the rotation according to the timeStamp given to us by
// the engine.
double
t
=
timeStamp
.
inMicroseconds
/
Duration
.
MICROSECONDS_PER_MILLISECOND
/
1800.0
;
final
double
t
=
timeStamp
.
inMicroseconds
/
Duration
.
MICROSECONDS_PER_MILLISECOND
/
1800.0
;
canvas
.
rotate
(
math
.
PI
*
(
t
%
1.0
));
canvas
.
drawRect
(
new
ui
.
Rect
.
fromLTRB
(-
100.0
,
-
100.0
,
100.0
,
100.0
),
new
ui
.
Paint
()..
color
=
const
ui
.
Color
.
fromARGB
(
255
,
0
,
255
,
0
));
ui
.
Picture
picture
=
recorder
.
endRecording
();
final
ui
.
Picture
picture
=
recorder
.
endRecording
();
// COMPOSITE
final
double
devicePixelRatio
=
ui
.
window
.
devicePixelRatio
;
Float64List
deviceTransform
=
new
Float64List
(
16
)
final
Float64List
deviceTransform
=
new
Float64List
(
16
)
..[
0
]
=
devicePixelRatio
..[
5
]
=
devicePixelRatio
..[
10
]
=
1.0
..[
15
]
=
1.0
;
ui
.
SceneBuilder
sceneBuilder
=
new
ui
.
SceneBuilder
()
final
ui
.
SceneBuilder
sceneBuilder
=
new
ui
.
SceneBuilder
()
..
pushTransform
(
deviceTransform
)
..
addPicture
(
ui
.
Offset
.
zero
,
picture
)
..
pop
();
...
...
examples/layers/raw/text.dart
View file @
4c8c420e
...
...
@@ -12,8 +12,8 @@ import 'dart:ui' as ui;
ui
.
Paragraph
paragraph
;
ui
.
Picture
paint
(
ui
.
Rect
paintBounds
)
{
ui
.
PictureRecorder
recorder
=
new
ui
.
PictureRecorder
();
ui
.
Canvas
canvas
=
new
ui
.
Canvas
(
recorder
,
paintBounds
);
final
ui
.
PictureRecorder
recorder
=
new
ui
.
PictureRecorder
();
final
ui
.
Canvas
canvas
=
new
ui
.
Canvas
(
recorder
,
paintBounds
);
final
double
devicePixelRatio
=
ui
.
window
.
devicePixelRatio
;
final
ui
.
Size
logicalSize
=
ui
.
window
.
physicalSize
/
devicePixelRatio
;
...
...
@@ -31,12 +31,12 @@ ui.Picture paint(ui.Rect paintBounds) {
ui
.
Scene
composite
(
ui
.
Picture
picture
,
ui
.
Rect
paintBounds
)
{
final
double
devicePixelRatio
=
ui
.
window
.
devicePixelRatio
;
Float64List
deviceTransform
=
new
Float64List
(
16
)
final
Float64List
deviceTransform
=
new
Float64List
(
16
)
..[
0
]
=
devicePixelRatio
..[
5
]
=
devicePixelRatio
..[
10
]
=
1.0
..[
15
]
=
1.0
;
ui
.
SceneBuilder
sceneBuilder
=
new
ui
.
SceneBuilder
()
final
ui
.
SceneBuilder
sceneBuilder
=
new
ui
.
SceneBuilder
()
..
pushTransform
(
deviceTransform
)
..
addPicture
(
ui
.
Offset
.
zero
,
picture
)
..
pop
();
...
...
@@ -44,15 +44,15 @@ ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
}
void
beginFrame
(
Duration
timeStamp
)
{
ui
.
Rect
paintBounds
=
ui
.
Point
.
origin
&
(
ui
.
window
.
physicalSize
/
ui
.
window
.
devicePixelRatio
);
ui
.
Picture
picture
=
paint
(
paintBounds
);
ui
.
Scene
scene
=
composite
(
picture
,
paintBounds
);
final
ui
.
Rect
paintBounds
=
ui
.
Point
.
origin
&
(
ui
.
window
.
physicalSize
/
ui
.
window
.
devicePixelRatio
);
final
ui
.
Picture
picture
=
paint
(
paintBounds
);
final
ui
.
Scene
scene
=
composite
(
picture
,
paintBounds
);
ui
.
window
.
render
(
scene
);
}
void
main
(
)
{
// To create a paragraph of text, we use ParagraphBuilder.
ui
.
ParagraphBuilder
builder
=
new
ui
.
ParagraphBuilder
(
new
ui
.
ParagraphStyle
())
final
ui
.
ParagraphBuilder
builder
=
new
ui
.
ParagraphBuilder
(
new
ui
.
ParagraphStyle
())
// We first push a style that turns the text blue.
..
pushStyle
(
new
ui
.
TextStyle
(
color:
const
ui
.
Color
(
0xFF0000FF
)))
..
addText
(
'Hello, '
)
...
...
examples/layers/raw/touch_input.dart
View file @
4c8c420e
...
...
@@ -14,17 +14,17 @@ ui.Picture paint(ui.Rect paintBounds) {
// First we create a PictureRecorder to record the commands we're going to
// feed in the canvas. The PictureRecorder will eventually produce a Picture,
// which is an immutable record of those commands.
ui
.
PictureRecorder
recorder
=
new
ui
.
PictureRecorder
();
final
ui
.
PictureRecorder
recorder
=
new
ui
.
PictureRecorder
();
// Next, we create a canvas from the recorder. The canvas is an interface
// which can receive drawing commands. The canvas interface is modeled after
// the SkCanvas interface from Skia. The paintBounds establishes a "cull rect"
// for the canvas, which lets the implementation discard any commands that
// are entirely outside this rectangle.
ui
.
Canvas
canvas
=
new
ui
.
Canvas
(
recorder
,
paintBounds
);
final
ui
.
Canvas
canvas
=
new
ui
.
Canvas
(
recorder
,
paintBounds
);
// The commands draw a circle in the center of the screen.
ui
.
Size
size
=
paintBounds
.
size
;
final
ui
.
Size
size
=
paintBounds
.
size
;
canvas
.
drawCircle
(
size
.
center
(
ui
.
Point
.
origin
),
size
.
shortestSide
*
0.45
,
...
...
@@ -46,7 +46,7 @@ ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
final
double
devicePixelRatio
=
ui
.
window
.
devicePixelRatio
;
// This transform scales the x and y coordinates by the devicePixelRatio.
Float64List
deviceTransform
=
new
Float64List
(
16
)
final
Float64List
deviceTransform
=
new
Float64List
(
16
)
..[
0
]
=
devicePixelRatio
..[
5
]
=
devicePixelRatio
..[
10
]
=
1.0
...
...
@@ -56,7 +56,7 @@ ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
// transform that scale its children by the device pixel ratio. This transform
// lets us paint in "logical" pixels which are converted to device pixels by
// this scaling operation.
ui
.
SceneBuilder
sceneBuilder
=
new
ui
.
SceneBuilder
()
final
ui
.
SceneBuilder
sceneBuilder
=
new
ui
.
SceneBuilder
()
..
pushTransform
(
deviceTransform
)
..
addPicture
(
ui
.
Offset
.
zero
,
picture
)
..
pop
();
...
...
@@ -67,11 +67,11 @@ ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
}
void
beginFrame
(
Duration
timeStamp
)
{
ui
.
Rect
paintBounds
=
ui
.
Point
.
origin
&
(
ui
.
window
.
physicalSize
/
ui
.
window
.
devicePixelRatio
);
final
ui
.
Rect
paintBounds
=
ui
.
Point
.
origin
&
(
ui
.
window
.
physicalSize
/
ui
.
window
.
devicePixelRatio
);
// First, record a picture with our painting commands.
ui
.
Picture
picture
=
paint
(
paintBounds
);
final
ui
.
Picture
picture
=
paint
(
paintBounds
);
// Second, include that picture in a scene graph.
ui
.
Scene
scene
=
composite
(
picture
,
paintBounds
);
final
ui
.
Scene
scene
=
composite
(
picture
,
paintBounds
);
// Third, instruct the engine to render that scene graph.
ui
.
window
.
render
(
scene
);
}
...
...
examples/layers/rendering/custom_coordinate_systems.dart
View file @
4c8c420e
...
...
@@ -9,10 +9,10 @@ import 'package:flutter/rendering.dart';
import
'src/sector_layout.dart'
;
RenderBox
buildSectorExample
(
)
{
RenderSectorRing
rootCircle
=
new
RenderSectorRing
(
padding:
20.0
);
final
RenderSectorRing
rootCircle
=
new
RenderSectorRing
(
padding:
20.0
);
rootCircle
.
add
(
new
RenderSolidColor
(
const
Color
(
0xFF00FFFF
),
desiredDeltaTheta:
kTwoPi
*
0.15
));
rootCircle
.
add
(
new
RenderSolidColor
(
const
Color
(
0xFF0000FF
),
desiredDeltaTheta:
kTwoPi
*
0.4
));
RenderSectorSlice
stack
=
new
RenderSectorSlice
(
padding:
2.0
);
final
RenderSectorSlice
stack
=
new
RenderSectorSlice
(
padding:
2.0
);
stack
.
add
(
new
RenderSolidColor
(
const
Color
(
0xFFFFFF00
),
desiredDeltaRadius:
20.0
));
stack
.
add
(
new
RenderSolidColor
(
const
Color
(
0xFFFF9000
),
desiredDeltaRadius:
20.0
));
stack
.
add
(
new
RenderSolidColor
(
const
Color
(
0xFF00FF00
)));
...
...
examples/layers/rendering/flex_layout.dart
View file @
4c8c420e
...
...
@@ -10,13 +10,13 @@ import 'package:flutter/rendering.dart';
import
'src/solid_color_box.dart'
;
void
main
(
)
{
RenderFlex
table
=
new
RenderFlex
(
direction:
Axis
.
vertical
);
final
RenderFlex
table
=
new
RenderFlex
(
direction:
Axis
.
vertical
);
void
addAlignmentRow
(
CrossAxisAlignment
crossAxisAlignment
)
{
TextStyle
style
=
const
TextStyle
(
color:
const
Color
(
0xFF000000
));
RenderParagraph
paragraph
=
new
RenderParagraph
(
new
TextSpan
(
style:
style
,
text:
'
$crossAxisAlignment
'
));
final
RenderParagraph
paragraph
=
new
RenderParagraph
(
new
TextSpan
(
style:
style
,
text:
'
$crossAxisAlignment
'
));
table
.
add
(
new
RenderPadding
(
child:
paragraph
,
padding:
const
EdgeInsets
.
only
(
top:
20.0
)));
RenderFlex
row
=
new
RenderFlex
(
crossAxisAlignment:
crossAxisAlignment
,
textBaseline:
TextBaseline
.
alphabetic
);
final
RenderFlex
row
=
new
RenderFlex
(
crossAxisAlignment:
crossAxisAlignment
,
textBaseline:
TextBaseline
.
alphabetic
);
style
=
const
TextStyle
(
fontSize:
15.0
,
color:
const
Color
(
0xFF000000
));
row
.
add
(
new
RenderDecoratedBox
(
decoration:
const
BoxDecoration
(
backgroundColor:
const
Color
(
0x7FFFCCCC
)),
...
...
@@ -27,7 +27,7 @@ void main() {
decoration:
const
BoxDecoration
(
backgroundColor:
const
Color
(
0x7FCCFFCC
)),
child:
new
RenderParagraph
(
new
TextSpan
(
style:
style
,
text:
'foo foo foo'
))
));
RenderFlex
subrow
=
new
RenderFlex
(
crossAxisAlignment:
crossAxisAlignment
,
textBaseline:
TextBaseline
.
alphabetic
);
final
RenderFlex
subrow
=
new
RenderFlex
(
crossAxisAlignment:
crossAxisAlignment
,
textBaseline:
TextBaseline
.
alphabetic
);
style
=
const
TextStyle
(
fontSize:
25.0
,
color:
const
Color
(
0xFF000000
));
subrow
.
add
(
new
RenderDecoratedBox
(
decoration:
const
BoxDecoration
(
backgroundColor:
const
Color
(
0x7FCCCCFF
)),
...
...
@@ -48,9 +48,9 @@ void main() {
void
addJustificationRow
(
MainAxisAlignment
justify
)
{
const
TextStyle
style
=
const
TextStyle
(
color:
const
Color
(
0xFF000000
));
RenderParagraph
paragraph
=
new
RenderParagraph
(
new
TextSpan
(
style:
style
,
text:
'
$justify
'
));
final
RenderParagraph
paragraph
=
new
RenderParagraph
(
new
TextSpan
(
style:
style
,
text:
'
$justify
'
));
table
.
add
(
new
RenderPadding
(
child:
paragraph
,
padding:
const
EdgeInsets
.
only
(
top:
20.0
)));
RenderFlex
row
=
new
RenderFlex
(
direction:
Axis
.
horizontal
);
final
RenderFlex
row
=
new
RenderFlex
(
direction:
Axis
.
horizontal
);
row
.
add
(
new
RenderSolidColorBox
(
const
Color
(
0xFFFFCCCC
),
desiredSize:
const
Size
(
80.0
,
60.0
)));
row
.
add
(
new
RenderSolidColorBox
(
const
Color
(
0xFFCCFFCC
),
desiredSize:
const
Size
(
64.0
,
60.0
)));
row
.
add
(
new
RenderSolidColorBox
(
const
Color
(
0xFFCCCCFF
),
desiredSize:
const
Size
(
160.0
,
60.0
)));
...
...
@@ -66,7 +66,7 @@ void main() {
addJustificationRow
(
MainAxisAlignment
.
spaceBetween
);
addJustificationRow
(
MainAxisAlignment
.
spaceAround
);
RenderDecoratedBox
root
=
new
RenderDecoratedBox
(
final
RenderDecoratedBox
root
=
new
RenderDecoratedBox
(
decoration:
const
BoxDecoration
(
backgroundColor:
const
Color
(
0xFFFFFFFF
)),
child:
new
RenderPadding
(
child:
table
,
padding:
const
EdgeInsets
.
symmetric
(
vertical:
50.0
))
);
...
...
examples/layers/rendering/spinning_square.dart
View file @
4c8c420e
...
...
@@ -19,12 +19,12 @@ class NonStopVSync implements TickerProvider {
void
main
(
)
{
// We first create a render object that represents a green box.
RenderBox
green
=
new
RenderDecoratedBox
(
final
RenderBox
green
=
new
RenderDecoratedBox
(
decoration:
const
BoxDecoration
(
backgroundColor:
const
Color
(
0xFF00FF00
))
);
// Second, we wrap that green box in a render object that forces the green box
// to have a specific size.
RenderBox
square
=
new
RenderConstrainedBox
(
final
RenderBox
square
=
new
RenderConstrainedBox
(
additionalConstraints:
const
BoxConstraints
.
tightFor
(
width:
200.0
,
height:
200.0
),
child:
green
);
...
...
@@ -32,13 +32,13 @@ void main() {
// transform before painting its child. Each frame of the animation, we'll
// update the transform of this render object to cause the green square to
// spin.
RenderTransform
spin
=
new
RenderTransform
(
final
RenderTransform
spin
=
new
RenderTransform
(
transform:
new
Matrix4
.
identity
(),
alignment:
FractionalOffset
.
center
,
child:
square
);
// Finally, we center the spinning green square...
RenderBox
root
=
new
RenderPositionedBox
(
final
RenderBox
root
=
new
RenderPositionedBox
(
alignment:
FractionalOffset
.
center
,
child:
spin
);
...
...
@@ -47,14 +47,14 @@ void main() {
// To make the square spin, we use an animation that repeats every 1800
// milliseconds.
AnimationController
animation
=
new
AnimationController
(
final
AnimationController
animation
=
new
AnimationController
(
duration:
const
Duration
(
milliseconds:
1800
),
vsync:
const
NonStopVSync
(),
)..
repeat
();
// The animation will produce a value between 0.0 and 1.0 each frame, but we
// want to rotate the square using a value between 0.0 and math.PI. To change
// the range of the animation, we use a Tween.
Tween
<
double
>
tween
=
new
Tween
<
double
>(
begin:
0.0
,
end:
math
.
PI
);
final
Tween
<
double
>
tween
=
new
Tween
<
double
>(
begin:
0.0
,
end:
math
.
PI
);
// We add a listener to the animation, which will be called every time the
// animation ticks.
animation
.
addListener
(()
{
...
...
examples/layers/rendering/src/sector_layout.dart
View file @
4c8c420e
...
...
@@ -167,13 +167,13 @@ abstract class RenderDecoratedSector extends RenderSector {
if
(
_decoration
.
backgroundColor
!=
null
)
{
final
Canvas
canvas
=
context
.
canvas
;
Paint
paint
=
new
Paint
()..
color
=
_decoration
.
backgroundColor
;
Path
path
=
new
Path
();
double
outerRadius
=
(
parentData
.
radius
+
deltaRadius
);
Rect
outerBounds
=
new
Rect
.
fromLTRB
(
offset
.
dx
-
outerRadius
,
offset
.
dy
-
outerRadius
,
offset
.
dx
+
outerRadius
,
offset
.
dy
+
outerRadius
);
final
Paint
paint
=
new
Paint
()..
color
=
_decoration
.
backgroundColor
;
final
Path
path
=
new
Path
();
final
double
outerRadius
=
(
parentData
.
radius
+
deltaRadius
);
final
Rect
outerBounds
=
new
Rect
.
fromLTRB
(
offset
.
dx
-
outerRadius
,
offset
.
dy
-
outerRadius
,
offset
.
dx
+
outerRadius
,
offset
.
dy
+
outerRadius
);
path
.
arcTo
(
outerBounds
,
parentData
.
theta
,
deltaTheta
,
true
);
double
innerRadius
=
parentData
.
radius
;
Rect
innerBounds
=
new
Rect
.
fromLTRB
(
offset
.
dx
-
innerRadius
,
offset
.
dy
-
innerRadius
,
offset
.
dx
+
innerRadius
,
offset
.
dy
+
innerRadius
);
final
double
innerRadius
=
parentData
.
radius
;
final
Rect
innerBounds
=
new
Rect
.
fromLTRB
(
offset
.
dx
-
innerRadius
,
offset
.
dy
-
innerRadius
,
offset
.
dx
+
innerRadius
,
offset
.
dy
+
innerRadius
);
path
.
arcTo
(
innerBounds
,
parentData
.
theta
+
deltaTheta
,
-
deltaTheta
,
false
);
path
.
close
();
canvas
.
drawPath
(
path
,
paint
);
...
...
@@ -248,19 +248,19 @@ class RenderSectorRing extends RenderSectorWithChildren {
@override
SectorDimensions
getIntrinsicDimensions
(
SectorConstraints
constraints
,
double
radius
)
{
double
outerDeltaRadius
=
constraints
.
constrainDeltaRadius
(
desiredDeltaRadius
);
double
innerDeltaRadius
=
outerDeltaRadius
-
padding
*
2.0
;
double
childRadius
=
radius
+
padding
;
double
paddingTheta
=
math
.
atan
(
padding
/
(
radius
+
outerDeltaRadius
));
final
double
outerDeltaRadius
=
constraints
.
constrainDeltaRadius
(
desiredDeltaRadius
);
final
double
innerDeltaRadius
=
outerDeltaRadius
-
padding
*
2.0
;
final
double
childRadius
=
radius
+
padding
;
final
double
paddingTheta
=
math
.
atan
(
padding
/
(
radius
+
outerDeltaRadius
));
double
innerTheta
=
paddingTheta
;
// increments with each child
double
remainingDeltaTheta
=
constraints
.
maxDeltaTheta
-
(
innerTheta
+
paddingTheta
);
RenderSector
child
=
firstChild
;
while
(
child
!=
null
)
{
SectorConstraints
innerConstraints
=
new
SectorConstraints
(
final
SectorConstraints
innerConstraints
=
new
SectorConstraints
(
maxDeltaRadius:
innerDeltaRadius
,
maxDeltaTheta:
remainingDeltaTheta
);
SectorDimensions
childDimensions
=
child
.
getIntrinsicDimensions
(
innerConstraints
,
childRadius
);
final
SectorDimensions
childDimensions
=
child
.
getIntrinsicDimensions
(
innerConstraints
,
childRadius
);
innerTheta
+=
childDimensions
.
deltaTheta
;
remainingDeltaTheta
-=
childDimensions
.
deltaTheta
;
final
SectorChildListParentData
childParentData
=
child
.
parentData
;
...
...
@@ -280,14 +280,14 @@ class RenderSectorRing extends RenderSectorWithChildren {
assert
(
this
.
parentData
is
SectorParentData
);
deltaRadius
=
constraints
.
constrainDeltaRadius
(
desiredDeltaRadius
);
assert
(
deltaRadius
<
double
.
INFINITY
);
double
innerDeltaRadius
=
deltaRadius
-
padding
*
2.0
;
double
childRadius
=
this
.
parentData
.
radius
+
padding
;
double
paddingTheta
=
math
.
atan
(
padding
/
(
this
.
parentData
.
radius
+
deltaRadius
));
final
double
innerDeltaRadius
=
deltaRadius
-
padding
*
2.0
;
final
double
childRadius
=
this
.
parentData
.
radius
+
padding
;
final
double
paddingTheta
=
math
.
atan
(
padding
/
(
this
.
parentData
.
radius
+
deltaRadius
));
double
innerTheta
=
paddingTheta
;
// increments with each child
double
remainingDeltaTheta
=
constraints
.
maxDeltaTheta
-
(
innerTheta
+
paddingTheta
);
RenderSector
child
=
firstChild
;
while
(
child
!=
null
)
{
SectorConstraints
innerConstraints
=
new
SectorConstraints
(
final
SectorConstraints
innerConstraints
=
new
SectorConstraints
(
maxDeltaRadius:
innerDeltaRadius
,
maxDeltaTheta:
remainingDeltaTheta
);
...
...
@@ -363,18 +363,18 @@ class RenderSectorSlice extends RenderSectorWithChildren {
@override
SectorDimensions
getIntrinsicDimensions
(
SectorConstraints
constraints
,
double
radius
)
{
assert
(
this
.
parentData
is
SectorParentData
);
double
paddingTheta
=
math
.
atan
(
padding
/
this
.
parentData
.
radius
);
double
outerDeltaTheta
=
constraints
.
constrainDeltaTheta
(
desiredDeltaTheta
);
double
innerDeltaTheta
=
outerDeltaTheta
-
paddingTheta
*
2.0
;
final
double
paddingTheta
=
math
.
atan
(
padding
/
this
.
parentData
.
radius
);
final
double
outerDeltaTheta
=
constraints
.
constrainDeltaTheta
(
desiredDeltaTheta
);
final
double
innerDeltaTheta
=
outerDeltaTheta
-
paddingTheta
*
2.0
;
double
childRadius
=
this
.
parentData
.
radius
+
padding
;
double
remainingDeltaRadius
=
constraints
.
maxDeltaRadius
-
(
padding
*
2.0
);
RenderSector
child
=
firstChild
;
while
(
child
!=
null
)
{
SectorConstraints
innerConstraints
=
new
SectorConstraints
(
final
SectorConstraints
innerConstraints
=
new
SectorConstraints
(
maxDeltaRadius:
remainingDeltaRadius
,
maxDeltaTheta:
innerDeltaTheta
);
SectorDimensions
childDimensions
=
child
.
getIntrinsicDimensions
(
innerConstraints
,
childRadius
);
final
SectorDimensions
childDimensions
=
child
.
getIntrinsicDimensions
(
innerConstraints
,
childRadius
);
childRadius
+=
childDimensions
.
deltaRadius
;
remainingDeltaRadius
-=
childDimensions
.
deltaRadius
;
final
SectorChildListParentData
childParentData
=
child
.
parentData
;
...
...
@@ -392,14 +392,14 @@ class RenderSectorSlice extends RenderSectorWithChildren {
assert
(
this
.
parentData
is
SectorParentData
);
deltaTheta
=
constraints
.
constrainDeltaTheta
(
desiredDeltaTheta
);
assert
(
deltaTheta
<=
kTwoPi
);
double
paddingTheta
=
math
.
atan
(
padding
/
this
.
parentData
.
radius
);
double
innerTheta
=
this
.
parentData
.
theta
+
paddingTheta
;
double
innerDeltaTheta
=
deltaTheta
-
paddingTheta
*
2.0
;
final
double
paddingTheta
=
math
.
atan
(
padding
/
this
.
parentData
.
radius
);
final
double
innerTheta
=
this
.
parentData
.
theta
+
paddingTheta
;
final
double
innerDeltaTheta
=
deltaTheta
-
paddingTheta
*
2.0
;
double
childRadius
=
this
.
parentData
.
radius
+
padding
;
double
remainingDeltaRadius
=
constraints
.
maxDeltaRadius
-
(
padding
*
2.0
);
RenderSector
child
=
firstChild
;
while
(
child
!=
null
)
{
SectorConstraints
innerConstraints
=
new
SectorConstraints
(
final
SectorConstraints
innerConstraints
=
new
SectorConstraints
(
maxDeltaRadius:
remainingDeltaRadius
,
maxDeltaTheta:
innerDeltaTheta
);
...
...
@@ -489,9 +489,9 @@ class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChil
assert
(
child
.
parentData
is
SectorParentData
);
assert
(
width
!=
null
);
assert
(
height
!=
null
);
double
maxChildDeltaRadius
=
math
.
min
(
width
,
height
)
/
2.0
-
innerRadius
;
SectorDimensions
childDimensions
=
child
.
getIntrinsicDimensions
(
new
SectorConstraints
(
maxDeltaRadius:
maxChildDeltaRadius
),
innerRadius
);
double
dimension
=
(
innerRadius
+
childDimensions
.
deltaRadius
)
*
2.0
;
final
double
maxChildDeltaRadius
=
math
.
min
(
width
,
height
)
/
2.0
-
innerRadius
;
final
SectorDimensions
childDimensions
=
child
.
getIntrinsicDimensions
(
new
SectorConstraints
(
maxDeltaRadius:
maxChildDeltaRadius
),
innerRadius
);
final
double
dimension
=
(
innerRadius
+
childDimensions
.
deltaRadius
)
*
2.0
;
return
constraints
.
constrain
(
new
Size
(
dimension
,
dimension
));
}
...
...
@@ -502,12 +502,12 @@ class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChil
}
else
{
assert
(
child
is
RenderSector
);
assert
(
constraints
.
maxWidth
<
double
.
INFINITY
||
constraints
.
maxHeight
<
double
.
INFINITY
);
double
maxChildDeltaRadius
=
math
.
min
(
constraints
.
maxWidth
,
constraints
.
maxHeight
)
/
2.0
-
innerRadius
;
final
double
maxChildDeltaRadius
=
math
.
min
(
constraints
.
maxWidth
,
constraints
.
maxHeight
)
/
2.0
-
innerRadius
;
assert
(
child
.
parentData
is
SectorParentData
);
child
.
parentData
.
radius
=
innerRadius
;
child
.
parentData
.
theta
=
0.0
;
child
.
layout
(
new
SectorConstraints
(
maxDeltaRadius:
maxChildDeltaRadius
),
parentUsesSize:
true
);
double
dimension
=
(
innerRadius
+
child
.
deltaRadius
)
*
2.0
;
final
double
dimension
=
(
innerRadius
+
child
.
deltaRadius
)
*
2.0
;
size
=
constraints
.
constrain
(
new
Size
(
dimension
,
dimension
));
}
}
...
...
@@ -516,7 +516,7 @@ class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChil
void
paint
(
PaintingContext
context
,
Offset
offset
)
{
super
.
paint
(
context
,
offset
);
if
(
child
!=
null
)
{
Rect
bounds
=
offset
&
size
;
final
Rect
bounds
=
offset
&
size
;
// we move the offset to the center of the circle for the RenderSectors
context
.
paintChild
(
child
,
bounds
.
center
.
toOffset
());
}
...
...
@@ -532,8 +532,8 @@ class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChil
x
-=
size
.
width
/
2.0
;
y
-=
size
.
height
/
2.0
;
// convert to radius/theta
double
radius
=
math
.
sqrt
(
x
*
x
+
y
*
y
);
double
theta
=
(
math
.
atan2
(
x
,
-
y
)
-
math
.
PI
/
2.0
)
%
kTwoPi
;
final
double
radius
=
math
.
sqrt
(
x
*
x
+
y
*
y
);
final
double
theta
=
(
math
.
atan2
(
x
,
-
y
)
-
math
.
PI
/
2.0
)
%
kTwoPi
;
if
(
radius
<
innerRadius
)
return
false
;
if
(
radius
>=
innerRadius
+
child
.
deltaRadius
)
...
...
examples/layers/rendering/touch_input.dart
View file @
4c8c420e
...
...
@@ -65,7 +65,7 @@ class RenderDots extends RenderBox {
@override
void
handleEvent
(
PointerEvent
event
,
BoxHitTestEntry
entry
)
{
if
(
event
is
PointerDownEvent
)
{
Color
color
=
_kColors
[
event
.
pointer
.
remainder
(
_kColors
.
length
)];
final
Color
color
=
_kColors
[
event
.
pointer
.
remainder
(
_kColors
.
length
)];
_dots
[
event
.
pointer
]
=
new
Dot
(
color:
color
)..
update
(
event
);
// We call markNeedsPaint to indicate that our painting commands have
// changed and that paint needs to be called before displaying a new frame
...
...
@@ -101,7 +101,7 @@ class RenderDots extends RenderBox {
void
main
(
)
{
// Create some styled text to tell the user to interact with the app.
RenderParagraph
paragraph
=
new
RenderParagraph
(
final
RenderParagraph
paragraph
=
new
RenderParagraph
(
new
TextSpan
(
style:
new
TextStyle
(
color:
Colors
.
black87
),
text:
"Touch me!"
...
...
@@ -110,7 +110,7 @@ void main() {
// A stack is a render object that layers its children on top of each other.
// The bottom later is our RenderDots object, and on top of that we show the
// text.
RenderStack
stack
=
new
RenderStack
(
final
RenderStack
stack
=
new
RenderStack
(
children:
<
RenderBox
>[
new
RenderDots
(),
paragraph
,
...
...
examples/layers/services/isolate.dart
View file @
4c8c420e
...
...
@@ -36,7 +36,7 @@ class Calculator {
// Run the computation associated with this Calculator.
void
run
()
{
int
i
=
0
;
JsonDecoder
decoder
=
new
JsonDecoder
(
final
JsonDecoder
decoder
=
new
JsonDecoder
(
(
dynamic
key
,
dynamic
value
)
{
if
(
key
is
int
&&
i
++
%
_NOTIFY_INTERVAL
==
0
)
onProgressListener
(
i
.
toDouble
(),
_NUM_ITEMS
.
toDouble
());
...
...
@@ -44,8 +44,8 @@ class Calculator {
}
);
try
{
List
<
dynamic
>
result
=
decoder
.
convert
(
_data
);
int
n
=
result
.
length
;
final
List
<
dynamic
>
result
=
decoder
.
convert
(
_data
);
final
int
n
=
result
.
length
;
onResultListener
(
"Decoded
$n
results"
);
}
catch
(
e
,
stack
)
{
print
(
"Invalid JSON file:
$e
"
);
...
...
@@ -54,7 +54,7 @@ class Calculator {
}
static
String
_replicateJson
(
String
data
,
int
count
)
{
StringBuffer
buffer
=
new
StringBuffer
()..
write
(
"["
);
final
StringBuffer
buffer
=
new
StringBuffer
()..
write
(
"["
);
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
buffer
.
write
(
data
);
if
(
i
<
count
-
1
)
...
...
@@ -178,8 +178,8 @@ class CalculationManager {
// Static and global variables are initialized anew in the spawned isolate,
// in a separate memory space.
static
void
_calculate
(
CalculationMessage
message
)
{
SendPort
sender
=
message
.
sendPort
;
Calculator
calculator
=
new
Calculator
(
final
SendPort
sender
=
message
.
sendPort
;
final
Calculator
calculator
=
new
Calculator
(
onProgressListener:
(
double
completed
,
double
total
)
{
sender
.
send
(<
double
>[
completed
,
total
]);
},
...
...
examples/layers/widgets/custom_render_box.dart
View file @
4c8c420e
...
...
@@ -30,7 +30,7 @@ class RenderDots extends RenderConstrainedBox {
final
Canvas
canvas
=
context
.
canvas
;
canvas
.
drawRect
(
offset
&
size
,
new
Paint
()..
color
=
const
Color
(
0xFF0000FF
));
Paint
paint
=
new
Paint
()..
color
=
const
Color
(
0xFF00FF00
);
final
Paint
paint
=
new
Paint
()..
color
=
const
Color
(
0xFF00FF00
);
for
(
Point
point
in
_dots
.
values
)
canvas
.
drawCircle
(
point
,
50.0
,
paint
);
...
...
examples/layers/widgets/gestures.dart
View file @
4c8c420e
...
...
@@ -27,13 +27,13 @@ class _GesturePainter extends CustomPainter {
@override
void
paint
(
Canvas
canvas
,
Size
size
)
{
Point
center
=
(
size
.
center
(
Point
.
origin
).
toOffset
()
*
zoom
+
offset
).
toPoint
();
double
radius
=
size
.
width
/
2.0
*
zoom
;
Gradient
gradient
=
new
RadialGradient
(
final
Point
center
=
(
size
.
center
(
Point
.
origin
).
toOffset
()
*
zoom
+
offset
).
toPoint
();
final
double
radius
=
size
.
width
/
2.0
*
zoom
;
final
Gradient
gradient
=
new
RadialGradient
(
colors:
forward
?
<
Color
>[
swatch
[
50
],
swatch
[
900
]]
:
<
Color
>[
swatch
[
900
],
swatch
[
50
]]
);
Paint
paint
=
new
Paint
()
final
Paint
paint
=
new
Paint
()
..
shader
=
gradient
.
createShader
(
new
Rect
.
fromLTWH
(
center
.
x
-
radius
,
center
.
y
-
radius
,
...
...
@@ -92,7 +92,7 @@ class _GestureDemoState extends State<GestureDemo> {
_zoom
=
(
_previousZoom
*
details
.
scale
);
// Ensure that item under the focal point stays in the same place despite zooming
Offset
normalizedOffset
=
(
_startingFocalPoint
.
toOffset
()
-
_previousOffset
)
/
_previousZoom
;
final
Offset
normalizedOffset
=
(
_startingFocalPoint
.
toOffset
()
-
_previousOffset
)
/
_previousZoom
;
_offset
=
details
.
focalPoint
.
toOffset
()
-
normalizedOffset
*
_zoom
;
});
}
...
...
examples/layers/widgets/media_query.dart
View file @
4c8c420e
...
...
@@ -90,7 +90,7 @@ class AdaptiveContainer extends StatelessWidget {
}
List
<
String
>
_initNames
()
{
List
<
String
>
names
=
<
String
>[];
final
List
<
String
>
names
=
<
String
>[];
for
(
int
i
=
0
;
i
<
30
;
i
++)
names
.
add
(
'Item
$i
'
);
return
names
;
...
...
examples/layers/widgets/sectors.dart
View file @
4c8c420e
...
...
@@ -54,13 +54,13 @@ class SectorAppState extends State<SectorApp> {
int
index
=
0
;
while
(
index
<
actualSectorSizes
.
length
&&
index
<
wantedSectorSizes
.
length
&&
actualSectorSizes
[
index
]
==
wantedSectorSizes
[
index
])
index
+=
1
;
RenderSectorRing
ring
=
sectors
.
child
;
final
RenderSectorRing
ring
=
sectors
.
child
;
while
(
index
<
actualSectorSizes
.
length
)
{
ring
.
remove
(
ring
.
lastChild
);
actualSectorSizes
.
removeLast
();
}
while
(
index
<
wantedSectorSizes
.
length
)
{
Color
color
=
new
Color
(((
0xFF
<<
24
)
+
rand
.
nextInt
(
0xFFFFFF
))
|
0x808080
);
final
Color
color
=
new
Color
(((
0xFF
<<
24
)
+
rand
.
nextInt
(
0xFFFFFF
))
|
0x808080
);
ring
.
add
(
new
RenderSolidColor
(
color
,
desiredDeltaTheta:
wantedSectorSizes
[
index
]));
actualSectorSizes
.
add
(
wantedSectorSizes
[
index
]);
index
+=
1
;
...
...
@@ -68,7 +68,7 @@ class SectorAppState extends State<SectorApp> {
}
static
RenderBox
initSector
(
Color
color
)
{
RenderSectorRing
ring
=
new
RenderSectorRing
(
padding:
1.0
);
final
RenderSectorRing
ring
=
new
RenderSectorRing
(
padding:
1.0
);
ring
.
add
(
new
RenderSolidColor
(
const
Color
(
0xFF909090
),
desiredDeltaTheta:
kTwoPi
*
0.15
));
ring
.
add
(
new
RenderSolidColor
(
const
Color
(
0xFF909090
),
desiredDeltaTheta:
kTwoPi
*
0.15
));
ring
.
add
(
new
RenderSolidColor
(
color
,
desiredDeltaTheta:
kTwoPi
*
0.2
));
...
...
examples/layers/widgets/spinning_mixed.dart
View file @
4c8c420e
...
...
@@ -9,9 +9,9 @@ import '../rendering/src/solid_color_box.dart';
// Solid colour, RenderObject version
void
addFlexChildSolidColor
(
RenderFlex
parent
,
Color
backgroundColor
,
{
int
flex:
0
})
{
RenderSolidColorBox
child
=
new
RenderSolidColorBox
(
backgroundColor
);
final
RenderSolidColorBox
child
=
new
RenderSolidColorBox
(
backgroundColor
);
parent
.
add
(
child
);
FlexParentData
childParentData
=
child
.
parentData
;
final
FlexParentData
childParentData
=
child
.
parentData
;
childParentData
.
flex
=
flex
;
}
...
...
@@ -80,7 +80,7 @@ RenderTransform transformBox;
void
rotate
(
Duration
timeStamp
)
{
if
(
timeBase
==
null
)
timeBase
=
timeStamp
;
double
delta
=
(
timeStamp
-
timeBase
).
inMicroseconds
.
toDouble
()
/
Duration
.
MICROSECONDS_PER_SECOND
;
// radians
final
double
delta
=
(
timeStamp
-
timeBase
).
inMicroseconds
.
toDouble
()
/
Duration
.
MICROSECONDS_PER_SECOND
;
// radians
transformBox
.
setIdentity
();
transformBox
.
rotateZ
(
delta
);
...
...
@@ -89,17 +89,17 @@ void rotate(Duration timeStamp) {
}
void
main
(
)
{
WidgetsBinding
binding
=
WidgetsFlutterBinding
.
ensureInitialized
();
RenderProxyBox
proxy
=
new
RenderProxyBox
();
final
WidgetsBinding
binding
=
WidgetsFlutterBinding
.
ensureInitialized
();
final
RenderProxyBox
proxy
=
new
RenderProxyBox
();
attachWidgetTreeToRenderTree
(
proxy
);
RenderFlex
flexRoot
=
new
RenderFlex
(
direction:
Axis
.
vertical
);
final
RenderFlex
flexRoot
=
new
RenderFlex
(
direction:
Axis
.
vertical
);
addFlexChildSolidColor
(
flexRoot
,
const
Color
(
0xFFFF00FF
),
flex:
1
);
flexRoot
.
add
(
proxy
);
addFlexChildSolidColor
(
flexRoot
,
const
Color
(
0xFF0000FF
),
flex:
1
);
transformBox
=
new
RenderTransform
(
child:
flexRoot
,
transform:
new
Matrix4
.
identity
(),
alignment:
FractionalOffset
.
center
);
RenderPadding
root
=
new
RenderPadding
(
padding:
const
EdgeInsets
.
all
(
80.0
),
child:
transformBox
);
final
RenderPadding
root
=
new
RenderPadding
(
padding:
const
EdgeInsets
.
all
(
80.0
),
child:
transformBox
);
binding
.
renderView
.
child
=
root
;
binding
.
addPersistentFrameCallback
(
rotate
);
...
...
examples/layers/widgets/styled_text.dart
View file @
4c8c420e
...
...
@@ -33,7 +33,7 @@ final TextStyle _kUnderline = const TextStyle(
);
Widget
toStyledText
(
String
name
,
String
text
)
{
TextStyle
lineStyle
=
(
name
==
"Dave"
)
?
_kDaveStyle
:
_kHalStyle
;
final
TextStyle
lineStyle
=
(
name
==
"Dave"
)
?
_kDaveStyle
:
_kHalStyle
;
return
new
RichText
(
key:
new
Key
(
text
),
text:
new
TextSpan
(
...
...
@@ -94,11 +94,11 @@ class _StyledTextDemoState extends State<StyledTextDemo> {
@override
Widget
build
(
BuildContext
context
)
{
List
<
Widget
>
lines
=
_kNameLines
final
List
<
Widget
>
lines
=
_kNameLines
.
map
<
Widget
>((
List
<
String
>
nameAndText
)
=>
_toText
(
nameAndText
[
0
],
nameAndText
[
1
]))
.
toList
();
List
<
Widget
>
children
=
<
Widget
>[];
final
List
<
Widget
>
children
=
<
Widget
>[];
for
(
Widget
line
in
lines
)
{
children
.
add
(
line
);
if
(
line
!=
lines
.
last
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment