mirror of
https://github.com/pd4d10/git-touch.git
synced 2026-04-29 11:03:05 -05:00
@@ -120,8 +120,20 @@ class GhUserScreen extends StatelessWidget {
|
|||||||
for (final week
|
for (final week
|
||||||
in p.contributionsCollection.contributionCalendar.weeks)
|
in p.contributionsCollection.contributionCalendar.weeks)
|
||||||
[
|
[
|
||||||
|
// https://github.com/git-touch/git-touch/issues/122
|
||||||
for (final day in week.contributionDays)
|
for (final day in week.contributionDays)
|
||||||
ContributionDay(hexColor: day.color)
|
if (day.color.startsWith('#'))
|
||||||
|
ContributionDay(hexColor: day.color)
|
||||||
|
else if (day.color.contains('L1'))
|
||||||
|
ContributionDay(hexColor: contributionColors[0])
|
||||||
|
else if (day.color.contains('L2'))
|
||||||
|
ContributionDay(hexColor: contributionColors[1])
|
||||||
|
else if (day.color.contains('L3'))
|
||||||
|
ContributionDay(hexColor: contributionColors[2])
|
||||||
|
else if (day.color.contains('L4'))
|
||||||
|
ContributionDay(hexColor: contributionColors[3])
|
||||||
|
else
|
||||||
|
ContributionDay(hexColor: contributionEmptyColor)
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ import 'package:git_touch/models/theme.dart';
|
|||||||
import 'package:git_touch/utils/utils.dart';
|
import 'package:git_touch/utils/utils.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
const contributionEmptyColor = '#ebedf0';
|
||||||
|
const contributionColors = ['#9be9a8', '#40c463', '#30a14e', '#216e39'];
|
||||||
|
|
||||||
class ContributionDay {
|
class ContributionDay {
|
||||||
String hexColor;
|
String hexColor;
|
||||||
int count;
|
int count;
|
||||||
@@ -28,10 +31,10 @@ class ContributionWidget extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (day.count == 0) {
|
if (day.count == 0) {
|
||||||
day.hexColor = emptyColor;
|
day.hexColor = contributionEmptyColor;
|
||||||
} else {
|
} else {
|
||||||
final level = (day.count * 4) ~/ (maxCount + 1);
|
final level = (day.count * 4) ~/ (maxCount + 1);
|
||||||
day.hexColor = colors[level];
|
day.hexColor = contributionColors[level];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (day.hexColor != null) {
|
if (day.hexColor != null) {
|
||||||
@@ -41,9 +44,6 @@ class ContributionWidget extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const emptyColor = '#ebedf0';
|
|
||||||
static const colors = ['#9be9a8', '#40c463', '#30a14e', '#216e39'];
|
|
||||||
|
|
||||||
static Color _revert(Color color) {
|
static Color _revert(Color color) {
|
||||||
return Color.fromRGBO(
|
return Color.fromRGBO(
|
||||||
0xff - color.red, 0xff - color.green, 0xff - color.blue, 1);
|
0xff - color.red, 0xff - color.green, 0xff - color.blue, 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user