Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 1 addition & 19 deletions lib/core/app_routes.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';

Expand Down Expand Up @@ -189,7 +188,7 @@ final GoRouter appRouter = GoRouter(
),
GoRoute(
path: AppRoute.relays,
builder: (_, __) => const _Stub('Relays'),
redirect: (_, __) => AppRoute.settings,
),
GoRoute(
path: AppRoute.walletSettings,
Expand Down Expand Up @@ -228,20 +227,3 @@ final GoRouter appRouter = GoRouter(
],
);

// ── Placeholder screen ─────────────────────────────────────────────────────────

class _Stub extends StatelessWidget {
const _Stub(this.name);

final String name;

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text(name)),
body: Center(
child: Text(name, style: Theme.of(context).textTheme.bodyLarge),
),
);
}
}
67 changes: 61 additions & 6 deletions lib/features/chat/screens/chat_rooms_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,41 @@ import 'package:mostro/features/chat/widgets/chat_list_item.dart';
import 'package:mostro/features/disputes/widgets/disputes_list.dart';
import 'package:mostro/features/drawer/screens/drawer_menu.dart';
import 'package:mostro/shared/widgets/bottom_nav_bar.dart';
import 'package:mostro/shared/widgets/notification_bell.dart';

/// Route: /chat_list
///
/// Top-level chat screen with two tabs: Messages and Disputes.
class ChatRoomsScreen extends ConsumerWidget {
class ChatRoomsScreen extends StatefulWidget {
const ChatRoomsScreen({super.key});

@override
Widget build(BuildContext context, WidgetRef ref) {
State<ChatRoomsScreen> createState() => _ChatRoomsScreenState();
}

class _ChatRoomsScreenState extends State<ChatRoomsScreen> {
bool _drawerOpen = false;

@override
Widget build(BuildContext context) {
final colors = Theme.of(context).extension<AppColors>();
if (colors == null) throw StateError('AppColors theme extension must be registered');
final textTheme = Theme.of(context).textTheme;
final green = colors.mostroGreen;

final isDesktop =
MediaQuery.sizeOf(context).width >= AppBreakpoints.desktop;

final mainContent = Column(
children: [
if (!isDesktop)
SafeArea(
bottom: false,
child: _ChatAppBar(
green: green,
onMenuTap: () => setState(() => _drawerOpen = true),
),
),
TabBar(
indicatorColor: colors.mostroGreen,
labelColor: colors.mostroGreen,
Expand Down Expand Up @@ -55,21 +72,59 @@ class ChatRoomsScreen extends ConsumerWidget {
Expanded(child: SafeArea(child: mainContent)),
],
)
: mainContent;
: Stack(
children: [
mainContent,
if (_drawerOpen)
DrawerMenu(
onClose: () => setState(() => _drawerOpen = false),
),
],
);

return DefaultTabController(
length: 2,
child: Scaffold(
appBar: isDesktop
? null
: AppBar(title: const Text('Chat')),
body: body,
bottomNavigationBar: const BottomNavBar(),
),
);
}
}

// ── Mobile app bar ─────────────────────────────────────────────────────────────

class _ChatAppBar extends StatelessWidget {
const _ChatAppBar({required this.green, required this.onMenuTap});

final Color green;
final VoidCallback onMenuTap;

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(
horizontal: AppSpacing.sm,
vertical: AppSpacing.xs,
),
child: Row(
children: [
IconButton(
onPressed: onMenuTap,
icon: const Icon(Icons.menu, size: 24),
tooltip: 'Menu',
),
const Spacer(),
Icon(Icons.psychology, size: 28, color: green),
const Spacer(),
const NotificationBell(),
const SizedBox(width: AppSpacing.sm),
],
),
);
}
}

// ── Messages tab ──────────────────────────────────────────────────────────────

class _MessagesTab extends ConsumerWidget {
Expand Down
Loading