factor:布局颜色重构
This commit is contained in:
@@ -53,7 +53,7 @@ class BlogCard extends StatelessWidget {
|
||||
alignment: WrapAlignment.center,
|
||||
children: [
|
||||
if (blog.isGreat)
|
||||
_buildBlogLabelItem('精品', Icons.workspace_premium, Colors.amber),
|
||||
_buildBlogLabelItem('精品', Icons.workspace_premium, Colors.deepOrange),
|
||||
if (blog.topValue > 1)
|
||||
_buildBlogLabelItem('置顶', Icons.push_pin, Colors.red),
|
||||
_buildBlogLabelItem(blog.category, Icons.folder, Colors.blue),
|
||||
@@ -114,26 +114,20 @@ class BlogCard extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return buildCard(
|
||||
context: context,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
_buildBlogTitle(context),
|
||||
SizedBox(height: 16),
|
||||
_buildBlogLabel(),
|
||||
SizedBox(height: 16),
|
||||
Container(
|
||||
height: 1,
|
||||
width: 80,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
_buildBlogSummary(),
|
||||
],
|
||||
),
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
|
||||
return BuildCard(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
_buildBlogTitle(context),
|
||||
SizedBox(height: 16),
|
||||
_buildBlogLabel(),
|
||||
SizedBox(height: 16),
|
||||
Container(height: 1, width: 80, color: colors.primary),
|
||||
SizedBox(height: 16),
|
||||
_buildBlogSummary(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -164,8 +158,7 @@ Widget buildCategoryTitle(BuildContext context, int count) {
|
||||
Widget buildCategoryCard(BuildContext context, BlogCategory category) {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
|
||||
return buildCard(
|
||||
context: context,
|
||||
return BuildCard(
|
||||
child: ListTile(
|
||||
leading: Container(
|
||||
width: 50,
|
||||
@@ -222,18 +215,12 @@ Widget buildListTitle(int count) {
|
||||
Widget buildBlogListItem(BuildContext context, Blog blog, int index) {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
|
||||
return buildCard(
|
||||
context: context,
|
||||
return BuildCard(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
padding: EdgeInsets.all(0),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
'$index.',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w500
|
||||
),
|
||||
),
|
||||
Text('$index.', style: TextStyle(fontWeight: FontWeight.w500)),
|
||||
SizedBox(width: 10),
|
||||
Text(
|
||||
formatDateString(blog.createTime),
|
||||
@@ -260,48 +247,65 @@ Widget buildBlogListItem(BuildContext context, Blog blog, int index) {
|
||||
|
||||
Widget buildStatsCard({
|
||||
required BuildContext context,
|
||||
required IconData icon,
|
||||
required String title,
|
||||
required int count,
|
||||
required String count,
|
||||
required String unit,
|
||||
}) {
|
||||
return buildCard(
|
||||
context: context,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
|
||||
return BuildCard(
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.grey.shade600,
|
||||
fontWeight: FontWeight.w500,
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: colors.primary.withAlpha(50),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(icon, size: 26, color: colors.primary),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
count.toString(),
|
||||
style: const TextStyle(
|
||||
fontSize: 28,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black87,
|
||||
height: 1.0,
|
||||
SizedBox(width: 6),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.grey.shade600,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
unit,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.grey.shade600,
|
||||
fontWeight: FontWeight.w500,
|
||||
const SizedBox(height: 6),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
count,
|
||||
style: TextStyle(
|
||||
fontSize: 28,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: colors.primary,
|
||||
height: 1.0,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
unit,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.grey.shade600,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user