mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-29 07:42:40 +00:00
DeviceAvatarView: SImplify layout.
This commit is contained in:
parent
a4d8eb595c
commit
8144e1fe9b
1 changed files with 13 additions and 20 deletions
|
@ -28,33 +28,26 @@ struct DeviceAvatarView: View {
|
|||
var badgeSize: CGFloat = 24
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
VStack {
|
||||
VStack(alignment: .center) {
|
||||
viewData.deviceType.image
|
||||
}
|
||||
.padding()
|
||||
ZStack(alignment: .bottomTrailing) {
|
||||
|
||||
// Device image
|
||||
VStack(alignment: .center) {
|
||||
viewData.deviceType.image
|
||||
}
|
||||
.padding()
|
||||
.frame(maxWidth: CGFloat(avatarSize), maxHeight: CGFloat(avatarSize))
|
||||
.background(theme.colors.system)
|
||||
.clipShape(Circle())
|
||||
|
||||
// Verification badge
|
||||
if let isVerified = viewData.isVerified {
|
||||
|
||||
VStack(alignment: .trailing) {
|
||||
Spacer()
|
||||
HStack(alignment: .bottom) {
|
||||
Spacer()
|
||||
VStack() {
|
||||
Image(isVerified ? Asset.Images.userSessionVerified.name : Asset.Images.userSessionUnverified.name)
|
||||
}
|
||||
.frame(maxWidth: CGFloat(badgeSize), maxHeight: CGFloat(badgeSize))
|
||||
.shapedBorder(color: theme.colors.system, borderWidth: 1, shape: Circle())
|
||||
.background(theme.colors.background)
|
||||
.clipShape(Circle())
|
||||
}
|
||||
.offset(x: 10, y: 8)
|
||||
}
|
||||
Image(isVerified ? Asset.Images.userSessionVerified.name : Asset.Images.userSessionUnverified.name)
|
||||
.frame(maxWidth: CGFloat(badgeSize), maxHeight: CGFloat(badgeSize))
|
||||
.shapedBorder(color: theme.colors.system, borderWidth: 1, shape: Circle())
|
||||
.background(theme.colors.background)
|
||||
.clipShape(Circle())
|
||||
.offset(x: 10, y: 8)
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: CGFloat(avatarSize), maxHeight: CGFloat(avatarSize))
|
||||
|
|
Loading…
Reference in a new issue