Skip to content

Commit f9fcf42

Browse files
committed
feat: add releases
1 parent 5df6a4f commit f9fcf42

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

lib/screens/repository.dart

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import 'dart:convert';
2-
32
import 'package:filesize/filesize.dart';
43
import 'package:flutter/material.dart';
54
import 'package:flutter/cupertino.dart';
@@ -76,6 +75,9 @@ class RepositoryScreen extends StatelessWidget {
7675
pullRequests(states: OPEN) {
7776
totalCount
7877
}
78+
releases {
79+
totalCount
80+
}
7981
languages(first: 10, orderBy: {field: SIZE, direction: DESC}) {
8082
totalSize
8183
edges {
@@ -310,6 +312,14 @@ class RepositoryScreen extends StatelessWidget {
310312
},
311313
),
312314
],
315+
if ((payload['releases']['totalCount'] as int) > 0)
316+
TableViewItem(
317+
leftIconData: Octicons.tag,
318+
text: Text('Releases'),
319+
rightWidget: Text(
320+
(payload['releases']['totalCount'] as int).toString()),
321+
url: payload['url'] + '/releases',
322+
),
313323
TableViewItem(
314324
leftIconData: Octicons.law,
315325
text: Text('License'),

lib/utils/utils.dart

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import 'dart:io';
2-
32
import 'package:flutter/material.dart';
43
import 'package:flutter/cupertino.dart';
54
import 'package:flutter/gestures.dart';

lib/widgets/table_view.dart

+7-2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class TableViewItem {
2828
final Widget leftWidget;
2929
final Widget rightWidget;
3030
final void Function() onTap;
31+
final String url;
3132
final WidgetBuilder screenBuilder;
3233
final bool hideRightChevron;
3334

@@ -37,6 +38,7 @@ class TableViewItem {
3738
this.leftWidget,
3839
this.rightWidget,
3940
this.onTap,
41+
this.url,
4042
this.screenBuilder,
4143
this.hideRightChevron = false,
4244
}) : assert(leftIconData == null || leftWidget == null);
@@ -86,7 +88,9 @@ class TableView extends StatelessWidget {
8688
),
8789
SizedBox(width: 6)
8890
],
89-
if ((item.onTap != null || item.screenBuilder != null) &&
91+
if ((item.onTap != null ||
92+
item.screenBuilder != null ||
93+
item.url != null) &&
9094
!item.hideRightChevron)
9195
Icon(CupertinoIcons.right_chevron,
9296
size: 20, color: PrimerColors.gray300)
@@ -98,12 +102,13 @@ class TableView extends StatelessWidget {
98102
),
99103
);
100104

101-
if (item.onTap == null && item.screenBuilder == null) {
105+
if (item.onTap == null && item.screenBuilder == null && item.url == null) {
102106
return widget;
103107
}
104108
return Link(
105109
onTap: item.onTap,
106110
screenBuilder: item.screenBuilder,
111+
url: item.url,
107112
child: widget,
108113
);
109114
}

0 commit comments

Comments
 (0)