This is an app I'm trying to create, I'm trying to add a button to get to the menu, but I don't know where to add it.
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
Expanded(
child: Container(
color: Colors.black,
child: Center(
child: Stack(
children: [
Updown(
updownY: UpdownY,
)
],
)),
))
],
),
);
}
}
Hope someone with a good heart can guide me in this difficult matter.
CodePudding user response:
It should be something like this assuming you use ElevatedButton
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
Expanded(
child: Container(
color: Colors.black,
child: Center(
child: Stack(
children: [
Updown(
updownY: UpdownY,
),
GestureDetector(
onLongPress: () => "Navigate",
child: const Image(
height: 60,
image: AssetImage("assets/your_asset.jpg"),
),
)
],
)),
))
],
),
);
}
}
CodePudding user response:
If you meant you want to show the AppBar menu, so you can try this:
Scaffold(
appBar: AppBar(
title: Text('My app'),
centerTitle: true,
)
Or if you meant to add a normal button to the screen, so you can add many kinds of buttons (elevated - material - text - ...etc).
In general I use MaterialButton
, it's simply to use it, like this:
MaterialButton(
onPressed: () {},
color: Colors.blueAccent,
child: const Text('Test button'),
),