mirror of
https://github.com/git-touch/git-touch
synced 2025-01-18 18:29:59 +01:00
feat: add files and commits links for repo screen
This commit is contained in:
parent
8e86e85b55
commit
925472f151
@ -48,6 +48,10 @@ class _RepoScreenState extends State<RepoScreen> {
|
||||
pullRequests(states: OPEN) {
|
||||
totalCount
|
||||
}
|
||||
url
|
||||
defaultBranchRef {
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,6 +110,16 @@ class _RepoScreenState extends State<RepoScreen> {
|
||||
isPullRequest: true,
|
||||
),
|
||||
),
|
||||
EntryItem(
|
||||
text: 'Files',
|
||||
url: payload['url'] + '?files=1',
|
||||
),
|
||||
EntryItem(
|
||||
text: 'Commits',
|
||||
url: payload['url'] +
|
||||
'/commits/' +
|
||||
payload['defaultBranchRef']['name'],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -1,3 +1,6 @@
|
||||
// These keys are for development
|
||||
// These keys are for development, not the production keys
|
||||
// You can also create OAuth App at https://github.com/settings/applications/new
|
||||
// to get your own keys and replace these ones
|
||||
|
||||
var clientId = '9b7d1cc04a1db5710767';
|
||||
var clientSecret = '710e085908dde6a8b55f7a9dc447ad5c0c5617d1';
|
||||
|
@ -5,8 +5,9 @@ class EntryItem extends StatelessWidget {
|
||||
final int count;
|
||||
final String text;
|
||||
final WidgetBuilder screenBuilder;
|
||||
final String url;
|
||||
|
||||
EntryItem({this.count, this.text, this.screenBuilder});
|
||||
EntryItem({this.count, this.text, this.screenBuilder, this.url});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -17,12 +18,14 @@ class EntryItem extends StatelessWidget {
|
||||
padding: EdgeInsets.symmetric(vertical: 10),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Text(count.toString(), style: TextStyle(fontSize: 18)),
|
||||
Text(count == null ? '' : count.toString(),
|
||||
style: TextStyle(fontSize: 18)),
|
||||
Text(text, style: TextStyle(fontSize: 13))
|
||||
],
|
||||
),
|
||||
),
|
||||
screenBuilder: screenBuilder,
|
||||
url: url,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -1,9 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import '../providers/settings.dart';
|
||||
|
||||
class Link extends StatelessWidget {
|
||||
final Widget child;
|
||||
final String url;
|
||||
final WidgetBuilder screenBuilder;
|
||||
final Function beforeRedirect;
|
||||
final Color bgColor;
|
||||
@ -13,13 +15,15 @@ class Link extends StatelessWidget {
|
||||
|
||||
Link({
|
||||
this.child,
|
||||
this.url,
|
||||
this.screenBuilder,
|
||||
this.beforeRedirect,
|
||||
this.bgColor,
|
||||
this.material = true,
|
||||
this.fullscreenDialog = false,
|
||||
this.iconButton,
|
||||
}) : assert(child != null || iconButton != null);
|
||||
}) : assert(child != null || iconButton != null),
|
||||
assert(screenBuilder == null || url == null);
|
||||
|
||||
void _onTap(BuildContext context, int theme) {
|
||||
if (beforeRedirect != null) {
|
||||
@ -41,6 +45,10 @@ class Link extends StatelessWidget {
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
if (url != null) {
|
||||
launch(url);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
Loading…
Reference in New Issue
Block a user