From ae881c4582ea8b89ba05b3005efac85ee9b475db Mon Sep 17 00:00:00 2001 From: YoussefHachicha Date: Sun, 22 Oct 2023 07:17:33 +0100 Subject: [PATCH 1/9] fixed name text field writing backwards --- .../compose/widgets/builder/CardBuilder.kt | 7 ---- .../builder/composables/BuilderBottomSheet.kt | 27 ------------- .../ui/builder/BoosterPackBuilder.kt | 11 ++++-- .../composables/BoosterPackBottomSheet.kt | 39 ++++++++++++++++++- .../builder/DeckBuilder.kt | 11 ++++-- .../composables/DeckBuilderBottomSheet.kt | 28 +++++++++++++ 6 files changed, 80 insertions(+), 43 deletions(-) diff --git a/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/CardBuilder.kt b/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/CardBuilder.kt index 249ba19f2..944bca25c 100644 --- a/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/CardBuilder.kt +++ b/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/CardBuilder.kt @@ -68,19 +68,15 @@ import kotlinx.coroutines.launch @OptIn(ExperimentalMaterial3Api::class) @Composable fun CardBuilder( - name: String, title: @Composable () -> AnnotatedString, floatingActionButton: @Composable (isScrolled: Boolean) -> Unit, bottomSheetContent: @Composable ColumnScope.() -> Unit, - onNavClick: () -> Unit, onAddClick: () -> Unit, onCardClick: (Stacked) -> Unit, onAddCardClick: (Stacked) -> Unit, onRemoveCardClick: (Stacked) -> Unit, onTipClick: (CardUiModel.Tip) -> Unit, - onNameChange: (String) -> Unit, - cardsState: LoadState>, modifier: Modifier = Modifier, isValid: Boolean = true, @@ -157,17 +153,14 @@ fun CardBuilder( }, sheetContent = { BuilderBottomSheet( - name = name, isValid = isValid, legalities = legalities, cardsState = cardsState, - focusRequester = nameFocusRequester, onHeaderClick = { coroutineScope.launch { scaffoldState.bottomSheetState.expand() } }, - onNameChange = onNameChange, content = bottomSheetContent, ) }, diff --git a/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/composables/BuilderBottomSheet.kt b/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/composables/BuilderBottomSheet.kt index ab34133bb..ec6a96d10 100644 --- a/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/composables/BuilderBottomSheet.kt +++ b/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/composables/BuilderBottomSheet.kt @@ -38,13 +38,10 @@ import kotlinx.collections.immutable.persistentListOf @OptIn(ExperimentalFoundationApi::class) @Composable internal fun ColumnScope.BuilderBottomSheet( - name: String, isValid: Boolean, legalities: Legalities, cardsState: LoadState>, - focusRequester: FocusRequester, onHeaderClick: () -> Unit, - onNameChange: (String) -> Unit, content: @Composable ColumnScope.() -> Unit, ) { val cards = cardsState.dataOrNull ?: persistentListOf() @@ -64,30 +61,6 @@ internal fun ColumnScope.BuilderBottomSheet( .focusGroup() .verticalScroll(rememberScrollState()), ) { - var nameValue by remember(name) { - mutableStateOf(TextFieldValue(name)) - } - BuilderTextField( - icon = { Icon(Icons.Rounded.ShortText, contentDescription = null) }, - ) { - TextField( - value = nameValue, - onValueChange = { value -> - nameValue = value - onNameChange(value.text) - }, - placeholder = { - Text("Name") - }, - label = { - Text("Name") - }, - modifier = Modifier - .fillMaxWidth() - .focusRequester(focusRequester), - ) - } - Spacer(Modifier.height(16.dp)) content() } diff --git a/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/BoosterPackBuilder.kt b/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/BoosterPackBuilder.kt index 8a1d86500..2419f4c9b 100644 --- a/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/BoosterPackBuilder.kt +++ b/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/BoosterPackBuilder.kt @@ -6,8 +6,10 @@ import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier +import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.font.FontStyle @@ -45,12 +47,11 @@ fun BoosterPackBuilder( val coroutineScope = rememberCoroutineScope() val overlayHost = LocalOverlayHost.current val eventSink = state.eventSink - + val nameFocusRequester = remember { FocusRequester() } val boosterPack = state.session.boosterPackOrNull() val boosterPackName = boosterPack?.name ?: "" CardBuilder( - name = boosterPackName, title = { if (boosterPackName.isBlank()) { AnnotatedString( @@ -74,7 +75,10 @@ fun BoosterPackBuilder( ) }, bottomSheetContent = { - BoosterPackBottomSheet(state) + BoosterPackBottomSheet( + state = state, + focusRequester = nameFocusRequester + ) }, onNavClick = { eventSink(NavigateBack) }, onAddClick = { @@ -96,7 +100,6 @@ fun BoosterPackBuilder( CardUiModel.Tip.Energy -> eventSink(AddCards(SuperType.ENERGY)) } }, - onNameChange = { newName -> eventSink(EditName(newName)) }, cardsState = state.cards, legalities = boosterPack?.legalities ?: Legalities(standard = Legality.LEGAL), modifier = modifier, diff --git a/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/composables/BoosterPackBottomSheet.kt b/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/composables/BoosterPackBottomSheet.kt index d2989d4ef..b02e0ffa2 100644 --- a/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/composables/BoosterPackBottomSheet.kt +++ b/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/composables/BoosterPackBottomSheet.kt @@ -2,18 +2,55 @@ package app.deckbox.features.boosterpacks.ui.builder.composables import androidx.compose.foundation.layout.ColumnScope import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.rounded.ShortText import androidx.compose.material3.Divider -import androidx.compose.runtime.Composable +import androidx.compose.material3.Icon +import androidx.compose.material3.Text +import androidx.compose.material3.TextField +import androidx.compose.runtime.* import androidx.compose.ui.Modifier +import androidx.compose.ui.focus.FocusRequester +import androidx.compose.ui.focus.focusRequester +import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.unit.dp +import app.deckbox.common.compose.widgets.builder.composables.BuilderTextField +import app.deckbox.features.boosterpacks.ui.builder.BoosterPackBuilderUiEvent import app.deckbox.features.boosterpacks.ui.builder.BoosterPackBuilderUiState import app.deckbox.features.boosterpacks.ui.builder.PackPriceState @Composable internal fun ColumnScope.BoosterPackBottomSheet( state: BoosterPackBuilderUiState, + focusRequester: FocusRequester, ) { + val eventSink = state.eventSink + var nameValue by remember(state.session.boosterPackOrNull() != null) { + mutableStateOf(TextFieldValue(state.session.boosterPackOrNull()?.name ?: "")) + } + BuilderTextField( + icon = { Icon(Icons.Rounded.ShortText, contentDescription = null) }, + ) { + TextField( + value = nameValue, + onValueChange = { value -> + nameValue = value + eventSink(BoosterPackBuilderUiEvent.EditName(value.text)) + }, + placeholder = { + Text("Name") + }, + label = { + Text("Name") + }, + modifier = Modifier + .fillMaxWidth() + .focusRequester(focusRequester), + ) + } + Spacer(Modifier.height(16.dp)) Divider() PackPrices( diff --git a/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/DeckBuilder.kt b/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/DeckBuilder.kt index 4dc60181d..1f2f73989 100644 --- a/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/DeckBuilder.kt +++ b/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/DeckBuilder.kt @@ -6,8 +6,10 @@ import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier +import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.font.FontStyle @@ -45,13 +47,13 @@ fun DeckBuilder( val coroutineScope = rememberCoroutineScope() val overlayHost = LocalOverlayHost.current val eventSink = state.eventSink + val nameFocusRequester = remember { FocusRequester() } val deck = state.session.deckOrNull() val deckName = deck?.name ?: "" val validation = state.validation.dataOrNull ?: DeckValidation() CardBuilder( - name = deckName, title = { if (deckName.isBlank()) { AnnotatedString( @@ -74,7 +76,10 @@ fun DeckBuilder( ) }, bottomSheetContent = { - DeckBuilderBottomSheet(state) + DeckBuilderBottomSheet( + state = state, + focusRequester = nameFocusRequester + ) }, onNavClick = { eventSink(NavigateBack) }, onAddClick = { @@ -96,8 +101,6 @@ fun DeckBuilder( CardUiModel.Tip.Energy -> eventSink(AddCards(SuperType.ENERGY)) } }, - onNameChange = { newName -> eventSink(EditName(newName)) }, - cardsState = state.cards, modifier = modifier, diff --git a/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/composables/DeckBuilderBottomSheet.kt b/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/composables/DeckBuilderBottomSheet.kt index eb7efb4a6..4f170e266 100644 --- a/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/composables/DeckBuilderBottomSheet.kt +++ b/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/composables/DeckBuilderBottomSheet.kt @@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.material.icons.Icons import androidx.compose.material.icons.rounded.ErrorOutline +import androidx.compose.material.icons.rounded.ShortText import androidx.compose.material.icons.rounded.Subject import androidx.compose.material3.Divider import androidx.compose.material3.Icon @@ -21,6 +22,8 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier +import androidx.compose.ui.focus.FocusRequester +import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.unit.dp import app.deckbox.common.compose.widgets.builder.composables.BuilderTextField @@ -33,6 +36,7 @@ import app.deckbox.ui.decks.builder.DeckPriceState @Composable internal fun ColumnScope.DeckBuilderBottomSheet( state: DeckBuilderUiState, + focusRequester: FocusRequester, ) { val eventSink = state.eventSink val validation = state.validation.dataOrNull ?: DeckValidation() @@ -41,6 +45,30 @@ internal fun ColumnScope.DeckBuilderBottomSheet( var descriptionValue by remember(state.session.deckOrNull() != null) { mutableStateOf(TextFieldValue(state.session.deckOrNull()?.description ?: "")) } + var nameValue by remember(state.session.deckOrNull() != null) { + mutableStateOf(TextFieldValue(state.session.deckOrNull()?.name ?: "")) + } + BuilderTextField( + icon = { Icon(Icons.Rounded.ShortText, contentDescription = null) }, + ) { + TextField( + value = nameValue, + onValueChange = { value -> + nameValue = value + eventSink(DeckBuilderUiEvent.EditName(value.text)) + }, + placeholder = { + Text("Name") + }, + label = { + Text("Name") + }, + modifier = Modifier + .fillMaxWidth() + .focusRequester(focusRequester), + ) + } + Spacer(Modifier.height(16.dp)) BuilderTextField( icon = { Icon(Icons.Rounded.Subject, contentDescription = null) }, ) { From 84b234a9e2d158209013c67808cebb8fb99addfc Mon Sep 17 00:00:00 2001 From: YoussefHachicha Date: Sun, 22 Oct 2023 07:43:01 +0100 Subject: [PATCH 2/9] imporved textfield user experience by adding keyboardOptions also when clicked outside the bottomSheet it will automaticlly hide the keyboard for better user experience --- .../common/compose/widgets/builder/CardBuilder.kt | 7 ++++++- .../boosterpacks/ui/builder/BoosterPackBuilder.kt | 3 +-- .../builder/composables/BoosterPackBottomSheet.kt | 10 +++++++++- .../app.deckbox.ui.decks/builder/DeckBuilder.kt | 5 +---- .../builder/composables/DeckBuilderBottomSheet.kt | 14 +++++++++++++- 5 files changed, 30 insertions(+), 9 deletions(-) diff --git a/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/CardBuilder.kt b/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/CardBuilder.kt index 944bca25c..9547ba302 100644 --- a/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/CardBuilder.kt +++ b/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/CardBuilder.kt @@ -36,11 +36,13 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment +import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.input.nestedscroll.nestedScroll import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalFocusManager +import androidx.compose.ui.platform.LocalSoftwareKeyboardController import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp @@ -65,7 +67,7 @@ import com.moriatsushi.insetsx.navigationBars import kotlinx.collections.immutable.ImmutableList import kotlinx.coroutines.launch -@OptIn(ExperimentalMaterial3Api::class) +@OptIn(ExperimentalMaterial3Api::class, ExperimentalComposeUiApi::class) @Composable fun CardBuilder( title: @Composable () -> AnnotatedString, @@ -86,6 +88,7 @@ fun CardBuilder( ) { val coroutineScope = rememberCoroutineScope() val focusManager = LocalFocusManager.current + val keyBoardController = LocalSoftwareKeyboardController.current val bottomPadding = with(LocalDensity.current) { WindowInsets.navigationBars.getBottom(this).toDp() @@ -126,6 +129,8 @@ fun CardBuilder( indication = null, onClick = { isEditing = false + keyBoardController?.hide() + focusManager.clearFocus() }, ), scaffoldState = scaffoldState, diff --git a/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/BoosterPackBuilder.kt b/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/BoosterPackBuilder.kt index 2419f4c9b..be82cadc4 100644 --- a/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/BoosterPackBuilder.kt +++ b/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/BoosterPackBuilder.kt @@ -28,7 +28,6 @@ import app.deckbox.features.boosterpacks.ui.builder.BoosterPackBuilderUiEvent.Ad import app.deckbox.features.boosterpacks.ui.builder.BoosterPackBuilderUiEvent.AddToDeck import app.deckbox.features.boosterpacks.ui.builder.BoosterPackBuilderUiEvent.CardClick import app.deckbox.features.boosterpacks.ui.builder.BoosterPackBuilderUiEvent.DecrementCard -import app.deckbox.features.boosterpacks.ui.builder.BoosterPackBuilderUiEvent.EditName import app.deckbox.features.boosterpacks.ui.builder.BoosterPackBuilderUiEvent.IncrementCard import app.deckbox.features.boosterpacks.ui.builder.BoosterPackBuilderUiEvent.NavigateBack import app.deckbox.features.boosterpacks.ui.builder.BoosterPackBuilderUiEvent.NewDeck @@ -102,8 +101,8 @@ fun BoosterPackBuilder( }, cardsState = state.cards, legalities = boosterPack?.legalities ?: Legalities(standard = Legality.LEGAL), - modifier = modifier, columns = 4, cardSpacing = 8.dp, + modifier = modifier ) } diff --git a/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/composables/BoosterPackBottomSheet.kt b/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/composables/BoosterPackBottomSheet.kt index b02e0ffa2..4bb39c961 100644 --- a/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/composables/BoosterPackBottomSheet.kt +++ b/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/composables/BoosterPackBottomSheet.kt @@ -4,6 +4,7 @@ import androidx.compose.foundation.layout.ColumnScope import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height +import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material.icons.Icons import androidx.compose.material.icons.rounded.ShortText import androidx.compose.material3.Divider @@ -14,6 +15,8 @@ import androidx.compose.runtime.* import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.focus.focusRequester +import androidx.compose.ui.text.input.ImeAction +import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.unit.dp import app.deckbox.common.compose.widgets.builder.composables.BuilderTextField @@ -45,9 +48,14 @@ internal fun ColumnScope.BoosterPackBottomSheet( label = { Text("Name") }, + keyboardOptions = KeyboardOptions( + keyboardType = KeyboardType.Text, + imeAction = ImeAction.Done, + ), + singleLine = true, modifier = Modifier .fillMaxWidth() - .focusRequester(focusRequester), + .focusRequester(focusRequester) ) } Spacer(Modifier.height(16.dp)) diff --git a/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/DeckBuilder.kt b/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/DeckBuilder.kt index 1f2f73989..ca911b714 100644 --- a/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/DeckBuilder.kt +++ b/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/DeckBuilder.kt @@ -28,7 +28,6 @@ import app.deckbox.ui.decks.builder.DeckBuilderUiEvent.AddBoosterPack import app.deckbox.ui.decks.builder.DeckBuilderUiEvent.AddCards import app.deckbox.ui.decks.builder.DeckBuilderUiEvent.CardClick import app.deckbox.ui.decks.builder.DeckBuilderUiEvent.DecrementCard -import app.deckbox.ui.decks.builder.DeckBuilderUiEvent.EditName import app.deckbox.ui.decks.builder.DeckBuilderUiEvent.IncrementCard import app.deckbox.ui.decks.builder.DeckBuilderUiEvent.NavigateBack import app.deckbox.ui.decks.builder.DeckBuilderUiEvent.NewBoosterPack @@ -48,7 +47,6 @@ fun DeckBuilder( val overlayHost = LocalOverlayHost.current val eventSink = state.eventSink val nameFocusRequester = remember { FocusRequester() } - val deck = state.session.deckOrNull() val deckName = deck?.name ?: "" val validation = state.validation.dataOrNull ?: DeckValidation() @@ -102,9 +100,8 @@ fun DeckBuilder( } }, cardsState = state.cards, - modifier = modifier, - isValid = validation.isValid && !validation.isEmpty, legalities = deck?.legalities ?: Legalities(standard = Legality.LEGAL), + modifier = modifier, ) } diff --git a/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/composables/DeckBuilderBottomSheet.kt b/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/composables/DeckBuilderBottomSheet.kt index 4f170e266..978fc41ca 100644 --- a/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/composables/DeckBuilderBottomSheet.kt +++ b/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/composables/DeckBuilderBottomSheet.kt @@ -4,6 +4,7 @@ import androidx.compose.foundation.layout.ColumnScope import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height +import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material.icons.Icons import androidx.compose.material.icons.rounded.ErrorOutline import androidx.compose.material.icons.rounded.ShortText @@ -24,6 +25,8 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.focus.focusRequester +import androidx.compose.ui.text.input.ImeAction +import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.unit.dp import app.deckbox.common.compose.widgets.builder.composables.BuilderTextField @@ -63,9 +66,14 @@ internal fun ColumnScope.DeckBuilderBottomSheet( label = { Text("Name") }, + keyboardOptions = KeyboardOptions( + keyboardType = KeyboardType.Text, + imeAction = ImeAction.Next, + ), + singleLine = true, modifier = Modifier .fillMaxWidth() - .focusRequester(focusRequester), + .focusRequester(focusRequester) ) } Spacer(Modifier.height(16.dp)) @@ -82,6 +90,10 @@ internal fun ColumnScope.DeckBuilderBottomSheet( Text("Description") }, minLines = 3, + keyboardOptions = KeyboardOptions( + keyboardType = KeyboardType.Text, + imeAction = ImeAction.Done, + ), modifier = Modifier.fillMaxWidth(), ) } From 2366a31127b9aaeb1a8f803fedc80e0969c801b8 Mon Sep 17 00:00:00 2001 From: YoussefHachicha Date: Sun, 22 Oct 2023 07:49:16 +0100 Subject: [PATCH 3/9] save --- .../app/deckbox/common/compose/widgets/builder/CardBuilder.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/CardBuilder.kt b/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/CardBuilder.kt index 9547ba302..6ed6dfa79 100644 --- a/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/CardBuilder.kt +++ b/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/CardBuilder.kt @@ -104,8 +104,10 @@ fun CardBuilder( } } + LaunchedEffect(isBottomSheetCollapsed) { if (isBottomSheetCollapsed) { + keyBoardController?.hide() focusManager.clearFocus() } } From bd0f49477e2361eadb19f71d8dd70356992ed806 Mon Sep 17 00:00:00 2001 From: YoussefHachicha Date: Sun, 22 Oct 2023 08:40:28 +0100 Subject: [PATCH 4/9] fixed focus requester crash --- .../common/compose/widgets/builder/CardBuilder.kt | 9 ++++++--- .../widgets/builder/composables/BuilderBottomSheet.kt | 5 +++-- .../boosterpacks/ui/builder/BoosterPackBuilder.kt | 7 ++----- .../ui/builder/composables/BoosterPackBottomSheet.kt | 2 +- .../kotlin/app.deckbox.ui.decks/builder/DeckBuilder.kt | 9 +++------ 5 files changed, 15 insertions(+), 17 deletions(-) diff --git a/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/CardBuilder.kt b/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/CardBuilder.kt index 6ed6dfa79..3ce79de31 100644 --- a/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/CardBuilder.kt +++ b/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/CardBuilder.kt @@ -72,7 +72,7 @@ import kotlinx.coroutines.launch fun CardBuilder( title: @Composable () -> AnnotatedString, floatingActionButton: @Composable (isScrolled: Boolean) -> Unit, - bottomSheetContent: @Composable ColumnScope.() -> Unit, + bottomSheetContent: @Composable ColumnScope.(FocusRequester) -> Unit, onNavClick: () -> Unit, onAddClick: () -> Unit, onCardClick: (Stacked) -> Unit, @@ -131,8 +131,8 @@ fun CardBuilder( indication = null, onClick = { isEditing = false - keyBoardController?.hide() focusManager.clearFocus() + keyBoardController?.hide() }, ), scaffoldState = scaffoldState, @@ -163,12 +163,15 @@ fun CardBuilder( isValid = isValid, legalities = legalities, cardsState = cardsState, + focusRequester = nameFocusRequester, onHeaderClick = { coroutineScope.launch { scaffoldState.bottomSheetState.expand() } }, - content = bottomSheetContent, + content = {focusRequester -> + bottomSheetContent(focusRequester) + }, ) }, sheetDragHandle = null, diff --git a/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/composables/BuilderBottomSheet.kt b/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/composables/BuilderBottomSheet.kt index ec6a96d10..0f0dbd49c 100644 --- a/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/composables/BuilderBottomSheet.kt +++ b/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/composables/BuilderBottomSheet.kt @@ -40,9 +40,10 @@ import kotlinx.collections.immutable.persistentListOf internal fun ColumnScope.BuilderBottomSheet( isValid: Boolean, legalities: Legalities, + focusRequester: FocusRequester, cardsState: LoadState>, onHeaderClick: () -> Unit, - content: @Composable ColumnScope.() -> Unit, + content: @Composable ColumnScope.(FocusRequester) -> Unit, ) { val cards = cardsState.dataOrNull ?: persistentListOf() @@ -61,7 +62,7 @@ internal fun ColumnScope.BuilderBottomSheet( .focusGroup() .verticalScroll(rememberScrollState()), ) { - content() + content(focusRequester) } Spacer(Modifier.windowInsetsBottomHeight(WindowInsets.navigationBars)) diff --git a/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/BoosterPackBuilder.kt b/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/BoosterPackBuilder.kt index be82cadc4..6ec1df31e 100644 --- a/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/BoosterPackBuilder.kt +++ b/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/BoosterPackBuilder.kt @@ -6,10 +6,8 @@ import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable -import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier -import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.font.FontStyle @@ -46,7 +44,6 @@ fun BoosterPackBuilder( val coroutineScope = rememberCoroutineScope() val overlayHost = LocalOverlayHost.current val eventSink = state.eventSink - val nameFocusRequester = remember { FocusRequester() } val boosterPack = state.session.boosterPackOrNull() val boosterPackName = boosterPack?.name ?: "" @@ -73,10 +70,10 @@ fun BoosterPackBuilder( containerColor = MaterialTheme.colorScheme.secondaryContainer, ) }, - bottomSheetContent = { + bottomSheetContent = {focusRequester -> BoosterPackBottomSheet( state = state, - focusRequester = nameFocusRequester + focusRequester = focusRequester, ) }, onNavClick = { eventSink(NavigateBack) }, diff --git a/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/composables/BoosterPackBottomSheet.kt b/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/composables/BoosterPackBottomSheet.kt index 4bb39c961..1bc47d6e9 100644 --- a/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/composables/BoosterPackBottomSheet.kt +++ b/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/composables/BoosterPackBottomSheet.kt @@ -27,7 +27,7 @@ import app.deckbox.features.boosterpacks.ui.builder.PackPriceState @Composable internal fun ColumnScope.BoosterPackBottomSheet( state: BoosterPackBuilderUiState, - focusRequester: FocusRequester, + focusRequester: FocusRequester ) { val eventSink = state.eventSink var nameValue by remember(state.session.boosterPackOrNull() != null) { diff --git a/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/DeckBuilder.kt b/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/DeckBuilder.kt index ca911b714..e848a6f19 100644 --- a/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/DeckBuilder.kt +++ b/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/DeckBuilder.kt @@ -6,10 +6,8 @@ import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable -import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier -import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.font.FontStyle @@ -46,7 +44,6 @@ fun DeckBuilder( val coroutineScope = rememberCoroutineScope() val overlayHost = LocalOverlayHost.current val eventSink = state.eventSink - val nameFocusRequester = remember { FocusRequester() } val deck = state.session.deckOrNull() val deckName = deck?.name ?: "" val validation = state.validation.dataOrNull ?: DeckValidation() @@ -73,10 +70,10 @@ fun DeckBuilder( icon = { Icon(Icons.Rounded.AddCard, contentDescription = null) }, ) }, - bottomSheetContent = { + bottomSheetContent = {focusRequester -> DeckBuilderBottomSheet( state = state, - focusRequester = nameFocusRequester + focusRequester = focusRequester, ) }, onNavClick = { eventSink(NavigateBack) }, @@ -102,6 +99,6 @@ fun DeckBuilder( cardsState = state.cards, isValid = validation.isValid && !validation.isEmpty, legalities = deck?.legalities ?: Legalities(standard = Legality.LEGAL), - modifier = modifier, + modifier = modifier ) } From c7e229a598beb012e888752a34408865c118504b Mon Sep 17 00:00:00 2001 From: YoussefHachicha Date: Tue, 24 Oct 2023 18:06:38 +0100 Subject: [PATCH 5/9] fixed conflits with spotless --- .idea/.name | 1 + .idea/kotlinScripting.xml | 11 ------ .../compose/widgets/builder/CardBuilder.kt | 37 +++---------------- .../builder/composables/BuilderBottomSheet.kt | 20 +--------- 4 files changed, 7 insertions(+), 62 deletions(-) create mode 100644 .idea/.name delete mode 100644 .idea/kotlinScripting.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 000000000..1a92dcbb5 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +DeckBox \ No newline at end of file diff --git a/.idea/kotlinScripting.xml b/.idea/kotlinScripting.xml deleted file mode 100644 index 424122b55..000000000 --- a/.idea/kotlinScripting.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - 2147483647 - - - 2147483647 - - - \ No newline at end of file diff --git a/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/CardBuilder.kt b/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/CardBuilder.kt index 3ce79de31..6625ab4f2 100644 --- a/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/CardBuilder.kt +++ b/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/CardBuilder.kt @@ -4,37 +4,14 @@ import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.Crossfade import androidx.compose.foundation.clickable import androidx.compose.foundation.interaction.MutableInteractionSource -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.ColumnScope -import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.foundation.layout.WindowInsets -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.windowInsetsPadding +import androidx.compose.foundation.layout.* import androidx.compose.foundation.lazy.grid.LazyGridState import androidx.compose.foundation.lazy.grid.rememberLazyGridState import androidx.compose.material.icons.Icons import androidx.compose.material.icons.rounded.ArrowBack import androidx.compose.material.icons.rounded.Edit -import androidx.compose.material3.BottomSheetScaffold -import androidx.compose.material3.BottomSheetScaffoldState -import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.Icon -import androidx.compose.material3.IconButton -import androidx.compose.material3.LargeTopAppBar -import androidx.compose.material3.SheetValue -import androidx.compose.material3.Text -import androidx.compose.material3.TopAppBarDefaults -import androidx.compose.material3.TopAppBarScrollBehavior -import androidx.compose.material3.rememberBottomSheetScaffoldState -import androidx.compose.runtime.Composable -import androidx.compose.runtime.LaunchedEffect -import androidx.compose.runtime.derivedStateOf -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.rememberCoroutineScope -import androidx.compose.runtime.setValue +import androidx.compose.material3.* +import androidx.compose.runtime.* import androidx.compose.ui.Alignment import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier @@ -53,11 +30,7 @@ import app.deckbox.common.compose.widgets.ContentLoadingSize import app.deckbox.common.compose.widgets.DefaultEmptyView import app.deckbox.common.compose.widgets.EditingAppBar import app.deckbox.common.compose.widgets.SpinningPokeballLoadingIndicator -import app.deckbox.common.compose.widgets.builder.composables.BuilderBottomSheet -import app.deckbox.common.compose.widgets.builder.composables.CardList -import app.deckbox.common.compose.widgets.builder.composables.DefaultCardSpacing -import app.deckbox.common.compose.widgets.builder.composables.DefaultColumns -import app.deckbox.common.compose.widgets.builder.composables.SheetHeaderHeight +import app.deckbox.common.compose.widgets.builder.composables.* import app.deckbox.common.compose.widgets.builder.model.CardUiModel import app.deckbox.core.coroutines.LoadState import app.deckbox.core.model.Card @@ -169,7 +142,7 @@ fun CardBuilder( scaffoldState.bottomSheetState.expand() } }, - content = {focusRequester -> + content = { focusRequester -> bottomSheetContent(focusRequester) }, ) diff --git a/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/composables/BuilderBottomSheet.kt b/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/composables/BuilderBottomSheet.kt index 0f0dbd49c..727d188e0 100644 --- a/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/composables/BuilderBottomSheet.kt +++ b/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/composables/BuilderBottomSheet.kt @@ -2,30 +2,12 @@ package app.deckbox.common.compose.widgets.builder.composables import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.focusGroup -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.ColumnScope -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.WindowInsets -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.windowInsetsBottomHeight +import androidx.compose.foundation.layout.* import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll -import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.rounded.ShortText -import androidx.compose.material3.Icon -import androidx.compose.material3.Text -import androidx.compose.material3.TextField import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusRequester -import androidx.compose.ui.focus.focusRequester -import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.unit.dp import app.deckbox.common.compose.widgets.builder.model.CardUiModel import app.deckbox.core.coroutines.LoadState From d6e885293585c794427946f3563af3ebe1030c88 Mon Sep 17 00:00:00 2001 From: YoussefHachicha Date: Wed, 25 Oct 2023 07:32:11 +0100 Subject: [PATCH 6/9] removed wild imports --- .../compose/widgets/builder/CardBuilder.kt | 35 ++++++++++++++++--- .../builder/composables/BuilderBottomSheet.kt | 7 +++- .../composables/BoosterPackBottomSheet.kt | 6 +++- 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/CardBuilder.kt b/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/CardBuilder.kt index 6625ab4f2..d0f129299 100644 --- a/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/CardBuilder.kt +++ b/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/CardBuilder.kt @@ -4,14 +4,37 @@ import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.Crossfade import androidx.compose.foundation.clickable import androidx.compose.foundation.interaction.MutableInteractionSource -import androidx.compose.foundation.layout.* +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.ColumnScope +import androidx.compose.foundation.layout.WindowInsets +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.windowInsetsPadding import androidx.compose.foundation.lazy.grid.LazyGridState import androidx.compose.foundation.lazy.grid.rememberLazyGridState import androidx.compose.material.icons.Icons import androidx.compose.material.icons.rounded.ArrowBack import androidx.compose.material.icons.rounded.Edit -import androidx.compose.material3.* -import androidx.compose.runtime.* +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.SheetValue +import androidx.compose.material3.Text +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.LargeTopAppBar +import androidx.compose.material3.TopAppBarScrollBehavior +import androidx.compose.material3.BottomSheetScaffoldState +import androidx.compose.material3.TopAppBarDefaults +import androidx.compose.material3.BottomSheetScaffold +import androidx.compose.material3.rememberBottomSheetScaffoldState +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.setValue +import androidx.compose.runtime.derivedStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Alignment import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier @@ -30,7 +53,11 @@ import app.deckbox.common.compose.widgets.ContentLoadingSize import app.deckbox.common.compose.widgets.DefaultEmptyView import app.deckbox.common.compose.widgets.EditingAppBar import app.deckbox.common.compose.widgets.SpinningPokeballLoadingIndicator -import app.deckbox.common.compose.widgets.builder.composables.* +import app.deckbox.common.compose.widgets.builder.composables.DefaultColumns +import app.deckbox.common.compose.widgets.builder.composables.DefaultCardSpacing +import app.deckbox.common.compose.widgets.builder.composables.BuilderBottomSheet +import app.deckbox.common.compose.widgets.builder.composables.SheetHeaderHeight +import app.deckbox.common.compose.widgets.builder.composables.CardList import app.deckbox.common.compose.widgets.builder.model.CardUiModel import app.deckbox.core.coroutines.LoadState import app.deckbox.core.model.Card diff --git a/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/composables/BuilderBottomSheet.kt b/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/composables/BuilderBottomSheet.kt index 727d188e0..dcfc45bac 100644 --- a/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/composables/BuilderBottomSheet.kt +++ b/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/composables/BuilderBottomSheet.kt @@ -2,7 +2,12 @@ package app.deckbox.common.compose.widgets.builder.composables import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.focusGroup -import androidx.compose.foundation.layout.* +import androidx.compose.foundation.layout.ColumnScope +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.windowInsetsBottomHeight +import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.runtime.Composable diff --git a/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/composables/BoosterPackBottomSheet.kt b/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/composables/BoosterPackBottomSheet.kt index 1bc47d6e9..63b093fcc 100644 --- a/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/composables/BoosterPackBottomSheet.kt +++ b/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/composables/BoosterPackBottomSheet.kt @@ -11,7 +11,11 @@ import androidx.compose.material3.Divider import androidx.compose.material3.Icon import androidx.compose.material3.Text import androidx.compose.material3.TextField -import androidx.compose.runtime.* +import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.getValue +import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.focus.focusRequester From 7b692d70a419a31906b189470de328fe48157e54 Mon Sep 17 00:00:00 2001 From: YoussefHachicha Date: Thu, 26 Oct 2023 08:54:13 +0100 Subject: [PATCH 7/9] added the resuested changes --- .../compose/widgets/builder/CardBuilder.kt | 47 ++++++++--------- .../builder/composables/BuilderBottomSheet.kt | 44 ++++++++++++---- .../ui/builder/BoosterPackBuilder.kt | 28 +++++++---- .../composables/BoosterPackBottomSheet.kt | 50 ------------------- .../builder/DeckBuilder.kt | 28 +++++++---- .../composables/DeckBuilderBottomSheet.kt | 33 ------------ 6 files changed, 93 insertions(+), 137 deletions(-) diff --git a/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/CardBuilder.kt b/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/CardBuilder.kt index d0f129299..58f94b93a 100644 --- a/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/CardBuilder.kt +++ b/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/CardBuilder.kt @@ -5,45 +5,44 @@ import androidx.compose.animation.Crossfade import androidx.compose.foundation.clickable import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.ColumnScope -import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.WindowInsets +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.windowInsetsPadding import androidx.compose.foundation.lazy.grid.LazyGridState import androidx.compose.foundation.lazy.grid.rememberLazyGridState import androidx.compose.material.icons.Icons import androidx.compose.material.icons.rounded.ArrowBack import androidx.compose.material.icons.rounded.Edit +import androidx.compose.material3.BottomSheetScaffold +import androidx.compose.material3.BottomSheetScaffoldState import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.SheetValue -import androidx.compose.material3.Text import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.LargeTopAppBar -import androidx.compose.material3.TopAppBarScrollBehavior -import androidx.compose.material3.BottomSheetScaffoldState +import androidx.compose.material3.SheetValue +import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults -import androidx.compose.material3.BottomSheetScaffold +import androidx.compose.material3.TopAppBarScrollBehavior import androidx.compose.material3.rememberBottomSheetScaffoldState import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.derivedStateOf import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.setValue -import androidx.compose.runtime.derivedStateOf import androidx.compose.runtime.remember -import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.rememberCoroutineScope +import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.input.nestedscroll.nestedScroll import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalFocusManager -import androidx.compose.ui.platform.LocalSoftwareKeyboardController import androidx.compose.ui.text.AnnotatedString +import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import app.deckbox.common.compose.PlatformBackHandler @@ -53,11 +52,11 @@ import app.deckbox.common.compose.widgets.ContentLoadingSize import app.deckbox.common.compose.widgets.DefaultEmptyView import app.deckbox.common.compose.widgets.EditingAppBar import app.deckbox.common.compose.widgets.SpinningPokeballLoadingIndicator -import app.deckbox.common.compose.widgets.builder.composables.DefaultColumns -import app.deckbox.common.compose.widgets.builder.composables.DefaultCardSpacing import app.deckbox.common.compose.widgets.builder.composables.BuilderBottomSheet -import app.deckbox.common.compose.widgets.builder.composables.SheetHeaderHeight import app.deckbox.common.compose.widgets.builder.composables.CardList +import app.deckbox.common.compose.widgets.builder.composables.DefaultCardSpacing +import app.deckbox.common.compose.widgets.builder.composables.DefaultColumns +import app.deckbox.common.compose.widgets.builder.composables.SheetHeaderHeight import app.deckbox.common.compose.widgets.builder.model.CardUiModel import app.deckbox.core.coroutines.LoadState import app.deckbox.core.model.Card @@ -67,18 +66,20 @@ import com.moriatsushi.insetsx.navigationBars import kotlinx.collections.immutable.ImmutableList import kotlinx.coroutines.launch -@OptIn(ExperimentalMaterial3Api::class, ExperimentalComposeUiApi::class) +@OptIn(ExperimentalMaterial3Api::class) @Composable fun CardBuilder( + name: TextFieldValue, title: @Composable () -> AnnotatedString, floatingActionButton: @Composable (isScrolled: Boolean) -> Unit, - bottomSheetContent: @Composable ColumnScope.(FocusRequester) -> Unit, + bottomSheetContent: @Composable ColumnScope.() -> Unit, onNavClick: () -> Unit, onAddClick: () -> Unit, onCardClick: (Stacked) -> Unit, onAddCardClick: (Stacked) -> Unit, onRemoveCardClick: (Stacked) -> Unit, onTipClick: (CardUiModel.Tip) -> Unit, + onNameChange: (TextFieldValue) -> Unit, cardsState: LoadState>, modifier: Modifier = Modifier, isValid: Boolean = true, @@ -88,7 +89,6 @@ fun CardBuilder( ) { val coroutineScope = rememberCoroutineScope() val focusManager = LocalFocusManager.current - val keyBoardController = LocalSoftwareKeyboardController.current val bottomPadding = with(LocalDensity.current) { WindowInsets.navigationBars.getBottom(this).toDp() @@ -104,10 +104,8 @@ fun CardBuilder( } } - LaunchedEffect(isBottomSheetCollapsed) { if (isBottomSheetCollapsed) { - keyBoardController?.hide() focusManager.clearFocus() } } @@ -132,7 +130,6 @@ fun CardBuilder( onClick = { isEditing = false focusManager.clearFocus() - keyBoardController?.hide() }, ), scaffoldState = scaffoldState, @@ -160,6 +157,7 @@ fun CardBuilder( }, sheetContent = { BuilderBottomSheet( + name = name, isValid = isValid, legalities = legalities, cardsState = cardsState, @@ -169,9 +167,8 @@ fun CardBuilder( scaffoldState.bottomSheetState.expand() } }, - content = { focusRequester -> - bottomSheetContent(focusRequester) - }, + onNameChange = onNameChange, + content = bottomSheetContent, ) }, sheetDragHandle = null, diff --git a/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/composables/BuilderBottomSheet.kt b/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/composables/BuilderBottomSheet.kt index dcfc45bac..2521bc28a 100644 --- a/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/composables/BuilderBottomSheet.kt +++ b/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/composables/BuilderBottomSheet.kt @@ -2,17 +2,19 @@ package app.deckbox.common.compose.widgets.builder.composables import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.focusGroup -import androidx.compose.foundation.layout.ColumnScope -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.windowInsetsBottomHeight -import androidx.compose.foundation.layout.WindowInsets +import androidx.compose.foundation.layout.* import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll -import androidx.compose.runtime.Composable +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.rounded.ShortText +import androidx.compose.material3.Icon +import androidx.compose.material3.Text +import androidx.compose.material3.TextField +import androidx.compose.runtime.* import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusRequester +import androidx.compose.ui.focus.focusRequester +import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.unit.dp import app.deckbox.common.compose.widgets.builder.model.CardUiModel import app.deckbox.core.coroutines.LoadState @@ -21,16 +23,17 @@ import app.deckbox.core.model.SuperType import com.moriatsushi.insetsx.navigationBars import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.persistentListOf - @OptIn(ExperimentalFoundationApi::class) @Composable internal fun ColumnScope.BuilderBottomSheet( + name: TextFieldValue, isValid: Boolean, legalities: Legalities, focusRequester: FocusRequester, cardsState: LoadState>, onHeaderClick: () -> Unit, - content: @Composable ColumnScope.(FocusRequester) -> Unit, + onNameChange: (TextFieldValue) -> Unit, + content: @Composable ColumnScope.() -> Unit, ) { val cards = cardsState.dataOrNull ?: persistentListOf() @@ -49,7 +52,28 @@ internal fun ColumnScope.BuilderBottomSheet( .focusGroup() .verticalScroll(rememberScrollState()), ) { - content(focusRequester) + + BuilderTextField( + icon = { Icon(Icons.Rounded.ShortText, contentDescription = null) }, + ) { + TextField( + value = name, + onValueChange = { value -> + onNameChange(value) + }, + placeholder = { + Text("Name") + }, + label = { + Text("Name") + }, + modifier = Modifier + .fillMaxWidth() + .focusRequester(focusRequester), + ) + } + Spacer(Modifier.height(16.dp)) + content() } Spacer(Modifier.windowInsetsBottomHeight(WindowInsets.navigationBars)) diff --git a/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/BoosterPackBuilder.kt b/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/BoosterPackBuilder.kt index 6ec1df31e..12ba8c820 100644 --- a/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/BoosterPackBuilder.kt +++ b/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/BoosterPackBuilder.kt @@ -7,10 +7,15 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.rememberCoroutineScope +import androidx.compose.runtime.remember +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.setValue +import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.font.FontStyle +import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.unit.dp import app.deckbox.common.compose.icons.rounded.AddCard import app.deckbox.common.compose.overlays.showBottomSheetScreen @@ -45,11 +50,19 @@ fun BoosterPackBuilder( val overlayHost = LocalOverlayHost.current val eventSink = state.eventSink val boosterPack = state.session.boosterPackOrNull() - val boosterPackName = boosterPack?.name ?: "" + + var boosterPackName by remember(state.session.boosterPackOrNull() != null) { + mutableStateOf(TextFieldValue(state.session.boosterPackOrNull()?.name ?: "")) + } CardBuilder( + name = boosterPackName, + onNameChange = { value -> + boosterPackName = value + eventSink(BoosterPackBuilderUiEvent.EditName(value.text)) + }, title = { - if (boosterPackName.isBlank()) { + if (boosterPackName.text.isBlank()) { AnnotatedString( LocalStrings.current.boosterPackPickerTitle, SpanStyle( @@ -58,7 +71,7 @@ fun BoosterPackBuilder( ), ) } else { - AnnotatedString(boosterPackName) + AnnotatedString(boosterPackName.text) } }, floatingActionButton = { isScrolled -> @@ -70,11 +83,8 @@ fun BoosterPackBuilder( containerColor = MaterialTheme.colorScheme.secondaryContainer, ) }, - bottomSheetContent = {focusRequester -> - BoosterPackBottomSheet( - state = state, - focusRequester = focusRequester, - ) + bottomSheetContent = { + BoosterPackBottomSheet(state) }, onNavClick = { eventSink(NavigateBack) }, onAddClick = { @@ -100,6 +110,6 @@ fun BoosterPackBuilder( legalities = boosterPack?.legalities ?: Legalities(standard = Legality.LEGAL), columns = 4, cardSpacing = 8.dp, - modifier = modifier + modifier = modifier, ) } diff --git a/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/composables/BoosterPackBottomSheet.kt b/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/composables/BoosterPackBottomSheet.kt index 63b093fcc..5ed6f2588 100644 --- a/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/composables/BoosterPackBottomSheet.kt +++ b/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/composables/BoosterPackBottomSheet.kt @@ -2,69 +2,19 @@ package app.deckbox.features.boosterpacks.ui.builder.composables import androidx.compose.foundation.layout.ColumnScope import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height -import androidx.compose.foundation.text.KeyboardOptions -import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.rounded.ShortText import androidx.compose.material3.Divider -import androidx.compose.material3.Icon -import androidx.compose.material3.Text -import androidx.compose.material3.TextField import androidx.compose.runtime.Composable -import androidx.compose.runtime.remember -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.getValue -import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier -import androidx.compose.ui.focus.FocusRequester -import androidx.compose.ui.focus.focusRequester -import androidx.compose.ui.text.input.ImeAction -import androidx.compose.ui.text.input.KeyboardType -import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.unit.dp -import app.deckbox.common.compose.widgets.builder.composables.BuilderTextField -import app.deckbox.features.boosterpacks.ui.builder.BoosterPackBuilderUiEvent import app.deckbox.features.boosterpacks.ui.builder.BoosterPackBuilderUiState import app.deckbox.features.boosterpacks.ui.builder.PackPriceState @Composable internal fun ColumnScope.BoosterPackBottomSheet( state: BoosterPackBuilderUiState, - focusRequester: FocusRequester ) { - val eventSink = state.eventSink - var nameValue by remember(state.session.boosterPackOrNull() != null) { - mutableStateOf(TextFieldValue(state.session.boosterPackOrNull()?.name ?: "")) - } - BuilderTextField( - icon = { Icon(Icons.Rounded.ShortText, contentDescription = null) }, - ) { - TextField( - value = nameValue, - onValueChange = { value -> - nameValue = value - eventSink(BoosterPackBuilderUiEvent.EditName(value.text)) - }, - placeholder = { - Text("Name") - }, - label = { - Text("Name") - }, - keyboardOptions = KeyboardOptions( - keyboardType = KeyboardType.Text, - imeAction = ImeAction.Done, - ), - singleLine = true, - modifier = Modifier - .fillMaxWidth() - .focusRequester(focusRequester) - ) - } - Spacer(Modifier.height(16.dp)) Divider() - PackPrices( prices = state.price.dataOrNull ?: PackPriceState(), ) diff --git a/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/DeckBuilder.kt b/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/DeckBuilder.kt index e848a6f19..09814cee5 100644 --- a/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/DeckBuilder.kt +++ b/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/DeckBuilder.kt @@ -7,10 +7,15 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.rememberCoroutineScope +import androidx.compose.runtime.remember +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.getValue +import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.font.FontStyle +import androidx.compose.ui.text.input.TextFieldValue import app.deckbox.common.compose.icons.rounded.AddCard import app.deckbox.common.compose.overlays.showBottomSheetScreen import app.deckbox.common.compose.widgets.builder.CardBuilder @@ -45,12 +50,18 @@ fun DeckBuilder( val overlayHost = LocalOverlayHost.current val eventSink = state.eventSink val deck = state.session.deckOrNull() - val deckName = deck?.name ?: "" val validation = state.validation.dataOrNull ?: DeckValidation() - + var deckName by remember(state.session.deckOrNull() != null) { + mutableStateOf(TextFieldValue(state.session.deckOrNull()?.name ?: "")) + } CardBuilder( + name = deckName, + onNameChange = { value -> + deckName = value + eventSink(DeckBuilderUiEvent.EditName(value.text)) + }, title = { - if (deckName.isBlank()) { + if (deckName.text.isBlank()) { AnnotatedString( LocalStrings.current.deckTitleNoName, SpanStyle( @@ -59,7 +70,7 @@ fun DeckBuilder( ), ) } else { - AnnotatedString(deckName) + AnnotatedString(deckName.text) } }, floatingActionButton = { isScrolled -> @@ -70,11 +81,8 @@ fun DeckBuilder( icon = { Icon(Icons.Rounded.AddCard, contentDescription = null) }, ) }, - bottomSheetContent = {focusRequester -> - DeckBuilderBottomSheet( - state = state, - focusRequester = focusRequester, - ) + bottomSheetContent = { + DeckBuilderBottomSheet(state) }, onNavClick = { eventSink(NavigateBack) }, onAddClick = { @@ -99,6 +107,6 @@ fun DeckBuilder( cardsState = state.cards, isValid = validation.isValid && !validation.isEmpty, legalities = deck?.legalities ?: Legalities(standard = Legality.LEGAL), - modifier = modifier + modifier = modifier, ) } diff --git a/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/composables/DeckBuilderBottomSheet.kt b/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/composables/DeckBuilderBottomSheet.kt index 978fc41ca..b74d0915d 100644 --- a/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/composables/DeckBuilderBottomSheet.kt +++ b/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/composables/DeckBuilderBottomSheet.kt @@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material.icons.Icons import androidx.compose.material.icons.rounded.ErrorOutline -import androidx.compose.material.icons.rounded.ShortText import androidx.compose.material.icons.rounded.Subject import androidx.compose.material3.Divider import androidx.compose.material3.Icon @@ -23,8 +22,6 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier -import androidx.compose.ui.focus.FocusRequester -import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.TextFieldValue @@ -39,7 +36,6 @@ import app.deckbox.ui.decks.builder.DeckPriceState @Composable internal fun ColumnScope.DeckBuilderBottomSheet( state: DeckBuilderUiState, - focusRequester: FocusRequester, ) { val eventSink = state.eventSink val validation = state.validation.dataOrNull ?: DeckValidation() @@ -48,35 +44,6 @@ internal fun ColumnScope.DeckBuilderBottomSheet( var descriptionValue by remember(state.session.deckOrNull() != null) { mutableStateOf(TextFieldValue(state.session.deckOrNull()?.description ?: "")) } - var nameValue by remember(state.session.deckOrNull() != null) { - mutableStateOf(TextFieldValue(state.session.deckOrNull()?.name ?: "")) - } - BuilderTextField( - icon = { Icon(Icons.Rounded.ShortText, contentDescription = null) }, - ) { - TextField( - value = nameValue, - onValueChange = { value -> - nameValue = value - eventSink(DeckBuilderUiEvent.EditName(value.text)) - }, - placeholder = { - Text("Name") - }, - label = { - Text("Name") - }, - keyboardOptions = KeyboardOptions( - keyboardType = KeyboardType.Text, - imeAction = ImeAction.Next, - ), - singleLine = true, - modifier = Modifier - .fillMaxWidth() - .focusRequester(focusRequester) - ) - } - Spacer(Modifier.height(16.dp)) BuilderTextField( icon = { Icon(Icons.Rounded.Subject, contentDescription = null) }, ) { From b031febb7cf10eb210eb0e4d61d23d5d116740c4 Mon Sep 17 00:00:00 2001 From: YoussefHachicha Date: Thu, 26 Oct 2023 08:57:22 +0100 Subject: [PATCH 8/9] removed wild cards imports --- .../builder/composables/BuilderBottomSheet.kt | 12 +++++++++--- .../boosterpacks/ui/builder/BoosterPackBuilder.kt | 6 +++--- .../app.deckbox.ui.decks/builder/DeckBuilder.kt | 6 +++--- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/composables/BuilderBottomSheet.kt b/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/composables/BuilderBottomSheet.kt index 2521bc28a..cc714d918 100644 --- a/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/composables/BuilderBottomSheet.kt +++ b/common/compose/src/commonMain/kotlin/app/deckbox/common/compose/widgets/builder/composables/BuilderBottomSheet.kt @@ -2,7 +2,14 @@ package app.deckbox.common.compose.widgets.builder.composables import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.focusGroup -import androidx.compose.foundation.layout.* +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.ColumnScope +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.WindowInsets +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.windowInsetsBottomHeight import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material.icons.Icons @@ -10,7 +17,7 @@ import androidx.compose.material.icons.rounded.ShortText import androidx.compose.material3.Icon import androidx.compose.material3.Text import androidx.compose.material3.TextField -import androidx.compose.runtime.* +import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.focus.focusRequester @@ -52,7 +59,6 @@ internal fun ColumnScope.BuilderBottomSheet( .focusGroup() .verticalScroll(rememberScrollState()), ) { - BuilderTextField( icon = { Icon(Icons.Rounded.ShortText, contentDescription = null) }, ) { diff --git a/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/BoosterPackBuilder.kt b/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/BoosterPackBuilder.kt index 12ba8c820..9b40b058a 100644 --- a/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/BoosterPackBuilder.kt +++ b/features/boosterpacks/ui/src/commonMain/kotlin/app/deckbox/features/boosterpacks/ui/builder/BoosterPackBuilder.kt @@ -6,11 +6,11 @@ import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable -import androidx.compose.runtime.rememberCoroutineScope -import androidx.compose.runtime.remember +import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue -import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.text.SpanStyle diff --git a/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/DeckBuilder.kt b/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/DeckBuilder.kt index 09814cee5..25fa19838 100644 --- a/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/DeckBuilder.kt +++ b/features/decks/ui/src/commonMain/kotlin/app.deckbox.ui.decks/builder/DeckBuilder.kt @@ -6,10 +6,10 @@ import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable -import androidx.compose.runtime.rememberCoroutineScope -import androidx.compose.runtime.remember -import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.text.AnnotatedString From 1a60892a3a470c7ac9b8ae35da8a1299f353c1b5 Mon Sep 17 00:00:00 2001 From: YoussefHachicha Date: Thu, 26 Oct 2023 13:02:14 +0100 Subject: [PATCH 9/9] added the kotlinScripting.xml again --- .idea/kotlinScripting.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .idea/kotlinScripting.xml diff --git a/.idea/kotlinScripting.xml b/.idea/kotlinScripting.xml new file mode 100644 index 000000000..bafd01b0e --- /dev/null +++ b/.idea/kotlinScripting.xml @@ -0,0 +1,11 @@ + + + + + 2147483647 + + + 2147483647 + + +