Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compose Multiplatform #89

Merged
merged 60 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
487261f
refactor core module to multiplatform
DatL4g Mar 29, 2024
58908fb
multiplatform core module
DatL4g Mar 29, 2024
1d38e02
fix old android targets
DatL4g Mar 29, 2024
2f65c32
prepare calendar multiplatform
DatL4g Mar 29, 2024
392641f
calendar multiplatform compatible
DatL4g Mar 29, 2024
afa6178
rating multiplatform compatible
DatL4g Mar 30, 2024
5393ed2
option multiplatform compatible
DatL4g Mar 30, 2024
50dcb48
list multiplatform compatible
DatL4g Mar 30, 2024
83dde05
multiplatform landscape check
DatL4g Mar 30, 2024
8e11b75
prepare snapshot release
DatL4g Mar 30, 2024
75d6893
fix snapshot release
DatL4g Mar 30, 2024
0cd7fa2
added release workflow
DatL4g Mar 30, 2024
da08075
api core library
DatL4g Mar 30, 2024
8ecc373
make states fully serializable
DatL4g Mar 30, 2024
14e7852
added missing java serialization
DatL4g Mar 30, 2024
981caa0
skip workflows
DatL4g Mar 30, 2024
3da43ed
fix calendar module
DatL4g Mar 30, 2024
4efdbde
fix calendar module
DatL4g Mar 30, 2024
879f669
fix calendar resources
DatL4g Mar 30, 2024
87bb4a0
fix calendar arrow size
DatL4g Mar 30, 2024
ba08232
added default selection for rating
DatL4g Apr 3, 2024
a8ba838
fix resources
DatL4g Apr 3, 2024
b795aa9
added possibility to deselect rating and rating of 0 is valid
DatL4g Apr 4, 2024
47a5cca
migrate state module
DatL4g Apr 4, 2024
8d3262e
migrate input module
DatL4g Apr 4, 2024
adeb1c0
migrate info module
DatL4g Apr 4, 2024
6f30cb1
migrate color module
DatL4g Apr 4, 2024
446bdd0
migrate emoji module
DatL4g Apr 11, 2024
37bc03c
migrate emoji module
DatL4g Apr 11, 2024
2a6a658
migrate date_time module
DatL4g Apr 11, 2024
dcc5d95
migrate date_time module
DatL4g Apr 11, 2024
7b2940a
migrate date_time module
DatL4g Apr 11, 2024
0d1f94e
migrate duration module
DatL4g Apr 12, 2024
38d3372
migrate clock module
DatL4g Apr 12, 2024
1d5bfa7
added missing configuration
DatL4g Apr 12, 2024
b29bc84
changed readme as core module is not required to add manually anymore
DatL4g Apr 12, 2024
02dbb78
added wasm target
DatL4g Apr 12, 2024
a6a90ff
added missing wasm implementations
DatL4g Apr 12, 2024
5f185b5
chore(deps): ⬆️ Upgraded Compose versions
maicol07 Apr 15, 2024
fb7d802
refactor: Moved dependency management from buildSrc to Version Catalog
maicol07 Apr 16, 2024
1c81161
Merge pull request #1 from maicol07/main
DatL4g Apr 16, 2024
da9f1f1
updated compose
DatL4g Apr 17, 2024
3886da0
ignore some fields from java serialization
DatL4g Apr 18, 2024
8c34770
roll back compose version
DatL4g Apr 18, 2024
e53bb5f
update to latest compose version
DatL4g Apr 29, 2024
cee7dbe
update to latest compose version
DatL4g Apr 30, 2024
90b23af
option invoke click listener
DatL4g Apr 30, 2024
01e57b0
option icon size
DatL4g May 12, 2024
b022d95
rating body max width
DatL4g May 12, 2024
dd2451a
revert sizing
DatL4g May 12, 2024
f16d2d3
revert LocalDate calculations and fix visual error
DatL4g May 13, 2024
dce4cd0
removed unused file
DatL4g May 13, 2024
f21cd3d
apply system locale on jvm
DatL4g May 14, 2024
24de041
added missing localization
DatL4g May 14, 2024
27692e6
added body for option
DatL4g May 14, 2024
ed2ba8c
added missing body dependency injection
DatL4g May 14, 2024
d2848f5
updated compose
DatL4g May 17, 2024
01f3361
updated dependencies
DatL4g May 22, 2024
3518cc7
fix crash on android
DatL4g May 31, 2024
9ea729a
bump versions
DatL4g Oct 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added body for option
  • Loading branch information
