mirror of
https://github.com/git-touch/git-touch
synced 2025-02-13 01:50:43 +01:00
refactor: tag widgets
This commit is contained in:
parent
3261db8fee
commit
9207d52cf3
@ -4,8 +4,8 @@ import 'package:git_touch/models/gitee.dart';
|
|||||||
import 'package:git_touch/scaffolds/list_stateful.dart';
|
import 'package:git_touch/scaffolds/list_stateful.dart';
|
||||||
import 'package:git_touch/widgets/action_entry.dart';
|
import 'package:git_touch/widgets/action_entry.dart';
|
||||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||||
|
import 'package:git_touch/widgets/hex_color_tag.dart';
|
||||||
import 'package:git_touch/widgets/issue_item.dart';
|
import 'package:git_touch/widgets/issue_item.dart';
|
||||||
import 'package:git_touch/widgets/label.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class GeIssuesScreen extends StatelessWidget {
|
class GeIssuesScreen extends StatelessWidget {
|
||||||
@ -44,7 +44,7 @@ class GeIssuesScreen extends StatelessWidget {
|
|||||||
? null
|
? null
|
||||||
: Wrap(spacing: 4, runSpacing: 4, children: [
|
: Wrap(spacing: 4, runSpacing: 4, children: [
|
||||||
for (var label in p.labels!)
|
for (var label in p.labels!)
|
||||||
MyLabel(name: label.name, cssColor: label.color)
|
HexColorTag(name: label.name!, color: label.color!)
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -3,8 +3,8 @@ import 'package:git_touch/models/auth.dart';
|
|||||||
import 'package:git_touch/models/gitee.dart';
|
import 'package:git_touch/models/gitee.dart';
|
||||||
import 'package:git_touch/scaffolds/list_stateful.dart';
|
import 'package:git_touch/scaffolds/list_stateful.dart';
|
||||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||||
|
import 'package:git_touch/widgets/hex_color_tag.dart';
|
||||||
import 'package:git_touch/widgets/issue_item.dart';
|
import 'package:git_touch/widgets/issue_item.dart';
|
||||||
import 'package:git_touch/widgets/label.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class GePullsScreen extends StatelessWidget {
|
class GePullsScreen extends StatelessWidget {
|
||||||
@ -39,7 +39,7 @@ class GePullsScreen extends StatelessWidget {
|
|||||||
? null
|
? null
|
||||||
: Wrap(spacing: 4, runSpacing: 4, children: [
|
: Wrap(spacing: 4, runSpacing: 4, children: [
|
||||||
for (var label in p.labels!)
|
for (var label in p.labels!)
|
||||||
MyLabel(name: label.name, cssColor: label.color)
|
HexColorTag(name: label.name!, color: label.color!)
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import 'package:ferry/ferry.dart';
|
import 'package:ferry/ferry.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_gen/gen_l10n/S.dart';
|
||||||
import 'package:git_touch/graphql/__generated__/github.data.gql.dart';
|
import 'package:git_touch/graphql/__generated__/github.data.gql.dart';
|
||||||
import 'package:git_touch/graphql/__generated__/github.req.gql.dart';
|
import 'package:git_touch/graphql/__generated__/github.req.gql.dart';
|
||||||
import 'package:git_touch/graphql/__generated__/github.var.gql.dart';
|
import 'package:git_touch/graphql/__generated__/github.var.gql.dart';
|
||||||
@ -7,10 +8,9 @@ import 'package:git_touch/models/auth.dart';
|
|||||||
import 'package:git_touch/scaffolds/list_stateful.dart';
|
import 'package:git_touch/scaffolds/list_stateful.dart';
|
||||||
import 'package:git_touch/widgets/action_entry.dart';
|
import 'package:git_touch/widgets/action_entry.dart';
|
||||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||||
|
import 'package:git_touch/widgets/hex_color_tag.dart';
|
||||||
import 'package:git_touch/widgets/issue_item.dart';
|
import 'package:git_touch/widgets/issue_item.dart';
|
||||||
import 'package:git_touch/widgets/label.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/S.dart';
|
|
||||||
|
|
||||||
class GhIssuesScreen extends StatelessWidget {
|
class GhIssuesScreen extends StatelessWidget {
|
||||||
final String owner;
|
final String owner;
|
||||||
@ -52,7 +52,7 @@ class GhIssuesScreen extends StatelessWidget {
|
|||||||
? null
|
? null
|
||||||
: Wrap(spacing: 4, runSpacing: 4, children: [
|
: Wrap(spacing: 4, runSpacing: 4, children: [
|
||||||
for (var label in p.labels!.nodes!)
|
for (var label in p.labels!.nodes!)
|
||||||
MyLabel(name: label.name, cssColor: label.color)
|
HexColorTag(name: label.name, color: label.color)
|
||||||
]),
|
]),
|
||||||
url: '/github/$owner/$name/issues/${p.number}',
|
url: '/github/$owner/$name/issues/${p.number}',
|
||||||
);
|
);
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
import 'package:ferry/ferry.dart';
|
import 'package:ferry/ferry.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_gen/gen_l10n/S.dart';
|
||||||
import 'package:git_touch/graphql/__generated__/github.data.gql.dart';
|
import 'package:git_touch/graphql/__generated__/github.data.gql.dart';
|
||||||
import 'package:git_touch/graphql/__generated__/github.req.gql.dart';
|
import 'package:git_touch/graphql/__generated__/github.req.gql.dart';
|
||||||
import 'package:git_touch/graphql/__generated__/github.var.gql.dart';
|
import 'package:git_touch/graphql/__generated__/github.var.gql.dart';
|
||||||
import 'package:git_touch/models/auth.dart';
|
import 'package:git_touch/models/auth.dart';
|
||||||
import 'package:git_touch/scaffolds/list_stateful.dart';
|
import 'package:git_touch/scaffolds/list_stateful.dart';
|
||||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||||
|
import 'package:git_touch/widgets/hex_color_tag.dart';
|
||||||
import 'package:git_touch/widgets/issue_item.dart';
|
import 'package:git_touch/widgets/issue_item.dart';
|
||||||
import 'package:git_touch/widgets/label.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/S.dart';
|
|
||||||
|
|
||||||
class GhPullsScreen extends StatelessWidget {
|
class GhPullsScreen extends StatelessWidget {
|
||||||
final String owner;
|
final String owner;
|
||||||
@ -48,7 +48,7 @@ class GhPullsScreen extends StatelessWidget {
|
|||||||
? null
|
? null
|
||||||
: Wrap(spacing: 4, runSpacing: 4, children: [
|
: Wrap(spacing: 4, runSpacing: 4, children: [
|
||||||
for (var label in p.labels!.nodes!)
|
for (var label in p.labels!.nodes!)
|
||||||
MyLabel(name: label.name, cssColor: label.color)
|
HexColorTag(name: label.name, color: label.color)
|
||||||
]),
|
]),
|
||||||
url: '/github/$owner/$name/pull/${p.number}',
|
url: '/github/$owner/$name/pull/${p.number}',
|
||||||
),
|
),
|
||||||
|
@ -1,29 +1,30 @@
|
|||||||
|
import 'package:antd_mobile/antd_mobile.dart';
|
||||||
import 'package:ferry/ferry.dart';
|
import 'package:ferry/ferry.dart';
|
||||||
import 'package:filesize/filesize.dart';
|
import 'package:filesize/filesize.dart';
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_gen/gen_l10n/S.dart';
|
||||||
import 'package:git_touch/graphql/__generated__/github.data.gql.dart';
|
import 'package:git_touch/graphql/__generated__/github.data.gql.dart';
|
||||||
import 'package:git_touch/graphql/__generated__/github.req.gql.dart';
|
import 'package:git_touch/graphql/__generated__/github.req.gql.dart';
|
||||||
import 'package:git_touch/graphql/__generated__/github.var.gql.dart';
|
import 'package:git_touch/graphql/__generated__/github.var.gql.dart';
|
||||||
import 'package:git_touch/graphql/__generated__/schema.schema.gql.dart';
|
import 'package:git_touch/graphql/__generated__/schema.schema.gql.dart';
|
||||||
import 'package:git_touch/models/auth.dart';
|
import 'package:git_touch/models/auth.dart';
|
||||||
|
import 'package:git_touch/models/theme.dart';
|
||||||
import 'package:git_touch/scaffolds/refresh_stateful.dart';
|
import 'package:git_touch/scaffolds/refresh_stateful.dart';
|
||||||
import 'package:git_touch/utils/utils.dart';
|
import 'package:git_touch/utils/utils.dart';
|
||||||
|
import 'package:git_touch/widgets/action_button.dart';
|
||||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||||
import 'package:git_touch/widgets/entry_item.dart';
|
import 'package:git_touch/widgets/entry_item.dart';
|
||||||
import 'package:git_touch/widgets/markdown_view.dart';
|
|
||||||
import 'package:git_touch/widgets/label.dart';
|
|
||||||
import 'package:git_touch/widgets/language_bar.dart';
|
import 'package:git_touch/widgets/language_bar.dart';
|
||||||
|
import 'package:git_touch/widgets/markdown_view.dart';
|
||||||
import 'package:git_touch/widgets/mutation_button.dart';
|
import 'package:git_touch/widgets/mutation_button.dart';
|
||||||
import 'package:git_touch/widgets/repo_header.dart';
|
import 'package:git_touch/widgets/repo_header.dart';
|
||||||
import 'package:git_touch/widgets/table_view.dart';
|
import 'package:git_touch/widgets/table_view.dart';
|
||||||
import 'package:github/github.dart';
|
import 'package:github/github.dart';
|
||||||
|
import 'package:primer/primer.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:git_touch/models/theme.dart';
|
|
||||||
import 'package:tuple/tuple.dart';
|
import 'package:tuple/tuple.dart';
|
||||||
import 'package:git_touch/widgets/action_button.dart';
|
|
||||||
import 'package:universal_io/io.dart';
|
import 'package:universal_io/io.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/S.dart';
|
|
||||||
|
|
||||||
class GhRepoScreen extends StatelessWidget {
|
class GhRepoScreen extends StatelessWidget {
|
||||||
final String owner;
|
final String owner;
|
||||||
@ -79,6 +80,7 @@ class GhRepoScreen extends StatelessWidget {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
final readmeData = MarkdownViewData(
|
final readmeData = MarkdownViewData(
|
||||||
context,
|
context,
|
||||||
md: readmeFactory('application/vnd.github.v3.raw'),
|
md: readmeFactory('application/vnd.github.v3.raw'),
|
||||||
@ -93,7 +95,8 @@ class GhRepoScreen extends StatelessWidget {
|
|||||||
title: AppLocalizations.of(context)!.repositoryActions,
|
title: AppLocalizations.of(context)!.repositoryActions,
|
||||||
items: [
|
items: [
|
||||||
ActionItem(
|
ActionItem(
|
||||||
text: '${AppLocalizations.of(context)!.projects}(${repo.projects.totalCount})',
|
text:
|
||||||
|
'${AppLocalizations.of(context)!.projects}(${repo.projects.totalCount})',
|
||||||
url: repo.projectsUrl,
|
url: repo.projectsUrl,
|
||||||
),
|
),
|
||||||
...ActionItem.getUrlActions(repo.url),
|
...ActionItem.getUrlActions(repo.url),
|
||||||
@ -192,14 +195,15 @@ class GhRepoScreen extends StatelessWidget {
|
|||||||
Wrap(
|
Wrap(
|
||||||
spacing: 4,
|
spacing: 4,
|
||||||
runSpacing: 4,
|
runSpacing: 4,
|
||||||
children: repo.repositoryTopics.nodes!.map((node) {
|
children: [
|
||||||
return MyLabel(
|
for (final node in repo.repositoryTopics.nodes!)
|
||||||
name: node.topic.name,
|
AntTag(
|
||||||
// color: Colors.blue.shade50,
|
color: PrimerColors.blue500,
|
||||||
color: theme.palette.grayBackground,
|
fill: AntTagFill.outline,
|
||||||
textColor: theme.palette.primary,
|
round: true,
|
||||||
);
|
child: Text(node.topic.name),
|
||||||
}).toList(),
|
)
|
||||||
|
],
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -274,7 +278,8 @@ class GhRepoScreen extends StatelessWidget {
|
|||||||
TableViewItem(
|
TableViewItem(
|
||||||
leftIconData: Octicons.git_branch,
|
leftIconData: Octicons.git_branch,
|
||||||
text: Text(AppLocalizations.of(context)!.branches),
|
text: Text(AppLocalizations.of(context)!.branches),
|
||||||
rightWidget: Text('${ref.name} • ${numberFormat.format(repo.refs!.totalCount)}'),
|
rightWidget: Text(
|
||||||
|
'${ref.name} • ${numberFormat.format(repo.refs!.totalCount)}'),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
final refs = repo.refs!.nodes!;
|
final refs = repo.refs!.nodes!;
|
||||||
if (refs.length < 2) return;
|
if (refs.length < 2) return;
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_gen/gen_l10n/S.dart';
|
||||||
import 'package:git_touch/models/auth.dart';
|
import 'package:git_touch/models/auth.dart';
|
||||||
import 'package:git_touch/models/gitlab.dart';
|
import 'package:git_touch/models/gitlab.dart';
|
||||||
import 'package:git_touch/scaffolds/list_stateful.dart';
|
import 'package:git_touch/scaffolds/list_stateful.dart';
|
||||||
import 'package:git_touch/widgets/action_entry.dart';
|
import 'package:git_touch/widgets/action_entry.dart';
|
||||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||||
|
import 'package:git_touch/widgets/hex_color_tag.dart';
|
||||||
import 'package:git_touch/widgets/issue_item.dart';
|
import 'package:git_touch/widgets/issue_item.dart';
|
||||||
import 'package:git_touch/widgets/label.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/S.dart';
|
|
||||||
|
|
||||||
class GlIssuesScreen extends StatelessWidget {
|
class GlIssuesScreen extends StatelessWidget {
|
||||||
final String id;
|
final String id;
|
||||||
@ -45,7 +45,7 @@ class GlIssuesScreen extends StatelessWidget {
|
|||||||
? null
|
? null
|
||||||
: Wrap(spacing: 4, runSpacing: 4, children: [
|
: Wrap(spacing: 4, runSpacing: 4, children: [
|
||||||
for (var label in p.labels!)
|
for (var label in p.labels!)
|
||||||
MyLabel(name: label, cssColor: '#428BCA')
|
HexColorTag(name: label, color: '#428BCA')
|
||||||
]),
|
]),
|
||||||
url: '/gitlab/projects/${p.projectId}/issues/${p.iid}',
|
url: '/gitlab/projects/${p.projectId}/issues/${p.iid}',
|
||||||
),
|
),
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_gen/gen_l10n/S.dart';
|
||||||
import 'package:git_touch/models/auth.dart';
|
import 'package:git_touch/models/auth.dart';
|
||||||
import 'package:git_touch/models/gitlab.dart';
|
import 'package:git_touch/models/gitlab.dart';
|
||||||
import 'package:git_touch/scaffolds/list_stateful.dart';
|
import 'package:git_touch/scaffolds/list_stateful.dart';
|
||||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||||
|
import 'package:git_touch/widgets/hex_color_tag.dart';
|
||||||
import 'package:git_touch/widgets/issue_item.dart';
|
import 'package:git_touch/widgets/issue_item.dart';
|
||||||
import 'package:git_touch/widgets/label.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/S.dart';
|
|
||||||
|
|
||||||
class GlMergeRequestsScreen extends StatelessWidget {
|
class GlMergeRequestsScreen extends StatelessWidget {
|
||||||
final String id;
|
final String id;
|
||||||
@ -40,7 +40,7 @@ class GlMergeRequestsScreen extends StatelessWidget {
|
|||||||
? null
|
? null
|
||||||
: Wrap(spacing: 4, runSpacing: 4, children: [
|
: Wrap(spacing: 4, runSpacing: 4, children: [
|
||||||
for (var label in p.labels!)
|
for (var label in p.labels!)
|
||||||
MyLabel(name: label, cssColor: '#428BCA')
|
HexColorTag(name: label, color: '#428BCA')
|
||||||
]),
|
]),
|
||||||
// url: '/gitlab/projects/${p.projectId}/merge_requests/${p.iid}',
|
// url: '/gitlab/projects/${p.projectId}/merge_requests/${p.iid}',
|
||||||
url: '$prefix/merge_requests/${p.iid}', // TODO:
|
url: '$prefix/merge_requests/${p.iid}', // TODO:
|
||||||
|
@ -5,8 +5,8 @@ import 'package:git_touch/models/gogs.dart';
|
|||||||
import 'package:git_touch/scaffolds/list_stateful.dart';
|
import 'package:git_touch/scaffolds/list_stateful.dart';
|
||||||
import 'package:git_touch/widgets/action_entry.dart';
|
import 'package:git_touch/widgets/action_entry.dart';
|
||||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||||
|
import 'package:git_touch/widgets/hex_color_tag.dart';
|
||||||
import 'package:git_touch/widgets/issue_item.dart';
|
import 'package:git_touch/widgets/issue_item.dart';
|
||||||
import 'package:git_touch/widgets/label.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class GoIssuesScreen extends StatelessWidget {
|
class GoIssuesScreen extends StatelessWidget {
|
||||||
@ -54,7 +54,7 @@ class GoIssuesScreen extends StatelessWidget {
|
|||||||
? null
|
? null
|
||||||
: Wrap(spacing: 4, runSpacing: 4, children: [
|
: Wrap(spacing: 4, runSpacing: 4, children: [
|
||||||
for (var label in p.labels!)
|
for (var label in p.labels!)
|
||||||
MyLabel(name: label.name, cssColor: label.color)
|
HexColorTag(name: label.name!, color: label.color!)
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -5,8 +5,8 @@ import 'package:git_touch/models/gitea.dart';
|
|||||||
import 'package:git_touch/scaffolds/list_stateful.dart';
|
import 'package:git_touch/scaffolds/list_stateful.dart';
|
||||||
import 'package:git_touch/widgets/action_entry.dart';
|
import 'package:git_touch/widgets/action_entry.dart';
|
||||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||||
|
import 'package:git_touch/widgets/hex_color_tag.dart';
|
||||||
import 'package:git_touch/widgets/issue_item.dart';
|
import 'package:git_touch/widgets/issue_item.dart';
|
||||||
import 'package:git_touch/widgets/label.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class GtIssuesScreen extends StatelessWidget {
|
class GtIssuesScreen extends StatelessWidget {
|
||||||
@ -54,7 +54,7 @@ class GtIssuesScreen extends StatelessWidget {
|
|||||||
? null
|
? null
|
||||||
: Wrap(spacing: 4, runSpacing: 4, children: [
|
: Wrap(spacing: 4, runSpacing: 4, children: [
|
||||||
for (var label in p.labels!)
|
for (var label in p.labels!)
|
||||||
MyLabel(name: label.name, cssColor: label.color)
|
HexColorTag(name: label.name!, color: label.color!)
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
23
lib/widgets/hex_color_tag.dart
Normal file
23
lib/widgets/hex_color_tag.dart
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import 'package:antd_mobile/antd_mobile.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:git_touch/utils/utils.dart';
|
||||||
|
|
||||||
|
class HexColorTag extends StatelessWidget {
|
||||||
|
final String name;
|
||||||
|
final String color;
|
||||||
|
|
||||||
|
const HexColorTag({
|
||||||
|
super.key,
|
||||||
|
required this.name,
|
||||||
|
required this.color,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AntTag(
|
||||||
|
round: true,
|
||||||
|
color: convertColor(color),
|
||||||
|
child: Text(name),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -1,36 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:git_touch/utils/utils.dart';
|
|
||||||
|
|
||||||
class MyLabel extends StatelessWidget {
|
|
||||||
final String? name;
|
|
||||||
final Color? color;
|
|
||||||
final String? cssColor;
|
|
||||||
final Color? textColor;
|
|
||||||
|
|
||||||
const MyLabel({
|
|
||||||
required this.name,
|
|
||||||
this.color,
|
|
||||||
this.cssColor,
|
|
||||||
this.textColor,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final finalColor = color ?? convertColor(cssColor);
|
|
||||||
return Container(
|
|
||||||
padding: const EdgeInsets.symmetric(vertical: 2, horizontal: 6),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: finalColor,
|
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(4)),
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
name!,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 13,
|
|
||||||
color: textColor ?? getFontColorByBrightness(finalColor),
|
|
||||||
// fontWeight: FontWeight.w600,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +1,15 @@
|
|||||||
import 'dart:core';
|
import 'dart:core';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_gen/gen_l10n/S.dart';
|
||||||
import 'package:git_touch/graphql/__generated__/github.data.gql.dart';
|
import 'package:git_touch/graphql/__generated__/github.data.gql.dart';
|
||||||
import 'package:git_touch/graphql/__generated__/schema.schema.gql.dart';
|
import 'package:git_touch/graphql/__generated__/schema.schema.gql.dart';
|
||||||
import 'package:git_touch/models/theme.dart';
|
import 'package:git_touch/models/theme.dart';
|
||||||
import 'package:git_touch/widgets/label.dart';
|
import 'package:git_touch/widgets/hex_color_tag.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
import '../utils/utils.dart';
|
import '../utils/utils.dart';
|
||||||
import 'comment_item.dart';
|
import 'comment_item.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/S.dart';
|
|
||||||
|
|
||||||
TextSpan createUserSpan(BuildContext context, String? login) {
|
TextSpan createUserSpan(BuildContext context, String? login) {
|
||||||
return createLinkSpan(context, login, '/github/$login');
|
return createLinkSpan(context, login, '/github/$login');
|
||||||
@ -202,7 +204,7 @@ class TimelineItem extends StatelessWidget {
|
|||||||
textSpan: TextSpan(children: [
|
textSpan: TextSpan(children: [
|
||||||
TextSpan(text: ' ${AppLocalizations.of(context)!.added} '),
|
TextSpan(text: ' ${AppLocalizations.of(context)!.added} '),
|
||||||
WidgetSpan(
|
WidgetSpan(
|
||||||
child: MyLabel(name: p.label.name, cssColor: p.label.color)),
|
child: HexColorTag(name: p.label.name, color: p.label.color)),
|
||||||
TextSpan(text: ' ${AppLocalizations.of(context)!.label}'),
|
TextSpan(text: ' ${AppLocalizations.of(context)!.label}'),
|
||||||
]),
|
]),
|
||||||
);
|
);
|
||||||
@ -214,7 +216,7 @@ class TimelineItem extends StatelessWidget {
|
|||||||
textSpan: TextSpan(children: [
|
textSpan: TextSpan(children: [
|
||||||
TextSpan(text: ' ${AppLocalizations.of(context)!.removed} '),
|
TextSpan(text: ' ${AppLocalizations.of(context)!.removed} '),
|
||||||
WidgetSpan(
|
WidgetSpan(
|
||||||
child: MyLabel(name: p.label.name, cssColor: p.label.color)),
|
child: HexColorTag(name: p.label.name, color: p.label.color)),
|
||||||
TextSpan(text: ' ${AppLocalizations.of(context)!.label}'),
|
TextSpan(text: ' ${AppLocalizations.of(context)!.label}'),
|
||||||
]),
|
]),
|
||||||
);
|
);
|
||||||
|
@ -15,6 +15,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.7.0"
|
version: "4.7.0"
|
||||||
|
antd_mobile:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
path: "../ant-design-mobile-flutter"
|
||||||
|
relative: true
|
||||||
|
source: path
|
||||||
|
version: "0.0.1"
|
||||||
args:
|
args:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -1147,5 +1154,5 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.1"
|
version: "3.1.1"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.17.5 <3.0.0"
|
dart: ">=2.17.6 <3.0.0"
|
||||||
flutter: ">=3.0.0"
|
flutter: ">=3.0.0"
|
||||||
|
@ -67,6 +67,8 @@ dependencies:
|
|||||||
pub_semver:
|
pub_semver:
|
||||||
google_fonts:
|
google_fonts:
|
||||||
go_router:
|
go_router:
|
||||||
|
antd_mobile:
|
||||||
|
path: ../ant-design-mobile-flutter
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user