Skip to content

Commit

Permalink
feat(ui_auth): allow passing custom user avatar widget (#11161)
Browse files Browse the repository at this point in the history
  • Loading branch information
lesnitsky authored Jun 21, 2023
1 parent 89df2b5 commit cfcaa2f
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions packages/firebase_ui_auth/lib/src/screens/profile_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -704,12 +704,19 @@ class ProfileScreen extends MultiProviderScreen {
/// verification.
final ActionCodeSettings? actionCodeSettings;

/// Indicates whether MFA tile should be shown.
final bool showMFATile;

/// A custom avatar widget that is used instead of the default one.
/// If provided, [avatarPlaceholderColor], [avatarShape] and [avatarSize]
/// are ignored.
final Widget? avatar;

const ProfileScreen({
super.key,
super.auth,
super.providers,
this.avatar,
this.avatarPlaceholderColor,
this.avatarShape,
this.avatarSize,
Expand Down Expand Up @@ -767,17 +774,20 @@ class ProfileScreen extends MultiProviderScreen {

final user = auth.currentUser!;

final content = Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
final avatarWidget = avatar ??
Align(
child: UserAvatar(
auth: auth,
placeholderColor: avatarPlaceholderColor,
shape: avatarShape,
size: avatarSize,
),
),
);

final content = Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
avatarWidget,
Align(child: EditableUserDisplayName(auth: auth)),
if (!user.emailVerified) ...[
RebuildScope(
Expand Down

0 comments on commit cfcaa2f

Please sign in to comment.