mirror of
https://github.com/git-touch/git-touch
synced 2024-12-16 18:28:51 +01:00
feat: add releases
This commit is contained in:
parent
5df6a4f5ea
commit
f9fcf42c98
@ -1,5 +1,4 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:filesize/filesize.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
@ -76,6 +75,9 @@ class RepositoryScreen extends StatelessWidget {
|
||||
pullRequests(states: OPEN) {
|
||||
totalCount
|
||||
}
|
||||
releases {
|
||||
totalCount
|
||||
}
|
||||
languages(first: 10, orderBy: {field: SIZE, direction: DESC}) {
|
||||
totalSize
|
||||
edges {
|
||||
@ -310,6 +312,14 @@ class RepositoryScreen extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
],
|
||||
if ((payload['releases']['totalCount'] as int) > 0)
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.tag,
|
||||
text: Text('Releases'),
|
||||
rightWidget: Text(
|
||||
(payload['releases']['totalCount'] as int).toString()),
|
||||
url: payload['url'] + '/releases',
|
||||
),
|
||||
TableViewItem(
|
||||
leftIconData: Octicons.law,
|
||||
text: Text('License'),
|
||||
|
@ -1,5 +1,4 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
|
@ -28,6 +28,7 @@ class TableViewItem {
|
||||
final Widget leftWidget;
|
||||
final Widget rightWidget;
|
||||
final void Function() onTap;
|
||||
final String url;
|
||||
final WidgetBuilder screenBuilder;
|
||||
final bool hideRightChevron;
|
||||
|
||||
@ -37,6 +38,7 @@ class TableViewItem {
|
||||
this.leftWidget,
|
||||
this.rightWidget,
|
||||
this.onTap,
|
||||
this.url,
|
||||
this.screenBuilder,
|
||||
this.hideRightChevron = false,
|
||||
}) : assert(leftIconData == null || leftWidget == null);
|
||||
@ -86,7 +88,9 @@ class TableView extends StatelessWidget {
|
||||
),
|
||||
SizedBox(width: 6)
|
||||
],
|
||||
if ((item.onTap != null || item.screenBuilder != null) &&
|
||||
if ((item.onTap != null ||
|
||||
item.screenBuilder != null ||
|
||||
item.url != null) &&
|
||||
!item.hideRightChevron)
|
||||
Icon(CupertinoIcons.right_chevron,
|
||||
size: 20, color: PrimerColors.gray300)
|
||||
@ -98,12 +102,13 @@ class TableView extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
|
||||
if (item.onTap == null && item.screenBuilder == null) {
|
||||
if (item.onTap == null && item.screenBuilder == null && item.url == null) {
|
||||
return widget;
|
||||
}
|
||||
return Link(
|
||||
onTap: item.onTap,
|
||||
screenBuilder: item.screenBuilder,
|
||||
url: item.url,
|
||||
child: widget,
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user