Implements the UI for the _LoggedOutView in home_screen.dart, including: - A centered column layout with an icon, title, and descriptive text. - An ElevatedButton for Login that navigates to the phone input screen using go_router. - Ensured code formatting and resolved any linting issues.
63 lines
1.6 KiB
Dart
63 lines
1.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:phone_login/auth/auth_state.dart';
|
|
|
|
class HomeScreen extends StatelessWidget {
|
|
const HomeScreen({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(title: const Text('Home')),
|
|
body: Consumer<AuthState>(
|
|
builder: (context, authState, child) {
|
|
return authState.isLoggedIn
|
|
? const _LoggedInView()
|
|
: const _LoggedOutView();
|
|
},
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class _LoggedInView extends StatelessWidget {
|
|
const _LoggedInView();
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return const Center(child: Text('Logged In'));
|
|
}
|
|
}
|
|
|
|
class _LoggedOutView extends StatelessWidget {
|
|
const _LoggedOutView();
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
const Icon(Icons.lock, size: 100, color: Colors.grey),
|
|
const SizedBox(height: 20),
|
|
Text('Welcome!', style: Theme.of(context).textTheme.headlineMedium),
|
|
const SizedBox(height: 10),
|
|
const Text(
|
|
'Please log in to continue.',
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(color: Colors.grey),
|
|
),
|
|
const SizedBox(height: 30),
|
|
ElevatedButton(
|
|
onPressed: () {
|
|
context.go('/phone');
|
|
},
|
|
child: const Text('Login'),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|