2023-12-14|閱讀時間 ‧ 約 2 分鐘

[Flutter]TabBar

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()],
),
),
),
);
}
}




分享至
成為作者繼續創作的動力吧!
© 2024 vocus All rights reserved.