图片生成

This commit is contained in:
Developer
2026-03-31 06:11:32 +08:00
parent d6ac0ed1e4
commit 66f72abab4
6 changed files with 912 additions and 69 deletions

View File

@@ -39,6 +39,8 @@ class _HomePageState extends State<HomePage>
late Animation<double> _fadeAnimation;
late Animation<Offset> _slideAnimation;
final GlobalKey _repaintKey = GlobalKey();
// 动态加载状态
bool _isLoadingNext = false;
Map<String, bool> _sectionLoadingStates = {
@@ -724,6 +726,15 @@ class _HomePageState extends State<HomePage>
}
}
Future<void> _sharePoetryImage() async {
if (_poetryData == null) return;
await ShareImageUtils.captureAndShare(
context,
_repaintKey,
subject: _poetryData!.name,
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
@@ -773,6 +784,7 @@ class _HomePageState extends State<HomePage>
keywordList: _keywordList,
onTap: _loadNextPoetry,
sectionLoadingStates: _sectionLoadingStates,
repaintKey: _repaintKey,
),
const SizedBox(height: 160), // 为悬浮按钮留出更多空间
],
@@ -799,6 +811,12 @@ class _HomePageState extends State<HomePage>
bottom: 32,
child: FloatingNextButton(onNext: _loadNextPoetry),
),
// 悬浮分享按钮 - 右边上方
Positioned(
right: 16,
bottom: 100,
child: FloatingShareButton(onShare: _sharePoetryImage),
),
// 悬浮点赞按钮 - 右边(仅在线状态显示)
if (isOnline)
Positioned(