mirror of
https://github.com/git-touch/git-touch
synced 2024-12-18 19:22:54 +01:00
feat: languages chart
This commit is contained in:
parent
864a995ac8
commit
23983fb556
@ -15,6 +15,7 @@ import 'package:git_touch/widgets/repository_item.dart';
|
|||||||
import 'package:tuple/tuple.dart';
|
import 'package:tuple/tuple.dart';
|
||||||
import '../widgets/entry_item.dart';
|
import '../widgets/entry_item.dart';
|
||||||
import 'package:git_touch/widgets/action_button.dart';
|
import 'package:git_touch/widgets/action_button.dart';
|
||||||
|
import 'package:charts_flutter/flutter.dart' as charts;
|
||||||
|
|
||||||
final repositoryRouter = RouterScreen('/:owner/:name', (context, params) {
|
final repositoryRouter = RouterScreen('/:owner/:name', (context, params) {
|
||||||
if (params['ref'] == null) {
|
if (params['ref'] == null) {
|
||||||
@ -165,23 +166,64 @@ class RepositoryScreen extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
CommonStyle.verticalGap,
|
CommonStyle.verticalGap,
|
||||||
if (repo.languages.edges.isNotEmpty)
|
if (repo.languages.edges.isNotEmpty)
|
||||||
Container(
|
GestureDetector(
|
||||||
color: theme.palette.background,
|
onTap: () {
|
||||||
padding: CommonStyle.padding.copyWith(top: 8, bottom: 8),
|
showCupertinoModalPopup(
|
||||||
child: ClipRRect(
|
context: context,
|
||||||
borderRadius: BorderRadius.circular(2),
|
builder: (context) {
|
||||||
child: SizedBox(
|
return Container(
|
||||||
height: 10,
|
color: theme.palette.background,
|
||||||
child: Row(
|
padding: EdgeInsets.all(40),
|
||||||
children: join(
|
height: 400,
|
||||||
SizedBox(width: 1),
|
child: charts.PieChart(
|
||||||
repo.languages.edges
|
[
|
||||||
.map((lang) => Container(
|
charts.Series<GithubRepositoryLanguageEdge, String>(
|
||||||
color: convertColor(lang.node.color),
|
id: 'languages',
|
||||||
width: langWidth *
|
domainFn: (v, _) => v.node.name,
|
||||||
lang.size /
|
measureFn: (v, _) => v.size,
|
||||||
repo.languages.totalSize))
|
colorFn: (v, _) =>
|
||||||
.toList(),
|
charts.Color.fromHex(code: v.node.color),
|
||||||
|
data: repo.languages.edges,
|
||||||
|
labelAccessorFn: (v, _) => v.node.name,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
defaultRenderer: charts.ArcRendererConfig(
|
||||||
|
arcRendererDecorators: [
|
||||||
|
charts.ArcLabelDecorator(
|
||||||
|
insideLabelStyleSpec: charts.TextStyleSpec(
|
||||||
|
fontSize: 20,
|
||||||
|
color: charts.Color.white,
|
||||||
|
),
|
||||||
|
outsideLabelStyleSpec: charts.TextStyleSpec(
|
||||||
|
fontSize: 20,
|
||||||
|
color: charts.Color.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
// color: theme.palette.background,
|
||||||
|
padding: CommonStyle.padding.copyWith(top: 8, bottom: 8),
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(2),
|
||||||
|
child: SizedBox(
|
||||||
|
height: 10,
|
||||||
|
child: Row(
|
||||||
|
children: join(
|
||||||
|
SizedBox(width: 1),
|
||||||
|
repo.languages.edges
|
||||||
|
.map((lang) => Container(
|
||||||
|
color: convertColor(lang.node.color),
|
||||||
|
width: langWidth *
|
||||||
|
lang.size /
|
||||||
|
repo.languages.totalSize))
|
||||||
|
.toList(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -41,6 +41,7 @@ dependencies:
|
|||||||
artemis: ^2.1.2
|
artemis: ^2.1.2
|
||||||
gql_link: ^0.2.0
|
gql_link: ^0.2.0
|
||||||
fluro: ^1.5.1
|
fluro: ^1.5.1
|
||||||
|
charts_flutter: ^0.8.1
|
||||||
|
|
||||||
# The following adds the Cupertino Icons font to your application.
|
# The following adds the Cupertino Icons font to your application.
|
||||||
# Use with the CupertinoIcons class for iOS style icons.
|
# Use with the CupertinoIcons class for iOS style icons.
|
||||||
|
Loading…
Reference in New Issue
Block a user