Comments (2)
I'll do something like this. But I will also create some SplashPage (root page), where I'll check the authorization status, and then open LoginPage or MainPage.
class App extends StatefulWidget {
@override
State<StatefulWidget> createState() => _AppState();
}
class _AppState extends State<App> {
final NestedNavigatorsBloc _bloc = NestedNavigatorsBloc<NestedNavItemKey>();
@override
Widget build(BuildContext context) {
return NestedNavigatorsBlocProvider(
bloc: _bloc,
child: MaterialApp(
title: 'Flutter Demo',
home: LoginPage(),
onGenerateRoute: (routeSettings) => routeSettings.name == "/main"
? MaterialPageRoute(settings: routeSettings, builder: (context) => MainPage())
: Routes.generateRoute(routeSettings),
),
);
}
}
class LoginPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
color: Colors.white,
alignment: Alignment.center,
child: FlatButton(
child: Text(
"Login",
textAlign: TextAlign.center,
style: TextStyle(fontSize: 26, color: Colors.red),
),
onPressed: () {
Navigator.popAndPushNamed(context, '/main');
},
),
),
);
}
}
from nested_navigators.
Thanks for the answer.
I found an another solution for this issue. The NestedNavigators
declared in RootPage. Therefore, it has the Bottom Navigation. So, If I set the initialRoute
to my LoginPage it seems working well.
from nested_navigators.
Related Issues (16)
- Calling set state in a screen at a lower level will remove the displayed screen HOT 3
- Flutter has removed RouteSettings.isInitialRoute and it is preventing running of an app HOT 2
- How get selected index
- Please update to give compatibilty with flutter 1.17 HOT 3
- Keyboard behavior
- can be support bottomnavigationbar selectable items?
- is it possible to customize bottomNavigationBar
- Package does not support Flutter platform Web
- Hot Reload - Maintain State HOT 2
- reset previous tab data
- Hero Animation is not working
- bottomNavigationBar elevation
- Bad state: Cannot add new events after calling close
- is it possible to not create immediately widgets and not save state? HOT 2
- Add badges to tab HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nested_navigators.