- 목표
- 탭이 있는 레이아웃 만들기
- 탭 클릭시 메인 컨테이너 변경하기
- 탭 종류 (홈 , 유저 , 설정)
main_container.dart
import 'package:flutter/material.dart'; class MainContainer extends StatelessWidget { MainContainer({super.key}); final List<Tab> tabs = <Tab>[ const Tab(text: '홈', icon: Icon(Icons.home)), const Tab(text: '사용자', icon: Icon(Icons.supervisor_account_sharp)), const Tab(text: '설정', icon: Icon(Icons.settings)) ]; @override Widget build(BuildContext context) { return DefaultTabController( length: tabs.length, child: Scaffold( appBar: AppBar( title : const Text("UserManager"), leading: const Icon(Icons.favorite, color : Colors.pink, size : 24.0, semanticLabel: "test favorite icon",), // bottom: TabBar( // tabs: tabs, // ), ), bottomNavigationBar: Container(color: const Color(0xFF3F5AA6), child: TabBar(tabs: tabs)), body: TabBarView( children: tabs.map((Tab tab) { final String label = tab.text.toString().toLowerCase(); return Center( child: Text( 'This is the $label tab', style: const TextStyle(fontSize: 36), ), ); }).toList(), ), ), ); } }