|
|
|
|
|
|
using Unity.UIWidgets.rendering; |
|
|
|
using Unity.UIWidgets.ui; |
|
|
|
using Unity.UIWidgets.widgets; |
|
|
|
using Color = Unity.UIWidgets.ui.Color; |
|
|
|
|
|
|
|
|
|
|
|
protected override string initialRoute => "/"; |
|
|
|
protected override string initialRoute { |
|
|
|
get { return "/"; } |
|
|
|
} |
|
|
|
protected override Dictionary<string, WidgetBuilder> routes => new Dictionary<string, WidgetBuilder> { |
|
|
|
{"/", (context) => new HomeScreen()}, |
|
|
|
{"/detail", (context) => new DetailScreen()} |
|
|
|
}; |
|
|
|
|
|
|
|
protected override TextStyle textStyle => new TextStyle(fontSize: 24); |
|
|
|
|
|
|
|
protected override PageRouteFactory pageRouteBuilder => (RouteSettings settings, WidgetBuilder builder) => |
|
|
|
new PageRouteBuilder( |
|
|
|
settings: settings, |
|
|
|
pageBuilder: (BuildContext context, Unity.UIWidgets.animation.Animation<double> animation, |
|
|
|
Unity.UIWidgets.animation.Animation<double> secondaryAnimation) => builder(context), |
|
|
|
transitionsBuilder: (BuildContext context, Animation<double> |
|
|
|
animation, Animation<double> secondaryAnimation, Widget child) => new _FadeUpwardsPageTransition( |
|
|
|
routeAnimation: animation, |
|
|
|
child: child |
|
|
|
) |
|
|
|
); |
|
|
|
protected override Dictionary<string, WidgetBuilder> routes { |
|
|
|
get { |
|
|
|
return new Dictionary<string, WidgetBuilder> { |
|
|
|
{"/", (context) => new HomeScreen()}, |
|
|
|
{"/detail", (context) => new DetailScreen()} |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
protected override TextStyle textStyle { |
|
|
|
get { return new TextStyle(fontSize: 24); } |
|
|
|
} |
|
|
|
|
|
|
|
protected override PageRouteFactory pageRouteBuilder { |
|
|
|
get { |
|
|
|
return (RouteSettings settings, WidgetBuilder builder) => |
|
|
|
new PageRouteBuilder( |
|
|
|
settings: settings, |
|
|
|
pageBuilder: (BuildContext context, Animation<double> animation, |
|
|
|
Animation<double> secondaryAnimation) => builder(context), |
|
|
|
transitionsBuilder: (BuildContext context, Animation<double> |
|
|
|
animation, Animation<double> secondaryAnimation, Widget child) => |
|
|
|
new _FadeUpwardsPageTransition( |
|
|
|
routeAnimation: animation, |
|
|
|
child: child |
|
|
|
) |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
body:new Container( |
|
|
|
body: new Container( |
|
|
|
child: new Center(child: new CustomButton(onPressed: () => { |
|
|
|
Navigator.pushName(context, "/detail"); |
|
|
|
}, child: new Text("Go to Detail")) |
|
|
|
child: new Center( |
|
|
|
child: new CustomButton(onPressed: () => { Navigator.pushName(context, "/detail"); }, |
|
|
|
child: new Text("Go to Detail")) |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
class DetailScreen : StatelessWidget { |
|
|
|
public override Widget build(BuildContext context) { |
|
|
|
return new NavigationPage( |
|
|
|
|
|
|
title: "Detail"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return new Center(child:new Container( |
|
|
|
return new Center(child: new Container( |
|
|
|
color: new Color(0xFFFF0000), |
|
|
|
width: 100, |
|
|
|
height: 80, |
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
class _FadeUpwardsPageTransition : StatelessWidget { |
|
|
|
|
|
|
|
) :base(key: key) { |
|
|
|
) : base(key: key) { |
|
|
|
this._positionAnimation = _bottomUpTween.chain(_fastOutSlowInTween).animate(routeAnimation); |
|
|
|
this._opacityAnimation = _easeInTween.animate(routeAnimation); |
|
|
|
this.child = child; |
|
|
|
|
|
|
begin: new Offset(0.0, 0.25), |
|
|
|
end: Offset.zero |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override Widget build(BuildContext context) { |
|
|
|
return new SlideTransition( |
|
|
|
position: this._positionAnimation, |
|
|
|
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
class NavigationPage: StatelessWidget { |
|
|
|
|
|
|
|
class NavigationPage : StatelessWidget { |
|
|
|
public readonly Widget body; |
|
|
|
public readonly string title; |
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
back = new CustomButton(onPressed: () => { Navigator.pop(context); }, |
|
|
|
back = new CustomButton(onPressed: () => { Navigator.pop(context); }, |
|
|
|
back = new Column(mainAxisAlignment: MainAxisAlignment.center, children: new List<Widget>(){back}); |
|
|
|
back = new Column(mainAxisAlignment: MainAxisAlignment.center, children: new List<Widget>() {back}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new ConstrainedBox(constraints: new BoxConstraints(maxHeight:80), |
|
|
|
child:new DecoratedBox( |
|
|
|
new ConstrainedBox(constraints: new BoxConstraints(maxHeight: 80), |
|
|
|
child: new DecoratedBox( |
|
|
|
child:new NavigationToolbar(leading: back, |
|
|
|
middle: new Text(this.title, textAlign: TextAlign.center)))) |
|
|
|
, |
|
|
|
new Flexible(child:this.body) |
|
|
|
} |
|
|
|
) |
|
|
|
); |
|
|
|
|
|
|
|
child: new NavigationToolbar(leading: back, |
|
|
|
middle: new Text(this.title, textAlign: TextAlign.center)))), |
|
|
|
new Flexible(child: this.body) |
|
|
|
} |
|
|
|
) |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|