问题描述
我正在使用此库FA Stepper the link for the library(fa_stepper) 我有5个步骤,每个步骤都有8-10个字段。在每个步骤上,用户单击``继续''按钮并转到下一步。如果我想在整个步骤中创建和维护对象,应该怎么做?就像在最后一步的最后,我需要获取具有键值对的最终JsonObject。
这就是我所做的。
List<FAStep> get mySteps => [
FAStep(
// Title of the Step
title: //Text("Step 1"),Column(
children: <Widget>[
Icon(
Icons.account_Box,color: Colors.grey,size: 24,),Padding(
padding: const EdgeInsets.only(top: 5),child: Text("Step01"),)
],// Content,it can be any widget here. Using basic Text for this example,subtitle: Text("subT"),content: Form(
key: formKeys[0],child: First()
),isActive: true),//2
FAStep(
title: Column(children: <Widget>[
Icon(
Icons.account_Box,Padding(
padding: const EdgeInsets.only(top: 5),child: Text("Step02"),)
]),content:Form(
key: formKeys[1],child: Second()
),//Text("World!"),// You can change the style of the step icon i.e number,editing,etc.
state: FAStepstate.complete,//FAStepState.complete,//3.
FAStep(
title: Column(children: <Widget>[
Icon(
Icons.account_Box,child: Text("Step03"),content:Form(
key: formKeys[2],child: Third()
),// Text("Hello World!"),//4
FAStep(
title: Column(children: <Widget>[
Icon(
Icons.account_Box,child: Text("Step04"),content:Form(
key: formKeys[3],child: Fourth()
),// Text("Hello World 4!"),
];
class First extends StatefulWidget {
@override
_FirstState createState() => _FirstState();
}
class _FirstState extends State<First> {
static var _focusNode = FocusNode();
TextEditingController textEditingController = TextEditingController();
@override
void initState() {
super.initState();
_focusNode.addListener(() {
print('Has focus: $_focusNode.hasFocus');
});
}
@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
TextFormField(
controller:textEditingController,focusNode: _focusNode,keyboardType: TextInputType.text,autocorrect: false,onChanged: (String value) {
print(value);
},onSaved: (String value) {
print(value);
},maxLines: 1,//initialValue: 'Aseem Wangoo',validator: (value) {
if (value.isEmpty || value.length < 1) {
return 'Please enter name';
}
},decoration: Inputdecoration(
labelText: 'Enter your name',hintText: 'Enter a name',//filled: true,icon: const Icon(Icons.person),labelStyle:
TextStyle(decorationStyle: TextdecorationStyle.solid)),],);
} }
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)