Skip to content

Commit

Permalink
feat: add borderStroke attribute to revealable() modifier (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
svenjacobs authored Jan 19, 2025
1 parent 8acfdec commit 2b5837f
Show file tree
Hide file tree
Showing 11 changed files with 183 additions and 115 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.svenjacobs.reveal.android.tests.presentation

import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
Expand All @@ -17,6 +18,7 @@ import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.svenjacobs.reveal.Key
Expand Down Expand Up @@ -65,6 +67,7 @@ fun MainScreen(revealCanvasState: RevealCanvasState, modifier: Modifier = Modifi
modifier = Modifier.revealable(
key = Keys.Fab,
shape = RevealShape.RoundRect(16.dp),
borderStroke = BorderStroke(2.dp, Color.DarkGray),
onClick = {
scope.launch { revealState.reveal(Keys.Explanation) }
},
Expand Down Expand Up @@ -92,6 +95,7 @@ fun MainScreen(revealCanvasState: RevealCanvasState, modifier: Modifier = Modifi
.padding(top = 16.dp)
.revealable(
key = Keys.Explanation,
borderStroke = BorderStroke(2.dp, Color.DarkGray),
onClick = {
scope.launch { revealState.hide() }
},
Expand Down
1 change: 1 addition & 0 deletions demo-app/.run/Demo (Android).run.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Demo (Android)" type="AndroidRunConfigurationType"
factoryName="Android App" activateToolWindowBeforeRun="false">
<module name="RevealDemo.androidApp" />
<option name="ANDROID_RUN_CONFIGURATION_SCHEMA_VERSION" value="1" />
<option name="DEPLOY" value="true" />
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.svenjacobs.reveal.demo.presentation

import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
Expand All @@ -17,6 +18,7 @@ import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.svenjacobs.reveal.Key
Expand Down Expand Up @@ -65,6 +67,7 @@ fun MainScreen(revealCanvasState: RevealCanvasState, modifier: Modifier = Modifi
modifier = Modifier.revealable(
key = Keys.Fab,
shape = RevealShape.RoundRect(16.dp),
borderStroke = BorderStroke(2.dp, Color.DarkGray),
onClick = {
scope.launch { revealState.reveal(Keys.Explanation) }
},
Expand Down Expand Up @@ -92,6 +95,7 @@ fun MainScreen(revealCanvasState: RevealCanvasState, modifier: Modifier = Modifi
.padding(top = 16.dp)
.revealable(
key = Keys.Explanation,
borderStroke = BorderStroke(2.dp, Color.DarkGray),
onClick = {
scope.launch { revealState.hide() }
},
Expand Down
48 changes: 26 additions & 22 deletions reveal-core/api/android/reveal-core.api
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
public final class com/svenjacobs/reveal/ActualRevealable {
public static final field $stable I
public fun <init> (Ljava/lang/Object;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/ui/geometry/Rect;Lkotlin/jvm/functions/Function1;)V
public fun <init> (Ljava/lang/Object;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/foundation/BorderStroke;Landroidx/compose/ui/geometry/Rect;Lkotlin/jvm/functions/Function1;)V
public final fun component1 ()Ljava/lang/Object;
public final fun component2 ()Lcom/svenjacobs/reveal/RevealShape;
public final fun component3 ()Landroidx/compose/foundation/layout/PaddingValues;
public final fun component4 ()Landroidx/compose/ui/geometry/Rect;
public final fun component5 ()Lkotlin/jvm/functions/Function1;
public final fun copy (Ljava/lang/Object;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/ui/geometry/Rect;Lkotlin/jvm/functions/Function1;)Lcom/svenjacobs/reveal/ActualRevealable;
public static synthetic fun copy$default (Lcom/svenjacobs/reveal/ActualRevealable;Ljava/lang/Object;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/ui/geometry/Rect;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lcom/svenjacobs/reveal/ActualRevealable;
public final fun component4 ()Landroidx/compose/foundation/BorderStroke;
public final fun component5 ()Landroidx/compose/ui/geometry/Rect;
public final fun component6 ()Lkotlin/jvm/functions/Function1;
public final fun copy (Ljava/lang/Object;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/foundation/BorderStroke;Landroidx/compose/ui/geometry/Rect;Lkotlin/jvm/functions/Function1;)Lcom/svenjacobs/reveal/ActualRevealable;
public static synthetic fun copy$default (Lcom/svenjacobs/reveal/ActualRevealable;Ljava/lang/Object;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/foundation/BorderStroke;Landroidx/compose/ui/geometry/Rect;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lcom/svenjacobs/reveal/ActualRevealable;
public fun equals (Ljava/lang/Object;)Z
public final fun getArea ()Landroidx/compose/ui/geometry/Rect;
public final fun getBorderStroke ()Landroidx/compose/foundation/BorderStroke;
public final fun getKey ()Ljava/lang/Object;
public final fun getOnClick ()Lkotlin/jvm/functions/Function1;
public final fun getPadding ()Landroidx/compose/foundation/layout/PaddingValues;
Expand All @@ -25,12 +27,12 @@ public final class com/svenjacobs/reveal/ComposableSingletons$RevealKt {
}

public final class com/svenjacobs/reveal/ModifiersKt {
public static final fun revealable (Landroidx/compose/ui/Modifier;Ljava/lang/Iterable;Lcom/svenjacobs/reveal/RevealState;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Lkotlin/jvm/functions/Function1;)Landroidx/compose/ui/Modifier;
public static final fun revealable (Landroidx/compose/ui/Modifier;Ljava/lang/Object;Lcom/svenjacobs/reveal/RevealState;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Lkotlin/jvm/functions/Function1;)Landroidx/compose/ui/Modifier;
public static final fun revealable (Landroidx/compose/ui/Modifier;[Ljava/lang/Object;Lcom/svenjacobs/reveal/RevealState;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Lkotlin/jvm/functions/Function1;)Landroidx/compose/ui/Modifier;
public static synthetic fun revealable$default (Landroidx/compose/ui/Modifier;Ljava/lang/Iterable;Lcom/svenjacobs/reveal/RevealState;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Landroidx/compose/ui/Modifier;
public static synthetic fun revealable$default (Landroidx/compose/ui/Modifier;Ljava/lang/Object;Lcom/svenjacobs/reveal/RevealState;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Landroidx/compose/ui/Modifier;
public static synthetic fun revealable$default (Landroidx/compose/ui/Modifier;[Ljava/lang/Object;Lcom/svenjacobs/reveal/RevealState;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Landroidx/compose/ui/Modifier;
public static final fun revealable (Landroidx/compose/ui/Modifier;Ljava/lang/Iterable;Lcom/svenjacobs/reveal/RevealState;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/foundation/BorderStroke;Lkotlin/jvm/functions/Function1;)Landroidx/compose/ui/Modifier;
public static final fun revealable (Landroidx/compose/ui/Modifier;Ljava/lang/Object;Lcom/svenjacobs/reveal/RevealState;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/foundation/BorderStroke;Lkotlin/jvm/functions/Function1;)Landroidx/compose/ui/Modifier;
public static final fun revealable (Landroidx/compose/ui/Modifier;[Ljava/lang/Object;Lcom/svenjacobs/reveal/RevealState;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/foundation/BorderStroke;Lkotlin/jvm/functions/Function1;)Landroidx/compose/ui/Modifier;
public static synthetic fun revealable$default (Landroidx/compose/ui/Modifier;Ljava/lang/Iterable;Lcom/svenjacobs/reveal/RevealState;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/foundation/BorderStroke;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Landroidx/compose/ui/Modifier;
public static synthetic fun revealable$default (Landroidx/compose/ui/Modifier;Ljava/lang/Object;Lcom/svenjacobs/reveal/RevealState;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/foundation/BorderStroke;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Landroidx/compose/ui/Modifier;
public static synthetic fun revealable$default (Landroidx/compose/ui/Modifier;[Ljava/lang/Object;Lcom/svenjacobs/reveal/RevealState;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/foundation/BorderStroke;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Landroidx/compose/ui/Modifier;
}

public final class com/svenjacobs/reveal/RevealCanvasKt {
Expand Down Expand Up @@ -116,15 +118,15 @@ public final class com/svenjacobs/reveal/RevealOverlayScope$DefaultImpls {
}

public abstract interface class com/svenjacobs/reveal/RevealScope {
public abstract fun revealable (Landroidx/compose/ui/Modifier;Ljava/lang/Iterable;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Lkotlin/jvm/functions/Function1;)Landroidx/compose/ui/Modifier;
public abstract fun revealable (Landroidx/compose/ui/Modifier;Ljava/lang/Object;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Lkotlin/jvm/functions/Function1;)Landroidx/compose/ui/Modifier;
public abstract fun revealable (Landroidx/compose/ui/Modifier;[Ljava/lang/Object;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Lkotlin/jvm/functions/Function1;)Landroidx/compose/ui/Modifier;
public abstract fun revealable (Landroidx/compose/ui/Modifier;Ljava/lang/Iterable;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/foundation/BorderStroke;Lkotlin/jvm/functions/Function1;)Landroidx/compose/ui/Modifier;
public abstract fun revealable (Landroidx/compose/ui/Modifier;Ljava/lang/Object;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/foundation/BorderStroke;Lkotlin/jvm/functions/Function1;)Landroidx/compose/ui/Modifier;
public abstract fun revealable (Landroidx/compose/ui/Modifier;[Ljava/lang/Object;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/foundation/BorderStroke;Lkotlin/jvm/functions/Function1;)Landroidx/compose/ui/Modifier;
}

public final class com/svenjacobs/reveal/RevealScope$DefaultImpls {
public static synthetic fun revealable$default (Lcom/svenjacobs/reveal/RevealScope;Landroidx/compose/ui/Modifier;Ljava/lang/Iterable;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Landroidx/compose/ui/Modifier;
public static synthetic fun revealable$default (Lcom/svenjacobs/reveal/RevealScope;Landroidx/compose/ui/Modifier;Ljava/lang/Object;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Landroidx/compose/ui/Modifier;
public static synthetic fun revealable$default (Lcom/svenjacobs/reveal/RevealScope;Landroidx/compose/ui/Modifier;[Ljava/lang/Object;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Landroidx/compose/ui/Modifier;
public static synthetic fun revealable$default (Lcom/svenjacobs/reveal/RevealScope;Landroidx/compose/ui/Modifier;Ljava/lang/Iterable;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/foundation/BorderStroke;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Landroidx/compose/ui/Modifier;
public static synthetic fun revealable$default (Lcom/svenjacobs/reveal/RevealScope;Landroidx/compose/ui/Modifier;Ljava/lang/Object;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/foundation/BorderStroke;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Landroidx/compose/ui/Modifier;
public static synthetic fun revealable$default (Lcom/svenjacobs/reveal/RevealScope;Landroidx/compose/ui/Modifier;[Ljava/lang/Object;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/foundation/BorderStroke;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Landroidx/compose/ui/Modifier;
}

public abstract interface class com/svenjacobs/reveal/RevealShape {
Expand Down Expand Up @@ -192,15 +194,17 @@ public final class com/svenjacobs/reveal/RevealStateKt {

public final class com/svenjacobs/reveal/Revealable {
public static final field $stable I
public fun <init> (Ljava/lang/Object;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Lcom/svenjacobs/reveal/Revealable$Layout;Lkotlin/jvm/functions/Function1;)V
public fun <init> (Ljava/lang/Object;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/foundation/BorderStroke;Lcom/svenjacobs/reveal/Revealable$Layout;Lkotlin/jvm/functions/Function1;)V
public final fun component1 ()Ljava/lang/Object;
public final fun component2 ()Lcom/svenjacobs/reveal/RevealShape;
public final fun component3 ()Landroidx/compose/foundation/layout/PaddingValues;
public final fun component4 ()Lcom/svenjacobs/reveal/Revealable$Layout;
public final fun component5 ()Lkotlin/jvm/functions/Function1;
public final fun copy (Ljava/lang/Object;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Lcom/svenjacobs/reveal/Revealable$Layout;Lkotlin/jvm/functions/Function1;)Lcom/svenjacobs/reveal/Revealable;
public static synthetic fun copy$default (Lcom/svenjacobs/reveal/Revealable;Ljava/lang/Object;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Lcom/svenjacobs/reveal/Revealable$Layout;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lcom/svenjacobs/reveal/Revealable;
public final fun component4 ()Landroidx/compose/foundation/BorderStroke;
public final fun component5 ()Lcom/svenjacobs/reveal/Revealable$Layout;
public final fun component6 ()Lkotlin/jvm/functions/Function1;
public final fun copy (Ljava/lang/Object;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/foundation/BorderStroke;Lcom/svenjacobs/reveal/Revealable$Layout;Lkotlin/jvm/functions/Function1;)Lcom/svenjacobs/reveal/Revealable;
public static synthetic fun copy$default (Lcom/svenjacobs/reveal/Revealable;Ljava/lang/Object;Lcom/svenjacobs/reveal/RevealShape;Landroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/foundation/BorderStroke;Lcom/svenjacobs/reveal/Revealable$Layout;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lcom/svenjacobs/reveal/Revealable;
public fun equals (Ljava/lang/Object;)Z
public final fun getBorderStroke ()Landroidx/compose/foundation/BorderStroke;
public final fun getKey ()Ljava/lang/Object;
public final fun getLayout ()Lcom/svenjacobs/reveal/Revealable$Layout;
public final fun getOnClick ()Lkotlin/jvm/functions/Function1;
Expand Down
Loading

0 comments on commit 2b5837f

Please sign in to comment.