重构
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
/// 最新变化: 新建文件
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import '../../../utils/http/poetry_api.dart';
|
||||
|
||||
@@ -31,7 +31,6 @@ class _HomePageState extends State<HomePage>
|
||||
bool _isLoadingLike = false;
|
||||
String _errorMessage = '';
|
||||
String _starDisplay = '';
|
||||
final String _historyKey = 'poetry_history';
|
||||
List<Map<String, dynamic>> _historyList = [];
|
||||
int _currentHistoryIndex = -1;
|
||||
late AnimationController _fadeController;
|
||||
@@ -41,7 +40,6 @@ class _HomePageState extends State<HomePage>
|
||||
|
||||
// 动态加载状态
|
||||
bool _isLoadingNext = false;
|
||||
bool _isLoadingPrevious = false;
|
||||
Map<String, bool> _sectionLoadingStates = {
|
||||
'title': false,
|
||||
'content': false,
|
||||
|
||||
@@ -524,34 +524,26 @@ class _PoetryCardState extends State<PoetryCard> {
|
||||
),
|
||||
),
|
||||
// 右边:星星和点赞
|
||||
if (!isLoading &&
|
||||
(widget.poetryData.star != null ||
|
||||
widget.poetryData.like != null ||
|
||||
widget.poetryData.hitsTotal != null))
|
||||
if (!isLoading)
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (widget.poetryData.star != null) ...[
|
||||
Text(
|
||||
PoetryDataUtils.generateStars(widget.poetryData.star),
|
||||
style: const TextStyle(fontSize: 14),
|
||||
Text(
|
||||
PoetryDataUtils.generateStars(widget.poetryData.star),
|
||||
style: const TextStyle(fontSize: 14),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
PoetryDataUtils.generateLikeText(widget.poetryData.like),
|
||||
style: const TextStyle(fontSize: 12, color: Colors.grey),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
PoetryDataUtils.generateViewText(
|
||||
widget.poetryData.hitsTotal,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
],
|
||||
if (widget.poetryData.like != null) ...[
|
||||
Text(
|
||||
PoetryDataUtils.generateLikeText(widget.poetryData.like),
|
||||
style: const TextStyle(fontSize: 12, color: Colors.grey),
|
||||
),
|
||||
],
|
||||
if (widget.poetryData.hitsTotal != null) ...[
|
||||
Text(
|
||||
PoetryDataUtils.generateViewText(
|
||||
widget.poetryData.hitsTotal,
|
||||
),
|
||||
style: const TextStyle(fontSize: 12, color: Colors.grey),
|
||||
),
|
||||
],
|
||||
style: const TextStyle(fontSize: 12, color: Colors.grey),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user