Junior — Middle
Que tipos de widgets típicos costuma usar nos seus projetos?
sobes.tech IA
Resposta da IA
Nos projetos Flutter, costumo usar os seguintes widgets típicos:
-
Container — widget universal para criar áreas retangulares com margens, bordas e fundo.
-
Column e Row — para disposição vertical e horizontal de widgets filhos.
-
Text — para exibir texto.
-
ListView — para criar listas roláveis.
-
Stack — para sobrepor widgets uns sobre os outros.
-
Scaffold — estrutura básica de tela com suporte para AppBar, Drawer e outros elementos.
-
ElevatedButton — para botões com efeito de elevação.
Exemplo de uma tela simples com texto e botão:
import 'package:flutter/material.dart';
class MyHomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Exemplo')),
body: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text('Olá, Flutter!'),
SizedBox(height: 20),
ElevatedButton(
onPressed: () => print('Botão pressionado'),
child: Text('Pressione-me'),
),
],
),
),
);
}
}