mirror of
https://github.com/git-touch/git-touch
synced 2025-01-31 08:04:51 +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) {
|
pullRequests(states: OPEN) {
|
||||||
totalCount
|
totalCount
|
||||||
}
|
}
|
||||||
|
url
|
||||||
|
defaultBranchRef {
|
||||||
|
name
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,6 +110,16 @@ class _RepoScreenState extends State<RepoScreen> {
|
|||||||
isPullRequest: true,
|
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 clientId = '9b7d1cc04a1db5710767';
|
||||||
var clientSecret = '710e085908dde6a8b55f7a9dc447ad5c0c5617d1';
|
var clientSecret = '710e085908dde6a8b55f7a9dc447ad5c0c5617d1';
|
||||||
|
@ -5,8 +5,9 @@ class EntryItem extends StatelessWidget {
|
|||||||
final int count;
|
final int count;
|
||||||
final String text;
|
final String text;
|
||||||
final WidgetBuilder screenBuilder;
|
final WidgetBuilder screenBuilder;
|
||||||
|
final String url;
|
||||||
|
|
||||||
EntryItem({this.count, this.text, this.screenBuilder});
|
EntryItem({this.count, this.text, this.screenBuilder, this.url});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -17,12 +18,14 @@ class EntryItem extends StatelessWidget {
|
|||||||
padding: EdgeInsets.symmetric(vertical: 10),
|
padding: EdgeInsets.symmetric(vertical: 10),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(count.toString(), style: TextStyle(fontSize: 18)),
|
Text(count == null ? '' : count.toString(),
|
||||||
|
style: TextStyle(fontSize: 18)),
|
||||||
Text(text, style: TextStyle(fontSize: 13))
|
Text(text, style: TextStyle(fontSize: 13))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
screenBuilder: screenBuilder,
|
screenBuilder: screenBuilder,
|
||||||
|
url: url,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
import '../providers/settings.dart';
|
import '../providers/settings.dart';
|
||||||
|
|
||||||
class Link extends StatelessWidget {
|
class Link extends StatelessWidget {
|
||||||
final Widget child;
|
final Widget child;
|
||||||
|
final String url;
|
||||||
final WidgetBuilder screenBuilder;
|
final WidgetBuilder screenBuilder;
|
||||||
final Function beforeRedirect;
|
final Function beforeRedirect;
|
||||||
final Color bgColor;
|
final Color bgColor;
|
||||||
@ -13,13 +15,15 @@ class Link extends StatelessWidget {
|
|||||||
|
|
||||||
Link({
|
Link({
|
||||||
this.child,
|
this.child,
|
||||||
|
this.url,
|
||||||
this.screenBuilder,
|
this.screenBuilder,
|
||||||
this.beforeRedirect,
|
this.beforeRedirect,
|
||||||
this.bgColor,
|
this.bgColor,
|
||||||
this.material = true,
|
this.material = true,
|
||||||
this.fullscreenDialog = false,
|
this.fullscreenDialog = false,
|
||||||
this.iconButton,
|
this.iconButton,
|
||||||
}) : assert(child != null || iconButton != null);
|
}) : assert(child != null || iconButton != null),
|
||||||
|
assert(screenBuilder == null || url == null);
|
||||||
|
|
||||||
void _onTap(BuildContext context, int theme) {
|
void _onTap(BuildContext context, int theme) {
|
||||||
if (beforeRedirect != null) {
|
if (beforeRedirect != null) {
|
||||||
@ -41,6 +45,10 @@ class Link extends StatelessWidget {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (url != null) {
|
||||||
|
launch(url);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user