Search code examples
android-studioflutterflutter-layoutflutter-design

I have created two 'raised buttons' but only one is showing. What is the problem here?


I have made total 14 screens in the application, you may see in the code whose link i have provided below. Two raised buttons i have created, one button named 'Wonders of world' on pressing will take it to second screen the other button named 'wonders of India' will take it to eleventh screen. Unfortunately The first button wonder of world is not visible. Why it is not showing? This is the image on running the app, you can see only one raised button visible.

The link of the code


Solution

  • Just wrap your both button in Row Like

    Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    RaisedButton(
                      child: Text("Wonders of World"),
                      onPressed: (){
                        Navigator.push(context, MaterialPageRoute(builder: (context) => SplashUI()));
                      },
                      color: Colors.red,
                      textColor: Colors.yellow,
                      padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
                      splashColor: Colors.grey,
                    ),
                    RaisedButton(
                      child: Text("Wonders of India"),
                      onPressed: (){
                        Navigator.push(context, MaterialPageRoute(builder: (context) => EleventhScreen()));
                      },
                      color: Colors.red,
                      textColor: Colors.yellow,
                      padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
                      splashColor: Colors.grey,
                    )
                  ],
                ),