parent
d940f3b3e9
commit
895f4792d6
|
@ -120,8 +120,20 @@ class GhUserScreen extends StatelessWidget {
|
|||
for (final week
|
||||
in p.contributionsCollection.contributionCalendar.weeks)
|
||||
[
|
||||
// https://github.com/git-touch/git-touch/issues/122
|
||||
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:provider/provider.dart';
|
||||
|
||||
const contributionEmptyColor = '#ebedf0';
|
||||
const contributionColors = ['#9be9a8', '#40c463', '#30a14e', '#216e39'];
|
||||
|
||||
class ContributionDay {
|
||||
String hexColor;
|
||||
int count;
|
||||
|
@ -28,10 +31,10 @@ class ContributionWidget extends StatelessWidget {
|
|||
}
|
||||
}
|
||||
if (day.count == 0) {
|
||||
day.hexColor = emptyColor;
|
||||
day.hexColor = contributionEmptyColor;
|
||||
} else {
|
||||
final level = (day.count * 4) ~/ (maxCount + 1);
|
||||
day.hexColor = colors[level];
|
||||
day.hexColor = contributionColors[level];
|
||||
}
|
||||
}
|
||||
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) {
|
||||
return Color.fromRGBO(
|
||||
0xff - color.red, 0xff - color.green, 0xff - color.blue, 1);
|
||||
|
|
Loading…
Reference in New Issue