diff --git a/lib/components/login_form.dart b/lib/components/login_form.dart index 10ec0b1..f205a9f 100644 --- a/lib/components/login_form.dart +++ b/lib/components/login_form.dart @@ -66,9 +66,7 @@ class _LoginFormState extends State { accountsGrpc.signIn(username, "", password).then((rs) { window.localStorage["token"] = rs.token; window.localStorage["uuid"] = rs.uuid; - setState(() { - - }); + Navigator.of(context, rootNavigator: true).pop(); }).catchError((e) { print(e); GrpcError error = e; diff --git a/lib/main.dart b/lib/main.dart index c519ab9..9d669af 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -27,13 +27,7 @@ class MyApp extends StatelessWidget { return MaterialApp( debugShowCheckedModeBanner: false, title: 'Softplayer', - home: Scaffold( - body: TestAlert(channel: channel), - appBar: AppBar(), - floatingActionButton: FloatingActionButton( - onPressed: () => print("1"), - ), - ), + home: TestAlert(channel: channel), theme: ThemeData( colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), useMaterial3: true, @@ -53,7 +47,8 @@ class TestAlert extends StatelessWidget { @override Widget build(BuildContext context) { if (!isSignedIn()) { - return Container( + return Scaffold( + body: Container( decoration: const BoxDecoration( image: DecorationImage( image: AssetImage("assets/login_background.jpg"), @@ -61,9 +56,15 @@ class TestAlert extends StatelessWidget { ), ), child: LoginForm(grpcChannel: channel), - ); + )); } else { - return EnvirnomentList(channel: channel); + return Scaffold( + body: EnvirnomentList(channel: channel), + appBar: AppBar(), + floatingActionButton: FloatingActionButton( + onPressed: () => print("1"), + ), + ); } } }