tabbar 0.1.1 tabbar: ^0.1.1 copied to clipboard
Simple tabbar, rewritten using pagecontroller and facilitating internal PageView manipulation
import 'package:flutter/material.dart';
import 'package:tabbar/tabbar.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Tabbar Example',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key}) : super(key: key);
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
final controller = PageController();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Tabbar Example"),
centerTitle: true,
bottom: PreferredSize(
preferredSize: Size.fromHeight(kToolbarHeight),
child: TabbarHeader(
controller: controller,
tabs: [
Tab(child: Icon(Icons.ac_unit)),
Tab(text: "Tab 2"),
Tab(child: Icon(Icons.access_alarm)),
],
),
),
),
body: TabbarContent(
controller: controller,
children: <Widget>[
Container(color: Colors.yellow),
Container(color: Colors.red),
Container(color: Colors.purple),
],
),
);
}
}