import 'package:flutter/material.dart';
class AppBarDemoPage extends StatelessWidget {
const AppBarDemoPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return DefaultTabController(
length: 2,
child: Scaffold(
appBar: AppBar(
title: Text("AppBarDemoPage"),
// backgroundColor: Colors.red, // 背景顔色
centerTitle: true, // 文字居中
actions: [
IconButton(
icon: Icon(Icons.search),
onPressed: () {
print('search');
},
),
icon: Icon(Icons.settings),
print('settings');
],
bottom: TabBar(
tabs: [
Tab(text: "熱門"),
Tab(text: "推薦"),
],
),
),
body: TabBarView(
children: [
ListView(
children: [
ListTile(
title: Text("第一個tab"),
),
],
title: Text("第二個tab"),
),
);
}
}