tabbed_view 1.11.0 tabbed_view: ^1.11.0 copied to clipboard
Flutter widget inspired by the classic Desktop-style tab component. Supports customizable themes.
import 'package:flutter/material.dart';
import 'package:tabbed_view/tabbed_view.dart';
void main() {
runApp(TabbedViewExample());
}
class TabbedViewExample extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false, home: TabbedViewExamplePage());
}
}
class TabbedViewExamplePage extends StatefulWidget {
@override
_TabbedViewExamplePageState createState() => _TabbedViewExamplePageState();
}
class _TabbedViewExamplePageState extends State<TabbedViewExamplePage> {
late TabbedViewController _controller;
@override
void initState() {
super.initState();
List<TabData> tabs = [];
tabs.add(TabData(
text: 'Tab 1',
content: Padding(child: Text('Hello'), padding: EdgeInsets.all(8))));
tabs.add(TabData(
text: 'Tab 2',
content:
Padding(child: Text('Hello again'), padding: EdgeInsets.all(8))));
tabs.add(TabData(
text: 'TextField',
content: Padding(
child: TextField(
decoration: InputDecoration(
isDense: true, border: OutlineInputBorder())),
padding: EdgeInsets.all(8)),
keepAlive: true));
_controller = TabbedViewController(tabs);
}
@override
Widget build(BuildContext context) {
TabbedView tabbedView = TabbedView(controller: _controller);
return Scaffold(
body: Container(child: tabbedView, padding: EdgeInsets.all(32)));
}
}