-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#18 - US05 - android list improved design
- Loading branch information
Harold Jose
committed
Apr 15, 2024
1 parent
a79c342
commit bbacc9e
Showing
24 changed files
with
344 additions
and
29 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
130 changes: 130 additions & 0 deletions
130
...oid/presentationLayer/pages/familyList/views/components/FamilyListBottomSheetOpenImage.kt
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,130 @@ | ||
package dev.haroldjose.familysharedlist.android.presentationLayer.pages.familyList.views.components | ||
|
||
import androidx.compose.foundation.BorderStroke | ||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.border | ||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.ColumnScope | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.requiredSize | ||
import androidx.compose.foundation.layout.width | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.foundation.text.KeyboardOptions | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.automirrored.twotone.List | ||
import androidx.compose.material.icons.filled.AddCircle | ||
import androidx.compose.material.icons.twotone.CheckCircle | ||
import androidx.compose.material.icons.twotone.ShoppingCart | ||
import androidx.compose.material3.BottomSheetScaffold | ||
import androidx.compose.material3.BottomSheetScaffoldState | ||
import androidx.compose.material3.CircularProgressIndicator | ||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.IconButton | ||
import androidx.compose.material3.LinearProgressIndicator | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.OutlinedTextField | ||
import androidx.compose.material3.Scaffold | ||
import androidx.compose.material3.SheetState | ||
import androidx.compose.material3.SheetValue | ||
import androidx.compose.material3.Tab | ||
import androidx.compose.material3.TabRow | ||
import androidx.compose.material3.Text | ||
import androidx.compose.material3.rememberBottomSheetScaffoldState | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.LaunchedEffect | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.rememberCoroutineScope | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.clip | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.graphics.asImageBitmap | ||
import androidx.compose.ui.layout.ContentScale | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.text.input.ImeAction | ||
import androidx.compose.ui.text.input.KeyboardCapitalization | ||
import androidx.compose.ui.text.input.KeyboardType | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import coil.compose.SubcomposeAsyncImage | ||
import dev.haroldjose.familysharedlist.Logger | ||
import dev.haroldjose.familysharedlist.android.R | ||
import dev.haroldjose.familysharedlist.android.app.MyApplicationTheme | ||
import dev.haroldjose.familysharedlist.android.presentationLayer.pages.barcodeScanner.QrScannerScreen | ||
import dev.haroldjose.familysharedlist.android.presentationLayer.pages.familyList.viewmodels.FamilyListViewModelMocked | ||
import dev.haroldjose.familysharedlist.android.presentationLayer.pages.familyList.viewmodels.IFamilyListViewModel | ||
import dev.haroldjose.familysharedlist.android.presentationLayer.pages.familyList.views.FamilyListPageTabEnum | ||
import dev.haroldjose.familysharedlist.android.presentationLayer.pages.familyList.views.components.rowItem.ColumnRigthDefault | ||
import dev.haroldjose.familysharedlist.domainLayer.extensions.Samples | ||
import kotlinx.coroutines.launch | ||
|
||
@Composable | ||
@OptIn(ExperimentalMaterial3Api::class) | ||
fun FamilyListBottomSheetOpenImage( | ||
bottomSheetScaffoldState: BottomSheetScaffoldState, | ||
viewModel: IFamilyListViewModel | ||
): @Composable() (ColumnScope.() -> Unit) { | ||
val imageUrl = viewModel.openImageSelectedItem?.product?.imageUrl ?: | ||
viewModel.openImageSelectedItem?.product?.imageFrontUrl ?: | ||
viewModel.openImageSelectedItem?.product?.imageFrontSmallUrl ?: | ||
"https://gamestation.com.br/wp-content/themes/game-station/images/image-not-found.png" | ||
|
||
LaunchedEffect(key1 = "FamilyListBottomSheetOpenImage") { | ||
bottomSheetScaffoldState.bottomSheetState.expand() | ||
} | ||
|
||
return { | ||
Column( | ||
horizontalAlignment = Alignment.CenterHorizontally | ||
) { | ||
SubcomposeAsyncImage( | ||
model = imageUrl, | ||
loading = { | ||
CircularProgressIndicator( | ||
modifier = Modifier | ||
.requiredSize(100.dp), | ||
color = Color.LightGray | ||
) | ||
}, | ||
contentDescription = viewModel.openImageSelectedItem?.product?.productName, | ||
contentScale = ContentScale.Fit, | ||
modifier = Modifier | ||
.fillMaxSize() | ||
.clip(RoundedCornerShape(16.dp)) | ||
.background(Color.White) | ||
.border(BorderStroke(1.dp, Color.Gray), RoundedCornerShape(16.dp)) | ||
.padding(4.dp) | ||
) | ||
} | ||
} | ||
} | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Preview | ||
@Composable | ||
fun FamilyListBottomSheetOpenImage_Preview() { | ||
val bottomSheetScaffoldState = rememberBottomSheetScaffoldState() | ||
val viewModel = FamilyListViewModelMocked() | ||
MyApplicationTheme { | ||
BottomSheetScaffold( | ||
scaffoldState = bottomSheetScaffoldState, | ||
sheetPeekHeight = 128.dp, | ||
sheetContent = FamilyListBottomSheetOpenImage(bottomSheetScaffoldState, viewModel), | ||
content = { | ||
Text("FamilyListBottomSheetOpenImage_Preview") | ||
} | ||
) | ||
} | ||
} |
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
Oops, something went wrong.