fix: 修复 M3 下多选面板图标按钮尺寸显示问题

- 为 Image.asset 添加 width 和 height 参数
- 桌面端图标设置为 30x30
- 移动端图标设置为 40x40
- 修复 IconButton 的 iconSize 参数对 Image.asset 不生效的问题
This commit is contained in:
Max 2026-01-06 15:59:15 +08:00
parent cc76651dba
commit 2599ce7cca
1 changed files with 56 additions and 35 deletions

View File

@ -25,12 +25,10 @@ class MultiSelectPanel extends TIMUIKitStatelessWidget {
_handleForwardMessage(BuildContext context, bool isMergerForward,
TUIChatSeparateViewModel model) {
//
if (model.getSelectedMessageList().isEmpty) {
onTIMCallback(TIMCallback(
type: TIMCallbackType.INFO,
infoRecommendText: TIM_t("请选择要操作的消息!")));
type: TIMCallbackType.INFO, infoRecommendText: TIM_t("请选择要操作的消息!")));
return;
}
@ -46,14 +44,15 @@ class MultiSelectPanel extends TIMUIKitStatelessWidget {
//
if (model.isVoteMessage(v2TimMessage)) {
onTIMCallback(TIMCallback(
type: TIMCallbackType.INFO,
infoRecommendText: TIM_t("投票消息不支持转发!")));
type: TIMCallbackType.INFO,
infoRecommendText: TIM_t("投票消息不支持转发!")));
return;
}
}
// 30
if (!isMergerForward && model.getSelectedMessageList().length > forwardMsgNumLimit) {
if (!isMergerForward &&
model.getSelectedMessageList().length > forwardMsgNumLimit) {
_showForwardLimitDialog(context);
return;
}
@ -105,20 +104,19 @@ class MultiSelectPanel extends TIMUIKitStatelessWidget {
submitWidget: Text(TIM_t("发送")),
width: MediaQuery.of(context).size.width * 0.5,
height: MediaQuery.of(context).size.height * 0.8,
onSubmit: (){
onSubmit: () {
forwardMessageScreenKey.currentState?.handleForwardMessage();
},
child: (onClose) => Container(
padding: const EdgeInsets.symmetric( horizontal: 10),
child: ForwardMessageScreen(
model: model,
key: forwardMessageScreenKey,
onClose: onClose,
isMergerForward: isMergerForward,
conversationType: conversationType,
),
)
);
padding: const EdgeInsets.symmetric(horizontal: 10),
child: ForwardMessageScreen(
model: model,
key: forwardMessageScreenKey,
onClose: onClose,
isMergerForward: isMergerForward,
conversationType: conversationType,
),
));
}
@override
@ -145,7 +143,7 @@ class MultiSelectPanel extends TIMUIKitStatelessWidget {
children: [
Expanded(
child: Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
crossAxisAlignment: WrapCrossAlignment.center,
alignment: WrapAlignment.center,
spacing: 64,
children: [
@ -154,7 +152,9 @@ class MultiSelectPanel extends TIMUIKitStatelessWidget {
IconButton(
icon: Image.asset('images/forward.png',
package: 'tencent_cloud_chat_uikit',
color: theme.selectPanelTextIconColor),
color: theme.selectPanelTextIconColor,
width: 30,
height: 30),
iconSize: 30,
onPressed: () {
_handleForwardMessageWide(context, false, model);
@ -170,7 +170,9 @@ class MultiSelectPanel extends TIMUIKitStatelessWidget {
IconButton(
icon: Image.asset('images/merge_forward.png',
package: 'tencent_cloud_chat_uikit',
color: theme.selectPanelTextIconColor),
color: theme.selectPanelTextIconColor,
width: 30,
height: 30),
iconSize: 30,
onPressed: () {
_handleForwardMessageWide(context, true, model);
@ -178,8 +180,8 @@ class MultiSelectPanel extends TIMUIKitStatelessWidget {
),
Text(
TIM_t("合并转发"),
style:
TextStyle(color: theme.selectPanelTextIconColor, fontSize: 12),
style: TextStyle(
color: theme.selectPanelTextIconColor, fontSize: 12),
)
],
),
@ -188,11 +190,14 @@ class MultiSelectPanel extends TIMUIKitStatelessWidget {
IconButton(
icon: Image.asset('images/delete.png',
package: 'tencent_cloud_chat_uikit',
color: theme.selectPanelTextIconColor),
color: theme.selectPanelTextIconColor,
width: 30,
height: 30),
iconSize: 30,
onPressed: () {
TUIKitWidePopup.showSecondaryConfirmDialog(
operationKey: TUIKitWideModalOperationKey.confirmDeleteMessages,
operationKey: TUIKitWideModalOperationKey
.confirmDeleteMessages,
context: context,
text: TIM_t("确定删除已选消息"),
theme: theme,
@ -205,14 +210,18 @@ class MultiSelectPanel extends TIMUIKitStatelessWidget {
),
Text(TIM_t("删除"),
style: TextStyle(
color: theme.selectPanelTextIconColor, fontSize: 12))
color: theme.selectPanelTextIconColor,
fontSize: 12))
],
),
InkWell(
onTap: (){
onTap: () {
model.updateMultiSelectStatus(false);
},
child: Icon(Icons.close, color: theme.darkTextColor,),
child: Icon(
Icons.close,
color: theme.darkTextColor,
),
)
],
))
@ -223,8 +232,8 @@ class MultiSelectPanel extends TIMUIKitStatelessWidget {
decoration: BoxDecoration(
border: Border(
top: BorderSide(
color: theme.weakDividerColor ??
CommonColor.weakDividerColor)),
color:
theme.weakDividerColor ?? CommonColor.weakDividerColor)),
color: theme.selectPanelBgColor ?? theme.primaryColor,
),
padding: const EdgeInsets.only(top: 12, bottom: 48),
@ -235,21 +244,28 @@ class MultiSelectPanel extends TIMUIKitStatelessWidget {
children: [
IconButton(
icon: Image.asset('images/forward.png',
package: 'tencent_cloud_chat_uikit', color: theme.selectPanelTextIconColor),
package: 'tencent_cloud_chat_uikit',
color: theme.selectPanelTextIconColor,
width: 40,
height: 40),
iconSize: 40,
onPressed: () {
_handleForwardMessage(context, false, model);
},
),
Text(TIM_t("逐条转发"),
style: TextStyle(color: theme.selectPanelTextIconColor, fontSize: 12))
style: TextStyle(
color: theme.selectPanelTextIconColor, fontSize: 12))
],
),
Column(
children: [
IconButton(
icon: Image.asset('images/merge_forward.png',
package: 'tencent_cloud_chat_uikit', color: theme.selectPanelTextIconColor),
package: 'tencent_cloud_chat_uikit',
color: theme.selectPanelTextIconColor,
width: 40,
height: 40),
iconSize: 40,
onPressed: () {
_handleForwardMessage(context, true, model);
@ -257,7 +273,8 @@ class MultiSelectPanel extends TIMUIKitStatelessWidget {
),
Text(
TIM_t("合并转发"),
style: TextStyle(color: theme.selectPanelTextIconColor, fontSize: 12),
style: TextStyle(
color: theme.selectPanelTextIconColor, fontSize: 12),
)
],
),
@ -265,7 +282,10 @@ class MultiSelectPanel extends TIMUIKitStatelessWidget {
children: [
IconButton(
icon: Image.asset('images/delete.png',
package: 'tencent_cloud_chat_uikit', color: theme.selectPanelTextIconColor),
package: 'tencent_cloud_chat_uikit',
color: theme.selectPanelTextIconColor,
width: 40,
height: 40),
iconSize: 40,
onPressed: () {
showCupertinoModalPopup<String>(
@ -306,7 +326,8 @@ class MultiSelectPanel extends TIMUIKitStatelessWidget {
},
),
Text(TIM_t("删除"),
style: TextStyle(color: theme.selectPanelTextIconColor, fontSize: 12))
style: TextStyle(
color: theme.selectPanelTextIconColor, fontSize: 12))
],
)
],