1
0
mirror of https://github.com/git-touch/git-touch synced 2024-12-18 19:22:54 +01:00

improvement: hide action if data not ready

This commit is contained in:
Rongjian Zhang 2020-01-01 17:00:26 +08:00
parent 8089980e20
commit 4b895c3a18
6 changed files with 6 additions and 17 deletions

View File

@ -58,7 +58,7 @@ class _RefreshStatefulScaffoldState<T>
}
Widget get _action {
if (widget.actionBuilder == null) return null;
if (widget.actionBuilder == null || _data == null) return null;
return widget.actionBuilder(_data, setState);
}

View File

@ -38,9 +38,6 @@ class GitlabProjectScreen extends StatelessWidget {
return project;
},
actionBuilder: (data, setState) {
if (data == null)
return ActionButton(title: 'Project Actions', items: []);
return ActionButton(
title: 'Project Actions',
items: [

View File

@ -10,9 +10,11 @@ import 'package:git_touch/utils/utils.dart';
import 'package:provider/provider.dart';
final issueAddRouter = RouterScreen(
'/:owner/:name/issues/new',
(context, params) =>
IssueFormScreen(params['owner'].first, params['name'].first));
'/:owner/:name/issues/new',
(context, params) {
return IssueFormScreen(params['owner'].first, params['name'].first);
},
);
class IssueFormScreen extends StatefulWidget {
final String owner;

View File

@ -104,7 +104,6 @@ class ObjectScreen extends StatelessWidget {
return data;
},
actionBuilder: (data, _) {
if (data == null) return null;
switch (data.resolveType) {
case 'Blob':
final blob = data as GithubObjectBlob;

View File

@ -69,9 +69,6 @@ class RepositoryScreen extends StatelessWidget {
return Tuple2(rs[0] as GithubRepositoryRepository, rs[1] as String);
},
actionBuilder: (data, setState) {
if (data == null)
return ActionButton(title: 'Repository Actions', items: []);
final repo = data.item1;
return ActionButton(
title: 'Repository Actions',

View File

@ -360,12 +360,6 @@ class UserScreen extends StatelessWidget {
},
title: AppBarTitle(isViewer ? 'Me' : 'User'), // TODO:
actionBuilder: (payload, _) {
if (payload == null)
return ActionButton(
title: "Actions",
items: [],
);
switch (payload.resolveType) {
case 'User':
final user = payload as GithubUserUser;