feat(app): 集成文字输入到编辑器 — TextInputOverlay + 工具栏选项行

This commit is contained in:
iven
2026-06-01 21:27:15 +08:00
parent d392515f4a
commit fef2d629e5
2 changed files with 92 additions and 4 deletions

View File

@@ -129,10 +129,72 @@ class EditorToolbar extends StatelessWidget {
static const _widths = [1.5, 3.0, 5.0, 8.0, 12.0];
Widget _buildOptionsRow(BuildContext context, ColorScheme colorScheme) {
if (!state.isDrawingMode) {
return const SizedBox(height: 44, child: Center(child: Text('选择元素或添加内容')));
// 画笔模式:颜色 + 粗细
if (state.isDrawingMode) {
return _buildBrushOptions(context, colorScheme);
}
// 文字工具提示
if (state.activeTool == EditorTool.text) {
return const SizedBox(
height: 44,
child: Center(
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.text_fields, size: 16),
SizedBox(width: 8),
Text('点击画布输入文字', style: TextStyle(fontSize: 13)),
],
),
),
);
}
// 贴纸工具提示
if (state.activeTool == EditorTool.sticker) {
return const SizedBox(
height: 44,
child: Center(
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.emoji_emotions_outlined, size: 16),
SizedBox(width: 8),
Text('选择一个贴纸放到日记上', style: TextStyle(fontSize: 13)),
],
),
),
);
}
// 图片工具提示
if (state.activeTool == EditorTool.image) {
return const SizedBox(
height: 44,
child: Center(
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.add_photo_alternate_outlined, size: 16),
SizedBox(width: 8),
Text('选择照片添加到日记', style: TextStyle(fontSize: 13)),
],
),
),
);
}
// 选择工具
return const SizedBox(
height: 44,
child: Center(child: Text('选择元素或添加内容')),
);
}
/// 画笔模式选项 — 颜色 + 粗细
Widget _buildBrushOptions(BuildContext context, ColorScheme colorScheme) {
return SizedBox(
height: 44,
child: Row(