93 lines
2.5 KiB
Dart
93 lines
2.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../../features/settings/presentation/pages/settings_page.dart';
|
|
import '../../features/chat/presentation/pages/chats_page.dart';
|
|
import '../../l10n/app_localizations.dart';
|
|
|
|
class MainScreen extends StatefulWidget {
|
|
static const String routeName = '/main';
|
|
|
|
const MainScreen({super.key});
|
|
|
|
@override
|
|
State<MainScreen> createState() => _MainScreenState();
|
|
}
|
|
|
|
class _MainScreenState extends State<MainScreen> {
|
|
int _currentIndex = 0;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final l10n = AppLocalizations.of(context)!;
|
|
return Scaffold(
|
|
body: IndexedStack(
|
|
index: _currentIndex,
|
|
children: const [
|
|
ChatsTab(),
|
|
ContactsTab(),
|
|
SettingsTab(),
|
|
],
|
|
),
|
|
bottomNavigationBar: BottomNavigationBar(
|
|
currentIndex: _currentIndex,
|
|
onTap: (index) => setState(() => _currentIndex = index),
|
|
type: BottomNavigationBarType.fixed,
|
|
items: [
|
|
BottomNavigationBarItem(
|
|
icon: const Icon(Icons.chat_bubble_outline),
|
|
activeIcon: const Icon(Icons.chat_bubble),
|
|
label: l10n.chats,
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: const Icon(Icons.contacts_outlined),
|
|
activeIcon: const Icon(Icons.contacts),
|
|
label: l10n.contacts,
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: const Icon(Icons.settings_outlined),
|
|
activeIcon: const Icon(Icons.settings),
|
|
label: l10n.settings,
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ChatsTab extends StatelessWidget {
|
|
const ChatsTab({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return const ChatsPage();
|
|
}
|
|
}
|
|
|
|
class ContactsTab extends StatelessWidget {
|
|
const ContactsTab({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return const Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Icon(Icons.contacts_outlined, size: 64, color: Colors.grey),
|
|
SizedBox(height: 16),
|
|
Text('Контакты', style: TextStyle(fontSize: 18)),
|
|
SizedBox(height: 8),
|
|
Text('Функция в разработке', style: TextStyle(color: Colors.grey)),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class SettingsTab extends StatelessWidget {
|
|
const SettingsTab({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return const SettingsPage();
|
|
}
|
|
}
|