feat: 为RecordingButton组件增加自定义图标和图标大小设置
- 添加 idleIcon 参数支持自定义空闲状态图标 - 添加 recordingIcon 参数支持自定义录音状态图标 - 添加 iconSize 参数支持自定义图标大小 - 保持向后兼容性,使用默认图标和大小 - 更新组件文档注释
This commit is contained in:
parent
c6b3396345
commit
ec003dcd4b
|
|
@ -52,6 +52,9 @@ class RecordingButton extends StatefulWidget {
|
|||
/// 录音状态时显示的图标
|
||||
final IconData? recordingIcon;
|
||||
|
||||
/// 按钮图标大小
|
||||
final double iconSize;
|
||||
|
||||
const RecordingButton({
|
||||
super.key,
|
||||
this.speechService,
|
||||
|
|
@ -68,6 +71,7 @@ class RecordingButton extends StatefulWidget {
|
|||
this.tooltip,
|
||||
this.idleIcon,
|
||||
this.recordingIcon,
|
||||
this.iconSize = 40.0,
|
||||
});
|
||||
|
||||
@override
|
||||
|
|
@ -236,7 +240,7 @@ class _RecordingButtonState extends State<RecordingButton>
|
|||
_isListening
|
||||
? (widget.recordingIcon ?? Icons.stop_rounded)
|
||||
: (widget.idleIcon ?? Icons.mic_rounded),
|
||||
size: widget.size * 0.55,
|
||||
size: widget.iconSize,
|
||||
color: iconColor,
|
||||
),
|
||||
),
|
||||
|
|
|
|||
Loading…
Reference in New Issue