diff --git a/lib/screens/gl_project.dart b/lib/screens/gl_project.dart index d574321..079868e 100644 --- a/lib/screens/gl_project.dart +++ b/lib/screens/gl_project.dart @@ -8,6 +8,7 @@ import 'package:git_touch/scaffolds/refresh_stateful.dart'; import 'package:git_touch/utils/utils.dart'; import 'package:git_touch/widgets/app_bar_title.dart'; import 'package:git_touch/widgets/entry_item.dart'; +import 'package:git_touch/widgets/language_bar.dart'; import 'package:git_touch/widgets/markdown_view.dart'; import 'package:git_touch/widgets/repo_header.dart'; import 'package:git_touch/widgets/table_view.dart'; @@ -57,11 +58,6 @@ class GlProjectScreen extends StatelessWidget { ); }, bodyBuilder: (t, _) { - // final langWidth = MediaQuery.of(context).size.width - - // CommonStyle.padding.left - - // CommonStyle.padding.right - - // data.languages.length + - // 1; final p = t.item1; final langs = t.item2; final badges = t.item3; @@ -107,6 +103,13 @@ class GlProjectScreen extends StatelessWidget { ), ], ), + if (langs.isNotEmpty) ...[ + CommonStyle.border, + LanguageBar([ + for (var e in langs.entries) + LanguageBarItem(name: e.key, ratio: e.value / 100) + ]), + ], CommonStyle.border, TableView( hasIcon: true, diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index c362804..6f3b151 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -37,7 +37,7 @@ class CommonStyle { Color convertColor(String cssHex) { if (cssHex == null) { - return Color(0xffcccccc); // Default color + return Color(0xffededed); // Default color } if (cssHex.startsWith('#')) { diff --git a/lib/widgets/language_bar.dart b/lib/widgets/language_bar.dart index 5e94ad4..7897182 100644 --- a/lib/widgets/language_bar.dart +++ b/lib/widgets/language_bar.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:git_touch/models/theme.dart'; import 'package:git_touch/utils/utils.dart'; import 'package:provider/provider.dart'; +import 'package:github/src/const/language_color.dart'; class LanguageBarItem { String name; @@ -10,9 +11,9 @@ class LanguageBarItem { double ratio; LanguageBarItem({ @required this.name, - this.hexColor, @required this.ratio, - }); + String hexColor, + }) : hexColor = hexColor ?? languagesColor[name]; } class LanguageBar extends StatelessWidget {