Reputation: 5
I want the button to display on top of the GraphQL provider widget, and still be functional as it is going to be used for routing. I want both to run simultaneously(or as close as possible so it doesn't ruin the UI when loading).
I've tried running both of the widgets at the top but they do not run as I would like them to.
void main() {
runApp(LoginPage());
runApp(Login());
class LoginPage extends StatelessWidget
class Login extends StatelessWidget
I thought the output would be the Login widget layered on top of LoginPage but it was just the Login widget expanded without the LoginPage widget running in the background.
Upvotes: 0
Views: 966
Reputation: 2877
From the runApp
documentation:
Calling runApp again will detach the previous root widget from the screen and attach the given widget in its place.
And:
If you wish to align your widget to one side of the screen (e.g., the top), consider using the Align widget. If you wish to center your widget, you can also use the Center widget
So, as @Nae said in the comments, you can use Stack for that. Like:
Stack(
children: <Widget>[
LoginPage(),
Login(),
]
)
Upvotes: 1