Skip to content

Commit cfcaa2f

Browse files
authored
feat(ui_auth): allow passing custom user avatar widget (#11161)
1 parent 89df2b5 commit cfcaa2f

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

packages/firebase_ui_auth/lib/src/screens/profile_screen.dart

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -704,12 +704,19 @@ class ProfileScreen extends MultiProviderScreen {
704704
/// verification.
705705
final ActionCodeSettings? actionCodeSettings;
706706

707+
/// Indicates whether MFA tile should be shown.
707708
final bool showMFATile;
708709

710+
/// A custom avatar widget that is used instead of the default one.
711+
/// If provided, [avatarPlaceholderColor], [avatarShape] and [avatarSize]
712+
/// are ignored.
713+
final Widget? avatar;
714+
709715
const ProfileScreen({
710716
super.key,
711717
super.auth,
712718
super.providers,
719+
this.avatar,
713720
this.avatarPlaceholderColor,
714721
this.avatarShape,
715722
this.avatarSize,
@@ -767,17 +774,20 @@ class ProfileScreen extends MultiProviderScreen {
767774

768775
final user = auth.currentUser!;
769776

770-
final content = Column(
771-
crossAxisAlignment: CrossAxisAlignment.stretch,
772-
children: [
777+
final avatarWidget = avatar ??
773778
Align(
774779
child: UserAvatar(
775780
auth: auth,
776781
placeholderColor: avatarPlaceholderColor,
777782
shape: avatarShape,
778783
size: avatarSize,
779784
),
780-
),
785+
);
786+
787+
final content = Column(
788+
crossAxisAlignment: CrossAxisAlignment.stretch,
789+
children: [
790+
avatarWidget,
781791
Align(child: EditableUserDisplayName(auth: auth)),
782792
if (!user.emailVerified) ...[
783793
RebuildScope(

0 commit comments

Comments
 (0)