gpt4 book ai didi

dart - Flutter - 如何重启或重绘当前屏幕 Widget

转载 作者:IT王子 更新时间:2023-10-29 07:09:45 25 4
gpt4 key购买 nike

我正在使用抽屉导航,我在其中设计了一个屏幕名称作为 PostProperty 屏幕,其中实现了多个文本表单字段、图像上传,我想要的是当用户单击提交/添加按钮时,然后是当前屏幕应该重绘小部件或清除所有表单字段,以便用户可以提交/添加另一个,请指导我,如何实现这一点。

Widget Build Code

  @override
Widget build(BuildContext context) {
return new Scaffold(
key: scaffoldKey,
resizeToAvoidBottomPadding: false,
backgroundColor: Colors.white,
appBar: showAppbar
? AppBar(
title: new Text(
setAppBarTitle(val_property_type),
style:
TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
),
centerTitle: true,
backgroundColor: ColorConstant.bg_color,
)
: null,
body: ModalProgressHUD(
inAsyncCall: _isInAsyncCall,
child: buildPropertyForm(context),
opacity: 0.5,
progressIndicator: CircularProgressIndicator(),
),
);
}

buildPropertyForm 是我在其中包含所有文本表单字段和其他内容的表单。

Please see below screenshot

enter image description here

enter image description here

最佳答案

您可以在提交后动态更改每个 TextFormField 的键,并将 TextEditingControllers 的值更改为 null。

关于dart - Flutter - 如何重启或重绘当前屏幕 Widget,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53993515/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com