showModalBottomSheet更新state

要使用
StatefulBuilder

eg:

showModalBottomSheet(
        backgroundColor: Colors.transparent,
        context: context,
        builder: (context) {
          return StatefulBuilder(builder: (context,state){
            return Container(
            decoration: BoxDecoration(
                color: Colors.white, borderRadius: BorderRadius.circular(50.w)),
            child: Column(
              children: [
                Container(
                  alignment: Alignment.center,
                  child: Text(
                    '修改環境',
                    style: TextStyle(fontSize: 40.sp, color: Colors.black),
                  ),
                  height: 160.w,
                ),
                _buildListViewItem('測試環境', weegetConf.Env.test,state),
                Divider(),
                _buildListViewItem('集成環境', weegetConf.Env.release,state),
                Divider(),
                _buildListViewItem('預發佈環境', weegetConf.Env.releaseV2,state),
                Divider(),
                _buildListViewItem('生產環境', weegetConf.Env.product,state),
                _submitBtn(),
              ],
            ),
          );
          });
        });
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章