mirror of
https://github.com/git-touch/git-touch
synced 2025-01-31 08:04:51 +01:00
feat: add contributions graph to user screen
This commit is contained in:
parent
2256b86eba
commit
c6d9b067b1
@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import 'package:share/share.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:github_contributions/github_contributions.dart';
|
||||
import '../providers/settings.dart';
|
||||
import '../scaffolds/refresh.dart';
|
||||
import '../widgets/avatar.dart';
|
||||
@ -139,9 +141,14 @@ class _UserScreenState extends State<UserScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return RefreshScaffold(
|
||||
onRefresh: () => queryUser(context),
|
||||
onRefresh: () {
|
||||
return Future.wait(
|
||||
[queryUser(context), getContributionsSvg(widget.login)],
|
||||
);
|
||||
},
|
||||
title: Text(widget.login),
|
||||
trailingBuilder: (payload) {
|
||||
trailingBuilder: (data) {
|
||||
var payload = data[0];
|
||||
if (widget.showSettings) {
|
||||
return Link(
|
||||
child: Icon(Icons.settings, size: 24),
|
||||
@ -187,7 +194,10 @@ class _UserScreenState extends State<UserScreen> {
|
||||
return ActionButton(title: 'User Actions', actions: actions);
|
||||
}
|
||||
},
|
||||
bodyBuilder: (payload) {
|
||||
bodyBuilder: (data) {
|
||||
var payload = data[0];
|
||||
var contributions = data[1];
|
||||
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
@ -253,6 +263,10 @@ class _UserScreenState extends State<UserScreen> {
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
child: SvgPicture.string(contributions),
|
||||
padding: EdgeInsets.symmetric(horizontal: 10),
|
||||
),
|
||||
_buildRepos(payload),
|
||||
],
|
||||
);
|
||||
|
@ -27,7 +27,9 @@ dependencies:
|
||||
nanoid: ^0.0.6
|
||||
share: ^0.6.0
|
||||
flutter_vector_icons: ^0.0.2
|
||||
github_trending: ^0.0.1
|
||||
github_trending: ^0.1.0
|
||||
github_contributions: ^0.1.1
|
||||
flutter_svg: ^0.12.0
|
||||
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
|
Loading…
x
Reference in New Issue
Block a user