E-mail: iuri.souza1@professor.pb.gov.br
import 'package:flutter/material.dart';
void main() => runApp(MaterialApp(
home: HomeComMenu(),
debugShowCheckedModeBanner: false,
));
class HomeComMenu extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
//Appbar com botão de sanduíche
appBar: AppBar(
title: Text("Meu primeiro App"),
backgroundColor: Colors.deepPurple,
),
//Cria o menu lateral
drawer: Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: [
//cabeçalho do menu
UserAccountsDrawerHeader(
decoration: BoxDecoration(color: Colors.deepPurple),
accountName: Text("Iúri Santos"),
accountEmail: Text("teste@email.com"),
currentAccountPicture: CircleAvatar(
backgroundColor: Colors.white,
child: Icon(Icons.person, size: 50, color: Colors.deepPurple),
),
),
//itens do menu
ListTile(
leading: Icon(Icons.home),
title: Text("Início"),
onTap: () {
Navigator.pop(context); //fecha o menu
},
),
ListTile(
leading: Icon(Icons.settings),
title: Text("Configurações"),
onTap: () {
Navigator.pop(context); //fecha o menu
},
),
Divider(),
ListTile(
leading: Icon(Icons.exit_to_app),
title: Text("Sair"),
onTap: () {
Navigator.pop(context); //fecha o menu
},
)
],
),
),
//texto do meio do app
body: SingleChildScrollView(
padding: EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
//Card: ótimo para destacar informações
Card(
elevation: 4,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15)
),
child: Padding(padding: EdgeInsets.all(16),
child: Column(
children: [
Icon(Icons.school, size: 50, color: Colors.deepPurple),
Text(
"Área do Estudante",
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold
),
),
Text("Exemplo de card com elevação")
],
),
),
),
SizedBox(height: 20), // Espaçamento entre elementos
TextField(
decoration: InputDecoration(
labelText: "Digite seu nome",
border: OutlineInputBorder(),
prefixIcon: Icon(Icons.person)
),
),
SizedBox(height: 20), // Espaçamento entre elementos
//Exemplos de botões
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
ElevatedButton.icon(
onPressed: () {},
icon: Icon(Icons.add),
label: Text("Adicionar"),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.green,
foregroundColor: Colors.white
),
),
OutlinedButton(
onPressed: () {},
child: Text("Cancelar")
)
],
),
SizedBox(height: 20), // Espaçamento entre elementos
ClipRRect(
borderRadius: BorderRadius.circular(10),
child: Image.network(
'https://picsum.photos/400/200',
height: 150,
fit: BoxFit.cover,
),
),
Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Text(
"Imagem carregada via URL",
textAlign: TextAlign.center,
style: TextStyle(fontStyle: FontStyle.italic),
),
),
],
),
)
);
}
}