Skip to content

Instantly share code, notes, and snippets.

@betapcode
Created December 21, 2018 08:06
Show Gist options
  • Save betapcode/fbebf6bd2dba292bbe6acfc607fc3f41 to your computer and use it in GitHub Desktop.
Save betapcode/fbebf6bd2dba292bbe6acfc607fc3f41 to your computer and use it in GitHub Desktop.
[flutter] tabber demo example 02
import 'package:flutter/material.dart';
class AudioTabsScreen extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return new _AudioTabsState();
}
}
class _AudioTabsState extends State<AudioTabsScreen> {
// C2
Widget build(context) {
return DefaultTabController(
length: 4,
child: Scaffold(
appBar: _buildAppBar(),
body: _buildBody(),
),
);
}
Widget _buildAppBar() {
return AppBar(
//backgroundColor: const Color(0xFF0099a9),
bottom: TabBar(
//labelColor: Colors.red,
indicatorColor: Colors.red,
isScrollable: true,
tabs: [
Tab(
//icon: Icon(Icons.directions_car),
text: "Car",
),
Tab(
//icon: Icon(Icons.directions_transit),
text: "Transit",
),
Tab(
//icon: Icon(Icons.directions_bike),
text: "Bike",
),
Tab(
//icon: Icon(Icons.directions_bike),
text: "Bike 2",
),
],
),
title: Text('Audio'),
);
}
Widget _buildBody() {
return TabBarView(
children: [
Icon(Icons.directions_car),
Icon(Icons.directions_transit),
Icon(Icons.directions_bike),
Icon(Icons.directions_bus),
],
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment