You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
2.7 KiB

import 'package:flutter/material.dart';
import '../../core/service_locator.dart';
import '../shared/primary_app_bar.dart';
/// Favourites screen displaying user's favorite recipes.
class FavouritesScreen extends StatelessWidget {
const FavouritesScreen({super.key});
@override
Widget build(BuildContext context) {
// Check if user is logged in
final sessionService = ServiceLocator.instance.sessionService;
final isLoggedIn = sessionService?.isLoggedIn ?? false;
return Scaffold(
appBar: PrimaryAppBar(title: 'Favourites'),
body: isLoggedIn ? _buildLoggedInContent() : _buildLoginPrompt(context),
);
}
Widget _buildLoginPrompt(BuildContext context) {
return Center(
child: Padding(
padding: const EdgeInsets.all(24),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.lock_outline, size: 64, color: Colors.grey.shade400),
const SizedBox(height: 16),
Text(
'Please log in to view favourites',
style: Theme.of(context).textTheme.titleLarge?.copyWith(
color: Colors.grey.shade700,
),
textAlign: TextAlign.center,
),
const SizedBox(height: 8),
Text(
'Favourites are associated with your user account',
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
color: Colors.grey.shade600,
),
textAlign: TextAlign.center,
),
const SizedBox(height: 24),
ElevatedButton.icon(
onPressed: () {
// Navigate to User/Session tab (index 3 in bottom nav)
// This is handled by the parent MainNavigationScaffold
},
icon: const Icon(Icons.person),
label: const Text('Go to Login'),
),
],
),
),
);
}
Widget _buildLoggedInContent() {
return const Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.favorite_outline,
size: 64,
color: Colors.grey,
),
SizedBox(height: 16),
Text(
'Favourites Screen',
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
color: Colors.grey,
),
),
SizedBox(height: 8),
Text(
'Your favorite recipes will appear here',
style: TextStyle(
fontSize: 16,
color: Colors.grey,
),
),
],
),
);
}
}

Powered by TurnKey Linux.