Skip to content

Commit 2122417

Browse files
Revert "feat(ui_auth): add a way to customize ErrorText message (firebase#119)"
This reverts commit a36884d.
1 parent d2bded5 commit 2122417

File tree

2 files changed

+5
-94
lines changed

2 files changed

+5
-94
lines changed

packages/firebase_ui_auth/lib/src/widgets/error_text.dart

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -36,28 +36,6 @@ String? localizedErrorText(
3636
/// A widget which displays error text for a given Firebase error code.
3737
/// {@endtemplate}
3838
class ErrorText extends StatelessWidget {
39-
/// A way to customize localized error messages.
40-
///
41-
/// Example usage:
42-
/// ```dart
43-
/// ErrorText.localizeError = (BuildContext context, FirebaseAuthException e) {
44-
/// return switch (e.code) {
45-
/// 'user-not-found' => 'Please create an account first.',
46-
/// 'credential-already-in-use' => 'This email is already in use.',
47-
/// _ => 'Oh no! Something went wrong.'
48-
/// }
49-
/// }
50-
static String Function(
51-
BuildContext context,
52-
FirebaseAuthException exception,
53-
)? localizeError;
54-
55-
/// A way to customize the widget that is used across the library to show
56-
/// error hints. By default a localized text is used with a color set to
57-
/// [ColorScheme.error] under [MaterialApp] and
58-
/// [CupertinoColors.destructiveRed] under [CupertinoApp].
59-
static Widget Function(BuildContext context, String message)? builder;
60-
6139
/// An exception that contains error details.
6240
/// Often this is a [FirebaseAuthException].
6341
final Exception exception;
@@ -91,16 +69,12 @@ class ErrorText extends StatelessWidget {
9169
}
9270

9371
if (exception is FirebaseAuthException) {
94-
if (localizeError != null) {
95-
text = localizeError!(context, exception as FirebaseAuthException);
96-
} else {
97-
final e = exception as FirebaseAuthException;
98-
final code = e.code;
99-
final newText = localizedErrorText(code, l) ?? e.message;
72+
final e = exception as FirebaseAuthException;
73+
final code = e.code;
74+
final newText = localizedErrorText(code, l) ?? e.message;
10075

101-
if (newText != null) {
102-
text = newText;
103-
}
76+
if (newText != null) {
77+
text = newText;
10478
}
10579
}
10680

packages/firebase_ui_auth/test/widgets/error_text_test.dart

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)