@@ -18,26 +18,20 @@ import androidx.compose.foundation.layout.Spacer
1818import androidx.compose.foundation.layout.fillMaxSize
1919import androidx.compose.foundation.layout.fillMaxWidth
2020import androidx.compose.foundation.layout.height
21- import androidx.compose.foundation.layout.imePadding
22- import androidx.compose.foundation.layout.navigationBarsPadding
2321import androidx.compose.foundation.layout.padding
2422import androidx.compose.foundation.layout.size
2523import androidx.compose.foundation.layout.statusBarsPadding
2624import androidx.compose.foundation.layout.width
2725import androidx.compose.foundation.pager.HorizontalPager
2826import androidx.compose.foundation.pager.rememberPagerState
2927import androidx.compose.foundation.shape.RoundedCornerShape
30- import androidx.compose.material3.BottomAppBar
31- import androidx.compose.material3.CenterAlignedTopAppBar
32- import androidx.compose.material3.ExperimentalMaterial3Api
3328import androidx.compose.material3.Icon
3429import androidx.compose.material3.IconButton
3530import androidx.compose.material3.MaterialTheme
3631import androidx.compose.material3.OutlinedButton
3732import androidx.compose.material3.Scaffold
3833import androidx.compose.material3.Surface
3934import androidx.compose.material3.Text
40- import androidx.compose.material3.TopAppBarDefaults
4135import androidx.compose.runtime.Composable
4236import androidx.compose.runtime.LaunchedEffect
4337import androidx.compose.runtime.derivedStateOf
@@ -75,7 +69,6 @@ import com.espressodev.gptmap.core.designsystem.Constants.SMALL_PADDING
7569import com.espressodev.gptmap.core.designsystem.GmIcons
7670import com.espressodev.gptmap.core.designsystem.IconType
7771import com.espressodev.gptmap.core.designsystem.component.LottieAnimationView
78- import com.espressodev.gptmap.core.designsystem.component.MapSearchButton
7972import com.espressodev.gptmap.core.designsystem.component.MapTextField
8073import com.espressodev.gptmap.core.designsystem.component.ShimmerImage
8174import com.espressodev.gptmap.core.designsystem.component.SquareButton
@@ -119,12 +112,12 @@ fun MapRoute(
119112 Scaffold (
120113 bottomBar = {
121114 if (uiState.bottomSearchState) {
122- MapBottomBar (
115+ MapSearchBar (
123116 value = uiState.searchValue,
124- isSearchButtonEnabled = uiState.searchButtonEnabledState,
125- isTextFieldEnabled = uiState.searchTextFieldEnabledState,
117+ userFirstChar = ' F' ,
126118 onValueChange = { viewModel.onEvent(MapUiEvent .OnSearchValueChanged (it)) },
127119 onSearchClick = { viewModel.onEvent(MapUiEvent .OnSearchClick ) },
120+ onAvatarClick = {}
128121 )
129122 }
130123 },
@@ -197,23 +190,26 @@ private fun MapScreen(
197190 }
198191}
199192
200- @OptIn(ExperimentalMaterial3Api ::class )
201193@Composable
202194fun MapTopButtons (
203195 onFavouriteClick : () -> Unit ,
204196 onScreenshotGalleryClick : () -> Unit ,
205197 onAccountClick : () -> Unit ,
206198 modifier : Modifier = Modifier
207199) {
208- CenterAlignedTopAppBar (
209- title = { Text (text = " Gptmap" , fontWeight = FontWeight .Medium ) },
210- navigationIcon = {
211- GmIconButtonWithText (
212- onClick = onAccountClick,
213- icon = IconType .Vector (GmIcons .PersonDefault ),
214- )
215- },
216- actions = {
200+ Row (
201+ modifier = modifier
202+ .fillMaxWidth()
203+ .height(56 .dp),
204+ verticalAlignment = Alignment .CenterVertically ,
205+ horizontalArrangement = Arrangement .SpaceBetween
206+ ) {
207+ GmIconButtonWithText (
208+ onClick = onAccountClick,
209+ icon = IconType .Vector (GmIcons .PersonDefault ),
210+ )
211+ Text (text = " Gptmap" , fontWeight = FontWeight .Medium )
212+ Row {
217213 GmIconButtonWithText (
218214 onClick = onFavouriteClick,
219215 icon = IconType .Vector (GmIcons .GalleryDefault ),
@@ -222,12 +218,8 @@ fun MapTopButtons(
222218 onClick = onScreenshotGalleryClick,
223219 icon = IconType .Vector (GmIcons .ScreenshotDefault ),
224220 )
225- },
226- modifier = modifier,
227- colors = TopAppBarDefaults .centerAlignedTopAppBarColors(
228- containerColor = Color .Transparent
229- )
230- )
221+ }
222+ }
231223}
232224
233225@Composable
@@ -349,42 +341,26 @@ private fun ImageGallery(initialPage: Int, images: List<LocationImage>, onDismis
349341}
350342
351343@Composable
352- private fun MapBottomBar (
353- isTextFieldEnabled : Boolean ,
354- isSearchButtonEnabled : Boolean ,
344+ private fun MapSearchBar (
355345 value : String ,
346+ userFirstChar : Char ,
356347 onValueChange : (String ) -> Unit ,
357348 onSearchClick : () -> Unit ,
349+ onAvatarClick : () -> Unit ,
358350) {
359- Surface (
351+ MapTextField (
352+ value = value,
353+ placeholder = AppText .map_text_field_placeholder,
354+ userFirstChar = userFirstChar,
355+ onValueChange = onValueChange,
356+ onSearchClick = onSearchClick,
357+ onAvatarClick = onAvatarClick,
360358 modifier = Modifier
361- .height(80 .dp)
362- .imePadding()
363- .navigationBarsPadding(),
364- ) {
365- Row (
366- modifier = Modifier
367- .fillMaxWidth()
368- .padding(horizontal = 8 .dp),
369- verticalAlignment = Alignment .CenterVertically ,
370- horizontalArrangement = Arrangement .Center
371- ) {
372- MapTextField (
373- value = value,
374- textFieldEnabledState = isTextFieldEnabled,
375- placeholder = AppText .map_text_field_placeholder,
376- onValueChange = onValueChange,
377- modifier = Modifier
378- .fillMaxWidth()
379- .weight(1f )
380- )
381- Spacer (modifier = Modifier .width(8 .dp))
382- MapSearchButton (
383- buttonEnabledState = isSearchButtonEnabled,
384- onClick = onSearchClick
385- )
386- }
387- }
359+ .fillMaxWidth()
360+ .statusBarsPadding()
361+ .padding(8 .dp),
362+ shape = RoundedCornerShape (36 .dp)
363+ )
388364}
389365
390366@Composable
@@ -593,10 +569,12 @@ fun BoxScope.SmallInformationCard(
593569@Composable
594570fun MapPreview () {
595571 GptmapTheme {
596- MapTopButtons (
597- onFavouriteClick = {},
598- onScreenshotGalleryClick = {},
599- onAccountClick = {},
572+ MapSearchBar (
573+ value = " libris" ,
574+ userFirstChar = ' F' ,
575+ onValueChange = {},
576+ onSearchClick = {},
577+ {}
600578 )
601579 }
602580}
0 commit comments