@@ -19,7 +19,6 @@ package com.example.compose.jetchat.profile
19
19
import androidx.compose.foundation.Image
20
20
import androidx.compose.foundation.ScrollState
21
21
import androidx.compose.foundation.ScrollableColumn
22
- import androidx.compose.foundation.background
23
22
import androidx.compose.foundation.clickable
24
23
import androidx.compose.foundation.layout.Box
25
24
import androidx.compose.foundation.layout.Column
@@ -49,7 +48,6 @@ import androidx.compose.runtime.Providers
49
48
import androidx.compose.runtime.key
50
49
import androidx.compose.ui.Alignment
51
50
import androidx.compose.ui.Modifier
52
- import androidx.compose.ui.graphics.Color
53
51
import androidx.compose.ui.layout.ContentScale
54
52
import androidx.compose.ui.layout.WithConstraints
55
53
import androidx.compose.ui.platform.DensityAmbient
@@ -62,7 +60,7 @@ import com.example.compose.jetchat.R
62
60
import com.example.compose.jetchat.components.AnimatingFabContent
63
61
import com.example.compose.jetchat.components.JetchatAppBar
64
62
import com.example.compose.jetchat.components.baselineHeight
65
- import com.example.compose.jetchat.data.colleagueProfile
63
+ import com.example.compose.jetchat.data.meProfile
66
64
import com.example.compose.jetchat.theme.JetchatTheme
67
65
68
66
@Composable
@@ -181,24 +179,17 @@ private fun ProfileHeader(
181
179
182
180
data.photo?.let {
183
181
val asset = imageResource(id = it)
184
- val ratioAsset = asset.width / asset.height.toFloat()
182
+ val ratioAsset = ( asset.width / asset.height.toFloat()).coerceAtLeast( 1f )
185
183
186
- Box (
184
+ // TODO: Fix landscape
185
+ Image (
187
186
modifier = Modifier
188
- .fillMaxWidth()
189
- // Allow for landscape and portrait ratios
190
- .preferredHeightIn(max = 320 .dp)
191
187
.aspectRatio(ratioAsset)
192
- .background(Color .LightGray )
193
- ) {
194
- Image (
195
- modifier = Modifier
196
- .fillMaxSize()
197
- .padding(top = offsetDp),
198
- asset = asset,
199
- contentScale = ContentScale .Crop
200
- )
201
- }
188
+ .preferredHeightIn(max = 320 .dp)
189
+ .padding(top = offsetDp),
190
+ asset = asset,
191
+ contentScale = ContentScale .FillWidth
192
+ )
202
193
}
203
194
}
204
195
@@ -267,7 +258,7 @@ fun ProfileFab(extended: Boolean, userIsMe: Boolean, modifier: Modifier = Modifi
267
258
@Composable
268
259
fun ConvPreview480MeDefault () {
269
260
JetchatTheme {
270
- ProfileScreen (colleagueProfile )
261
+ ProfileScreen (meProfile )
271
262
}
272
263
}
273
264
0 commit comments