Skip to content

Instantly share code, notes, and snippets.

@gabrielgatu
Created November 22, 2021 08:08
Show Gist options
  • Save gabrielgatu/64afd53a0a9144aa9e071649dbe1142a to your computer and use it in GitHub Desktop.
Save gabrielgatu/64afd53a0a9144aa9e071649dbe1142a to your computer and use it in GitHub Desktop.
Flutter2Start - TabBar #flutter2start
// ignore_for_file: use_key_in_widget_constructors, prefer_const_constructors, prefer_const_literals_to_create_immutables
import 'package:flutter/material.dart';
void main() {
runApp(App());
}
class App extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: HomePage(),
);
}
}
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return DefaultTabController(
length: 2,
child: Scaffold(
appBar: AppBar(
title: Text("Flutter2Start"),
centerTitle: true,
bottom: TabBar(
tabs: [
Tab(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.home),
SizedBox(width: 16),
Text("Home"),
],
),
),
Tab(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.person),
SizedBox(width: 16),
Text("Profilo"),
],
),
),
],
),
),
body: TabBarView(
children: [
Center(
child: Text("Home"),
),
Center(
child: Text("Profilo"),
),
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment