한번 좆되서 다시 돌림
This commit is contained in:
@@ -6,7 +6,9 @@ import 'package:flutter/material.dart';
|
||||
import 'home_page.dart'; // HomePage에 콜백을 전달해야 하므로 import 경로 확인
|
||||
import 'plan_page.dart';
|
||||
import 'statistics_page.dart';
|
||||
import 'jobs_page.dart';
|
||||
import 'more_page.dart';
|
||||
import 'common/widgets/custom_bottom_nav_bar.dart';
|
||||
|
||||
void main() {
|
||||
runApp(const MyApp());
|
||||
@@ -51,6 +53,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
HomePage(onNavigateToPlanTab: _onItemTapped), // 콜백 함수 전달
|
||||
const PlanPage(),
|
||||
const StatisticsPage(),
|
||||
const JobsPage(),
|
||||
const MorePage(),
|
||||
];
|
||||
}
|
||||
@@ -59,6 +62,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
setState(() {
|
||||
_selectedIndex = index;
|
||||
});
|
||||
print('Selected index: $_selectedIndex'); // 디버깅 출력 추가
|
||||
// HomePage의 _recommendTimer 제어 로직은 HomePage 내부에서 독립적으로 관리됩니다.
|
||||
// 또는 필요에 따라 GlobalKey 등을 사용하여 HomePage의 상태에 접근할 수 있습니다.
|
||||
}
|
||||
@@ -78,23 +82,22 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
String appBarTitle = 'Home'; // 기본값
|
||||
if (_selectedIndex == 1) {
|
||||
appBarTitle = 'Plan';
|
||||
} else if (_selectedIndex == 2) {
|
||||
}
|
||||
else if (_selectedIndex == 2) {
|
||||
appBarTitle = 'Statistics';
|
||||
} else if (_selectedIndex == 3) {
|
||||
}
|
||||
else if (_selectedIndex == 3) {
|
||||
appBarTitle = 'Jobs';
|
||||
}
|
||||
else if (_selectedIndex == 4) {
|
||||
appBarTitle = 'More';
|
||||
}
|
||||
|
||||
// --- BottomNavigationBar 크기 및 스타일 설정 ---
|
||||
const double customBottomNavHeight = 75.0; // 원하는 BottomNavigationBar 높이
|
||||
const double customBottomNavIconSize = 22.0; // 내부 아이콘 크기 (선택적 조절)
|
||||
const double customBottomNavSelectedFontSize = 12.0; // 선택된 레이블 폰트 크기 (선택적 조절)
|
||||
const double customBottomNavUnselectedFontSize = 10.0; // 미선택 레이블 폰트 크기 (선택적 조절)
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
toolbarHeight: 40,
|
||||
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
||||
title: Text(appBarTitle), // 동적으로 변경된 AppBar 제목
|
||||
title: Text(appBarTitle), // 동적으로 변경된 AppBar 제목\
|
||||
actions: <Widget>[
|
||||
IconButton(
|
||||
icon: const Icon(Icons.notifications),
|
||||
@@ -125,37 +128,10 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
index: _selectedIndex,
|
||||
children: _widgetOptions,
|
||||
),
|
||||
bottomNavigationBar: SizedBox(
|
||||
height: customBottomNavHeight,
|
||||
child: BottomNavigationBar(
|
||||
items: const <BottomNavigationBarItem>[
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.home_filled),
|
||||
label: 'Home',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.calendar_today_outlined),
|
||||
label: 'Plan',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.bar_chart_outlined),
|
||||
label: 'Statistics',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.more_horiz_outlined),
|
||||
label: 'More',
|
||||
),
|
||||
],
|
||||
currentIndex: _selectedIndex,
|
||||
selectedItemColor: Colors.amber[800],
|
||||
unselectedItemColor: Colors.blue,
|
||||
onTap: _onItemTapped,
|
||||
type: BottomNavigationBarType.fixed,
|
||||
iconSize: customBottomNavIconSize,
|
||||
selectedFontSize: customBottomNavSelectedFontSize,
|
||||
unselectedFontSize: customBottomNavUnselectedFontSize,
|
||||
),
|
||||
bottomNavigationBar: CustomBottomNavBar(
|
||||
currentIndex: _selectedIndex,
|
||||
onTap: _onItemTapped,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user