a85890f30a
- mobile/: Flutter/Dart merchant mobile app skeleton - .github/: GitHub Actions CI workflows - .dockerignore: exclude host node_modules from build context - .cursorrules: Cursor IDE project rules - .claude/: Claude Code project settings and launch config Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
68 lines
2.0 KiB
Dart
68 lines
2.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
import '../notifications/notification_provider.dart';
|
|
import '../notifications/notifications_screen.dart';
|
|
import '../shift/shift_screen.dart';
|
|
import '../tables/table_board_screen.dart';
|
|
|
|
class HomeScreen extends ConsumerStatefulWidget {
|
|
const HomeScreen({super.key});
|
|
|
|
@override
|
|
ConsumerState<HomeScreen> createState() => _HomeScreenState();
|
|
}
|
|
|
|
class _HomeScreenState extends ConsumerState<HomeScreen> {
|
|
int _tab = 0;
|
|
|
|
static const _screens = [
|
|
NotificationsScreen(),
|
|
TableBoardScreen(),
|
|
ShiftScreen(),
|
|
];
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final unread = ref.watch(
|
|
notificationProvider.select((s) => s.unreadCount),
|
|
);
|
|
|
|
return Directionality(
|
|
textDirection: TextDirection.rtl,
|
|
child: Scaffold(
|
|
body: IndexedStack(index: _tab, children: _screens),
|
|
bottomNavigationBar: NavigationBar(
|
|
selectedIndex: _tab,
|
|
onDestinationSelected: (i) => setState(() => _tab = i),
|
|
destinations: [
|
|
NavigationDestination(
|
|
icon: Badge(
|
|
isLabelVisible: unread > 0,
|
|
label: Text(unread > 9 ? '۹+' : '$unread'),
|
|
child: const Icon(Icons.notifications_outlined),
|
|
),
|
|
selectedIcon: Badge(
|
|
isLabelVisible: unread > 0,
|
|
label: Text(unread > 9 ? '۹+' : '$unread'),
|
|
child: const Icon(Icons.notifications),
|
|
),
|
|
label: 'اعلانها',
|
|
),
|
|
const NavigationDestination(
|
|
icon: Icon(Icons.table_restaurant_outlined),
|
|
selectedIcon: Icon(Icons.table_restaurant),
|
|
label: 'میزها',
|
|
),
|
|
const NavigationDestination(
|
|
icon: Icon(Icons.person_outline),
|
|
selectedIcon: Icon(Icons.person),
|
|
label: 'شیفت من',
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|