factor:布局颜色重构
This commit is contained in:
@@ -53,7 +53,11 @@ class BlogCard extends StatelessWidget {
|
||||
alignment: WrapAlignment.center,
|
||||
children: [
|
||||
if (blog.isGreat)
|
||||
_buildBlogLabelItem('精品', Icons.workspace_premium, Colors.deepOrange),
|
||||
_buildBlogLabelItem(
|
||||
'精品',
|
||||
Icons.workspace_premium,
|
||||
Colors.deepOrange,
|
||||
),
|
||||
if (blog.topValue > 1)
|
||||
_buildBlogLabelItem('置顶', Icons.push_pin, Colors.red),
|
||||
_buildBlogLabelItem(blog.category, Icons.folder, Colors.blue),
|
||||
@@ -101,12 +105,14 @@ class BlogCard extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBlogSummary() {
|
||||
Widget _buildBlogSummary(BuildContext context) {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
child: Text(
|
||||
blog.summary,
|
||||
style: TextStyle(color: Colors.grey.shade700, height: 1.6),
|
||||
style: TextStyle(color: colors.secondary, height: 1.6),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
);
|
||||
@@ -126,7 +132,7 @@ class BlogCard extends StatelessWidget {
|
||||
SizedBox(height: 16),
|
||||
Container(height: 1, width: 80, color: colors.primary),
|
||||
SizedBox(height: 16),
|
||||
_buildBlogSummary(),
|
||||
_buildBlogSummary(context),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -181,14 +187,16 @@ Widget buildCategoryCard(BuildContext context, BlogCategory category) {
|
||||
),
|
||||
),
|
||||
trailing: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||
width: 30,
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
color: colors.primary.withAlpha(50),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
color: Theme.of(context).colorScheme.primary.withAlpha(50),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Text(
|
||||
category.count.toString(),
|
||||
style: TextStyle(color: colors.primary, fontWeight: FontWeight.bold),
|
||||
child: Icon(
|
||||
Icons.arrow_forward,
|
||||
size: 16,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
onTap: () => navigateToBlogList(context, category),
|
||||
@@ -220,11 +228,17 @@ Widget buildBlogListItem(BuildContext context, Blog blog, int index) {
|
||||
padding: EdgeInsets.all(0),
|
||||
child: Row(
|
||||
children: [
|
||||
Text('$index.', style: TextStyle(fontWeight: FontWeight.w500)),
|
||||
Text(
|
||||
'$index.',
|
||||
style: TextStyle(
|
||||
color: colors.onSurface,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
Text(
|
||||
formatDateString(blog.createTime),
|
||||
style: TextStyle(fontSize: 14, color: Colors.grey.shade600),
|
||||
style: TextStyle(fontSize: 14, color: colors.onSurface),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
Expanded(
|
||||
|
||||
Reference in New Issue
Block a user