title: How to pass data from one widget to its sibling widget?
body: <p>I have a Column widget which contains a custom widget (ViewCard) and a RaisedButton.
  There is some data inside ViewCard which the user can interact with and change. Now, I want the RaisedButton to submit those changes or details to the firestore. The problem I am facing right now is that I can't access the custom widget's data from outside of it.</p>
  
  <pre><code>Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: &lt;Widget&gt;[
            SizedBox(height: 20,),
  
            ViewCard(args.combo,_changeprice),
  
            SizedBox(height: 20,),
  
            Container(
              padding: EdgeInsets.only(top: 15),
              height: 75,
              decoration: BoxDecoration(
                color: Colors.yellow,
                borderRadius: BorderRadius.circular(20)
              ),
              child: Card(
                elevation: 0,
                color: Colors.transparent,
                child: Row(
                  children: &lt;Widget&gt;[
                  Text("Cart price : $price"),
                  SizedBox(width: 75,),
                  Container(
                    decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(25),
                      color: Colors.yellow
                    ),
                    child: RaisedButton(
                      onPressed: (){},     
                      child: Text("Host this order"),
                    ),
                  ),
                ],)
              ),
            )
          ],
        ),
  </code></pre>
  
  <p>I need to somehow pass 3 variables from inside of CardView to the current class so that I can use them in RaisedButton.</p>
  
  <p>edit : args.combo is of type Combo</p>
  
  <pre><code>class Combo {
    List&lt;Items&gt; items;
    Combo({this.items});
  }
  class Items {
    String item;
    String price;
  }
  </code></pre>
  
  <p>Here is the code for CardView. This class created a card for args.combo</p>
  
  <pre><code>class ViewCard extends StatefulWidget {
    ViewCard(this.combo, this.changePrice);
    final Combo combo;
    final IntCallback changePrice;
  
    @override
    _ViewCardState createState() =&gt; _ViewCardState();
  }
  
  class _ViewCardState extends State&lt;ViewCard&gt; {
    @override
    Widget build(BuildContext context) {
      return Container(
        height: (50 * widget.combo.items.length + 125).toDouble(),
        padding: EdgeInsets.only(left: 20),
        decoration: BoxDecoration(
            borderRadius: BorderRadius.circular(40), color: Colors.yellow),
        child: Card(
            elevation: 0,
            color: Colors.transparent,
            child: Column(children: &lt;Widget&gt;[
              ListView.builder(
                shrinkWrap: true,
                itemCount: widget.combo.items.length,
                physics: NeverScrollableScrollPhysics(),
                itemBuilder: (context, index) {
                  return Column(
                    children: &lt;Widget&gt;[
                      SizedBox(
                        height: 25,
                      ),
                      OneItem(widget.combo, index, widget.changePrice),
  
                    ],
                  );
                },
              ),
            ])),
      );
    }
  }
  </code></pre>
  
  <p>OneItem is another class which iterates through combo to find the number of items in it. Each Item is printed in a row along with a CheckBox. The user selects some checkboxes and it is this data I need to pass to the top-most class.</p>
  
  <pre><code>class OneItem extends StatefulWidget {
    OneItem(this.combo, this.index, this.changePrice);
    final Combo combo;
    final int index;
    final Function changePrice;
    double priceval;
  
    @override
    State&lt;StatefulWidget&gt; createState() =&gt; OneItemState();
  }
  
  class OneItemState extends State&lt;OneItem&gt; {
    List&lt;bool&gt; Vals = new List();
  
    @override
    void initState() {
      super.initState();
  
      int count = widget.combo.items.length;
  
  
      Vals = List&lt;bool&gt;.generate(count, (_) =&gt; false);
    }
  
    @override
    Widget build(BuildContext context) {
      return Stack(
        children: &lt;Widget&gt;[
          Align(
            child: Text(widget.combo.items[widget.index].item),
            alignment: Alignment(-1, 0),
          ),
          Align(
              child: Text(widget.combo.items[widget.index].price),
              alignment: Alignment(0.1, 0)),
          Align(
              child: Checkbox(
                value: Vals[widget.index],
                onChanged: (bool value) {
                  setState(() {
                    Vals[widget.index] = value;
                    if(value == true){ widget.priceval = double.parse(widget.combo.items[widget.index].price); }
                    else{double val = double.parse(widget.combo.items[widget.index].price); 
                           widget.priceval = -1*val;}
                    widget.changePrice(widget.priceval);
                    print('${widget.priceval}');
                  });
                },
              ),
              alignment: Alignment(0.6, 0)),
        ],
      );
    }
  }
  </code></pre>