buildForwardTransition()

For those times when you want to do something as you move away from a
route into the next one, as well as when you move into it from the
previous one.
This commit is contained in:
Hixie
2015-12-02 10:00:26 -08:00
parent 9d86ac5e35
commit bc5307f5af
11 changed files with 465 additions and 16 deletions

View File

@@ -8,6 +8,7 @@ import 'dart:async';
import 'dart:math' as math;
import 'dart:ui' as ui;
import 'package:flutter/animation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/painting.dart';

View File

@@ -146,13 +146,22 @@ class StockHomeState extends State<StockHome> {
}
Widget buildToolBar() {
PageRoute page = ModalRoute.of(context);
return new ToolBar(
elevation: 0,
left: new IconButton(
icon: "navigation/menu",
onPressed: _showDrawer
),
center: new Text('Stocks'),
center: new FadeTransition(
opacity: new AnimatedValue<double>(
1.0,
end: 0.0,
curve: const Interval(0.0, 0.5)
),
performance: page.forwardPerformance,
child: new Text('Stocks')
),
right: <Widget>[
new IconButton(
icon: "action/search",

View File

@@ -53,6 +53,7 @@ class StockSymbolPage extends StatelessComponent {
final Stock stock;
Widget build(BuildContext context) {
PageRoute page = ModalRoute.of(context);
return new Scaffold(
toolBar: new ToolBar(
left: new IconButton(
@@ -61,7 +62,15 @@ class StockSymbolPage extends StatelessComponent {
Navigator.pop(context);
}
),
center: new Text(stock.name)
center: new FadeTransition(
opacity: new AnimatedValue<double>(
0.0,
end: 1.0,
curve: const Interval(0.5, 1.0)
),
performance: page.performance,
child: new Text(stock.name)
)
),
body: new Block(<Widget>[
new Container(