Skip to content

Commit

Permalink
feat: show user details in home page
Browse files Browse the repository at this point in the history
  • Loading branch information
thisissandipp committed Jan 25, 2025
1 parent 0d289b4 commit b885c15
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/firebase_login/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Example flutter app built with Riverpod that demonstrates authentication with Fi
<img src="./samples/demo.gif" alt="demo" width="320">
<img src="./samples/error.png" alt="error" width="320">
<img src="./samples/signup.png" alt="signup" width="320">
<img src="./samples/home.png" alt="home" width="320">

## Features

Expand Down
18 changes: 18 additions & 0 deletions examples/firebase_login/lib/home/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

import '../auth/auth_repository.dart';
import '../main.dart';

class HomePage extends ConsumerWidget {
const HomePage({super.key});

@override
Widget build(BuildContext context, WidgetRef ref) {
final authProvider = ref.read(authRepositoryProvider);
final user = ref.watch(userProvider).value;

return Scaffold(
appBar: AppBar(
title: const Text('Home Page'),
Expand All @@ -19,6 +22,21 @@ class HomePage extends ConsumerWidget {
),
],
),
body: Padding(
padding: const EdgeInsets.only(bottom: 2 * kToolbarHeight),
child: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 16,
children: [
Text('User ID: ${user?.id ?? ''}'),
Text('Name: ${user?.name ?? ''}'),
Text('Email: ${user?.email ?? ''}'),
],
),
),
),
);
}
}
Binary file added examples/firebase_login/samples/home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b885c15

Please sign in to comment.