feat: format numbers with group seperator
This commit is contained in:
parent
a2cb2fb9e9
commit
ede2d064f1
|
@ -156,8 +156,8 @@ class IssuesScreen extends StatelessWidget {
|
||||||
Icon(Octicons.comment,
|
Icon(Octicons.comment,
|
||||||
size: 13, color: PrimerColors.gray700),
|
size: 13, color: PrimerColors.gray700),
|
||||||
SizedBox(width: 4),
|
SizedBox(width: 4),
|
||||||
Text(payload['comments']['totalCount']
|
Text(numberFormat
|
||||||
.toString())
|
.format(payload['comments']['totalCount']))
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
@ -251,7 +251,7 @@ class RepoScreen extends StatelessWidget {
|
||||||
text: Text('Issues'),
|
text: Text('Issues'),
|
||||||
rightWidget: Row(
|
rightWidget: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(payload['issues']['totalCount'].toString()),
|
Text(numberFormat.format(payload['issues']['totalCount'])),
|
||||||
Icon(
|
Icon(
|
||||||
CupertinoIcons.right_chevron,
|
CupertinoIcons.right_chevron,
|
||||||
size: 18,
|
size: 18,
|
||||||
|
@ -266,7 +266,8 @@ class RepoScreen extends StatelessWidget {
|
||||||
text: Text('Pull requests'),
|
text: Text('Pull requests'),
|
||||||
rightWidget: Row(
|
rightWidget: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(payload['pullRequests']['totalCount'].toString()),
|
Text(numberFormat
|
||||||
|
.format(payload['pullRequests']['totalCount'])),
|
||||||
Icon(
|
Icon(
|
||||||
CupertinoIcons.right_chevron,
|
CupertinoIcons.right_chevron,
|
||||||
size: 18,
|
size: 18,
|
||||||
|
@ -286,17 +287,15 @@ class RepoScreen extends StatelessWidget {
|
||||||
rightWidget: Text(payload['licenseInfo'] == null
|
rightWidget: Text(payload['licenseInfo'] == null
|
||||||
? 'Unknown'
|
? 'Unknown'
|
||||||
: (payload['licenseInfo']['spdxId'] ??
|
: (payload['licenseInfo']['spdxId'] ??
|
||||||
payload['licenseInfo']['name'])
|
payload['licenseInfo']['name'])),
|
||||||
.toString()),
|
|
||||||
),
|
),
|
||||||
TableViewItem(
|
TableViewItem(
|
||||||
leftWidget: Icon(Octicons.history, size: 20),
|
leftWidget: Icon(Octicons.history, size: 20),
|
||||||
text: Text('Commits'),
|
text: Text('Commits'),
|
||||||
rightWidget: Row(
|
rightWidget: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(payload['defaultBranchRef']['target']['history']
|
Text(numberFormat.format(payload['defaultBranchRef']
|
||||||
['totalCount']
|
['target']['history']['totalCount'])),
|
||||||
.toString()),
|
|
||||||
Icon(
|
Icon(
|
||||||
CupertinoIcons.right_chevron,
|
CupertinoIcons.right_chevron,
|
||||||
size: 18,
|
size: 18,
|
||||||
|
|
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:git_touch/screens/user.dart';
|
import 'package:git_touch/screens/user.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
import 'package:primer/primer.dart';
|
import 'package:primer/primer.dart';
|
||||||
import '../screens/repo.dart';
|
import '../screens/repo.dart';
|
||||||
export 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
export 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
||||||
|
@ -125,6 +126,8 @@ K ifNotNull<T, K>(T value, K Function(T v) builder) {
|
||||||
return value == null ? null : builder(value);
|
return value == null ? null : builder(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final numberFormat = NumberFormat();
|
||||||
|
|
||||||
class BorderView extends StatelessWidget {
|
class BorderView extends StatelessWidget {
|
||||||
final double height;
|
final double height;
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ class CommentItem extends StatelessWidget {
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(emoji, style: TextStyle(fontSize: 18)),
|
Text(emoji, style: TextStyle(fontSize: 18)),
|
||||||
SizedBox(width: 4),
|
SizedBox(width: 4),
|
||||||
Text(count.toString(),
|
Text(numberFormat.format(count),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: PrimerColors.blue500, fontSize: 14))
|
color: PrimerColors.blue500, fontSize: 14))
|
||||||
],
|
],
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:git_touch/utils/utils.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
import 'package:primer/primer.dart';
|
import 'package:primer/primer.dart';
|
||||||
import 'link.dart';
|
import 'link.dart';
|
||||||
|
|
||||||
|
@ -19,7 +21,7 @@ class EntryItem extends StatelessWidget {
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
count.toString(),
|
numberFormat.format(count),
|
||||||
style: TextStyle(fontSize: 17, fontWeight: FontWeight.w600),
|
style: TextStyle(fontSize: 17, fontWeight: FontWeight.w600),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
|
|
|
@ -54,7 +54,7 @@ class RepoItem extends StatelessWidget {
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Icon(Octicons.star, size: 14, color: PrimerColors.gray600),
|
Icon(Octicons.star, size: 14, color: PrimerColors.gray600),
|
||||||
Text(payload['stargazers']['totalCount'].toString()),
|
Text(numberFormat.format(payload['stargazers']['totalCount'])),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -64,7 +64,7 @@ class RepoItem extends StatelessWidget {
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Icon(Octicons.repo_forked,
|
Icon(Octicons.repo_forked,
|
||||||
size: 14, color: PrimerColors.gray600),
|
size: 14, color: PrimerColors.gray600),
|
||||||
Text(payload['forks']['totalCount'].toString())
|
Text(numberFormat.format(payload['forks']['totalCount'])),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in New Issue