DEV Community

Alexandre Freire
Alexandre Freire

Posted on

Botão responsivo no Flutter

Uma solução interessante para criar um botão responsivo no flutter é utilizar o SizedBox.expand widget, que força o filho a corresponder ao tamanho do pai.

new SizedBox.expand(
  child: new RaisedButton(...),
)
Enter fullscreen mode Exit fullscreen mode

Existem muitas alternativas, o que permite mais ou menos essa personalização:

new SizedBox(
  width: double.infinity,
  // height: double.infinity,
  child: new RaisedButton(...),
)
Enter fullscreen mode Exit fullscreen mode

ou usando um ConstrainedBox

new ConstrainedBox(
    constraints: const BoxConstraints(minWidth: double.infinity),
    child: new RaisedButton(...),
)
Enter fullscreen mode Exit fullscreen mode

Top comments (0)