public override Widget build(BuildContext context) => new Scaffold( body: new PageView( controller: _pageController, onPageChanged: id => setState(() => _currentIndex = id), children: _pages .Select(b => b(context)) .ToList() ), bottomNavigationBar: new Theme( data: Theme.of(context), child: new BottomNavigationBar( items: new List <BottomNavigationBarItem> { new BottomNavigationBarItem( icon: new Icon(Icons.home), title: new Text("Home") ), new BottomNavigationBarItem( icon: new Icon(Icons.settings), title: new Text("Settings") ), }, showUnselectedLabels: true, currentIndex: _currentIndex, onTap: id => _pageController.animateToPage( id, duration: System.TimeSpan.FromMilliseconds(300), curve: Curves.ease ), type: BottomNavigationBarType.fix ) ), floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, floatingActionButton: new FloatingActionButton( child: new Icon(Icons.camera_alt), onPressed: () => Navigator .of(context) .push( new PageRouteBuilder( pageBuilder: (cont, _, __) => _camera(cont), transitionsBuilder: (_, animation, __, child) => { var begin = new Offset(0f, 1f); var end = Offset.zero; var curve = Curves.ease; var tween = new OffsetTween(begin: begin, end: end) .chain(new CurveTween(curve)); return(new SlideTransition( position: animation.drive(tween), child: child)); } ) ) ) );
public override Widget buildActions(BuildContext context, CustomDismissibleDelegateContext ctx) { var animation = new OffsetTween( Offset.zero, ctx.createOffset(ctx.state.totalActionsExtent * ctx.state.dragSign) ).animate(ctx.state.actionsMoveAnimation); if (ctx.state.actionsMoveAnimation.value != 0.0f) { return(new Container( child: new Stack( children: new List <Widget> { this.buildStackActions(context, ctx), new SlideTransition( position: animation, child: ctx.state.widget.child ) } ) )); } return(ctx.state.widget.child); }
protected override Widget buildActionsWhileDismissing(BuildContext context, CustomDismissibleDelegateContext ctx) { var animation = new OffsetTween( Offset.zero, ctx.createOffset(ctx.state.dragSign) ).animate(ctx.state.overallMoveAnimation); return(new Container( child: new Stack( children: new List <Widget> { Positioned.fill( new LayoutBuilder(builder: (_context, constraints) => { var count = ctx.state.actionCount; var actionExtent = ctx.getMaxExtent(constraints) * ctx.state.widget.actionExtentRatio; var totalExtent = ctx.getMaxExtent(constraints); var extentAnimations = new List <Animation <float> >(); for (var index = 0; index < count; index++) { var extentAnimation = new FloatTween( (float)actionExtent, totalExtent - (float)actionExtent * (ctx.state.actionCount - index - 1) ).animate( new CurvedAnimation( ctx.state.overallMoveAnimation, new Interval(ctx.state.totalActionsExtent, 1) ) ); extentAnimations.Add(extentAnimation); } return new AnimatedBuilder( animation: ctx.state.overallMoveAnimation, builder: (cxt, child) => { var widgets = new List <Widget>(); for (var index = 0; index < ctx.state.actionCount; index++) { var displayIndex = ctx.showActions ? ctx.state.actionCount - index - 1 : index; var widget = ctx.createPositioned( position: (float)actionExtent * (ctx.state.actionCount - index - 1), extent: extentAnimations[index].value, child: ctx.state.actionDelegate.build( context, displayIndex, ctx.state.overallMoveAnimation, ctx.state.renderingMode ) ); widgets.Add(widget); } return new Stack( children: widgets ); } ); } ) ), new SlideTransition( position: animation, child: ctx.state.widget.child ) } ))); }