It seems that when I add alignment inside each container in Stack, the only button that would work is always the last one.

What causes this behavior?

      child: Stack(
        children: <Widget>[

          //Button_1
          new Container(
            child: Align(
              alignment: Alignment(-0.34, -1),
                child: new FlatButton(
                  color: Color.fromRGBO(255, 255, 0, 0.3),
                  onPressed: () {
                    Navigator.push(
                      context,
                      MaterialPageRoute(builder: (context) => MapMain()),
                    );
                  },
                ),
              ),
            ),

          // button_2
          new Container(
            child: Align(
              alignment: Alignment(1, -1),
                child: new FlatButton(
                  color: Color.fromRGBO(255, 105, 0, 0.3),
                  onPressed: () {
                    Navigator.push(
                      context,
                      MaterialPageRoute(builder: (context) => MapMain()),
                    );
                  },
                ),
              ),
            ),
        ],
      ),

0 Answers