mirror of
https://github.com/pd4d10/git-touch.git
synced 2026-04-29 02:52:20 -05:00
committed by
GitHub
parent
b9852e1e05
commit
fba6e4cb72
@@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:git_touch/models/github.dart';
|
||||
import 'package:git_touch/models/theme.dart';
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:git_touch/widgets/avatar.dart';
|
||||
@@ -11,8 +10,7 @@ import 'package:github/github.dart' as github;
|
||||
class GistsItem extends StatelessWidget {
|
||||
final String description;
|
||||
final String login;
|
||||
final Map<String, GistFiles> files;
|
||||
final List<GistFiles> filenames;
|
||||
final List<String> filenames;
|
||||
final String language;
|
||||
final String avatarUrl;
|
||||
final DateTime updatedAt;
|
||||
@@ -21,7 +19,6 @@ class GistsItem extends StatelessWidget {
|
||||
GistsItem({
|
||||
@required this.description,
|
||||
@required this.login,
|
||||
@required this.files,
|
||||
@required this.filenames,
|
||||
@required this.language,
|
||||
@required this.avatarUrl,
|
||||
@@ -62,7 +59,7 @@ class GistsItem extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
text: filenames[0].filename,
|
||||
text: filenames[0],
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
color: theme.palette.primary,
|
||||
|
||||
114
lib/widgets/release_item.dart
Normal file
114
lib/widgets/release_item.dart
Normal file
@@ -0,0 +1,114 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:git_touch/graphql/github.data.gql.dart';
|
||||
import 'package:git_touch/models/theme.dart';
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:git_touch/widgets/avatar.dart';
|
||||
import 'package:git_touch/widgets/markdown_view.dart';
|
||||
import 'package:git_touch/widgets/table_view.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:timeago/timeago.dart' as timeago;
|
||||
|
||||
class ReleaseItem extends StatelessWidget {
|
||||
final String login;
|
||||
final DateTime publishedAt;
|
||||
final String name;
|
||||
final String avatarUrl;
|
||||
final String tagName;
|
||||
final String description;
|
||||
final GReleasesData_repository_releases_nodes_releaseAssets releaseAssets;
|
||||
|
||||
ReleaseItem(
|
||||
{@required this.login,
|
||||
@required this.publishedAt,
|
||||
@required this.name,
|
||||
@required this.tagName,
|
||||
@required this.avatarUrl,
|
||||
@required this.description,
|
||||
this.releaseAssets});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Provider.of<ThemeModel>(context);
|
||||
return Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
Row(children: <Widget>[
|
||||
Avatar(url: avatarUrl, size: AvatarSize.large),
|
||||
SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
tagName,
|
||||
style: TextStyle(
|
||||
color: theme.palette.primary,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 6),
|
||||
DefaultTextStyle(
|
||||
style: TextStyle(
|
||||
color: theme.palette.secondaryText,
|
||||
fontSize: 16,
|
||||
),
|
||||
child:
|
||||
Text(login + " released " + timeago.format(publishedAt)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
]),
|
||||
if (description != null && description.isNotEmpty) ...[
|
||||
MarkdownFlutterView(
|
||||
description,
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
],
|
||||
ExpansionTile(
|
||||
title: Text(
|
||||
'Assets (' + (releaseAssets?.nodes?.length ?? 0).toString() + ')',
|
||||
style: TextStyle(
|
||||
color: theme.palette.secondaryText,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
children: <Widget>[
|
||||
TableView(items: [
|
||||
if (releaseAssets != null)
|
||||
for (var asset in releaseAssets.nodes)
|
||||
TableViewItem(
|
||||
text: Text(
|
||||
asset.name,
|
||||
style: TextStyle(
|
||||
color: theme.palette.primary,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
rightWidget: IconButton(
|
||||
onPressed: () {
|
||||
if (asset.downloadUrl != null) {
|
||||
theme.push(context, asset.downloadUrl);
|
||||
}
|
||||
},
|
||||
icon: Icon(MaterialCommunityIcons.download)),
|
||||
hideRightChevron: true,
|
||||
),
|
||||
])
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user