diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fa99a4..1351a99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## 1.5.0 - Updated flutter_input_library to 3.2.1 +- Added the option to give a `BoxFit` to the avatar image ## 1.4.0 diff --git a/lib/src/widgets/avatar/avatar.dart b/lib/src/widgets/avatar/avatar.dart index 7c1cafd..0525ab0 100644 --- a/lib/src/widgets/avatar/avatar.dart +++ b/lib/src/widgets/avatar/avatar.dart @@ -12,6 +12,7 @@ class Avatar extends StatelessWidget { this.user, this.size = 100, this.avatarBackgroundColor, + this.boxfit = BoxFit.contain, }); /// The user object containing user information. @@ -23,6 +24,8 @@ class Avatar extends StatelessWidget { /// Background color of the avatar. final Color? avatarBackgroundColor; + final BoxFit boxfit; + @override Widget build(BuildContext context) { var imageProvider = _getImageProvider(user); @@ -42,7 +45,7 @@ class Avatar extends StatelessWidget { image: hasImage ? DecorationImage( image: imageProvider, - fit: BoxFit.contain, + fit: boxfit, ) : null, ),