import 'package:flutter/material.dart';
import 'package:test_app/button.dart';
void main() {
runApp(
MaterialApp(
home: Scaffold(
body: Center(
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
TestButton(buttonText: '1', onPressed: () {}),
TestButton(buttonText: '2', onPressed: () {}),
],
),
Expanded(
child: TestButton(buttonText: '3', onPressed: () {}),
),
],
),
),
),
),
);
}
This my code so far, the button with the text "3" is just next to button "1". The hight below is missing:
This is how my UI looks like now
I want the App UI to look like this Picture:
Buttons should be placed like this
I tried to look a solution up on the Flutter documentation and I also tried it with ChatGPT without success. Maybe there is someone who is able to help me, thank you.
2
Answers
Your problem is that you managed the arrangement of your elements badly. The beauty of Dart, from my point of view, is that you can arrange the elements as you like and like, with many besstemmies sometimes. I advise you to divide the screen space in half, with size box or you can use a row and inside put two expansion and inside them put the buttons so they will take
coumn
It would be the scheme of what I explained to you above.
Your mistake was to have put out the Expanded that contains the 3 button from Column. You have to put it in.
Try this Code