From f2799cacc4df9aef5b564cb5f92ee25b32cc77d1 Mon Sep 17 00:00:00 2001 From: Rongjian Zhang Date: Fri, 6 Dec 2019 21:54:09 +0800 Subject: [PATCH] fix: user screen login --- lib/main.dart | 9 +++++---- lib/screens/user.dart | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 6ba503f..3e01f5c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -102,7 +102,9 @@ class _HomeState extends State { // return TrendingScreen(); // return RepoScreen('flutter', 'flutter'); // return Image.asset('images/spinner.webp', width: 32, height: 32); - switch (Provider.of(context).activeAccount.platform) { + final auth = Provider.of(context); + + switch (auth.activeAccount.platform) { case PlatformType.github: switch (index) { case 0: @@ -114,7 +116,7 @@ class _HomeState extends State { case 3: return SearchScreen(); case 4: - return UserScreen(null); + return UserScreen(auth.activeAccount.login); } break; case PlatformType.gitlab: @@ -122,8 +124,7 @@ class _HomeState extends State { case 0: return GitlabTodosScreen(); case 1: - return GitlabUserScreen( - Provider.of(context).activeAccount.login); + return GitlabUserScreen(auth.activeAccount.login); } break; } diff --git a/lib/screens/user.dart b/lib/screens/user.dart index 8126c76..8893c46 100644 --- a/lib/screens/user.dart +++ b/lib/screens/user.dart @@ -29,7 +29,7 @@ class UserScreen extends StatelessWidget { Future _query(BuildContext context) async { final data = await Provider.of(context) .gqlClient - .execute(GhUserQuery(variables: GhUserArguments(login: 'pd4d10'))); + .execute(GhUserQuery(variables: GhUserArguments(login: login))); return data.data.repositoryOwner; }