I have A Card data in one sceen and I save Card Text in a List.So I need to do when I press (onTap) My Card The Text data send to the anothe screen.In second screen I have some Text Field and Card value need to fill on thiss text field.
class _LoadDataState extends State<LoadData> {
String cupcakeName = '';
String cupcakeDesc = '';
String cupcakePrice = '';
String listDocID = '';
var cakeData = [];
List<String> strArr = [];
@override
Widget build(BuildContext context) {
return Container(
child: ListView(
return Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12)),
child: new InkWell(
onTap: () { //This is the methord I need to send my data
cupcakeName = (data['cupcake_name']);
cupcakeDesc = (data['description']);
cupcakePrice = (data['price']);
strArr = [cupcakeName, cupcakeDesc, cupcakePrice];
print(strArr);
},
child: Container(
padding: EdgeInsets.all(16),
child: Column(
children: <Widget>[
Text(
data['cupcake_name'],
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
}).toList(),
),
Thsi is my secodn screen Text Field :-
Widget build(BuildContext context) {
return Scaffold(
body: ListView(
shrinkWrap: true,
children: <Widget>[
DropDown(),
Form(
key: _cupcakeKey,
autovalidateMode: AutovalidateMode.always,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: TextFormField(
decoration: InputDecoration(
controller: cupCake,
validator: (_val) {
if (_val!.isEmpty) {
return "Can't Be Empty";
} else {
return null;
}
},
onChanged: (cupcake) {
cupcakeName = cupcake;
},
),
),
),