factor:布局颜色重构
This commit is contained in:
@@ -84,7 +84,7 @@ class _BlogPageState extends State<BlogPage> {
|
||||
);
|
||||
}
|
||||
|
||||
return ListView.builder(
|
||||
return ListView.separated(
|
||||
controller: _scrollController,
|
||||
itemCount: provider.blogList.length,
|
||||
itemBuilder: (context, index) {
|
||||
@@ -94,6 +94,9 @@ class _BlogPageState extends State<BlogPage> {
|
||||
child: BlogCard(blog: blog),
|
||||
);
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return SizedBox(height: 8);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class _CategoryListPageState extends State<CategoryListPage> {
|
||||
}
|
||||
|
||||
Widget _buildBlogList(BlogProvider provider) {
|
||||
return ListView.builder(
|
||||
return ListView.separated(
|
||||
itemCount: provider.blogList.length,
|
||||
itemBuilder: (context, index) {
|
||||
final blog = provider.blogList[index];
|
||||
@@ -33,6 +33,9 @@ class _CategoryListPageState extends State<CategoryListPage> {
|
||||
child: buildBlogListItem(context, blog, index + 1),
|
||||
);
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return SizedBox(height: 8);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,12 +36,15 @@ class _CategoryPageState extends State<CategoryPage> {
|
||||
SizedBox(height: 10),
|
||||
// 分类列表
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
child: ListView.separated(
|
||||
itemCount: provider.categoryList.length,
|
||||
itemBuilder: (context, index) {
|
||||
final category = provider.categoryList[index];
|
||||
return buildCategoryCard(context, category);
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return SizedBox(height: 8);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:blog_app/utils/index.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:blog_app/provider/blog.dart';
|
||||
import 'package:blog_app/widget/blog.dart';
|
||||
@@ -131,29 +132,35 @@ class StatsPageState extends State<StatsPage> {
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
childAspectRatio: 2,
|
||||
mainAxisSpacing: 8,
|
||||
crossAxisSpacing: 8,
|
||||
children: [
|
||||
buildStatsCard(
|
||||
icon: Icons.article,
|
||||
context: context,
|
||||
title: '博客数量',
|
||||
count: provider.overviewStats.blogCount,
|
||||
count: provider.overviewStats.blogCount.toString(),
|
||||
unit: '篇',
|
||||
),
|
||||
buildStatsCard(
|
||||
icon: Icons.folder,
|
||||
context: context,
|
||||
title: '分类数量',
|
||||
count: provider.overviewStats.categoryCount,
|
||||
count: provider.overviewStats.categoryCount.toString(),
|
||||
unit: '个',
|
||||
),
|
||||
buildStatsCard(
|
||||
icon: Icons.remove_red_eye,
|
||||
context: context,
|
||||
title: '访问量',
|
||||
count: provider.overviewStats.visitCount,
|
||||
count: formatChineseDecimal(provider.overviewStats.visitCount),
|
||||
unit: '次',
|
||||
),
|
||||
buildStatsCard(
|
||||
icon: Icons.text_fields,
|
||||
context: context,
|
||||
title: '总字数',
|
||||
count: provider.overviewStats.wordCount,
|
||||
count: formatChineseDecimal(provider.overviewStats.wordCount),
|
||||
unit: '字',
|
||||
),
|
||||
],
|
||||
@@ -181,44 +188,32 @@ class StatsPageState extends State<StatsPage> {
|
||||
});
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
const SizedBox(height: 8),
|
||||
_buildBlogStatsGrid(provider),
|
||||
const SizedBox(height: 6),
|
||||
const SizedBox(height: 8),
|
||||
SizedBox(
|
||||
height: chartHeight,
|
||||
child: buildCard(
|
||||
context: context,
|
||||
child: _buildApprovedStats(provider),
|
||||
),
|
||||
child: BuildCard(child: _buildApprovedStats(provider)),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
const SizedBox(height: 8),
|
||||
SizedBox(
|
||||
height: chartHeight,
|
||||
child: buildCard(context: context, child: _buildVisitStats(provider)),
|
||||
child: BuildCard(child: _buildVisitStats(provider)),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
const SizedBox(height: 8),
|
||||
SizedBox(
|
||||
height: chartHeight,
|
||||
child: buildCard(
|
||||
context: context,
|
||||
child: _buildVisitRankStats(provider),
|
||||
),
|
||||
child: BuildCard(child: _buildVisitRankStats(provider)),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
const SizedBox(height: 8),
|
||||
SizedBox(
|
||||
height: chartHeight,
|
||||
child: buildCard(
|
||||
context: context,
|
||||
child: _buildCategoryStats(provider),
|
||||
),
|
||||
child: BuildCard(child: _buildCategoryStats(provider)),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
const SizedBox(height: 8),
|
||||
SizedBox(
|
||||
height: chartHeight,
|
||||
child: buildCard(
|
||||
context: context,
|
||||
child: _buildReadRankStats(provider),
|
||||
),
|
||||
child: BuildCard(child: _buildReadRankStats(provider)),
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -233,8 +228,8 @@ class StatsPageState extends State<StatsPage> {
|
||||
if (blogProvider.isLoading)
|
||||
buildLoadingIndicator()
|
||||
else
|
||||
SingleChildScrollView(child: _buildContent(blogProvider))
|
||||
]
|
||||
SingleChildScrollView(child: _buildContent(blogProvider)),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class TimelinePageState extends State<TimelinePage> {
|
||||
|
||||
return Timeline.tileBuilder(
|
||||
theme: TimelineThemeData(nodePosition: 0, indicatorPosition: 0),
|
||||
padding: EdgeInsets.all(6),
|
||||
padding: EdgeInsets.all(0),
|
||||
builder: TimelineTileBuilder.connected(
|
||||
itemCount: provider.blogList.length,
|
||||
connectorBuilder:
|
||||
@@ -39,9 +39,12 @@ class TimelinePageState extends State<TimelinePage> {
|
||||
},
|
||||
contentsBuilder: (context, index) {
|
||||
final blog = provider.blogList[index];
|
||||
return InkWell(
|
||||
onTap: () => navigatorToBlogDetail(context, blog.id),
|
||||
child: buildBlogListItem(context, blog, index + 1),
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
||||
child: InkWell(
|
||||
onTap: () => navigatorToBlogDetail(context, blog.id),
|
||||
child: buildBlogListItem(context, blog, index + 1),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user