0

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.

Thsi is my Card Screen:- enter image description here

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 :-

enter image description here

  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;
                },
              ),
            ),
          ),
Zenixo
  • 727
  • 1
  • 12
  • 36

1 Answers1

0

you can use Flutter Navigator 1.0 to achive that. Try passing argument to the second page Pass arguments to a named route

AceP
  • 112
  • 1
  • 12