feat(app): add manual entry and sharing flows
This commit is contained in:
@@ -12,7 +12,7 @@ import '../settings/settings_screen.dart';
|
||||
|
||||
class MainScreen extends ConsumerStatefulWidget {
|
||||
final int initialTab;
|
||||
|
||||
|
||||
const MainScreen({super.key, this.initialTab = 2});
|
||||
|
||||
@override
|
||||
@@ -21,31 +21,30 @@ class MainScreen extends ConsumerStatefulWidget {
|
||||
|
||||
class _MainScreenState extends ConsumerState<MainScreen> {
|
||||
late int _selectedIndex;
|
||||
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_selectedIndex = widget.initialTab;
|
||||
|
||||
|
||||
// 알림 핸들러 설정
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
NotificationService.onNotificationTap = (NotificationResponse response) {
|
||||
if (mounted) {
|
||||
ref.read(notificationHandlerProvider.notifier).handleNotificationTap(
|
||||
context,
|
||||
response.payload,
|
||||
);
|
||||
ref
|
||||
.read(notificationHandlerProvider.notifier)
|
||||
.handleNotificationTap(context, response.payload);
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
NotificationService.onNotificationTap = null;
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
||||
final List<({IconData icon, String label})> _navItems = [
|
||||
(icon: Icons.share, label: '공유'),
|
||||
(icon: Icons.restaurant, label: '맛집'),
|
||||
@@ -53,7 +52,7 @@ class _MainScreenState extends ConsumerState<MainScreen> {
|
||||
(icon: Icons.calendar_month, label: '기록'),
|
||||
(icon: Icons.settings, label: '설정'),
|
||||
];
|
||||
|
||||
|
||||
final List<Widget> _screens = [
|
||||
const ShareScreen(),
|
||||
const RestaurantListScreen(),
|
||||
@@ -61,28 +60,31 @@ class _MainScreenState extends ConsumerState<MainScreen> {
|
||||
const CalendarScreen(),
|
||||
const SettingsScreen(),
|
||||
];
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
|
||||
|
||||
return Scaffold(
|
||||
body: IndexedStack(
|
||||
index: _selectedIndex,
|
||||
children: _screens,
|
||||
),
|
||||
body: IndexedStack(index: _selectedIndex, children: _screens),
|
||||
bottomNavigationBar: NavigationBar(
|
||||
selectedIndex: _selectedIndex,
|
||||
onDestinationSelected: (index) {
|
||||
setState(() => _selectedIndex = index);
|
||||
},
|
||||
backgroundColor: isDark ? AppColors.darkSurface : AppColors.lightSurface,
|
||||
destinations: _navItems.map((item) => NavigationDestination(
|
||||
icon: Icon(item.icon),
|
||||
label: item.label,
|
||||
)).toList(),
|
||||
backgroundColor: isDark
|
||||
? AppColors.darkSurface
|
||||
: AppColors.lightSurface,
|
||||
destinations: _navItems
|
||||
.map(
|
||||
(item) => NavigationDestination(
|
||||
icon: Icon(item.icon),
|
||||
label: item.label,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
indicatorColor: AppColors.lightPrimary.withOpacity(0.2),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user