flutter 内部一层的innerSetState设置了初始值,在innerSetState改变值也无法视图刷新

本文探讨了在Flutter中使用innerSetState时遇到的问题,即为初始值设置innerSetState不会触发视图刷新,且可能影响后续用户操作的视图更新。建议在初始化时不使用innerSetState。
摘要由CSDN通过智能技术生成
void _show_selected (Function tap) {
    showModalBottomSheet(context: context, builder: (BuildContext context) {
      return StatefulBuilder(builder: (bottomContext, setBottomSheetState) {
        setSelectedState = setBottomSheetState;
        // 在这里初始用bootomSheet的setState设置初始值时,在_popup_item(e, () { setBootomSheetState时会无法触发视图更新})
        setBottomSheetState(() {
          tap();
        });
        return Column(
          children: <Widget>[
            Container(
              width: double.infinity,
              margin: EdgeInsets.only(bottom: UIUtils.bottomBarH),
              padding: EdgeInsets.fromLTRB(16, 16, 16, 24),
              color: Colors.white,
              height: 340,
//              constraints: BoxConstraints(minHeight: 340),
              child: Column(
                children: <Widget>[
                  Text(
                    '请选择默认问诊单',
                    style: TextStyle(
                        fontSize: UIUtils.TextStyle(context).title.fontSize + 2
                    ),
                  ),
                  Padding(
                    padding: EdgeInsets.only(top: 16),
                  ),
                  Expanded(
                      flex: 1,
                      child: ListView(
                        chi
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值