feat: 为RecordingButton组件增加自定义图标和图标大小设置

- 添加 idleIcon 参数支持自定义空闲状态图标
- 添加 recordingIcon 参数支持自定义录音状态图标
- 添加 iconSize 参数支持自定义图标大小
- 保持向后兼容性,使用默认图标和大小
- 更新组件文档注释
This commit is contained in:
Max 2025-09-10 09:32:02 +08:00
parent c6b3396345
commit ec003dcd4b
1 changed files with 5 additions and 1 deletions

View File

@ -52,6 +52,9 @@ class RecordingButton extends StatefulWidget {
/// ///
final IconData? recordingIcon; final IconData? recordingIcon;
///
final double iconSize;
const RecordingButton({ const RecordingButton({
super.key, super.key,
this.speechService, this.speechService,
@ -68,6 +71,7 @@ class RecordingButton extends StatefulWidget {
this.tooltip, this.tooltip,
this.idleIcon, this.idleIcon,
this.recordingIcon, this.recordingIcon,
this.iconSize = 40.0,
}); });
@override @override
@ -236,7 +240,7 @@ class _RecordingButtonState extends State<RecordingButton>
_isListening _isListening
? (widget.recordingIcon ?? Icons.stop_rounded) ? (widget.recordingIcon ?? Icons.stop_rounded)
: (widget.idleIcon ?? Icons.mic_rounded), : (widget.idleIcon ?? Icons.mic_rounded),
size: widget.size * 0.55, size: widget.iconSize,
color: iconColor, color: iconColor,
), ),
), ),