-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
57 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
part of katana_ui; | ||
|
||
/// Square version of [CircleAvatar]. | ||
/// | ||
/// Can be used in place of [CircleAvatar]. | ||
/// | ||
/// 四角版の[CircleAvatar]。 | ||
/// | ||
/// [CircleAvatar]の代わりに使用できます。 | ||
class SquareAvatar extends StatelessWidget { | ||
/// Square version of [CircleAvatar]. | ||
/// | ||
/// Can be used in place of [CircleAvatar]. | ||
/// | ||
/// 四角版の[CircleAvatar]。 | ||
/// | ||
/// [CircleAvatar]の代わりに使用できます。 | ||
const SquareAvatar({ | ||
super.key, | ||
this.radius, | ||
this.backgroundColor, | ||
this.backgroundImage, | ||
}); | ||
|
||
/// Rounded corners. | ||
/// | ||
/// 角丸。 | ||
final double? radius; | ||
|
||
/// Background color. | ||
/// | ||
/// 背景色。 | ||
final Color? backgroundColor; | ||
|
||
/// Background image. | ||
/// | ||
/// 背景画像。 | ||
final ImageProvider<Object>? backgroundImage; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return ClipRRect( | ||
borderRadius: BorderRadius.circular(radius ?? 0), | ||
child: Stack( | ||
fit: StackFit.expand, | ||
children: [ | ||
if (backgroundImage != null) Image(image: backgroundImage!), | ||
if (backgroundColor != null) ColoredBox(color: backgroundColor!), | ||
], | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters