mirror of
https://github.com/git-touch/git-touch
synced 2025-01-31 16:14:49 +01:00
improvement(gl): add language bar
This commit is contained in:
parent
4b093a1c4f
commit
8c45a70ae3
@ -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,
|
||||
|
@ -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('#')) {
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user