Skip to content

Instantly share code, notes, and snippets.

@Lesliecalvillo
Last active May 15, 2021 00:42
Show Gist options
  • Save Lesliecalvillo/da12713f1f9d1d291bcf5172b636f65c to your computer and use it in GitHub Desktop.
Save Lesliecalvillo/da12713f1f9d1d291bcf5172b636f65c to your computer and use it in GitHub Desktop.
POO Act11 Navigator Bar icons
import 'package:flutter/material.dart';
void main() => runApp(LeslieApp());
class LeslieApp extends StatefulWidget {
@override
_LeslieAppState createState() => _LeslieAppState();
} // Fin LeslieApp
class _LeslieAppState extends State<LeslieApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(brightness: Brightness.dark),
home: Principal()); // fin materialApp
}// fin de widget
}// fin clase _LeslieAppState
class Principal extends StatefulWidget {
@override
_PrincipalState createState() => _PrincipalState();
} // fin clase principal
class _PrincipalState extends State<Principal> with
SingleTickerProviderStateMixin {
TabController controller;
void initState() {
super.initState();
controller = TabController(
length: 6,
vsync: this,
initialIndex: 0,
);// fin TabControler
}// fin de initState
Widget card(String text) {
return Card(
color: Colors.purple,
child: Container(
height: 200.0,
width: 200.0,
child: Center(child: Text(text)),
), // contenedor
); // fin de card
}// fin de widget
Tab tab(String text, Icon icon) {
return Tab(
icon: icon,
text: text,
);
} //fin de tab
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Mi App Leslie Calvillo "),
centerTitle: true,
backgroundColor: Theme.of(context).canvasColor,
elevation: 0.0,
),
body: TabBarView(
controller: controller,
children: <Widget>[
card("Tarjeta No 1 Audifonos"),
card("Tarjeta No 2 Reloj despertador ring ring..."),
card("Tarjeta No 3 Sistema Android"),
card("Tarjeta No 4 Modo Avion"),
card("Tarjeta No 5 WiFi señal inhalambrica"),
card("Tarjeta No 6 Correo electronico"),
],
),
bottomNavigationBar: TabBar(
controller: controller,
isScrollable: true ,
tabs: <Widget>[
tab("Audifonos", Icon(Icons.headset)),
tab("Reloj", Icon(Icons.alarm)),
tab("Android", Icon(Icons.android)),
tab("Avion", Icon(Icons.airplanemode_active)),
tab("Wifi", Icon(Icons.wifi)),
tab("Correo", Icon(Icons.email)),
], // fin widget []
),// fin tabBar Iconos
); // fin de Sacaffold
} // fin widgets
}// clase _PrincipalState
@Lesliecalvillo
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment