mirror of
https://github.com/git-touch/git-touch
synced 2025-02-21 22:07:51 +01:00
improvement: tweak entries
This commit is contained in:
parent
b5933dd895
commit
12d542c4f3
@ -77,7 +77,7 @@ class GithubRepositoryRepository extends GithubRepositoryPinnableItem
|
|||||||
bool viewerHasStarred;
|
bool viewerHasStarred;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String projectsResourcePath;
|
String projectsUrl;
|
||||||
|
|
||||||
GithubRepositoryUserConnection watchers;
|
GithubRepositoryUserConnection watchers;
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ class GithubRepositoryRepository extends GithubRepositoryPinnableItem
|
|||||||
hasIssuesEnabled,
|
hasIssuesEnabled,
|
||||||
url,
|
url,
|
||||||
viewerHasStarred,
|
viewerHasStarred,
|
||||||
projectsResourcePath,
|
projectsUrl,
|
||||||
watchers,
|
watchers,
|
||||||
issues,
|
issues,
|
||||||
pullRequests,
|
pullRequests,
|
||||||
@ -608,7 +608,7 @@ class GithubRepositoryProjectOwner with EquatableMixin {
|
|||||||
|
|
||||||
String id;
|
String id;
|
||||||
|
|
||||||
String projectsResourcePath;
|
String projectsUrl;
|
||||||
|
|
||||||
GithubRepositoryProjectConnection projects;
|
GithubRepositoryProjectConnection projects;
|
||||||
|
|
||||||
@ -616,7 +616,7 @@ class GithubRepositoryProjectOwner with EquatableMixin {
|
|||||||
String resolveType;
|
String resolveType;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [id, projectsResourcePath, projects, resolveType];
|
List<Object> get props => [id, projectsUrl, projects, resolveType];
|
||||||
Map<String, dynamic> toJson() => _$GithubRepositoryProjectOwnerToJson(this);
|
Map<String, dynamic> toJson() => _$GithubRepositoryProjectOwnerToJson(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -904,7 +904,7 @@ class GithubRepositoryQuery
|
|||||||
directives: [],
|
directives: [],
|
||||||
selectionSet: null),
|
selectionSet: null),
|
||||||
FieldNode(
|
FieldNode(
|
||||||
name: NameNode(value: 'projectsResourcePath'),
|
name: NameNode(value: 'projectsUrl'),
|
||||||
alias: null,
|
alias: null,
|
||||||
arguments: [],
|
arguments: [],
|
||||||
directives: [],
|
directives: [],
|
||||||
|
@ -48,7 +48,7 @@ GithubRepositoryRepository _$GithubRepositoryRepositoryFromJson(
|
|||||||
..hasIssuesEnabled = json['hasIssuesEnabled'] as bool
|
..hasIssuesEnabled = json['hasIssuesEnabled'] as bool
|
||||||
..url = json['url'] as String
|
..url = json['url'] as String
|
||||||
..viewerHasStarred = json['viewerHasStarred'] as bool
|
..viewerHasStarred = json['viewerHasStarred'] as bool
|
||||||
..projectsResourcePath = json['projectsResourcePath'] as String
|
..projectsUrl = json['projectsUrl'] as String
|
||||||
..watchers = json['watchers'] == null
|
..watchers = json['watchers'] == null
|
||||||
? null
|
? null
|
||||||
: GithubRepositoryUserConnection.fromJson(
|
: GithubRepositoryUserConnection.fromJson(
|
||||||
@ -91,7 +91,7 @@ Map<String, dynamic> _$GithubRepositoryRepositoryToJson(
|
|||||||
'hasIssuesEnabled': instance.hasIssuesEnabled,
|
'hasIssuesEnabled': instance.hasIssuesEnabled,
|
||||||
'url': instance.url,
|
'url': instance.url,
|
||||||
'viewerHasStarred': instance.viewerHasStarred,
|
'viewerHasStarred': instance.viewerHasStarred,
|
||||||
'projectsResourcePath': instance.projectsResourcePath,
|
'projectsUrl': instance.projectsUrl,
|
||||||
'watchers': instance.watchers?.toJson(),
|
'watchers': instance.watchers?.toJson(),
|
||||||
'issues': instance.issues?.toJson(),
|
'issues': instance.issues?.toJson(),
|
||||||
'pullRequests': instance.pullRequests?.toJson(),
|
'pullRequests': instance.pullRequests?.toJson(),
|
||||||
@ -471,7 +471,7 @@ GithubRepositoryProjectOwner _$GithubRepositoryProjectOwnerFromJson(
|
|||||||
Map<String, dynamic> json) {
|
Map<String, dynamic> json) {
|
||||||
return GithubRepositoryProjectOwner()
|
return GithubRepositoryProjectOwner()
|
||||||
..id = json['id'] as String
|
..id = json['id'] as String
|
||||||
..projectsResourcePath = json['projectsResourcePath'] as String
|
..projectsUrl = json['projectsUrl'] as String
|
||||||
..projects = json['projects'] == null
|
..projects = json['projects'] == null
|
||||||
? null
|
? null
|
||||||
: GithubRepositoryProjectConnection.fromJson(
|
: GithubRepositoryProjectConnection.fromJson(
|
||||||
@ -483,7 +483,7 @@ Map<String, dynamic> _$GithubRepositoryProjectOwnerToJson(
|
|||||||
GithubRepositoryProjectOwner instance) =>
|
GithubRepositoryProjectOwner instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
'id': instance.id,
|
'id': instance.id,
|
||||||
'projectsResourcePath': instance.projectsResourcePath,
|
'projectsUrl': instance.projectsUrl,
|
||||||
'projects': instance.projects?.toJson(),
|
'projects': instance.projects?.toJson(),
|
||||||
'__typename': instance.resolveType,
|
'__typename': instance.resolveType,
|
||||||
};
|
};
|
||||||
|
@ -31,7 +31,7 @@ query(
|
|||||||
url
|
url
|
||||||
viewerHasStarred
|
viewerHasStarred
|
||||||
# viewerSubscription # TODO
|
# viewerSubscription # TODO
|
||||||
projectsResourcePath
|
projectsUrl
|
||||||
watchers {
|
watchers {
|
||||||
totalCount
|
totalCount
|
||||||
}
|
}
|
||||||
|
@ -382,7 +382,7 @@ class ThemeModel with ChangeNotifier {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
actionItems[value].onPress(context);
|
actionItems[value].onTap(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,24 +72,11 @@ class RepositoryScreen extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
actionBuilder: (data, setState) {
|
actionBuilder: (data, setState) {
|
||||||
final repo = data.item1;
|
final repo = data.item1;
|
||||||
|
final ref = branch == null ? repo.defaultBranchRef : repo.ref;
|
||||||
|
|
||||||
return ActionButton(
|
return ActionButton(
|
||||||
title: 'Repository Actions',
|
title: 'Repository Actions',
|
||||||
items: [
|
items: [
|
||||||
ActionItem(
|
|
||||||
text: repo.viewerHasStarred ? 'Unstar' : 'Star',
|
|
||||||
onPress: (_) async {
|
|
||||||
if (repo.viewerHasStarred) {
|
|
||||||
await Provider.of<AuthModel>(context)
|
|
||||||
.deleteWithCredentials('/user/starred/$owner/$name');
|
|
||||||
repo.viewerHasStarred = false;
|
|
||||||
} else {
|
|
||||||
await Provider.of<AuthModel>(context)
|
|
||||||
.putWithCredentials('/user/starred/$owner/$name');
|
|
||||||
repo.viewerHasStarred = true;
|
|
||||||
}
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
// TODO:
|
// TODO:
|
||||||
// ActionItem(
|
// ActionItem(
|
||||||
// text: data[0]['viewerSubscription'] == 'SUBSCRIBED'
|
// text: data[0]['viewerSubscription'] == 'SUBSCRIBED'
|
||||||
@ -108,12 +95,25 @@ class RepositoryScreen extends StatelessWidget {
|
|||||||
// setState(() {});
|
// setState(() {});
|
||||||
// },
|
// },
|
||||||
// ),
|
// ),
|
||||||
|
ActionItem(
|
||||||
|
text:
|
||||||
|
'Commits (${(ref.target as GithubRepositoryCommit).history?.totalCount})',
|
||||||
|
url: '/$owner/$name/commits',
|
||||||
|
),
|
||||||
|
ActionItem(
|
||||||
|
text: 'Projects (${repo.projects.totalCount})',
|
||||||
|
url: repo.projectsUrl,
|
||||||
|
),
|
||||||
|
ActionItem(
|
||||||
|
text: 'Releases (${repo.releases.totalCount})',
|
||||||
|
url: 'https://github.com/$owner/$name/releases',
|
||||||
|
),
|
||||||
ActionItem.share(repo.url),
|
ActionItem.share(repo.url),
|
||||||
ActionItem.launch(repo.url),
|
ActionItem.launch(repo.url),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
bodyBuilder: (data, _) {
|
bodyBuilder: (data, setState) {
|
||||||
final repo = data.item1;
|
final repo = data.item1;
|
||||||
final readme = data.item2;
|
final readme = data.item2;
|
||||||
final ref = branch == null ? repo.defaultBranchRef : repo.ref;
|
final ref = branch == null ? repo.defaultBranchRef : repo.ref;
|
||||||
@ -150,6 +150,33 @@ class RepositoryScreen extends StatelessWidget {
|
|||||||
color: theme.palette.primary,
|
color: theme.palette.primary,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Expanded(child: Container()),
|
||||||
|
CupertinoButton(
|
||||||
|
onPressed: () async {
|
||||||
|
if (repo.viewerHasStarred) {
|
||||||
|
await Provider.of<AuthModel>(context)
|
||||||
|
.deleteWithCredentials(
|
||||||
|
'/user/starred/$owner/$name');
|
||||||
|
repo.viewerHasStarred = false;
|
||||||
|
} else {
|
||||||
|
await Provider.of<AuthModel>(context)
|
||||||
|
.putWithCredentials(
|
||||||
|
'/user/starred/$owner/$name');
|
||||||
|
repo.viewerHasStarred = true;
|
||||||
|
}
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 10),
|
||||||
|
child: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Icon(Octicons.star, size: 15),
|
||||||
|
SizedBox(width: 2),
|
||||||
|
Text(repo.viewerHasStarred ? 'Unstar' : 'Star',
|
||||||
|
style: TextStyle(fontSize: 15)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (repo.description != null && repo.description.isNotEmpty)
|
if (repo.description != null && repo.description.isNotEmpty)
|
||||||
@ -309,32 +336,7 @@ class RepositoryScreen extends StatelessWidget {
|
|||||||
Text(numberFormat.format(repo.pullRequests.totalCount)),
|
Text(numberFormat.format(repo.pullRequests.totalCount)),
|
||||||
url: '/$owner/$name/pulls',
|
url: '/$owner/$name/pulls',
|
||||||
),
|
),
|
||||||
TableViewItem(
|
|
||||||
leftIconData: Octicons.project,
|
|
||||||
text: Text('Projects'),
|
|
||||||
rightWidget:
|
|
||||||
Text(numberFormat.format(repo.projects.totalCount)),
|
|
||||||
url: 'https://github.com' + repo.projectsResourcePath,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
CommonStyle.verticalGap,
|
|
||||||
TableView(
|
|
||||||
hasIcon: true,
|
|
||||||
items: [
|
|
||||||
if (ref != null) ...[
|
if (ref != null) ...[
|
||||||
TableViewItem(
|
|
||||||
leftIconData: Octicons.history,
|
|
||||||
text: Text('Commits'),
|
|
||||||
rightWidget: Text(
|
|
||||||
numberFormat.format(
|
|
||||||
(ref.target as GithubRepositoryCommit)
|
|
||||||
.history
|
|
||||||
?.totalCount,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
url: '/$owner/$name/commits',
|
|
||||||
),
|
|
||||||
if (repo.refs != null)
|
if (repo.refs != null)
|
||||||
TableViewItem(
|
TableViewItem(
|
||||||
leftIconData: Octicons.git_branch,
|
leftIconData: Octicons.git_branch,
|
||||||
@ -365,12 +367,6 @@ class RepositoryScreen extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
TableViewItem(
|
|
||||||
leftIconData: Octicons.tag,
|
|
||||||
text: Text('Releases'),
|
|
||||||
rightWidget: Text(repo.releases.totalCount.toString()),
|
|
||||||
url: repo.url + '/releases',
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
CommonStyle.verticalGap,
|
CommonStyle.verticalGap,
|
||||||
|
@ -369,7 +369,7 @@ class UserScreen extends StatelessWidget {
|
|||||||
if (user.viewerCanFollow)
|
if (user.viewerCanFollow)
|
||||||
ActionItem(
|
ActionItem(
|
||||||
text: user.viewerIsFollowing ? 'Unfollow' : 'Follow',
|
text: user.viewerIsFollowing ? 'Unfollow' : 'Follow',
|
||||||
onPress: (_) async {
|
onTap: (_) async {
|
||||||
if (user.viewerIsFollowing) {
|
if (user.viewerIsFollowing) {
|
||||||
await Provider.of<AuthModel>(context)
|
await Provider.of<AuthModel>(context)
|
||||||
.deleteWithCredentials(
|
.deleteWithCredentials(
|
||||||
|
@ -7,47 +7,27 @@ import 'package:share/share.dart';
|
|||||||
|
|
||||||
class ActionItem {
|
class ActionItem {
|
||||||
String text;
|
String text;
|
||||||
void Function(BuildContext context) onPress;
|
String url;
|
||||||
|
void Function(BuildContext context) onTap;
|
||||||
IconData iconData;
|
IconData iconData;
|
||||||
|
|
||||||
ActionItem({
|
ActionItem({
|
||||||
@required this.text,
|
@required this.text,
|
||||||
@required this.onPress,
|
this.onTap,
|
||||||
|
this.url,
|
||||||
this.iconData,
|
this.iconData,
|
||||||
});
|
});
|
||||||
|
|
||||||
ActionItem.share(String url)
|
ActionItem.share(String url)
|
||||||
: text = 'Share',
|
: text = 'Share',
|
||||||
onPress = ((_) {
|
onTap = ((_) {
|
||||||
Share.share(url);
|
Share.share(url);
|
||||||
});
|
});
|
||||||
ActionItem.launch(String url)
|
ActionItem.launch(String url)
|
||||||
: text = 'Open in Browser',
|
: text = 'Open in Browser',
|
||||||
onPress = ((_) {
|
onTap = ((_) {
|
||||||
launchUrl(url);
|
launchUrl(url);
|
||||||
});
|
});
|
||||||
ActionItem.user(String login)
|
|
||||||
: text = '@$login',
|
|
||||||
onPress = ((context) {
|
|
||||||
Provider.of<ThemeModel>(context).push(context, '/$login');
|
|
||||||
});
|
|
||||||
ActionItem.repository(String owner, String name)
|
|
||||||
: text = '$owner/$name',
|
|
||||||
onPress = ((context) {
|
|
||||||
Provider.of<ThemeModel>(context).push(context, '/$owner/$name');
|
|
||||||
});
|
|
||||||
ActionItem.issue(String owner, String name, int number)
|
|
||||||
: text = '$owner/$name #$number',
|
|
||||||
onPress = ((context) {
|
|
||||||
Provider.of<ThemeModel>(context)
|
|
||||||
.push(context, '/$owner/$name/issues/$number');
|
|
||||||
});
|
|
||||||
ActionItem.pullRequest(String owner, String name, int number)
|
|
||||||
: text = '$owner/$name #$number',
|
|
||||||
onPress = ((context) {
|
|
||||||
Provider.of<ThemeModel>(context)
|
|
||||||
.push(context, '/$owner/$name/pulls/$number');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ActionButton extends StatelessWidget {
|
class ActionButton extends StatelessWidget {
|
||||||
@ -65,7 +45,8 @@ class ActionButton extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
switch (Provider.of<ThemeModel>(context).theme) {
|
final theme = Provider.of<ThemeModel>(context);
|
||||||
|
switch (theme.theme) {
|
||||||
case AppThemeType.cupertino:
|
case AppThemeType.cupertino:
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
child: Icon(iconData, size: 22),
|
child: Icon(iconData, size: 22),
|
||||||
@ -101,7 +82,9 @@ class ActionButton extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
items[value].onPress(context);
|
if (items[value].onTap != null) items[value].onTap(context);
|
||||||
|
if (items[value].url != null)
|
||||||
|
theme.push(context, items[value].url);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -118,7 +101,7 @@ class ActionButton extends StatelessWidget {
|
|||||||
}).toList();
|
}).toList();
|
||||||
},
|
},
|
||||||
onSelected: (value) {
|
onSelected: (value) {
|
||||||
items[value].onPress(context);
|
items[value].onTap(context);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user