Raúl Peñate
Raúl Peñate

Reputation: 609

How to resize in flutter with flexible

I'm using flexible to make it responsible

  Widget build(BuildContext context) {
return Scaffold(
  body: Stack(
    children: [
      SafeArea(
          child: Column(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          //Creating timer for white side
          Flexible(child: TimerBox(WhiteSideColor, WhiteSideRotation),),

          //Creating buttons in the middle
          Flexible(child: SizedBox(child: ButtonsInTheMiddle(),)),

          //Creating timer for black side
          Flexible(child: TimerBox(BlackSideColor, BlackSideRotation)),
        ],
      ))
    ],
  ),
); 
}

And I want to make it like this picture below, but i can't resize the Flexible widget in the middle, I tried sizedbox and FractionallySizedBox. And thanks in advance for helping.

PD: I draw some green/blue (i can't tell the color) line boxes arounds that is the size I want to make for the widgets

enter image description here

Upvotes: 1

Views: 524

Answers (2)

Thiago Carvalho
Thiago Carvalho

Reputation: 390

I don't think if I really understand. Do you want to make the middle button has some size? If you want a specific size, use SizedBox to give a height and width, and in its child pass your desired size. If not, use flex factor to Flexible

Upvotes: 1

Yair Chen
Yair Chen

Reputation: 973

You can add the flex factor to each Flexible widget to decide what it's size will be compared to the other Flexible widgets. https://api.flutter.dev/flutter/widgets/Flexible/flex.html

Upvotes: 2

Related Questions