چله تابستون 🔥 چله تخفیف استثنایی راکت، این فرصت دیگه پیش نمیاد!
فرصت محدود، تعداد محدودسلام
کد زیر یک لیست رو به صورت داینامیک درست میکنه تو دریافت اطلاعاتش مشکل دارم
بابت هر input باید یک controller ایجاد کنم؟
class _MyHomePageState extends State<MyHomePage> {
List<Widget> Inputs = [];
Widget customInput(String title,String placeHolder){
return Container(
padding: EdgeInsets.all(12),
margin: EdgeInsets.only(bottom: 5),
child: TextFormField(
decoration: InputDecoration(
hintText: placeHolder,
labelText: title
),
),
);
}
@override
void initState() {
Inputs.add(customInput("Email","exampel@Exampel.com"));
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("MyApp"),
centerTitle: false,
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
floatingActionButton: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
FloatingActionButton.extended(
backgroundColor: Colors.blueAccent,
label: Text("Add"),
icon: Icon(Icons.add),
onPressed: (){
setState(() {
Inputs.add(customInput("NewFiled", "NewFiled"));
});
},
),
FloatingActionButton.extended(
backgroundColor: Colors.redAccent,
label: Text("Save"),
icon: Icon(Icons.save),
onPressed: (){
},
),
],
),
body: Form(
child: Column(
children: Inputs,
) ,
),
);
}
}
آیا مایل به ارسال نوتیفیکیشن و اخبار از طرف راکت هستید ؟