mirror of
https://github.com/Iconica-Development/flutter_profile.git
synced 2025-05-18 16:53:45 +02:00
56 lines
1.3 KiB
Dart
56 lines
1.3 KiB
Dart
// SPDX-FileCopyrightText: 2022 Iconica
|
|
//
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_profile/src/models/user.dart';
|
|
import 'package:flutter_profile/src/widgets/avatar/avatar.dart';
|
|
|
|
class AvatarWrapper extends StatelessWidget {
|
|
const AvatarWrapper({
|
|
required this.user,
|
|
super.key,
|
|
this.showName = false,
|
|
this.padding = const EdgeInsets.only(top: 16),
|
|
this.size = 100,
|
|
this.textStyle,
|
|
this.customAvatar,
|
|
this.avatarBackgroundColor,
|
|
});
|
|
|
|
final User user;
|
|
final Widget? customAvatar;
|
|
final Color? avatarBackgroundColor;
|
|
final bool showName;
|
|
final EdgeInsets padding;
|
|
final TextStyle? textStyle;
|
|
final double size;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
var avatar = customAvatar ??
|
|
Avatar(
|
|
user: user,
|
|
size: size,
|
|
avatarBackgroundColor: avatarBackgroundColor,
|
|
);
|
|
|
|
return showName
|
|
? Column(
|
|
children: [
|
|
avatar,
|
|
Padding(
|
|
padding: padding,
|
|
child: Flexible(
|
|
child: Text(
|
|
style: textStyle,
|
|
user.displayName,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
)
|
|
: avatar;
|
|
}
|
|
}
|