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
972417f5
Commit
972417f5
authored
Jul 21, 2015
by
Viktor Lidholt
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:domokit/sky_engine
parents
27181225
6d304c03
Changes
31
Hide whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
260 additions
and
217 deletions
+260
-217
BUILD.gn
packages/flutter/BUILD.gn
+1
-0
CHANGELOG.md
packages/flutter/CHANGELOG.md
+4
-0
AndroidManifest.xml
...ges/flutter/example/demo_launcher/apk/AndroidManifest.xml
+1
-1
0.0.20.txt
...lutter/example/demo_launcher/apk/release_notes/0.0.20.txt
+1
-0
home.dart
packages/flutter/example/fitness/lib/home.dart
+0
-1
measurement.dart
packages/flutter/example/fitness/lib/measurement.dart
+0
-1
mutating-dom.dart
packages/flutter/example/raw/mutating-dom.dart
+9
-8
align_items.dart
packages/flutter/example/rendering/align_items.dart
+2
-2
interactive_flex.dart
packages/flutter/example/rendering/interactive_flex.dart
+4
-4
stock_home.dart
packages/flutter/example/stocks/lib/stock_home.dart
+5
-4
stock_settings.dart
packages/flutter/example/stocks/lib/stock_settings.dart
+1
-1
card_collection.dart
packages/flutter/example/widgets/card_collection.dart
+3
-4
container.dart
packages/flutter/example/widgets/container.dart
+2
-1
animated_value.dart
packages/flutter/lib/animation/animated_value.dart
+79
-0
animation_performance.dart
packages/flutter/lib/animation/animation_performance.dart
+3
-66
timeline.dart
packages/flutter/lib/animation/timeline.dart
+2
-1
box.dart
packages/flutter/lib/rendering/box.dart
+33
-25
flex.dart
packages/flutter/lib/rendering/flex.dart
+1
-1
animated_container.dart
packages/flutter/lib/widgets/animated_container.dart
+11
-10
animation_builder.dart
packages/flutter/lib/widgets/animation_builder.dart
+7
-17
basic.dart
packages/flutter/lib/widgets/basic.dart
+28
-16
dismissable.dart
packages/flutter/lib/widgets/dismissable.dart
+6
-5
drawer.dart
packages/flutter/lib/widgets/drawer.dart
+6
-5
icon.dart
packages/flutter/lib/widgets/icon.dart
+2
-1
ink_well.dart
packages/flutter/lib/widgets/ink_well.dart
+3
-2
navigator.dart
packages/flutter/lib/widgets/navigator.dart
+16
-18
popup_menu.dart
packages/flutter/lib/widgets/popup_menu.dart
+12
-10
toggleable.dart
packages/flutter/lib/widgets/toggleable.dart
+4
-3
variable_height_scrollable.dart
packages/flutter/lib/widgets/variable_height_scrollable.dart
+2
-0
widget.dart
packages/flutter/lib/widgets/widget.dart
+11
-9
pubspec.yaml
packages/flutter/pubspec.yaml
+1
-1
No files found.
packages/flutter/BUILD.gn
View file @
972417f5
...
@@ -9,6 +9,7 @@ dart_pkg("sky") {
...
@@ -9,6 +9,7 @@ dart_pkg("sky") {
"CHANGELOG.md",
"CHANGELOG.md",
"bin/init.dart",
"bin/init.dart",
"lib/animation/animated_simulation.dart",
"lib/animation/animated_simulation.dart",
"lib/animation/animated_value.dart",
"lib/animation/animation_performance.dart",
"lib/animation/animation_performance.dart",
"lib/animation/curves.dart",
"lib/animation/curves.dart",
"lib/animation/forces.dart",
"lib/animation/forces.dart",
...
...
packages/flutter/CHANGELOG.md
View file @
972417f5
## 0.0.20
-
167 changes: https://github.com/domokit/mojo/compare/f2830c7...603f589
## 0.0.19
## 0.0.19
-
49 changes: https://github.com/domokit/mojo/compare/a64559a...1b8968c
-
49 changes: https://github.com/domokit/mojo/compare/a64559a...1b8968c
...
...
packages/flutter/example/demo_launcher/apk/AndroidManifest.xml
View file @
972417f5
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
Use of this source code is governed by a BSD-style license that can be
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
found in the LICENSE file.
-->
-->
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"org.domokit.sky.demo"
android:versionCode=
"
19"
android:versionName=
"0.0.19
"
>
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"org.domokit.sky.demo"
android:versionCode=
"
20"
android:versionName=
"0.0.20
"
>
<uses-sdk
android:minSdkVersion=
"14"
android:targetSdkVersion=
"21"
/>
<uses-sdk
android:minSdkVersion=
"14"
android:targetSdkVersion=
"21"
/>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
...
...
packages/flutter/example/demo_launcher/apk/release_notes/0.0.20.txt
0 → 100644
View file @
972417f5
Fixes crash on Nexus 6
packages/flutter/example/fitness/lib/home.dart
View file @
972417f5
...
@@ -14,7 +14,6 @@ import 'package:sky/widgets/drawer_item.dart';
...
@@ -14,7 +14,6 @@ import 'package:sky/widgets/drawer_item.dart';
import
'package:sky/widgets/floating_action_button.dart'
;
import
'package:sky/widgets/floating_action_button.dart'
;
import
'package:sky/widgets/icon_button.dart'
;
import
'package:sky/widgets/icon_button.dart'
;
import
'package:sky/widgets/icon.dart'
;
import
'package:sky/widgets/icon.dart'
;
import
'package:sky/widgets/ink_well.dart'
;
import
'package:sky/widgets/material.dart'
;
import
'package:sky/widgets/material.dart'
;
import
'package:sky/widgets/navigator.dart'
;
import
'package:sky/widgets/navigator.dart'
;
import
'package:sky/widgets/scaffold.dart'
;
import
'package:sky/widgets/scaffold.dart'
;
...
...
packages/flutter/example/fitness/lib/measurement.dart
View file @
972417f5
...
@@ -4,7 +4,6 @@
...
@@ -4,7 +4,6 @@
import
'package:sky/editing/input.dart'
;
import
'package:sky/editing/input.dart'
;
import
'package:sky/widgets/basic.dart'
;
import
'package:sky/widgets/basic.dart'
;
import
'package:sky/widgets/flat_button.dart'
;
import
'package:sky/widgets/icon_button.dart'
;
import
'package:sky/widgets/icon_button.dart'
;
import
'package:sky/widgets/ink_well.dart'
;
import
'package:sky/widgets/ink_well.dart'
;
import
'package:sky/widgets/material.dart'
;
import
'package:sky/widgets/material.dart'
;
...
...
packages/flutter/example/raw/mutating-dom.dart
View file @
972417f5
...
@@ -148,26 +148,27 @@ void doFrame(double timeStamp) {
...
@@ -148,26 +148,27 @@ void doFrame(double timeStamp) {
break
;
break
;
}
}
}
else
{
}
else
{
assert
(
node
is
sky
.
Text
);
//
assert
(
node
is
sky
.
Text
);
//
final
sky
.
Text
text
=
node
;
if
(
pickThis
(
0.1
))
{
if
(
pickThis
(
0.1
))
{
report
(
"appending a new text node (ASCII)"
);
report
(
"appending a new text node (ASCII)"
);
node
.
appendData
(
generateCharacter
(
0x20
,
0x7F
));
text
.
appendData
(
generateCharacter
(
0x20
,
0x7F
));
break
;
break
;
}
else
if
(
pickThis
(
0.05
))
{
}
else
if
(
pickThis
(
0.05
))
{
report
(
"appending a new text node (Latin1)"
);
report
(
"appending a new text node (Latin1)"
);
node
.
appendData
(
generateCharacter
(
0x20
,
0xFF
));
text
.
appendData
(
generateCharacter
(
0x20
,
0xFF
));
break
;
break
;
}
else
if
(
pickThis
(
0.025
))
{
}
else
if
(
pickThis
(
0.025
))
{
report
(
"appending a new text node (BMP)"
);
report
(
"appending a new text node (BMP)"
);
node
.
appendData
(
generateCharacter
(
0x20
,
0xFFFF
));
text
.
appendData
(
generateCharacter
(
0x20
,
0xFFFF
));
break
;
break
;
}
else
if
(
pickThis
(
0.0125
))
{
}
else
if
(
pickThis
(
0.0125
))
{
report
(
"appending a new text node (Unicode)"
);
report
(
"appending a new text node (Unicode)"
);
node
.
appendData
(
generateCharacter
(
0x20
,
0x10FFFF
));
text
.
appendData
(
generateCharacter
(
0x20
,
0x10FFFF
));
break
;
break
;
}
else
if
(
node
.
length
>
1
&&
pickThis
(
0.1
))
{
}
else
if
(
text
.
length
>
1
&&
pickThis
(
0.1
))
{
report
(
"deleting character from Text node"
);
report
(
"deleting character from Text node"
);
node
.
deleteData
(
random
.
nextInt
(
node
.
length
),
1
);
text
.
deleteData
(
random
.
nextInt
(
text
.
length
),
1
);
break
;
break
;
}
}
}
}
...
@@ -178,7 +179,7 @@ void doFrame(double timeStamp) {
...
@@ -178,7 +179,7 @@ void doFrame(double timeStamp) {
int
count
=
1
;
int
count
=
1
;
while
(
node
!=
null
)
{
while
(
node
!=
null
)
{
if
(
node
is
sky
.
Element
&&
node
.
firstChild
!=
null
)
{
if
(
node
is
sky
.
Element
&&
node
.
firstChild
!=
null
)
{
node
=
node
.
firstChild
;
node
=
(
node
as
sky
.
Element
)
.
firstChild
;
count
+=
1
;
count
+=
1
;
}
else
{
}
else
{
while
(
node
!=
null
&&
node
.
nextSibling
==
null
)
while
(
node
!=
null
&&
node
.
nextSibling
==
null
)
...
...
packages/flutter/example/rendering/align_items.dart
View file @
972417f5
...
@@ -20,7 +20,7 @@ void main() {
...
@@ -20,7 +20,7 @@ void main() {
TextStyle
style
=
const
TextStyle
(
color:
const
Color
(
0xFF000000
));
TextStyle
style
=
const
TextStyle
(
color:
const
Color
(
0xFF000000
));
RenderParagraph
paragraph
=
new
RenderParagraph
(
new
InlineStyle
(
style
,
[
new
InlineText
(
"
${alignItems}
"
)]));
RenderParagraph
paragraph
=
new
RenderParagraph
(
new
InlineStyle
(
style
,
[
new
InlineText
(
"
${alignItems}
"
)]));
table
.
add
(
new
RenderPadding
(
child:
paragraph
,
padding:
new
EdgeDims
.
only
(
top:
20.0
)));
table
.
add
(
new
RenderPadding
(
child:
paragraph
,
padding:
new
EdgeDims
.
only
(
top:
20.0
)));
var
row
=
new
RenderFlex
(
alignItems:
alignItems
,
b
aseline:
TextBaseline
.
alphabetic
);
var
row
=
new
RenderFlex
(
alignItems:
alignItems
,
textB
aseline:
TextBaseline
.
alphabetic
);
style
=
new
TextStyle
(
fontSize:
15.0
,
color:
const
Color
(
0xFF000000
));
style
=
new
TextStyle
(
fontSize:
15.0
,
color:
const
Color
(
0xFF000000
));
row
.
add
(
new
RenderDecoratedBox
(
row
.
add
(
new
RenderDecoratedBox
(
...
@@ -32,7 +32,7 @@ void main() {
...
@@ -32,7 +32,7 @@ void main() {
decoration:
new
BoxDecoration
(
backgroundColor:
const
Color
(
0x7FCCFFCC
)),
decoration:
new
BoxDecoration
(
backgroundColor:
const
Color
(
0x7FCCFFCC
)),
child:
new
RenderParagraph
(
new
InlineStyle
(
style
,
[
new
InlineText
(
'foo foo foo'
)]))
child:
new
RenderParagraph
(
new
InlineStyle
(
style
,
[
new
InlineText
(
'foo foo foo'
)]))
));
));
var
subrow
=
new
RenderFlex
(
alignItems:
alignItems
,
b
aseline:
TextBaseline
.
alphabetic
);
var
subrow
=
new
RenderFlex
(
alignItems:
alignItems
,
textB
aseline:
TextBaseline
.
alphabetic
);
style
=
new
TextStyle
(
fontSize:
25.0
,
color:
const
Color
(
0xFF000000
));
style
=
new
TextStyle
(
fontSize:
25.0
,
color:
const
Color
(
0xFF000000
));
subrow
.
add
(
new
RenderDecoratedBox
(
subrow
.
add
(
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
(
backgroundColor:
const
Color
(
0x7FCCCCFF
)),
decoration:
new
BoxDecoration
(
backgroundColor:
const
Color
(
0x7FCCCCFF
)),
...
...
packages/flutter/example/rendering/interactive_flex.dart
View file @
972417f5
...
@@ -25,15 +25,15 @@ class Touch {
...
@@ -25,15 +25,15 @@ class Touch {
class
RenderImageGrow
extends
RenderImage
{
class
RenderImageGrow
extends
RenderImage
{
final
Size
_startingSize
;
final
Size
_startingSize
;
RenderImageGrow
(
Image
image
,
Size
size
)
:
_startingSize
=
size
,
super
(
image
,
size
);
RenderImageGrow
(
Image
image
,
Size
size
)
:
_startingSize
=
size
,
super
(
image:
image
,
width:
size
.
width
,
height:
size
.
height
);
double
_growth
=
0.0
;
double
_growth
=
0.0
;
double
get
growth
=>
_growth
;
double
get
growth
=>
_growth
;
void
set
growth
(
double
value
)
{
void
set
growth
(
double
value
)
{
_growth
=
value
;
_growth
=
value
;
double
newWidth
=
_startingSize
.
width
==
null
?
null
:
_startingSize
.
width
+
growth
;
width
=
_startingSize
.
width
==
null
?
null
:
_startingSize
.
width
+
growth
;
double
newHeight
=
_startingSize
.
height
==
null
?
null
:
_startingSize
.
height
+
growth
;
height
=
_startingSize
.
height
==
null
?
null
:
_startingSize
.
height
+
growth
;
requestedSize
=
new
Size
(
newWidth
,
newHeight
);
}
}
}
}
...
...
packages/flutter/example/stocks/lib/stock_home.dart
View file @
972417f5
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
// found in the LICENSE file.
// found in the LICENSE file.
import
'package:sky/editing/input.dart'
;
import
'package:sky/editing/input.dart'
;
import
'package:sky/animation/animat
ion_performanc
e.dart'
;
import
'package:sky/animation/animat
ed_valu
e.dart'
;
import
'package:sky/widgets/animated_component.dart'
;
import
'package:sky/widgets/animated_component.dart'
;
import
'package:sky/widgets/animation_builder.dart'
;
import
'package:sky/widgets/animation_builder.dart'
;
import
'package:sky/theme/colors.dart'
as
colors
;
import
'package:sky/theme/colors.dart'
as
colors
;
...
@@ -69,7 +69,8 @@ class StockHome extends AnimatedComponent {
...
@@ -69,7 +69,8 @@ class StockHome extends AnimatedComponent {
}
}
void
_handleSearchEnd
()
{
void
_handleSearchEnd
()
{
assert
(
navigator
.
currentRoute
.
key
==
this
);
assert
(
navigator
.
currentRoute
is
RouteState
);
assert
((
navigator
.
currentRoute
as
RouteState
).
owner
==
this
);
// TODO(ianh): remove cast once analyzer is cleverer
navigator
.
pop
();
navigator
.
pop
();
setState
(()
{
setState
(()
{
_isSearching
=
false
;
_isSearching
=
false
;
...
@@ -280,10 +281,10 @@ class StockHome extends AnimatedComponent {
...
@@ -280,10 +281,10 @@ class StockHome extends AnimatedComponent {
void
_handleStockPurchased
()
{
void
_handleStockPurchased
()
{
setState
(()
{
setState
(()
{
_snackbarTransform
=
new
AnimationBuilder
()
_snackbarTransform
=
new
AnimationBuilder
()
..
position
=
new
Animated
Typ
e
<
Point
>(
const
Point
(
0.0
,
45.0
),
end:
Point
.
origin
);
..
position
=
new
Animated
Valu
e
<
Point
>(
const
Point
(
0.0
,
45.0
),
end:
Point
.
origin
);
var
performance
=
_snackbarTransform
.
createPerformance
(
var
performance
=
_snackbarTransform
.
createPerformance
(
[
_snackbarTransform
.
position
],
duration:
_kSnackbarSlideDuration
);
[
_snackbarTransform
.
position
],
duration:
_kSnackbarSlideDuration
);
watch
(
performance
);
watch
(
performance
);
// TODO(mpcomplete): need to unwatch
performance
.
play
();
performance
.
play
();
});
});
}
}
...
...
packages/flutter/example/stocks/lib/stock_settings.dart
View file @
972417f5
...
@@ -61,7 +61,7 @@ class StockSettings extends StatefulComponent {
...
@@ -61,7 +61,7 @@ class StockSettings extends StatefulComponent {
break
;
break
;
case
StockMode
.
pessimistic
:
case
StockMode
.
pessimistic
:
showModeDialog
=
true
;
showModeDialog
=
true
;
navigator
.
pushState
(
"/settings/confirm"
,
(
_
)
{
navigator
.
pushState
(
this
,
(
_
)
{
showModeDialog
=
false
;
showModeDialog
=
false
;
});
});
break
;
break
;
...
...
packages/flutter/example/widgets/card_collection.dart
View file @
972417f5
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'package:sky/animation/animated_value.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/animation/curves.dart'
;
import
'package:sky/animation/curves.dart'
;
import
'package:sky/base/lerp.dart'
;
import
'package:sky/base/lerp.dart'
;
...
@@ -27,8 +28,6 @@ class CardModel {
...
@@ -27,8 +28,6 @@ class CardModel {
AnimationPerformance
performance
;
AnimationPerformance
performance
;
String
get
label
=>
"Item
$value
"
;
String
get
label
=>
"Item
$value
"
;
String
get
key
=>
value
.
toString
();
String
get
key
=>
value
.
toString
();
bool
operator
==(
other
)
=>
other
is
CardModel
&&
other
.
value
==
value
;
int
get
hashCode
=>
373
*
37
*
value
.
hashCode
;
}
}
class
ShrinkingCard
extends
AnimatedComponent
{
class
ShrinkingCard
extends
AnimatedComponent
{
...
@@ -44,7 +43,7 @@ class ShrinkingCard extends AnimatedComponent {
...
@@ -44,7 +43,7 @@ class ShrinkingCard extends AnimatedComponent {
Function
onUpdated
;
Function
onUpdated
;
Function
onCompleted
;
Function
onCompleted
;
double
get
currentHeight
=>
card
.
performance
.
variable
.
value
;
double
get
currentHeight
=>
(
card
.
performance
.
variable
as
AnimatedValue
)
.
value
;
void
initState
()
{
void
initState
()
{
assert
(
card
.
performance
!=
null
);
assert
(
card
.
performance
!=
null
);
...
@@ -100,7 +99,7 @@ class CardCollectionApp extends App {
...
@@ -100,7 +99,7 @@ class CardCollectionApp extends App {
assert
(
card
.
performance
==
null
);
assert
(
card
.
performance
==
null
);
card
.
performance
=
new
AnimationPerformance
()
card
.
performance
=
new
AnimationPerformance
()
..
duration
=
const
Duration
(
milliseconds:
300
)
..
duration
=
const
Duration
(
milliseconds:
300
)
..
variable
=
new
Animated
Typ
e
<
double
>(
..
variable
=
new
Animated
Valu
e
<
double
>(
card
.
height
+
kCardMargins
.
top
+
kCardMargins
.
bottom
,
card
.
height
+
kCardMargins
.
top
+
kCardMargins
.
bottom
,
end:
0.0
,
end:
0.0
,
curve:
ease
,
curve:
ease
,
...
...
packages/flutter/example/widgets/container.dart
View file @
972417f5
...
@@ -16,7 +16,8 @@ class ContainerApp extends App {
...
@@ -16,7 +16,8 @@ class ContainerApp extends App {
decoration:
new
BoxDecoration
(
backgroundColor:
const
Color
(
0xFFCCCCCC
)),
decoration:
new
BoxDecoration
(
backgroundColor:
const
Color
(
0xFFCCCCCC
)),
child:
new
NetworkImage
(
child:
new
NetworkImage
(
src:
"https://www.dartlang.org/logos/dart-logo.png"
,
src:
"https://www.dartlang.org/logos/dart-logo.png"
,
size:
new
Size
(
300.0
,
300.0
)
width:
300.0
,
height:
300.0
)
)
),
),
new
Container
(
new
Container
(
...
...
packages/flutter/lib/animation/animated_value.dart
0 → 100644
View file @
972417f5
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
"dart:sky"
;
import
'package:sky/animation/curves.dart'
;
import
'package:sky/base/lerp.dart'
;
abstract
class
AnimatedVariable
{
void
setProgress
(
double
t
);
String
toString
();
}
class
Interval
{
final
double
start
;
final
double
end
;
double
adjustTime
(
double
t
)
{
return
((
t
-
start
)
/
(
end
-
start
)).
clamp
(
0.0
,
1.0
);
}
Interval
(
this
.
start
,
this
.
end
)
{
assert
(
start
>=
0.0
);
assert
(
start
<=
1.0
);
assert
(
end
>=
0.0
);
assert
(
end
<=
1.0
);
}
}
class
AnimatedValue
<
T
extends
dynamic
>
extends
AnimatedVariable
{
AnimatedValue
(
this
.
begin
,
{
this
.
end
,
this
.
interval
,
this
.
curve
:
linear
})
{
value
=
begin
;
}
T
value
;
T
begin
;
T
end
;
Interval
interval
;
Curve
curve
;
void
setProgress
(
double
t
)
{
if
(
end
!=
null
)
{
double
adjustedTime
=
interval
==
null
?
t
:
interval
.
adjustTime
(
t
);
if
(
adjustedTime
==
1.0
)
{
value
=
end
;
}
else
{
// TODO(mpcomplete): Reverse the timeline and curve.
value
=
begin
+
(
end
-
begin
)
*
curve
.
transform
(
adjustedTime
);
}
}
}
String
toString
()
=>
'AnimatedValue(begin=
$begin
, end=
$end
, value=
$value
)'
;
}
class
AnimatedList
extends
AnimatedVariable
{
List
<
AnimatedVariable
>
variables
;
Interval
interval
;
AnimatedList
(
this
.
variables
,
{
this
.
interval
});
void
setProgress
(
double
t
)
{
double
adjustedTime
=
interval
==
null
?
t
:
interval
.
adjustTime
(
t
);
for
(
AnimatedVariable
variable
in
variables
)
variable
.
setProgress
(
adjustedTime
);
}
String
toString
()
=>
'AnimatedList([
$variables
])'
;
}
class
AnimatedColor
extends
AnimatedValue
<
Color
>
{
AnimatedColor
(
Color
begin
,
{
Color
end
,
Curve
curve:
linear
})
:
super
(
begin
,
end:
end
,
curve:
curve
);
void
setProgress
(
double
t
)
{
value
=
lerpColor
(
begin
,
end
,
t
);
}
}
packages/flutter/lib/animation/animation_performance.dart
View file @
972417f5
...
@@ -4,71 +4,9 @@
...
@@ -4,71 +4,9 @@
import
'dart:async'
;
import
'dart:async'
;
import
'package:sky/animation/timeline.dart'
;
import
'package:sky/animation/animated_value.dart'
;
import
'package:sky/animation/curves.dart'
;
import
'package:sky/animation/forces.dart'
;
import
'package:sky/animation/forces.dart'
;
import
'package:sky/animation/timeline.dart'
;
abstract
class
AnimatedVariable
{
void
setFraction
(
double
t
);
String
toString
();
}
class
Interval
{
final
double
start
;
final
double
end
;
double
adjustTime
(
double
t
)
{
return
((
t
-
start
)
/
(
end
-
start
)).
clamp
(
0.0
,
1.0
);
}
Interval
(
this
.
start
,
this
.
end
)
{
assert
(
start
>=
0.0
);
assert
(
start
<=
1.0
);
assert
(
end
>=
0.0
);
assert
(
end
<=
1.0
);
}
}
class
AnimatedType
<
T
extends
dynamic
>
extends
AnimatedVariable
{
AnimatedType
(
this
.
begin
,
{
this
.
end
,
this
.
interval
,
this
.
curve
:
linear
})
{
value
=
begin
;
}
T
value
;
T
begin
;
T
end
;
Interval
interval
;
Curve
curve
;
void
setFraction
(
double
t
)
{
if
(
end
!=
null
)
{
double
adjustedTime
=
interval
==
null
?
t
:
interval
.
adjustTime
(
t
);
if
(
adjustedTime
==
1.0
)
{
value
=
end
;
}
else
{
// TODO(mpcomplete): Reverse the timeline and curve.
value
=
begin
+
(
end
-
begin
)
*
curve
.
transform
(
adjustedTime
);
}
}
}
String
toString
()
=>
'AnimatedType(begin=
$begin
, end=
$end
, value=
$value
)'
;
}
class
AnimatedList
extends
AnimatedVariable
{
List
<
AnimatedVariable
>
variables
;
Interval
interval
;
AnimatedList
(
this
.
variables
,
{
this
.
interval
});
void
setFraction
(
double
t
)
{
double
adjustedTime
=
interval
==
null
?
t
:
interval
.
adjustTime
(
t
);
for
(
AnimatedVariable
variable
in
variables
)
variable
.
setFraction
(
adjustedTime
);
}
String
toString
()
=>
'AnimatedList([
$variables
])'
;
}
// This class manages a "performance" - a collection of values that change
// This class manages a "performance" - a collection of values that change
// based on a timeline. For example, a performance may handle an animation
// based on a timeline. For example, a performance may handle an animation
...
@@ -82,7 +20,6 @@ class AnimationPerformance {
...
@@ -82,7 +20,6 @@ class AnimationPerformance {
_timeline
=
new
Timeline
(
_tick
);
_timeline
=
new
Timeline
(
_tick
);
}
}
// TODO(mpcomplete): make this a list, or composable somehow.
AnimatedVariable
variable
;
AnimatedVariable
variable
;
// TODO(mpcomplete): duration should be on a director.
// TODO(mpcomplete): duration should be on a director.
Duration
duration
;
Duration
duration
;
...
@@ -142,7 +79,7 @@ class AnimationPerformance {
...
@@ -142,7 +79,7 @@ class AnimationPerformance {
}
}
void
_tick
(
double
t
)
{
void
_tick
(
double
t
)
{
variable
.
set
Fraction
(
t
);
variable
.
set
Progress
(
t
);
_notifyListeners
();
_notifyListeners
();
}
}
}
}
packages/flutter/lib/animation/timeline.dart
View file @
972417f5
...
@@ -54,11 +54,12 @@ class Timeline {
...
@@ -54,11 +54,12 @@ class Timeline {
double
end:
1.0
double
end:
1.0
})
{
})
{
assert
(!
_animation
.
isAnimating
);
assert
(!
_animation
.
isAnimating
);
assert
(
duration
>
Duration
.
ZERO
);
return
_animation
.
start
(
new
TweenSimulation
(
duration
,
begin
,
end
));
return
_animation
.
start
(
new
TweenSimulation
(
duration
,
begin
,
end
));
}
}
Future
animateTo
(
double
target
,
{
Duration
duration
})
{
Future
animateTo
(
double
target
,
{
Duration
duration
})
{
assert
(
duration
>
Duration
.
ZERO
);
return
_start
(
duration:
duration
,
begin:
value
,
end:
target
);
return
_start
(
duration:
duration
,
begin:
value
,
end:
target
);
}
}
...
...
packages/flutter/lib/rendering/box.dart
View file @
972417f5
...
@@ -1249,9 +1249,10 @@ class RenderViewport extends RenderBox with RenderObjectWithChildMixin<RenderBox
...
@@ -1249,9 +1249,10 @@ class RenderViewport extends RenderBox with RenderObjectWithChildMixin<RenderBox
class
RenderImage
extends
RenderBox
{
class
RenderImage
extends
RenderBox
{
RenderImage
(
sky
.
Image
image
,
Size
requestedSize
,
{
sky
.
ColorFilter
colorFilter
})
RenderImage
(
{
sky
.
Image
image
,
double
width
,
double
height
,
sky
.
ColorFilter
colorFilter
})
:
_image
=
image
,
:
_image
=
image
,
_requestedSize
=
requestedSize
,
_width
=
width
,
_height
=
height
,
_colorFilter
=
colorFilter
;
_colorFilter
=
colorFilter
;
sky
.
Image
_image
;
sky
.
Image
_image
;
...
@@ -1261,18 +1262,25 @@ class RenderImage extends RenderBox {
...
@@ -1261,18 +1262,25 @@ class RenderImage extends RenderBox {
return
;
return
;
_image
=
value
;
_image
=
value
;
markNeedsPaint
();
markNeedsPaint
();
if
(
_
requestedSize
.
width
==
null
||
_requestedSize
.
height
==
null
)
if
(
_
width
==
null
||
_
height
==
null
)
markNeedsLayout
();
markNeedsLayout
();
}
}
Size
_requestedSize
;
double
_width
;
Size
get
requestedSize
=>
_requestedSize
;
double
get
width
=>
_width
;
void
set
requestedSize
(
Size
value
)
{
void
set
width
(
double
value
)
{
if
(
value
==
null
)
if
(
value
==
_width
)
value
=
const
Size
(
null
,
null
);
if
(
value
==
_requestedSize
)
return
;
return
;
_requestedSize
=
value
;
_width
=
value
;
markNeedsLayout
();
}
double
_height
;
double
get
height
=>
_height
;
void
set
height
(
double
value
)
{
if
(
value
==
_height
)
return
;
_height
=
value
;
markNeedsLayout
();
markNeedsLayout
();
}
}
...
@@ -1299,8 +1307,8 @@ class RenderImage extends RenderBox {
...
@@ -1299,8 +1307,8 @@ class RenderImage extends RenderBox {
Size
_sizeForConstraints
(
BoxConstraints
constraints
)
{
Size
_sizeForConstraints
(
BoxConstraints
constraints
)
{
// If there's no image, we can't size ourselves automatically
// If there's no image, we can't size ourselves automatically
if
(
_image
==
null
)
{
if
(
_image
==
null
)
{
double
width
=
requestedSize
.
width
==
null
?
0.0
:
requestedSize
.
width
;
double
width
=
_width
==
null
?
0.0
:
_
width
;
double
height
=
requestedSize
.
height
==
null
?
0.0
:
requestedSize
.
height
;
double
height
=
_height
==
null
?
0.0
:
_
height
;
return
constraints
.
constrain
(
new
Size
(
width
,
height
));
return
constraints
.
constrain
(
new
Size
(
width
,
height
));
}
}
...
@@ -1310,8 +1318,8 @@ class RenderImage extends RenderBox {
...
@@ -1310,8 +1318,8 @@ class RenderImage extends RenderBox {
// other dimension to maintain the aspect ratio. In both cases,
// other dimension to maintain the aspect ratio. In both cases,
// constrain dimensions first, otherwise we end up losing the
// constrain dimensions first, otherwise we end up losing the
// ratio after constraining.
// ratio after constraining.
if
(
requestedSize
.
width
==
null
)
{
if
(
_
width
==
null
)
{
if
(
requestedSize
.
height
==
null
)
{
if
(
_
height
==
null
)
{
// autosize
// autosize
double
width
=
constraints
.
constrainWidth
(
_image
.
width
.
toDouble
());
double
width
=
constraints
.
constrainWidth
(
_image
.
width
.
toDouble
());
double
maxHeight
=
constraints
.
constrainHeight
(
_image
.
height
.
toDouble
());
double
maxHeight
=
constraints
.
constrainHeight
(
_image
.
height
.
toDouble
());
...
@@ -1323,21 +1331,21 @@ class RenderImage extends RenderBox {
...
@@ -1323,21 +1331,21 @@ class RenderImage extends RenderBox {
}
}
return
constraints
.
constrain
(
new
Size
(
width
,
height
));
return
constraints
.
constrain
(
new
Size
(
width
,
height
));
}
}
//
d
etermine width from height
//
D
etermine width from height
double
width
=
requestedSize
.
height
*
_image
.
width
/
_image
.
height
;
double
width
=
_
height
*
_image
.
width
/
_image
.
height
;
return
constraints
.
constrain
(
new
Size
(
width
,
requestedSize
.
height
));
return
constraints
.
constrain
(
new
Size
(
width
,
height
));
}
}
if
(
requestedSize
.
height
==
null
)
{
if
(
_
height
==
null
)
{
//
d
etermine height from width
//
D
etermine height from width
double
height
=
requestedSize
.
width
*
_image
.
height
/
_image
.
width
;
double
height
=
_
width
*
_image
.
height
/
_image
.
width
;
return
constraints
.
constrain
(
new
Size
(
requestedSize
.
width
,
height
));
return
constraints
.
constrain
(
new
Size
(
width
,
height
));
}
}
}
}
return
constraints
.
constrain
(
requestedSize
);
return
constraints
.
constrain
(
new
Size
(
width
,
height
)
);
}
}
double
getMinIntrinsicWidth
(
BoxConstraints
constraints
)
{
double
getMinIntrinsicWidth
(
BoxConstraints
constraints
)
{
if
(
requestedSize
.
width
==
null
&&
requestedSize
.
height
==
null
)
if
(
_width
==
null
&&
_
height
==
null
)
return
constraints
.
constrainWidth
(
0.0
);
return
constraints
.
constrainWidth
(
0.0
);
return
_sizeForConstraints
(
constraints
).
width
;
return
_sizeForConstraints
(
constraints
).
width
;
}
}
...
@@ -1347,7 +1355,7 @@ class RenderImage extends RenderBox {
...
@@ -1347,7 +1355,7 @@ class RenderImage extends RenderBox {
}
}
double
getMinIntrinsicHeight
(
BoxConstraints
constraints
)
{
double
getMinIntrinsicHeight
(
BoxConstraints
constraints
)
{
if
(
requestedSize
.
width
==
null
&&
requestedSize
.
height
==
null
)
if
(
_width
==
null
&&
_
height
==
null
)
return
constraints
.
constrainHeight
(
0.0
);
return
constraints
.
constrainHeight
(
0.0
);
return
_sizeForConstraints
(
constraints
).
height
;
return
_sizeForConstraints
(
constraints
).
height
;
}
}
...
@@ -1377,7 +1385,7 @@ class RenderImage extends RenderBox {
...
@@ -1377,7 +1385,7 @@ class RenderImage extends RenderBox {
canvas
.
restore
();
canvas
.
restore
();
}
}
String
debugDescribeSettings
(
String
prefix
)
=>
'
${super.debugDescribeSettings(prefix)}${prefix}
dimensions:
${requestedSize
}
\n
'
;
String
debugDescribeSettings
(
String
prefix
)
=>
'
${super.debugDescribeSettings(prefix)}${prefix}
width:
${width}
\n
${prefix}
height:
${height
}
\n
'
;
}
}
class
RenderDecoratedBox
extends
RenderProxyBox
{
class
RenderDecoratedBox
extends
RenderProxyBox
{
...
...
packages/flutter/lib/rendering/flex.dart
View file @
972417f5
...
@@ -83,6 +83,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
...
@@ -83,6 +83,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
}
}
}
}
// Set during layout if overflow occurred on the main axis
TextBaseline
_textBaseline
;
TextBaseline
_textBaseline
;
TextBaseline
get
textBaseline
=>
_textBaseline
;
TextBaseline
get
textBaseline
=>
_textBaseline
;
void
set
textBaseline
(
TextBaseline
value
)
{
void
set
textBaseline
(
TextBaseline
value
)
{
...
@@ -92,7 +93,6 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
...
@@ -92,7 +93,6 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
}
}
}
}
// Set during layout if overflow occurred on the main axis
double
_overflow
;
double
_overflow
;
void
setupParentData
(
RenderBox
child
)
{
void
setupParentData
(
RenderBox
child
)
{
...
...
packages/flutter/lib/widgets/animated_container.dart
View file @
972417f5
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
import
'package:vector_math/vector_math.dart'
;
import
'package:vector_math/vector_math.dart'
;
import
'package:sky/animation/animated_value.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/animation/curves.dart'
;
import
'package:sky/animation/curves.dart'
;
import
'package:sky/base/lerp.dart'
;
import
'package:sky/base/lerp.dart'
;
...
@@ -11,21 +12,21 @@ import 'package:sky/painting/box_painter.dart';
...
@@ -11,21 +12,21 @@ import 'package:sky/painting/box_painter.dart';
import
'package:sky/widgets/basic.dart'
;
import
'package:sky/widgets/basic.dart'
;
import
'package:sky/widgets/animated_component.dart'
;
import
'package:sky/widgets/animated_component.dart'
;
class
AnimatedBoxConstraintsValue
extends
Animated
Typ
e
<
BoxConstraints
>
{
class
AnimatedBoxConstraintsValue
extends
Animated
Valu
e
<
BoxConstraints
>
{
AnimatedBoxConstraintsValue
(
BoxConstraints
begin
,
{
BoxConstraints
end
,
Curve
curve:
linear
})
AnimatedBoxConstraintsValue
(
BoxConstraints
begin
,
{
BoxConstraints
end
,
Curve
curve:
linear
})
:
super
(
begin
,
end:
end
,
curve:
curve
);
:
super
(
begin
,
end:
end
,
curve:
curve
);
void
set
Fraction
(
double
t
)
{
void
set
Progress
(
double
t
)
{
// TODO(abarth): We should lerp the BoxConstraints.
// TODO(abarth): We should lerp the BoxConstraints.
value
=
end
;
value
=
end
;
}
}
}
}
class
AnimatedBoxDecorationValue
extends
Animated
Typ
e
<
BoxDecoration
>
{
class
AnimatedBoxDecorationValue
extends
Animated
Valu
e
<
BoxDecoration
>
{
AnimatedBoxDecorationValue
(
BoxDecoration
begin
,
{
BoxDecoration
end
,
Curve
curve:
linear
})
AnimatedBoxDecorationValue
(
BoxDecoration
begin
,
{
BoxDecoration
end
,
Curve
curve:
linear
})
:
super
(
begin
,
end:
end
,
curve:
curve
);
:
super
(
begin
,
end:
end
,
curve:
curve
);
void
set
Fraction
(
double
t
)
{
void
set
Progress
(
double
t
)
{
if
(
t
==
1.0
)
{
if
(
t
==
1.0
)
{
value
=
end
;
value
=
end
;
return
;
return
;
...
@@ -34,11 +35,11 @@ class AnimatedBoxDecorationValue extends AnimatedType<BoxDecoration> {
...
@@ -34,11 +35,11 @@ class AnimatedBoxDecorationValue extends AnimatedType<BoxDecoration> {
}
}
}
}
class
AnimatedEdgeDimsValue
extends
Animated
Typ
e
<
EdgeDims
>
{
class
AnimatedEdgeDimsValue
extends
Animated
Valu
e
<
EdgeDims
>
{
AnimatedEdgeDimsValue
(
EdgeDims
begin
,
{
EdgeDims
end
,
Curve
curve:
linear
})
AnimatedEdgeDimsValue
(
EdgeDims
begin
,
{
EdgeDims
end
,
Curve
curve:
linear
})
:
super
(
begin
,
end:
end
,
curve:
curve
);
:
super
(
begin
,
end:
end
,
curve:
curve
);
void
set
Fraction
(
double
t
)
{
void
set
Progress
(
double
t
)
{
if
(
t
==
1.0
)
{
if
(
t
==
1.0
)
{
value
=
end
;
value
=
end
;
return
;
return
;
...
@@ -54,7 +55,7 @@ class AnimatedEdgeDimsValue extends AnimatedType<EdgeDims> {
...
@@ -54,7 +55,7 @@ class AnimatedEdgeDimsValue extends AnimatedType<EdgeDims> {
class
ImplicitlyAnimatedValue
<
T
>
{
class
ImplicitlyAnimatedValue
<
T
>
{
final
AnimationPerformance
performance
=
new
AnimationPerformance
();
final
AnimationPerformance
performance
=
new
AnimationPerformance
();
final
Animated
Typ
e
<
T
>
_variable
;
final
Animated
Valu
e
<
T
>
_variable
;
ImplicitlyAnimatedValue
(
this
.
_variable
,
Duration
duration
)
{
ImplicitlyAnimatedValue
(
this
.
_variable
,
Duration
duration
)
{
performance
performance
...
@@ -168,21 +169,21 @@ class AnimatedContainer extends AnimatedComponent {
...
@@ -168,21 +169,21 @@ class AnimatedContainer extends AnimatedComponent {
void
_updateTransform
()
{
void
_updateTransform
()
{
_updateField
(
transform
,
_transform
,
()
{
_updateField
(
transform
,
_transform
,
()
{
_transform
=
new
ImplicitlyAnimatedValue
<
Matrix4
>(
new
Animated
Typ
e
<
Matrix4
>(
transform
),
duration
);
_transform
=
new
ImplicitlyAnimatedValue
<
Matrix4
>(
new
Animated
Valu
e
<
Matrix4
>(
transform
),
duration
);
watch
(
_transform
.
performance
);
watch
(
_transform
.
performance
);
});
});
}
}
void
_updateWidth
()
{
void
_updateWidth
()
{
_updateField
(
width
,
_width
,
()
{
_updateField
(
width
,
_width
,
()
{
_width
=
new
ImplicitlyAnimatedValue
<
double
>(
new
Animated
Typ
e
<
double
>(
width
),
duration
);
_width
=
new
ImplicitlyAnimatedValue
<
double
>(
new
Animated
Valu
e
<
double
>(
width
),
duration
);
watch
(
_width
.
performance
);
watch
(
_width
.
performance
);
});
});
}
}
void
_updateHeight
()
{
void
_updateHeight
()
{
_updateField
(
height
,
_height
,
()
{
_updateField
(
height
,
_height
,
()
{
_height
=
new
ImplicitlyAnimatedValue
<
double
>(
new
Animated
Typ
e
<
double
>(
height
),
duration
);
_height
=
new
ImplicitlyAnimatedValue
<
double
>(
new
Animated
Valu
e
<
double
>(
height
),
duration
);
watch
(
_height
.
performance
);
watch
(
_height
.
performance
);
});
});
}
}
...
...
packages/flutter/lib/widgets/animation_builder.dart
View file @
972417f5
...
@@ -4,9 +4,8 @@
...
@@ -4,9 +4,8 @@
import
'package:vector_math/vector_math.dart'
;
import
'package:vector_math/vector_math.dart'
;
import
'package:sky/animation/animated_value.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/animation/curves.dart'
;
import
'package:sky/base/lerp.dart'
;
import
'package:sky/painting/box_painter.dart'
;
import
'package:sky/painting/box_painter.dart'
;
import
'package:sky/theme/shadows.dart'
;
import
'package:sky/theme/shadows.dart'
;
import
'package:sky/widgets/basic.dart'
;
import
'package:sky/widgets/basic.dart'
;
...
@@ -18,9 +17,9 @@ class AnimationBuilder {
...
@@ -18,9 +17,9 @@ class AnimationBuilder {
AnimationBuilder
();
AnimationBuilder
();
Animated
Typ
e
<
double
>
opacity
;
Animated
Valu
e
<
double
>
opacity
;
Animated
Typ
e
<
Point
>
position
;
Animated
Valu
e
<
Point
>
position
;
Animated
Typ
e
<
double
>
shadow
;
Animated
Valu
e
<
double
>
shadow
;
AnimatedColor
backgroundColor
;
AnimatedColor
backgroundColor
;
// These don't animate, but are used to build the AnimationBuilder anyway.
// These don't animate, but are used to build the AnimationBuilder anyway.
...
@@ -30,7 +29,7 @@ class AnimationBuilder {
...
@@ -30,7 +29,7 @@ class AnimationBuilder {
Map
<
AnimatedVariable
,
AnimationPerformance
>
_variableToPerformance
=
Map
<
AnimatedVariable
,
AnimationPerformance
>
_variableToPerformance
=
new
Map
<
AnimatedVariable
,
AnimationPerformance
>();
new
Map
<
AnimatedVariable
,
AnimationPerformance
>();
AnimationPerformance
createPerformance
(
List
<
Animated
Typ
e
>
variables
,
AnimationPerformance
createPerformance
(
List
<
Animated
Valu
e
>
variables
,
{
Duration
duration
})
{
{
Duration
duration
})
{
AnimationPerformance
performance
=
new
AnimationPerformance
()
AnimationPerformance
performance
=
new
AnimationPerformance
()
..
duration
=
duration
..
duration
=
duration
...
@@ -67,7 +66,7 @@ class AnimationBuilder {
...
@@ -67,7 +66,7 @@ class AnimationBuilder {
}
}
void
updateFields
({
void
updateFields
({
Animated
Typ
e
<
double
>
shadow
,
Animated
Valu
e
<
double
>
shadow
,
AnimatedColor
backgroundColor
,
AnimatedColor
backgroundColor
,
double
borderRadius
,
double
borderRadius
,
Shape
shape
Shape
shape
...
@@ -78,7 +77,7 @@ class AnimationBuilder {
...
@@ -78,7 +77,7 @@ class AnimationBuilder {
this
.
shape
=
shape
;
this
.
shape
=
shape
;
}
}
void
_updateField
(
Animated
Type
variable
,
AnimatedTyp
e
sourceVariable
)
{
void
_updateField
(
Animated
Value
variable
,
AnimatedValu
e
sourceVariable
)
{
if
(
variable
==
null
)
if
(
variable
==
null
)
return
;
// TODO(mpcomplete): Should we handle transition from null?
return
;
// TODO(mpcomplete): Should we handle transition from null?
...
@@ -101,15 +100,6 @@ class AnimationBuilder {
...
@@ -101,15 +100,6 @@ class AnimationBuilder {
}
}
}
}
class
AnimatedColor
extends
AnimatedType
<
Color
>
{
AnimatedColor
(
Color
begin
,
{
Color
end
,
Curve
curve:
linear
})
:
super
(
begin
,
end:
end
,
curve:
curve
);
void
setFraction
(
double
t
)
{
value
=
lerpColor
(
begin
,
end
,
t
);
}
}
List
<
BoxShadow
>
_computeShadow
(
double
level
)
{
List
<
BoxShadow
>
_computeShadow
(
double
level
)
{
if
(
level
<
1.0
)
// shadows[1] is the first shadow
if
(
level
<
1.0
)
// shadows[1] is the first shadow
return
null
;
return
null
;
...
...
packages/flutter/lib/widgets/basic.dart
View file @
972417f5
...
@@ -488,31 +488,34 @@ class Text extends Component {
...
@@ -488,31 +488,34 @@ class Text extends Component {
}
}
class
Image
extends
LeafRenderObjectWrapper
{
class
Image
extends
LeafRenderObjectWrapper
{
Image
({
sky
.
Image
image
,
this
.
size
,
this
.
colorFilter
})
Image
({
sky
.
Image
image
,
this
.
width
,
this
.
height
,
this
.
colorFilter
})
:
image
=
image
,
:
image
=
image
,
super
(
key:
image
.
hashCode
.
toString
());
// TODO(ianh): Find a way to uniquely identify the sky.Image rather than using hashCode, which could collide
super
(
key:
image
.
hashCode
.
toString
());
// TODO(ianh): Find a way to uniquely identify the sky.Image rather than using hashCode, which could collide
final
sky
.
Image
image
;
final
sky
.
Image
image
;
final
Size
size
;
final
double
width
;
final
double
height
;
final
sky
.
ColorFilter
colorFilter
;
final
sky
.
ColorFilter
colorFilter
;
RenderImage
createNode
()
=>
new
RenderImage
(
image
,
size
,
colorFilter:
colorFilter
);
RenderImage
createNode
()
=>
new
RenderImage
(
image
:
image
,
width:
width
,
height:
height
,
colorFilter:
colorFilter
);
RenderImage
get
root
=>
super
.
root
;
RenderImage
get
root
=>
super
.
root
;
void
syncRenderObject
(
Widget
old
)
{
void
syncRenderObject
(
Widget
old
)
{
super
.
syncRenderObject
(
old
);
super
.
syncRenderObject
(
old
);
root
.
image
=
image
;
root
.
image
=
image
;
root
.
requestedSize
=
size
;
root
.
width
=
width
;
root
.
height
=
height
;
root
.
colorFilter
=
colorFilter
;
root
.
colorFilter
=
colorFilter
;
}
}
}
}
class
FutureImage
extends
StatefulComponent
{
class
FutureImage
extends
StatefulComponent
{
FutureImage
({
String
key
,
this
.
image
,
this
.
size
,
this
.
colorFilter
})
FutureImage
({
String
key
,
this
.
image
,
this
.
width
,
this
.
height
,
this
.
colorFilter
})
:
super
(
key:
key
);
:
super
(
key:
key
);
Future
<
sky
.
Image
>
image
;
Future
<
sky
.
Image
>
image
;
Size
size
;
double
width
;
double
height
;
sky
.
ColorFilter
colorFilter
;
sky
.
ColorFilter
colorFilter
;
sky
.
Image
_resolvedImage
;
sky
.
Image
_resolvedImage
;
...
@@ -535,48 +538,57 @@ class FutureImage extends StatefulComponent {
...
@@ -535,48 +538,57 @@ class FutureImage extends StatefulComponent {
void
syncFields
(
FutureImage
source
)
{
void
syncFields
(
FutureImage
source
)
{
bool
needToResolveImage
=
(
image
!=
source
.
image
);
bool
needToResolveImage
=
(
image
!=
source
.
image
);
image
=
source
.
image
;
image
=
source
.
image
;
size
=
source
.
size
;
width
=
source
.
width
;
height
=
source
.
height
;
if
(
needToResolveImage
)
if
(
needToResolveImage
)
_resolveImage
();
_resolveImage
();
}
}
Widget
build
()
{
Widget
build
()
{
return
new
Image
(
image:
_resolvedImage
,
size:
size
,
colorFilter:
colorFilter
);
return
new
Image
(
image:
_resolvedImage
,
width:
width
,
height:
height
,
colorFilter:
colorFilter
);
}
}
}
}
class
NetworkImage
extends
Component
{
class
NetworkImage
extends
Component
{
NetworkImage
({
String
src
,
this
.
size
,
this
.
colorFilter
})
NetworkImage
({
String
src
,
this
.
width
,
this
.
height
,
this
.
colorFilter
})
:
src
=
src
,
:
src
=
src
,
super
(
key:
src
);
super
(
key:
src
);
final
String
src
;
final
String
src
;
final
Size
size
;
final
double
width
;
final
double
height
;
final
sky
.
ColorFilter
colorFilter
;
final
sky
.
ColorFilter
colorFilter
;
Widget
build
()
{
Widget
build
()
{
return
new
FutureImage
(
return
new
FutureImage
(
image:
image_cache
.
load
(
src
),
image:
image_cache
.
load
(
src
),
size:
size
,
width:
width
,
height:
height
,
colorFilter:
colorFilter
colorFilter:
colorFilter
);
);
}
}
}
}
class
AssetImage
extends
Component
{
class
AssetImage
extends
Component
{
AssetImage
({
String
name
,
this
.
bundle
,
this
.
size
,
this
.
colorFilter
})
AssetImage
({
String
name
,
this
.
bundle
,
this
.
width
,
this
.
height
,
this
.
colorFilter
})
:
name
=
name
,
:
name
=
name
,
super
(
key:
name
);
super
(
key:
name
);
final
String
name
;
final
String
name
;
final
AssetBundle
bundle
;
final
AssetBundle
bundle
;
final
Size
size
;
final
double
width
;
final
double
height
;
final
sky
.
ColorFilter
colorFilter
;
final
sky
.
ColorFilter
colorFilter
;
Widget
build
()
{
Widget
build
()
{
return
new
FutureImage
(
return
new
FutureImage
(
image:
bundle
.
loadImage
(
name
),
image:
bundle
.
loadImage
(
name
),
size:
size
,
width:
width
,
height:
height
,
colorFilter:
colorFilter
colorFilter:
colorFilter
);
);
}
}
...
...
packages/flutter/lib/widgets/dismissable.dart
View file @
972417f5
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
import
'dart:sky'
as
sky
;
import
'dart:sky'
as
sky
;
import
'package:sky/animation/animated_value.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/widgets/animated_component.dart'
;
import
'package:sky/widgets/animated_component.dart'
;
import
'package:sky/widgets/basic.dart'
;
import
'package:sky/widgets/basic.dart'
;
...
@@ -13,7 +14,7 @@ import 'package:vector_math/vector_math.dart';
...
@@ -13,7 +14,7 @@ import 'package:vector_math/vector_math.dart';
const
Duration
_kCardDismissFadeout
=
const
Duration
(
milliseconds:
200
);
const
Duration
_kCardDismissFadeout
=
const
Duration
(
milliseconds:
200
);
const
double
_kMinFlingVelocity
=
700.0
;
const
double
_kMinFlingVelocity
=
700.0
;
const
double
_kMinFlingVelocityDelta
=
400.0
;
const
double
_kMinFlingVelocityDelta
=
400.0
;
const
double
_kFlingVelocityScale
=
1.0
/
300.0
;
const
double
_kFlingVelocityScale
=
1.0
/
300.0
;
const
double
_kDismissCardThreshold
=
0.6
;
const
double
_kDismissCardThreshold
=
0.6
;
typedef
void
DismissedCallback
(
);
typedef
void
DismissedCallback
(
);
...
@@ -30,8 +31,8 @@ class Dismissable extends AnimatedComponent {
...
@@ -30,8 +31,8 @@ class Dismissable extends AnimatedComponent {
Widget
child
;
Widget
child
;
DismissedCallback
onDismissed
;
DismissedCallback
onDismissed
;
Animated
Typ
e
<
Point
>
_position
;
Animated
Valu
e
<
Point
>
_position
;
Animated
Typ
e
<
double
>
_opacity
;
Animated
Valu
e
<
double
>
_opacity
;
AnimationPerformance
_performance
;
AnimationPerformance
_performance
;
double
_width
;
double
_width
;
...
@@ -39,8 +40,8 @@ class Dismissable extends AnimatedComponent {
...
@@ -39,8 +40,8 @@ class Dismissable extends AnimatedComponent {
bool
_dragUnderway
=
false
;
bool
_dragUnderway
=
false
;
void
initState
()
{
void
initState
()
{
_position
=
new
Animated
Typ
e
<
Point
>(
Point
.
origin
);
_position
=
new
Animated
Valu
e
<
Point
>(
Point
.
origin
);
_opacity
=
new
Animated
Typ
e
<
double
>(
1.0
,
end:
0.0
);
_opacity
=
new
Animated
Valu
e
<
double
>(
1.0
,
end:
0.0
);
_performance
=
new
AnimationPerformance
()
_performance
=
new
AnimationPerformance
()
..
duration
=
_kCardDismissFadeout
..
duration
=
_kCardDismissFadeout
..
variable
=
new
AnimatedList
([
_position
,
_opacity
])
..
variable
=
new
AnimatedList
([
_position
,
_opacity
])
...
...
packages/flutter/lib/widgets/drawer.dart
View file @
972417f5
...
@@ -4,11 +4,11 @@
...
@@ -4,11 +4,11 @@
import
'dart:sky'
as
sky
;
import
'dart:sky'
as
sky
;
import
'package:sky/animation/animated_value.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/theme/shadows.dart'
;
import
'package:sky/theme/shadows.dart'
;
import
'package:sky/theme/colors.dart'
as
colors
;
import
'package:sky/theme/colors.dart'
as
colors
;
import
'package:sky/widgets/animated_component.dart'
;
import
'package:sky/widgets/animated_component.dart'
;
import
'package:sky/widgets/animation_builder.dart'
;
import
'package:sky/widgets/basic.dart'
;
import
'package:sky/widgets/basic.dart'
;
import
'package:sky/widgets/navigator.dart'
;
import
'package:sky/widgets/navigator.dart'
;
import
'package:sky/widgets/scrollable_viewport.dart'
;
import
'package:sky/widgets/scrollable_viewport.dart'
;
...
@@ -30,7 +30,7 @@ import 'package:vector_math/vector_math.dart';
...
@@ -30,7 +30,7 @@ import 'package:vector_math/vector_math.dart';
const
double
_kWidth
=
304.0
;
const
double
_kWidth
=
304.0
;
const
double
_kMinFlingVelocity
=
365.0
;
const
double
_kMinFlingVelocity
=
365.0
;
const
double
_kFlingVelocityScale
=
1.0
/
300.0
;
const
double
_kFlingVelocityScale
=
1.0
/
300.0
;
const
Duration
_kBaseSettleDuration
=
const
Duration
(
milliseconds:
246
);
const
Duration
_kBaseSettleDuration
=
const
Duration
(
milliseconds:
246
);
const
Point
_kOpenPosition
=
Point
.
origin
;
const
Point
_kOpenPosition
=
Point
.
origin
;
const
Point
_kClosedPosition
=
const
Point
(-
_kWidth
,
0.0
);
const
Point
_kClosedPosition
=
const
Point
(-
_kWidth
,
0.0
);
...
@@ -60,12 +60,12 @@ class Drawer extends AnimatedComponent {
...
@@ -60,12 +60,12 @@ class Drawer extends AnimatedComponent {
DrawerStatusChangedCallback
onStatusChanged
;
DrawerStatusChangedCallback
onStatusChanged
;
Navigator
navigator
;
Navigator
navigator
;
Animated
Typ
e
<
Point
>
_position
;
Animated
Valu
e
<
Point
>
_position
;
AnimatedColor
_maskColor
;
AnimatedColor
_maskColor
;
AnimationPerformance
_performance
;
AnimationPerformance
_performance
;
void
initState
()
{
void
initState
()
{
_position
=
new
Animated
Typ
e
<
Point
>(
_kClosedPosition
,
end:
_kOpenPosition
);
_position
=
new
Animated
Valu
e
<
Point
>(
_kClosedPosition
,
end:
_kOpenPosition
);
_maskColor
=
new
AnimatedColor
(
colors
.
transparent
,
end:
const
Color
(
0x7F000000
));
_maskColor
=
new
AnimatedColor
(
colors
.
transparent
,
end:
const
Color
(
0x7F000000
));
_performance
=
new
AnimationPerformance
()
_performance
=
new
AnimationPerformance
()
..
duration
=
_kBaseSettleDuration
..
duration
=
_kBaseSettleDuration
...
@@ -143,7 +143,8 @@ class Drawer extends AnimatedComponent {
...
@@ -143,7 +143,8 @@ class Drawer extends AnimatedComponent {
if
(
_lastStatus
!=
null
&&
status
!=
_lastStatus
)
{
if
(
_lastStatus
!=
null
&&
status
!=
_lastStatus
)
{
if
(
status
==
DrawerStatus
.
inactive
&&
if
(
status
==
DrawerStatus
.
inactive
&&
navigator
!=
null
&&
navigator
!=
null
&&
navigator
.
currentRoute
.
key
==
this
)
navigator
.
currentRoute
is
RouteState
&&
(
navigator
.
currentRoute
as
RouteState
).
owner
==
this
)
// TODO(ianh): remove cast once analyzer is cleverer
navigator
.
pop
();
navigator
.
pop
();
if
(
onStatusChanged
!=
null
)
if
(
onStatusChanged
!=
null
)
onStatusChanged
(
status
);
onStatusChanged
(
status
);
...
...
packages/flutter/lib/widgets/icon.dart
View file @
972417f5
...
@@ -93,7 +93,8 @@ class Icon extends Component {
...
@@ -93,7 +93,8 @@ class Icon extends Component {
return
new
AssetImage
(
return
new
AssetImage
(
bundle:
_iconBundle
,
bundle:
_iconBundle
,
name:
'
${category}
/
${density}
/ic_
${subtype}
_
${colorSuffix}
_
${size}
dp.png'
,
name:
'
${category}
/
${density}
/ic_
${subtype}
_
${colorSuffix}
_
${size}
dp.png'
,
size:
new
Size
(
size
.
toDouble
(),
size
.
toDouble
()),
width:
size
.
toDouble
(),
height:
size
.
toDouble
(),
colorFilter:
colorFilter
colorFilter:
colorFilter
);
);
}
}
...
...
packages/flutter/lib/widgets/ink_well.dart
View file @
972417f5
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
import
'dart:math'
as
math
;
import
'dart:math'
as
math
;
import
'dart:sky'
as
sky
;
import
'dart:sky'
as
sky
;
import
'package:sky/animation/animated_value.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/animation/curves.dart'
;
import
'package:sky/animation/curves.dart'
;
import
'package:sky/rendering/box.dart'
;
import
'package:sky/rendering/box.dart'
;
...
@@ -29,7 +30,7 @@ double _getSplashTargetSize(Size bounds, Point position) {
...
@@ -29,7 +30,7 @@ double _getSplashTargetSize(Size bounds, Point position) {
class
InkSplash
{
class
InkSplash
{
InkSplash
(
this
.
pointer
,
this
.
position
,
this
.
well
)
{
InkSplash
(
this
.
pointer
,
this
.
position
,
this
.
well
)
{
_targetRadius
=
_getSplashTargetSize
(
well
.
size
,
position
);
_targetRadius
=
_getSplashTargetSize
(
well
.
size
,
position
);
_radius
=
new
Animated
Typ
e
<
double
>(
_radius
=
new
Animated
Valu
e
<
double
>(
_kSplashInitialSize
,
end:
_targetRadius
,
curve:
easeOut
);
_kSplashInitialSize
,
end:
_targetRadius
,
curve:
easeOut
);
_performance
=
new
AnimationPerformance
()
_performance
=
new
AnimationPerformance
()
...
@@ -45,7 +46,7 @@ class InkSplash {
...
@@ -45,7 +46,7 @@ class InkSplash {
double
_targetRadius
;
double
_targetRadius
;
double
_pinnedRadius
;
double
_pinnedRadius
;
Animated
Typ
e
<
double
>
_radius
;
Animated
Valu
e
<
double
>
_radius
;
AnimationPerformance
_performance
;
AnimationPerformance
_performance
;
void
_updateVelocity
(
double
velocity
)
{
void
_updateVelocity
(
double
velocity
)
{
...
...
packages/flutter/lib/widgets/navigator.dart
View file @
972417f5
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'package:sky/animation/animated_value.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/animation/curves.dart'
;
import
'package:sky/animation/curves.dart'
;
import
'package:sky/widgets/animated_component.dart'
;
import
'package:sky/widgets/animated_component.dart'
;
...
@@ -11,25 +12,24 @@ import 'package:vector_math/vector_math.dart';
...
@@ -11,25 +12,24 @@ import 'package:vector_math/vector_math.dart';
typedef
Widget
Builder
(
Navigator
navigator
,
RouteBase
route
);
typedef
Widget
Builder
(
Navigator
navigator
,
RouteBase
route
);
abstract
class
RouteBase
{
abstract
class
RouteBase
{
RouteBase
({
this
.
key
});
final
Object
key
;
Widget
build
(
Navigator
navigator
,
RouteBase
route
);
Widget
build
(
Navigator
navigator
,
RouteBase
route
);
void
popState
()
{
}
void
popState
()
{
}
}
}
class
Route
extends
RouteBase
{
class
Route
extends
RouteBase
{
Route
({
String
name
,
this
.
builder
})
:
super
(
key:
name
);
Route
({
this
.
name
,
this
.
builder
}
);
String
get
name
=>
key
;
final
String
name
;
final
Builder
builder
;
final
Builder
builder
;
Widget
build
(
Navigator
navigator
,
RouteBase
route
)
=>
builder
(
navigator
,
route
);
Widget
build
(
Navigator
navigator
,
RouteBase
route
)
=>
builder
(
navigator
,
route
);
}
}
class
RouteState
extends
RouteBase
{
class
RouteState
extends
RouteBase
{
RouteState
({
this
.
callback
,
this
.
route
,
Object
key
})
:
super
(
key:
key
);
RouteState
({
this
.
callback
,
this
.
route
,
this
.
owner
}
);
RouteBase
route
;
Function
callback
;
Function
callback
;
RouteBase
route
;
StatefulComponent
owner
;
Widget
build
(
Navigator
navigator
,
RouteBase
route
)
=>
null
;
Widget
build
(
Navigator
navigator
,
RouteBase
route
)
=>
null
;
...
@@ -59,17 +59,17 @@ class Transition extends AnimatedComponent {
...
@@ -59,17 +59,17 @@ class Transition extends AnimatedComponent {
Function
onDismissed
;
Function
onDismissed
;
Function
onCompleted
;
Function
onCompleted
;
Animated
Typ
e
<
Point
>
_position
;
Animated
Valu
e
<
Point
>
_position
;
Animated
Typ
e
<
double
>
_opacity
;
Animated
Valu
e
<
double
>
_opacity
;
AnimationPerformance
_performance
;
AnimationPerformance
_performance
;
void
initState
()
{
void
initState
()
{
_position
=
new
Animated
Typ
e
<
Point
>(
_position
=
new
Animated
Valu
e
<
Point
>(
_kTransitionStartPoint
,
_kTransitionStartPoint
,
end:
Point
.
origin
,
end:
Point
.
origin
,
curve:
easeOut
curve:
easeOut
);
);
_opacity
=
new
Animated
Typ
e
<
double
>(
0.0
,
end:
1.0
)
_opacity
=
new
Animated
Valu
e
<
double
>(
0.0
,
end:
1.0
)
..
curve
=
easeOut
;
..
curve
=
easeOut
;
_performance
=
new
AnimationPerformance
()
_performance
=
new
AnimationPerformance
()
..
duration
=
_kTransitionDuration
..
duration
=
_kTransitionDuration
...
@@ -143,9 +143,8 @@ class Transition extends AnimatedComponent {
...
@@ -143,9 +143,8 @@ class Transition extends AnimatedComponent {
}
}
class
HistoryEntry
{
class
HistoryEntry
{
HistoryEntry
({
this
.
route
,
this
.
key
});
HistoryEntry
({
this
.
route
});
final
RouteBase
route
;
final
RouteBase
route
;
final
int
key
;
bool
transitionFinished
=
false
;
bool
transitionFinished
=
false
;
// TODO(jackson): Keep track of the requested transition
// TODO(jackson): Keep track of the requested transition
}
}
...
@@ -157,12 +156,11 @@ class NavigationState {
...
@@ -157,12 +156,11 @@ class NavigationState {
if
(
route
.
name
!=
null
)
if
(
route
.
name
!=
null
)
namedRoutes
[
route
.
name
]
=
route
;
namedRoutes
[
route
.
name
]
=
route
;
}
}
history
.
add
(
new
HistoryEntry
(
route:
routes
[
0
]
,
key:
_lastKey
++
));
history
.
add
(
new
HistoryEntry
(
route:
routes
[
0
]));
}
}
List
<
HistoryEntry
>
history
=
new
List
<
HistoryEntry
>();
List
<
HistoryEntry
>
history
=
new
List
<
HistoryEntry
>();
int
historyIndex
=
0
;
int
historyIndex
=
0
;
int
_lastKey
=
0
;
Map
<
String
,
RouteBase
>
namedRoutes
=
new
Map
<
String
,
RouteBase
>();
Map
<
String
,
RouteBase
>
namedRoutes
=
new
Map
<
String
,
RouteBase
>();
RouteBase
get
currentRoute
=>
history
[
historyIndex
].
route
;
RouteBase
get
currentRoute
=>
history
[
historyIndex
].
route
;
...
@@ -175,7 +173,7 @@ class NavigationState {
...
@@ -175,7 +173,7 @@ class NavigationState {
}
}
void
push
(
RouteBase
route
)
{
void
push
(
RouteBase
route
)
{
HistoryEntry
historyEntry
=
new
HistoryEntry
(
route:
route
,
key:
_lastKey
++
);
HistoryEntry
historyEntry
=
new
HistoryEntry
(
route:
route
);
history
.
insert
(
historyIndex
+
1
,
historyEntry
);
history
.
insert
(
historyIndex
+
1
,
historyEntry
);
historyIndex
++;
historyIndex
++;
}
}
...
@@ -202,9 +200,9 @@ class Navigator extends StatefulComponent {
...
@@ -202,9 +200,9 @@ class Navigator extends StatefulComponent {
RouteBase
get
currentRoute
=>
state
.
currentRoute
;
RouteBase
get
currentRoute
=>
state
.
currentRoute
;
void
pushState
(
Object
key
,
Function
callback
)
{
void
pushState
(
StatefulComponent
owner
,
Function
callback
)
{
RouteBase
route
=
new
RouteState
(
RouteBase
route
=
new
RouteState
(
key:
key
,
owner:
owner
,
callback:
callback
,
callback:
callback
,
route:
state
.
currentRoute
route:
state
.
currentRoute
);
);
...
@@ -244,7 +242,7 @@ class Navigator extends StatefulComponent {
...
@@ -244,7 +242,7 @@ class Navigator extends StatefulComponent {
if
(
content
==
null
)
if
(
content
==
null
)
continue
;
continue
;
Transition
transition
=
new
Transition
(
Transition
transition
=
new
Transition
(
key:
historyEntry
.
key
.
toString
(),
key:
historyEntry
.
hashCode
.
toString
(),
// TODO(ianh): make it not collide
content:
content
,
content:
content
,
direction:
(
i
<=
state
.
historyIndex
)
?
TransitionDirection
.
forward
:
TransitionDirection
.
reverse
,
direction:
(
i
<=
state
.
historyIndex
)
?
TransitionDirection
.
forward
:
TransitionDirection
.
reverse
,
interactive:
(
i
==
state
.
historyIndex
),
interactive:
(
i
==
state
.
historyIndex
),
...
...
packages/flutter/lib/widgets/popup_menu.dart
View file @
972417f5
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
import
'dart:math'
as
math
;
import
'dart:math'
as
math
;
import
'dart:sky'
as
sky
;
import
'dart:sky'
as
sky
;
import
'package:sky/animation/animated_value.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/painting/box_painter.dart'
;
import
'package:sky/painting/box_painter.dart'
;
import
'package:sky/theme/colors.dart'
;
import
'package:sky/theme/colors.dart'
;
...
@@ -48,10 +49,10 @@ class PopupMenu extends AnimatedComponent {
...
@@ -48,10 +49,10 @@ class PopupMenu extends AnimatedComponent {
int
level
;
int
level
;
Navigator
navigator
;
Navigator
navigator
;
Animated
Typ
e
<
double
>
_opacity
;
Animated
Valu
e
<
double
>
_opacity
;
Animated
Typ
e
<
double
>
_width
;
Animated
Valu
e
<
double
>
_width
;
Animated
Typ
e
<
double
>
_height
;
Animated
Valu
e
<
double
>
_height
;
List
<
Animated
Typ
e
<
double
>>
_itemOpacities
;
List
<
Animated
Valu
e
<
double
>>
_itemOpacities
;
AnimatedList
_animationList
;
AnimatedList
_animationList
;
AnimationPerformance
_performance
;
AnimationPerformance
_performance
;
...
@@ -88,14 +89,14 @@ class PopupMenu extends AnimatedComponent {
...
@@ -88,14 +89,14 @@ class PopupMenu extends AnimatedComponent {
void
_updateAnimationVariables
()
{
void
_updateAnimationVariables
()
{
double
unit
=
1.0
/
(
items
.
length
+
1.5
);
// 1.0 for the width and 0.5 for the last item's fade.
double
unit
=
1.0
/
(
items
.
length
+
1.5
);
// 1.0 for the width and 0.5 for the last item's fade.
_opacity
=
new
Animated
Typ
e
<
double
>(
0.0
,
end:
1.0
);
_opacity
=
new
Animated
Valu
e
<
double
>(
0.0
,
end:
1.0
);
_width
=
new
Animated
Typ
e
<
double
>(
0.0
,
end:
1.0
,
interval:
new
Interval
(
0.0
,
unit
));
_width
=
new
Animated
Valu
e
<
double
>(
0.0
,
end:
1.0
,
interval:
new
Interval
(
0.0
,
unit
));
_height
=
new
Animated
Typ
e
<
double
>(
0.0
,
end:
1.0
,
interval:
new
Interval
(
0.0
,
unit
*
items
.
length
));
_height
=
new
Animated
Valu
e
<
double
>(
0.0
,
end:
1.0
,
interval:
new
Interval
(
0.0
,
unit
*
items
.
length
));
_itemOpacities
=
new
List
<
Animated
Typ
e
<
double
>>();
_itemOpacities
=
new
List
<
Animated
Valu
e
<
double
>>();
for
(
int
i
=
0
;
i
<
items
.
length
;
++
i
)
{
for
(
int
i
=
0
;
i
<
items
.
length
;
++
i
)
{
double
start
=
(
i
+
1
)
*
unit
;
double
start
=
(
i
+
1
)
*
unit
;
double
end
=
(
start
+
1.5
*
unit
).
clamp
(
0.0
,
1.0
);
double
end
=
(
start
+
1.5
*
unit
).
clamp
(
0.0
,
1.0
);
_itemOpacities
.
add
(
new
Animated
Typ
e
<
double
>(
_itemOpacities
.
add
(
new
Animated
Valu
e
<
double
>(
0.0
,
end:
1.0
,
interval:
new
Interval
(
start
,
end
)));
0.0
,
end:
1.0
,
interval:
new
Interval
(
start
,
end
)));
}
}
List
<
AnimatedVariable
>
variables
=
new
List
<
AnimatedVariable
>()
List
<
AnimatedVariable
>
variables
=
new
List
<
AnimatedVariable
>()
...
@@ -122,7 +123,8 @@ class PopupMenu extends AnimatedComponent {
...
@@ -122,7 +123,8 @@ class PopupMenu extends AnimatedComponent {
if
(
_lastStatus
!=
null
&&
status
!=
_lastStatus
)
{
if
(
_lastStatus
!=
null
&&
status
!=
_lastStatus
)
{
if
(
status
==
PopupMenuStatus
.
inactive
&&
if
(
status
==
PopupMenuStatus
.
inactive
&&
navigator
!=
null
&&
navigator
!=
null
&&
navigator
.
currentRoute
.
key
==
this
)
navigator
.
currentRoute
is
RouteState
&&
(
navigator
.
currentRoute
as
RouteState
).
owner
==
this
)
// TODO(ianh): remove cast once analyzer is cleverer
navigator
.
pop
();
navigator
.
pop
();
if
(
onStatusChanged
!=
null
)
if
(
onStatusChanged
!=
null
)
onStatusChanged
(
status
);
onStatusChanged
(
status
);
...
...
packages/flutter/lib/widgets/toggleable.dart
View file @
972417f5
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
import
'dart:sky'
as
sky
;
import
'dart:sky'
as
sky
;
import
'package:sky/animation/animated_value.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/animation/curves.dart'
;
import
'package:sky/animation/curves.dart'
;
import
'package:sky/widgets/animated_component.dart'
;
import
'package:sky/widgets/animated_component.dart'
;
...
@@ -24,14 +25,14 @@ abstract class Toggleable extends AnimatedComponent {
...
@@ -24,14 +25,14 @@ abstract class Toggleable extends AnimatedComponent {
bool
value
;
bool
value
;
ValueChanged
onChanged
;
ValueChanged
onChanged
;
Animated
Typ
e
<
double
>
_position
;
Animated
Valu
e
<
double
>
_position
;
Animated
Typ
e
<
double
>
get
position
=>
_position
;
Animated
Valu
e
<
double
>
get
position
=>
_position
;
AnimationPerformance
_performance
;
AnimationPerformance
_performance
;
AnimationPerformance
get
performance
=>
_performance
;
AnimationPerformance
get
performance
=>
_performance
;
void
initState
()
{
void
initState
()
{
_position
=
new
Animated
Typ
e
<
double
>(
0.0
,
end:
1.0
);
_position
=
new
Animated
Valu
e
<
double
>(
0.0
,
end:
1.0
);
_performance
=
new
AnimationPerformance
()
_performance
=
new
AnimationPerformance
()
..
variable
=
position
..
variable
=
position
..
duration
=
_kCheckDuration
..
duration
=
_kCheckDuration
...
...
packages/flutter/lib/widgets/variable_height_scrollable.dart
View file @
972417f5
...
@@ -8,6 +8,8 @@ import 'package:sky/widgets/block_viewport.dart';
...
@@ -8,6 +8,8 @@ import 'package:sky/widgets/block_viewport.dart';
import
'package:sky/widgets/scrollable.dart'
;
import
'package:sky/widgets/scrollable.dart'
;
import
'package:sky/widgets/widget.dart'
;
import
'package:sky/widgets/widget.dart'
;
export
'package:sky/widgets/block_viewport.dart'
show
BlockViewportLayoutState
;
class
VariableHeightScrollable
extends
Scrollable
{
class
VariableHeightScrollable
extends
Scrollable
{
VariableHeightScrollable
({
VariableHeightScrollable
({
String
key
,
String
key
,
...
...
packages/flutter/lib/widgets/widget.dart
View file @
972417f5
...
@@ -6,7 +6,6 @@ import 'dart:async';
...
@@ -6,7 +6,6 @@ import 'dart:async';
import
'dart:collection'
;
import
'dart:collection'
;
import
'dart:sky'
as
sky
;
import
'dart:sky'
as
sky
;
import
'package:sky/base/debug.dart'
;
import
'package:sky/base/hit_test.dart'
;
import
'package:sky/base/hit_test.dart'
;
import
'package:sky/mojo/activity.dart'
as
activity
;
import
'package:sky/mojo/activity.dart'
as
activity
;
import
'package:sky/rendering/box.dart'
;
import
'package:sky/rendering/box.dart'
;
...
@@ -600,17 +599,20 @@ int _inLayoutCallbackBuilder = 0;
...
@@ -600,17 +599,20 @@ int _inLayoutCallbackBuilder = 0;
class
LayoutCallbackBuilderHandle
{
bool
_active
=
true
;
}
class
LayoutCallbackBuilderHandle
{
bool
_active
=
true
;
}
LayoutCallbackBuilderHandle
enterLayoutCallbackBuilder
(
)
{
LayoutCallbackBuilderHandle
enterLayoutCallbackBuilder
(
)
{
if
(!
inDebugBuild
)
assert
(()
{
return
null
;
_inLayoutCallbackBuilder
+=
1
;
_inLayoutCallbackBuilder
+=
1
;
return
true
;
});
return
new
LayoutCallbackBuilderHandle
();
return
new
LayoutCallbackBuilderHandle
();
}
}
void
exitLayoutCallbackBuilder
(
LayoutCallbackBuilderHandle
handle
)
{
void
exitLayoutCallbackBuilder
(
LayoutCallbackBuilderHandle
handle
)
{
if
(!
inDebugBuild
)
assert
(()
{
return
;
assert
(
handle
.
_active
);
assert
(
handle
.
_active
);
handle
.
_active
=
false
;
handle
.
_active
=
false
;
_inLayoutCallbackBuilder
-=
1
;
_inLayoutCallbackBuilder
-=
1
;
return
true
;
});
Widget
.
_notifyMountStatusChanged
();
}
}
List
<
int
>
_debugFrameTimes
=
<
int
>[];
List
<
int
>
_debugFrameTimes
=
<
int
>[];
...
...
packages/flutter/pubspec.yaml
View file @
972417f5
...
@@ -11,4 +11,4 @@ environment:
...
@@ -11,4 +11,4 @@ environment:
sdk
:
'
>=1.8.0
<2.0.0'
sdk
:
'
>=1.8.0
<2.0.0'
homepage
:
https://github.com/domokit/mojo/tree/master/sky
homepage
:
https://github.com/domokit/mojo/tree/master/sky
name
:
sky
name
:
sky
version
:
0.0.
19
version
:
0.0.
20
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