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

Extend TabStrip API to support custom behaviours #276

Merged
merged 9 commits into from
Dec 28, 2023

Conversation

fscarponi
Copy link
Collaborator

@fscarponi fscarponi commented Dec 18, 2023

In the IDE and in some specs, you can find some kind of fanciful Tabs usage...

as an example, using a composite tabHeader content that has a title made by two different texts with different styles or icons

image

image

we can change the api for to allow users to provide content for tabs, allowing users to solve their own problems

migrating to a new DSL:

    public class TabData.Editor(
        override val selected: Boolean,
        override val content: @Composable TabContentScope.(tabState: TabState) -> Unit,
        override val closable: Boolean = true,
        override val onClose: () -> Unit = {},
        override val onClick: () -> Unit = {},
    ) : TabData()

and exposing the following methods:

@Composable
public fun TabContentScope.SimpleTabContent(
    title: String,
    state: TabState,
    icon: Painter?,
    modifier: Modifier = Modifier,
) 

@Composable
public fun TabContentScope.SimpleTabContent(
    modifier: Modifier = Modifier,
    state: TabState,
    icon: (@Composable () -> Unit)? = null,
    label: @Composable () -> Unit,
)

this will allow achieving custom behavior for the tab, as we show in the standalone sample
image

@fscarponi fscarponi requested a review from rock3r December 18, 2023 16:39
@fscarponi fscarponi linked an issue Dec 18, 2023 that may be closed by this pull request
@fscarponi fscarponi marked this pull request as draft December 18, 2023 16:39
@fscarponi fscarponi changed the title 275 tabs for tabs strips does not allow custom content Extend TabStrip API to support custom behaviours Dec 18, 2023
@fscarponi fscarponi force-pushed the 275-tabs-for-tabs-strips-does-not-allow-custom-content branch 2 times, most recently from 80a6c02 to aafc431 Compare December 19, 2023 08:40
@fscarponi fscarponi marked this pull request as ready for review December 19, 2023 08:40
@fscarponi fscarponi force-pushed the 275-tabs-for-tabs-strips-does-not-allow-custom-content branch from aafc431 to 904bb80 Compare December 20, 2023 07:47
@rock3r rock3r force-pushed the 275-tabs-for-tabs-strips-does-not-allow-custom-content branch from 6af7513 to c28795d Compare December 20, 2023 17:31
@rock3r rock3r added feature New feature or request consistency Our UI presentation is not consistent with IJ labels Dec 20, 2023
@rock3r rock3r added this to the Milestone 13 milestone Dec 20, 2023
@fscarponi fscarponi force-pushed the 275-tabs-for-tabs-strips-does-not-allow-custom-content branch 2 times, most recently from eadaeea to 762e295 Compare December 21, 2023 10:06
@fscarponi fscarponi force-pushed the 275-tabs-for-tabs-strips-does-not-allow-custom-content branch from 762e295 to bb496b7 Compare December 21, 2023 12:17
@fscarponi fscarponi requested a review from rock3r December 21, 2023 13:02
fscarponi and others added 4 commits December 22, 2023 17:15
The user interface has been updated to include tab content spacing. This is established by adding a new parameter, `tabContentSpacing`, in TabMetrics and adjusting and testing its implementation across various files like `IntUiTabStyling.kt`, `IntUiBridge.kt`, and `Tabs.kt`. This modification will ensure more consistency and control over the user interface design. The user interface api file has also been updated to reflect this change.
@rock3r rock3r enabled auto-merge (squash) December 28, 2023 09:45
@rock3r rock3r merged commit 2af35dc into main Dec 28, 2023
12 checks passed
@rock3r rock3r deleted the 275-tabs-for-tabs-strips-does-not-allow-custom-content branch December 28, 2023 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consistency Our UI presentation is not consistent with IJ feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tabs for Tabs strips does not allow custom content
2 participants