Skip to content
Open
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
268 changes: 147 additions & 121 deletions .dart_tool/package_config.json

Large diffs are not rendered by default.

401 changes: 401 additions & 0 deletions .dart_tool/package_config_subset

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions .dart_tool/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.24.5
27 changes: 27 additions & 0 deletions firebase-dart-admin-auth-sdk/bin/main.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import 'package:firebase_dart_admin_auth_sdk/src/firebase_auth.dart';
import 'package:firebase_dart_admin_auth_sdk/src/firebase_user/firebase_user_service.dart';
import 'package:firebase_dart_admin_auth_sdk/src/utils.dart';
import '../../utils.dart'; // Import the spinner function


void main() async {
final auth =
FirebaseAuth(apiKey: 'YOUR_API_KEY', projectId: 'YOUR_PROJECT_ID');
final userService = FirebaseUserService(); // Initialize the user service

try {
// Display a spinner while initializing Firebase Auth
showSpinner('Initializing Firebase Auth', 3);

// Sign up a new user
final newUser = await auth.createUserWithEmailAndPassword(
'newuser@aortem.com', 'password123');
Expand All @@ -15,6 +23,25 @@ void main() async {
final userCredential = await auth.signInWithEmailAndPassword(
'newuser@aortem.com', 'password123');
print('Signed in: ${userCredential?.user.email}');

// Fetch users
print('Fetching users...');
final users = await userService.fetchUsers();
print('Fetched ${users.length} users.');

// Sort users by name
print('Sorting users by name...');
final sortedUsers = userService.sortUsers(users, 'name');
for (final user in sortedUsers) {
print('Name: ${user['name']}, Email: ${user['email']}');
}

// Filter users with query 'john'
print('Filtering users with query "john"...');
final filteredUsers = userService.filterUsers(users, 'john');
for (final user in filteredUsers) {
print('Filtered - Name: ${user['name']}, Email: ${user['email']}');
}
} catch (e) {
print('Error: $e');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@ class _SignInWithEmailAndPasswordScreenState
controller: _emailController,
hint: 'test@gmail.com',
label: 'Email',
tooltip: 'Enter your registered email address', // Tooltip added
),
20.vSpace,
InputField(
controller: _passwordController,
hint: '******',
label: 'Password',
obscure: true,
tooltip: 'Enter your account password', // Tooltip added
),
20.vSpace,
Button(
Expand All @@ -65,6 +67,7 @@ class _SignInWithEmailAndPasswordScreenState
);
},
title: 'Sign In',
loading: value.loading, // Spinner already integrated
),
20.vSpace,
GestureDetector(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@ class _SignUpScreenState extends State<SignUpScreen> {
label: 'Email',
hint: '1234@gmail.com',
controller: _emailController,
tooltip: 'Enter your email address', // Tooltip added
),
30.vSpace,
InputField(
label: 'Password',
hint: '******',
controller: _passwordController,
obscure: true,
tooltip: 'Enter a password with at least 6 characters', // Tooltip added
),
30.vSpace,
Button(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ class _UpdateProfileScreenState extends State<UpdateProfileScreen> {
controller: _displayNameController,
label: 'Display Name',
hint: 'Drake',
tooltip: 'Enter the name you want displayed', // Tooltip added
),
20.vSpace,
InputField(
controller: _displayImageController,
label: 'Display Image',
hint: 'www.sample.jpg',
tooltip: 'Enter a valid image URL', // Tooltip added
),
20.vSpace,
Button(
Expand All @@ -59,7 +61,7 @@ class _UpdateProfileScreenState extends State<UpdateProfileScreen> {
() => Navigator.of(context).pop(),
),
title: 'Update Profile',
loading: value.loading,
loading: value.loading, // Spinner already integrated
),
],
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,50 @@ class ActionTile extends StatelessWidget {
final String title;
final VoidCallback onTap;
final bool loading;
final String? tooltipMessage; // Add a tooltip message

const ActionTile({
super.key,
required this.onTap,
required this.title,
this.loading = false,
this.tooltipMessage,
});

@override
Widget build(BuildContext context) {
return InkWell(
onTap: onTap,
child: Container(
padding: 10.all,
decoration: BoxDecoration(
return Tooltip(
message: tooltipMessage ??
'Perform action: $title', // Display tooltip if provided
child: InkWell(
onTap: loading ? null : onTap, // Disable tap while loading
child: Container(
padding: 10.all,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
border: Border.all(
color: Colors.purple,
)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
loading
? const SizedBox(
height: 15,
width: 15,
child: CircularProgressIndicator(),
)
: Text(title),
const Icon(
Icons.arrow_forward_ios,
color: Colors.purple,
),
],
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
loading
? const SizedBox(
height: 15,
width: 15,
child: CircularProgressIndicator(
strokeWidth: 2,
color: Colors.purple, // Match the theme
),
)
: Text(title),
const Icon(
Icons.arrow_forward_ios,
color: Colors.purple,
),
],
),
),
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ class InputField extends StatelessWidget {
final bool? obscure;
final TextInputType? textInputType;
final bool obscureText;
final String? tooltip; // New field for the tooltip message

const InputField({
super.key,
this.controller,
Expand All @@ -15,18 +17,21 @@ class InputField extends StatelessWidget {
this.obscure,
this.textInputType,
this.obscureText = false,
this.tooltip, // Initialize the tooltip field
});

@override
Widget build(BuildContext context) {
return TextField(
controller: controller,
obscureText: obscure ?? false,
// obscureText: obscureText,
keyboardType: textInputType,
decoration: InputDecoration(
hintText: hint,
labelText: label,
return Tooltip(
message: tooltip ?? '', // Display tooltip if provided
child: TextField(
controller: controller,
obscureText: obscure ?? false,
keyboardType: textInputType,
decoration: InputDecoration(
hintText: hint,
labelText: label,
),
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ packages:
dependency: transitive
description:
name: _fe_analyzer_shared
sha256: "45cfa8471b89fb6643fe9bf51bd7931a76b8f5ec2d65de4fb176dba8d4f22c77"
sha256: f256b0c0ba6c7577c15e2e4e114755640a875e885099367bf6e012b19314c834
url: "https://pub.dev"
source: hosted
version: "73.0.0"
version: "72.0.0"
_macros:
dependency: transitive
description: dart
Expand All @@ -18,10 +18,10 @@ packages:
dependency: transitive
description:
name: analyzer
sha256: "4959fec185fe70cce007c57e9ab6983101dbe593d2bf8bbfb4453aaec0cf470a"
sha256: b652861553cd3990d8ed361f7979dc6d7053a9ac8843fa73820ab68ce5410139
url: "https://pub.dev"
source: hosted
version: "6.8.0"
version: "6.7.0"
archive:
dependency: transitive
description:
Expand Down Expand Up @@ -138,10 +138,10 @@ packages:
dependency: transitive
description:
name: collection
sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.dev"
source: hosted
version: "1.19.0"
version: "1.18.0"
convert:
dependency: transitive
description:
Expand Down Expand Up @@ -228,7 +228,7 @@ packages:
path: "../.."
relative: true
source: path
version: "0.0.1-pre+9"
version: "0.0.1-pre+10"
fixnum:
dependency: transitive
description:
Expand Down Expand Up @@ -376,10 +376,10 @@ packages:
dependency: transitive
description:
name: http_parser
sha256: "76d306a1c3afb33fe82e2bbacad62a61f409b5634c915fceb0d799de1a913360"
sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b"
url: "https://pub.dev"
source: hosted
version: "4.1.1"
version: "4.0.2"
intl:
dependency: transitive
description:
Expand Down Expand Up @@ -424,18 +424,18 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06"
sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
url: "https://pub.dev"
source: hosted
version: "10.0.7"
version: "10.0.5"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379"
sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
url: "https://pub.dev"
source: hosted
version: "3.0.8"
version: "3.0.5"
leak_tracker_testing:
dependency: transitive
description:
Expand Down Expand Up @@ -712,7 +712,7 @@ packages:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
version: "0.0.99"
source_maps:
dependency: transitive
description:
Expand Down Expand Up @@ -757,10 +757,10 @@ packages:
dependency: transitive
description:
name: string_scanner
sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3"
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
url: "https://pub.dev"
source: hosted
version: "1.3.0"
version: "1.2.0"
term_glyph:
dependency: transitive
description:
Expand All @@ -773,10 +773,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c"
sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
url: "https://pub.dev"
source: hosted
version: "0.7.3"
version: "0.7.2"
typed_data:
dependency: transitive
description:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'dart:convert';
import 'package:firebase_dart_admin_auth_sdk/firebase_dart_admin_auth_sdk.dart';
import '../../utils.dart'; // Import the spinner function


///create user connect
class CreateUserWithEmailAndPasswordService {
Expand All @@ -11,6 +13,7 @@ class CreateUserWithEmailAndPasswordService {

///create function
Future<UserCredential> create(String email, String password) async {
showSpinner('Creating user', 3); // Add spinner at the start
final url = Uri.https(
'identitytoolkit.googleapis.com',
'/v1/accounts:signUp',
Expand Down
3 changes: 3 additions & 0 deletions firebase-dart-admin-auth-sdk/lib/src/auth/reload_user.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'package:firebase_dart_admin_auth_sdk/src/exceptions.dart';
import 'package:firebase_dart_admin_auth_sdk/src/firebase_auth.dart';
import 'package:firebase_dart_admin_auth_sdk/src/user.dart';
import '../../utils.dart'; // Import the spinner function


/// Service to reload the user's information from Firebase based on their ID token.
///
Expand Down Expand Up @@ -28,6 +30,7 @@ class ReloadUser {
/// Throws:
/// - [FirebaseAuthException] if the reload request fails or if the [idToken] is invalid or null.
Future<User> reloadUser(String? idToken) async {
showSpinner('Refreshing user data', 3); // Add spinner at the start
try {
// Validate that the idToken is not null
assert(idToken != null, 'Id token cannot be null');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'dart:developer';
import '../../firebase_dart_admin_auth_sdk.dart';
import '../../utils.dart'; // Import the spinner function


/// A service that handles anonymous sign-in for Firebase Authentication.
///
Expand Down Expand Up @@ -31,6 +33,7 @@ class FirebaseSignInAnonymously {
/// - A [UserCredential] object if the sign-in is successful.
/// - `null` if the sign-in fails.
Future<UserCredential?> signInAnonymously() async {
showSpinner('Signing in anonymously', 3); // Add spinner at the start
try {
// Send the request to Firebase Authentication to sign up the user anonymously
final response = await auth.performRequest('signUp', {
Expand Down
Loading