Move Scaffold over to using AnimationController
Also, clean up the class hierarchy for AnimationController now that we've renamed progress to value. That means everything in the hierarchy now has a value, include Watchable. This patch renames Watchable to Animated<T>, which lets us use that type almost everywhere. I've added some ducktape to modal bottom sheets to avoid having to refactor all of Navigator to use AnimationController. I'll remove the ducktape in the next patch.
This commit is contained in:
@@ -12,9 +12,9 @@ class PageSelectorDemo extends StatelessComponent {
|
||||
final ColorTween _previousColor = new ColorTween(begin: color, end: Colors.transparent);
|
||||
final TabBarSelectionState selection = TabBarSelection.of(context);
|
||||
|
||||
Animation animation = new CurvedAnimation(parent: selection.animation, curve: Curves.ease);
|
||||
return new AnimationWatchingBuilder(
|
||||
watchable: animation,
|
||||
CurvedAnimation animation = new CurvedAnimation(parent: selection.animation, curve: Curves.ease);
|
||||
return new AnimatedBuilder(
|
||||
animation: animation,
|
||||
builder: (BuildContext context) {
|
||||
Color background = selection.value == iconName ? _selectedColor.end : _selectedColor.begin;
|
||||
if (selection.valueIsChanging) {
|
||||
|
||||
@@ -27,7 +27,7 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> {
|
||||
});
|
||||
}
|
||||
|
||||
Animation animation;
|
||||
Animated<double> animation;
|
||||
AnimationController controller;
|
||||
|
||||
void handleTap() {
|
||||
@@ -55,19 +55,19 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> {
|
||||
),
|
||||
new LinearProgressIndicator(),
|
||||
new LinearProgressIndicator(),
|
||||
new LinearProgressIndicator(value: animation.progress),
|
||||
new LinearProgressIndicator(value: animation.value),
|
||||
new CircularProgressIndicator(),
|
||||
new SizedBox(
|
||||
width: 20.0,
|
||||
height: 20.0,
|
||||
child: new CircularProgressIndicator(value: animation.progress)
|
||||
child: new CircularProgressIndicator(value: animation.value)
|
||||
),
|
||||
new SizedBox(
|
||||
width: 50.0,
|
||||
height: 30.0,
|
||||
child: new CircularProgressIndicator(value: animation.progress)
|
||||
child: new CircularProgressIndicator(value: animation.value)
|
||||
),
|
||||
new Text("${(animation.progress * 100.0).toStringAsFixed(1)}%" + (controller.isAnimating ? '' : ' (paused)'))
|
||||
new Text("${(animation.value * 100.0).toStringAsFixed(1)}%" + (controller.isAnimating ? '' : ' (paused)'))
|
||||
];
|
||||
return new Column(
|
||||
children: indicators
|
||||
@@ -87,8 +87,8 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> {
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: new Container(
|
||||
padding: const EdgeDims.symmetric(vertical: 12.0, horizontal: 8.0),
|
||||
child: new AnimationWatchingBuilder(
|
||||
watchable: animation,
|
||||
child: new AnimatedBuilder(
|
||||
animation: animation,
|
||||
builder: buildIndicators
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user