flutter - Viewing a greeting screen for a specific period of time -
i have been trying find information creating widget disappears after period of time. trying create greeting page appears once app runs , disappears after couple of seconds; navigating home page afterwards.
what correct direction in order done?
i understand how use showdialog buttons, want greetings view first view when app starts, how correctly use showdialog?
void main() { runapp( new materialapp( home: new signin(),//how integrate showdialog flow )) }
the full code of transition between 'greeting page' , home using pageroutebuilder , navigatorstate.pushreplacement :
import 'dart:async'; import 'package:flutter/material.dart'; void main() { runapp(new materialapp( home: new greeting(), )); } class greeting extends statefulwidget { @override _greetingstate createstate() => new _greetingstate(); } class _greetingstate extends state<greeting> { @override initstate() { super.initstate(); new timer(const duration(seconds: 5), onclose); } @override widget build(buildcontext context) { return new scaffold( body: new align( alignment: fractionaloffset.center, child: new column( mainaxisalignment: mainaxisalignment.center, children: <widget>[ new text( "hello !", style: theme.of(context).texttheme.display1, ), new row( mainaxisalignment: mainaxisalignment.center, children: <widget>[ new text("here's unicorn your"), new image.network( "https://i.pinimg.com/736x/3b/06/ef/3b06efe25fed62de2960090ff2b8d83a--cute-cartoon-drawings-drawings-of.jpg", height: 42.0, width: 42.0, ), ], ) ], )), ); } void onclose() { navigator.of(context).pushreplacement(new pageroutebuilder( maintainstate: true, opaque: true, pagebuilder: (context, _, __) => new home(), transitionduration: const duration(seconds: 2), transitionsbuilder: (context, anim1, anim2, child) { return new fadetransition( child: child, opacity: anim1, ); })); } } class home extends statelesswidget { @override widget build(buildcontext context) { return new scaffold( appbar: new appbar( backgroundcolor: colors.pink, title: new text("home"), ), ); } }
Comments
Post a Comment