Refactors the HomeScreen to dynamically display content based on the user's authentication status. - Migrated HomeScreen from StatefulWidget to StatelessWidget. - Introduced Consumer<AuthState> to listen for authentication changes. - Implemented placeholder _LoggedInView and _LoggedOutView widgets for conditional rendering. - Restored irebase_core and irebase_auth dependencies to pubspec.yaml and main.dart which were inadvertently removed by dart_fix. - Removed outdated state management for bottom navigation bar. - Addressed dart fix warnings and ensured code formatting.
40 lines
925 B
Dart
40 lines
925 B
Dart
import 'package:flutter/material.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 const Center(child: Text('Logged Out'));
|
|
}
|
|
}
|