DatL4g committed May 14, 2024
commit 27692e64a2f7ead3dd8f275f1520da113d3c22a4
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import androidx.compose.ui.window.DialogProperties
import com.maxkeppeker.sheets.core.models.base.Header
import com.maxkeppeker.sheets.core.models.base.UseCaseState
import com.maxkeppeker.sheets.core.views.base.DialogBase
import com.maxkeppeler.sheets.option.models.OptionBody
import com.maxkeppeler.sheets.option.models.OptionConfig
import com.maxkeppeler.sheets.option.models.OptionSelection

Expand All @@ -41,6 +42,7 @@ fun OptionDialog(
selection: OptionSelection,
config: OptionConfig = OptionConfig(),
header: Header? = null,
body: OptionBody? = null,
properties: DialogProperties = DialogProperties(),
) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import androidx.compose.ui.window.PopupProperties
import com.maxkeppeker.sheets.core.models.base.Header
import com.maxkeppeker.sheets.core.models.base.UseCaseState
import com.maxkeppeker.sheets.core.views.base.PopupBase
import com.maxkeppeler.sheets.option.models.OptionBody
import com.maxkeppeler.sheets.option.models.OptionConfig
import com.maxkeppeler.sheets.option.models.OptionSelection

Expand All @@ -45,6 +46,7 @@ fun OptionPopup(
selection: OptionSelection,
config: OptionConfig = OptionConfig(),
header: Header? = null,
body: OptionBody? = null,
alignment: Alignment = Alignment.TopStart,
offset: IntOffset = IntOffset(0, 0),
properties: PopupProperties = PopupProperties(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
package com.maxkeppeler.sheets.option

import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.runtime.Composable
import androidx.compose.runtime.rememberCoroutineScope
Expand All @@ -30,8 +32,10 @@ import com.maxkeppeker.sheets.core.utils.BaseModifiers.dynamicContentWrapOrMaxHe
import com.maxkeppeker.sheets.core.views.ButtonsComponent
import com.maxkeppeker.sheets.core.views.base.FrameBase
import com.maxkeppeler.sheets.option.models.Option
import com.maxkeppeler.sheets.option.models.OptionBody
import com.maxkeppeler.sheets.option.models.OptionConfig
import com.maxkeppeler.sheets.option.models.OptionSelection
import com.maxkeppeler.sheets.option.views.OptionBodyComponent
import com.maxkeppeler.sheets.option.views.OptionBoundsComponent
import com.maxkeppeler.sheets.option.views.OptionComponent

Expand All @@ -49,6 +53,7 @@ fun OptionView(
selection: OptionSelection,
config: OptionConfig = OptionConfig(),
header: Header? = null,
body: OptionBody? = null
) {

val coroutine = rememberCoroutineScope()
Expand All @@ -73,6 +78,12 @@ fun OptionView(
// Override content padding, spacing is within the scrollable container for display mode GRID_HORIZONTAL
horizontalContentPadding = PaddingValues(horizontal = 0.dp),
layout = {
body?.let {
OptionBodyComponent(
body = it
)
Spacer(modifier = Modifier.height(24.dp))
}
OptionBoundsComponent(
selection = selection,
selectedOptions = optionState.selectedOptions
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.maxkeppeler.sheets.option.models

import androidx.compose.runtime.Composable

/**
* Defined implementations of a body for the rating dialog.
*/
abstract class OptionBody {

/**
* Standard implementation of a body.
* @param bodyText Text that will set as the title
* @param preBody Content that is added before the body text.
* @param postBody Content that is added after the body text.
*/
data class Default(
val bodyText: String,
val preBody: @Composable () -> Unit = {},
val postBody: @Composable () -> Unit = {}
) : OptionBody()

/**
* Custom implementation of a body.
*/
data class Custom(
val body: @Composable () -> Unit
) : OptionBody()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.maxkeppeler.sheets.option.views

import androidx.compose.runtime.Composable
import com.maxkeppeler.sheets.option.models.OptionBody

@Composable
fun OptionBodyComponent(
body: OptionBody
) {
when (body) {
is OptionBody.Custom -> body.body.invoke()
is OptionBody.Default -> DefaultBodyComponent(body)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.maxkeppeler.sheets.option.views

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.maxkeppeker.sheets.core.utils.TestTags
import com.maxkeppeler.sheets.option.models.OptionBody
import com.maxkeppeler.sheets.option.models.OptionConfig

/**
* The default body component for the rating dialog.
* @param config The configuration for the rating view.
* @param body The data of the default body.
*/
@Composable
internal fun DefaultBodyComponent(
body: OptionBody.Default,
) {
Column(
modifier = Modifier
.fillMaxWidth()
.padding(top = 16.dp)
) {
body.preBody()
Text(
modifier = Modifier.fillMaxWidth(),
textAlign = TextAlign.Center,
text = body.bodyText,
style = MaterialTheme.typography.bodyMedium
)
body.postBody()
}
}