@@ -5,16 +5,21 @@ import androidx.compose.foundation.background
55import androidx.compose.foundation.border
66import androidx.compose.foundation.layout.Column
77import androidx.compose.foundation.layout.Spacer
8- import androidx.compose.foundation.layout.fillMaxSize
98import androidx.compose.foundation.layout.fillMaxWidth
109import androidx.compose.foundation.layout.size
1110import androidx.compose.foundation.shape.RoundedCornerShape
1211import androidx.compose.material3.ExperimentalMaterial3Api
1312import androidx.compose.material3.Text
13+ import androidx.compose.material3.TextField
1414import androidx.compose.runtime.Composable
15+ import androidx.compose.runtime.getValue
16+ import androidx.compose.runtime.mutableStateOf
17+ import androidx.compose.runtime.remember
18+ import androidx.compose.runtime.setValue
1519import androidx.compose.ui.Modifier
1620import androidx.compose.ui.graphics.Brush
1721import androidx.compose.ui.graphics.Color
22+ import androidx.compose.ui.graphics.ImageBitmap
1823import androidx.compose.ui.graphics.Shadow
1924import androidx.compose.ui.res.painterResource
2025import androidx.compose.ui.text.TextStyle
@@ -29,12 +34,17 @@ import de.berlindroid.zepatch.R
2934import de.berlindroid.zepatch.annotations.Patch
3035import de.berlindroid.zepatch.ui.SafeArea
3136
32-
3337@OptIn(ExperimentalMaterial3Api ::class )
3438@Patch(" AppLogo" )
3539@Composable
36- fun AppLogo () {
37- SafeArea {
40+ fun AppLogo (
41+ shouldCapture : Boolean = false,
42+ onBitmap : (ImageBitmap ) -> Unit = {},
43+ ) {
44+ SafeArea (
45+ shouldCapture = shouldCapture,
46+ onBitmap = onBitmap,
47+ ) {
3848 Image (
3949 modifier = Modifier .size(200 .dp),
4050 painter = painterResource(R .drawable.ai_logo),
@@ -47,8 +57,14 @@ fun AppLogo() {
4757@OptIn(ExperimentalMaterial3Api ::class )
4858@Patch(" BerlindroidLogo" )
4959@Composable
50- fun BerlindroidLogo () {
51- SafeArea {
60+ fun BerlindroidLogo (
61+ shouldCapture : Boolean = false,
62+ onBitmap : (ImageBitmap ) -> Unit = {},
63+ ) {
64+ SafeArea (
65+ shouldCapture = shouldCapture,
66+ onBitmap = onBitmap,
67+ ) {
5268 Image (
5369 modifier = Modifier .size(200 .dp),
5470 painter = painterResource(R .drawable.voltron_nosign),
@@ -61,8 +77,14 @@ fun BerlindroidLogo() {
6177@OptIn(ExperimentalMaterial3Api ::class )
6278@Patch(" GoogleLogo" )
6379@Composable
64- fun GoogleLogo () {
65- SafeArea {
80+ fun GoogleLogo (
81+ shouldCapture : Boolean = false,
82+ onBitmap : (ImageBitmap ) -> Unit = {},
83+ ) {
84+ SafeArea (
85+ shouldCapture = shouldCapture,
86+ onBitmap = onBitmap,
87+ ) {
6688 Image (
6789 modifier = Modifier .size(200 .dp),
6890 painter = painterResource(R .drawable.g),
@@ -75,8 +97,14 @@ fun GoogleLogo() {
7597@OptIn(ExperimentalMaterial3Api ::class )
7698@Patch(" Android" )
7799@Composable
78- fun AndroidLogo () {
79- SafeArea {
100+ fun AndroidLogo (
101+ shouldCapture : Boolean = false,
102+ onBitmap : (ImageBitmap ) -> Unit = {},
103+ ) {
104+ SafeArea (
105+ shouldCapture = shouldCapture,
106+ onBitmap = onBitmap,
107+ ) {
80108 Image (
81109 modifier = Modifier .size(200 .dp),
82110 painter = painterResource(R .drawable.andriod),
@@ -88,69 +116,85 @@ fun AndroidLogo() {
88116
89117@Patch(" AndyA" )
90118@Composable
91- fun AndyA () {
92- SafeArea (
93- modifier = Modifier
94- .size(200 .dp)
95- .background(
96- brush = Brush .linearGradient(
97- colors = listOf (
98- Color .Red ,
99- Color .Yellow ,
100- Color .Green ,
101- Color .Blue ,
102- Color .Cyan
103- )
104- ),
105- shape = RoundedCornerShape (
106- topStartPercent = 50 ,
107- topEndPercent = 50 ,
108- bottomStartPercent = 50 ,
109- bottomEndPercent = 0
119+ fun AndyA (
120+ shouldCapture : Boolean = false,
121+ onBitmap : (ImageBitmap ) -> Unit = {},
122+ ) {
123+ var name by remember { mutableStateOf(" Andy" ) }
124+ Column {
125+ SafeArea (
126+ shouldCapture = shouldCapture,
127+ onBitmap = onBitmap,
128+ ) {
129+ Column (
130+ modifier = Modifier
131+ .size(200 .dp)
132+ .background(
133+ brush = Brush .linearGradient(
134+ colors = listOf (
135+ Color .Red ,
136+ Color .Yellow ,
137+ Color .Green ,
138+ Color .Blue ,
139+ Color .Cyan
140+ )
141+ ),
142+ shape = RoundedCornerShape (
143+ topStartPercent = 50 ,
144+ topEndPercent = 50 ,
145+ bottomStartPercent = 50 ,
146+ bottomEndPercent = 0
147+ )
148+ ),
149+ ) {
150+ Spacer (modifier = Modifier .weight(1f ))
151+ Text (
152+ modifier = Modifier .fillMaxWidth(),
153+ fontFamily = FontFamily .Cursive ,
154+ textAlign = TextAlign .Center ,
155+ fontStyle = FontStyle .Italic ,
156+ fontWeight = FontWeight .ExtraBold ,
157+ fontSize = 70 .sp,
158+ text = name,
110159 )
111- ),
112- ) {
113- Column (modifier = Modifier .fillMaxSize()) {
114- Spacer (modifier = Modifier .weight(1f ))
115- Text (
116- modifier = Modifier .fillMaxWidth(),
117- fontFamily = FontFamily .Cursive ,
118- textAlign = TextAlign .Center ,
119- fontStyle = FontStyle .Italic ,
120- fontWeight = FontWeight .ExtraBold ,
121- fontSize = 70 .sp,
122- text = " Andy" ,
123- )
124- Spacer (modifier = Modifier .weight(1f ))
160+ Spacer (modifier = Modifier .weight(1f ))
161+ }
125162 }
163+ TextField (value = name, onValueChange = { name = it })
126164 }
127165}
128166
129167@Patch(" AndyB" )
130168@Composable
131- fun AndyB () {
169+ fun AndyB (
170+ shouldCapture : Boolean = false,
171+ onBitmap : (ImageBitmap ) -> Unit = {},
172+ ) {
132173 SafeArea (
133- modifier = Modifier
134- .size(200 .dp)
135- .background(
136- color = Color .White ,
137- shape = RoundedCornerShape (
138- topStartPercent = 0 ,
139- topEndPercent = 50 ,
140- bottomStartPercent = 50 ,
141- bottomEndPercent = 50
142- )
143- )
144- .border(
145- 12 .dp, Color .Black , RoundedCornerShape (
146- topStartPercent = 0 ,
147- topEndPercent = 50 ,
148- bottomStartPercent = 50 ,
149- bottomEndPercent = 50
150- )
151- ),
174+ shouldCapture = shouldCapture,
175+ onBitmap = onBitmap,
152176 ) {
153- Column (modifier = Modifier .fillMaxSize()) {
177+ Column (
178+ modifier = Modifier
179+ .size(200 .dp)
180+ .background(
181+ color = Color .White ,
182+ shape = RoundedCornerShape (
183+ topStartPercent = 0 ,
184+ topEndPercent = 50 ,
185+ bottomStartPercent = 50 ,
186+ bottomEndPercent = 50
187+ )
188+ )
189+ .border(
190+ 12 .dp, Color .Black , RoundedCornerShape (
191+ topStartPercent = 0 ,
192+ topEndPercent = 50 ,
193+ bottomStartPercent = 50 ,
194+ bottomEndPercent = 50
195+ )
196+ ),
197+ ) {
154198 Spacer (modifier = Modifier .weight(1f ))
155199 Text (
156200 modifier = Modifier .fillMaxWidth(),
@@ -161,7 +205,7 @@ fun AndyB() {
161205 style = TextStyle .Default .copy(shadow = Shadow (blurRadius = 12f )),
162206 color = Color .Black ,
163207 text = " Andy" ,
164- letterSpacing = - 1 .sp
208+ letterSpacing = ( - 1 ) .sp
165209 )
166210 Spacer (modifier = Modifier .weight(1f ))
167211 }
@@ -170,22 +214,34 @@ fun AndyB() {
170214
171215@Patch(" flex" )
172216@Composable
173- fun Emoji () {
174- SafeArea {
217+ fun Emoji (
218+ shouldCapture : Boolean = false,
219+ onBitmap : (ImageBitmap ) -> Unit = {},
220+ ) {
221+ SafeArea (
222+ shouldCapture = shouldCapture,
223+ onBitmap = onBitmap,
224+ ) {
175225 Text (" 💪" , fontSize = 48 .sp)
176226 }
177227}
178228
179229@Patch(" ROBOT" )
180230@Composable
181- fun Emoji2 () {
182- SafeArea {
231+ fun Emoji2 (
232+ shouldCapture : Boolean = false,
233+ onBitmap : (ImageBitmap ) -> Unit = {},
234+ ) {
235+ SafeArea (
236+ shouldCapture = shouldCapture,
237+ onBitmap = onBitmap,
238+ ) {
183239 Text (" 🦾🤖\n HereWeGo" , fontSize = 34 .sp)
184240 }
185241}
186242
187243@Preview
188244@Composable
189245fun PreviewDemo () {
190- AndyB ()
246+ AndyA ()
191247}
0 commit comments