You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter中如何修改NetworkGiffyDialog按钮颜色?

修改NetworkGiffyDialog确认按钮颜色

只需调整buttonOkColor参数的取值,替换当前的Colors.black为注释中的目标色值即可完成修改:

修改后的完整代码片段

builder: (_) => NetworkGiffyDialog(
  title: Text('لايوجد اتصال',
              textAlign: TextAlign.center, style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.w600)),
  description: Text(
    'يبدو أنك غير متصل بالانترنت.يرجى التحقق من اعدادات الشبكة الخاصة بك مرة أخرى',
    textAlign: TextAlign.center,
  ),
  entryAnimation: EntryAnimation.BOTTOM_RIGHT,
  onOkButtonPressed: () { Navigator.of(context).pop(); },
  key: key,
  image: Image.asset("assets/no-internet.jpeg"),
  onCancelButtonPressed: () { Navigator.of(context).pop(); },
  buttonOkColor: Color(0xff8e1538),
  buttonCancelColor: Color(0xff8e1538),
  buttonOkText: Text('تاكد'),
  buttonCancelText: Text("الغاء"),
));

修改要点

删除原buttonOkColor:Colors.black,代码,直接启用注释中的Color(0xff8e1538)作为按钮颜色参数值。

内容的提问来源于stack exchange,提问作者نواف الشهري

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.22 10:33:11