fix: users screen title

This commit is contained in:
Rongjian Zhang 2019-09-23 21:47:58 +08:00
parent c6acbf9d8c
commit bd4ed6382c
1 changed files with 12 additions and 6 deletions

View File

@ -10,27 +10,33 @@ class UsersScreen extends StatelessWidget {
final String scope; final String scope;
final String params; final String params;
final String resource; final String resource;
final String title;
UsersScreen.followers(String login) UsersScreen.followers(String login)
: scope = 'user', : scope = 'user',
params = 'login: "$login"', params = 'login: "$login"',
resource = 'followers'; resource = 'followers',
title = 'Followers';
UsersScreen.following(String login) UsersScreen.following(String login)
: scope = 'user', : scope = 'user',
params = 'login: "$login"', params = 'login: "$login"',
resource = 'following'; resource = 'following',
title = 'Following';
UsersScreen.stars(String owner, String name) UsersScreen.stars(String owner, String name)
: scope = 'repository', : scope = 'repository',
params = 'owner: "$owner", name: "$name"', params = 'owner: "$owner", name: "$name"',
resource = 'stargazers'; resource = 'stargazers',
title = 'Stargazers';
UsersScreen.watchers(String owner, String name) UsersScreen.watchers(String owner, String name)
: scope = 'repository', : scope = 'repository',
params = 'owner: "$owner", name: "$name"', params = 'owner: "$owner", name: "$name"',
resource = 'watchers'; resource = 'watchers',
title = 'Watchers';
UsersScreen.members(String login) UsersScreen.members(String login)
: scope = 'organization', : scope = 'organization',
params = 'login: "$login"', params = 'login: "$login"',
resource = 'membersWithRole'; resource = 'membersWithRole',
title = 'Members';
Future<ListPayload> _queryUsers(BuildContext context, [String cursor]) async { Future<ListPayload> _queryUsers(BuildContext context, [String cursor]) async {
var cursorChunk = cursor == null ? '' : ', after: "$cursor"'; var cursorChunk = cursor == null ? '' : ', after: "$cursor"';
@ -64,7 +70,7 @@ class UsersScreen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListScaffold( return ListScaffold(
title: AppBarTitle('Users'), title: AppBarTitle(title),
onRefresh: () => _queryUsers(context), onRefresh: () => _queryUsers(context),
onLoadMore: (cursor) => _queryUsers(context, cursor), onLoadMore: (cursor) => _queryUsers(context, cursor),
itemBuilder: (payload) => UserItem( itemBuilder: (payload) => UserItem(