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:
parent
8089980e20
commit
4b895c3a18
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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: [
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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',
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user