I'm creating the button over the image and i want the button at the bottom center of the image
Widget buildBody() {
return Stack(
children: <Widget> [
Image(
image: new AssetImage('assets/homebg.png'),
),
Center(
child: RaisedButton(
onPressed: () => launch("tel://21213123123"),
child: new Text("Call me")
)
),
]
);
}
I expect the output of button should be at the bottom of the image
From Settings, tap Display, and then tap Navigation bar. Make sure Buttons is selected, and then you can choose your desired button setup at the bottom of the screen. Note: This option will also affect the location you swipe when using Swipe gestures.
By default, the shape of the floating action button (FAB) in the flutter is circular and the location is bottom right floated. You can change the location and shape of the floating action button using properties in Scaffold() widget class and FloatingActionButton() widget class.
You can just do it using 'Stack' widget.
Try to add alignment
Stack(
alignment: Alignment.bottomCenter,
children: <Widget>[
Image(
image: new AssetImage('assets/homebg.png'),
),
Padding(
padding: EdgeInsets.all(8.0),
child: RaisedButton(
onPressed: () => launch("tel://21213123123"),
child: new Text("Call me")
)
),
]
);
You can try to use the Positioned widget as a child of Stack.
Stack(
children: [
Image(...),
Positioned(
left: 0.0,
right: 0.0,
bottom: 0.0,
child: yourChildWidget(),
)
]
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With