class MyApp extends StatelessWidget {
final List<Tab> myTabs = <Tab>[
Tab(text: '第一頁'),
Tab(text: '第二頁'),
Tab(text: '第三頁'),
];
final pages = [One(), Two(), Three()];
@override
Widget build(BuildContext context) {
return MaterialApp(
home: DefaultTabController(
length: myTabs.length,
child: Scaffold(
appBar: AppBar(
title: Text("TabBarDemo"),
bottom: TabBar(
tabs: myTabs,
),
),
body: TabBarView(
children: <Widget>[One(), Two(), Three()],
),
),
),
);
}
}