@@ -2,13 +2,16 @@ package processing.app.ui
22
33import androidx.compose.foundation.Image
44import androidx.compose.foundation.background
5+ import androidx.compose.foundation.border
56import androidx.compose.foundation.layout.*
67import androidx.compose.foundation.lazy.grid.GridCells
78import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
89import androidx.compose.foundation.shape.RoundedCornerShape
10+ import androidx.compose.material.Checkbox
911import androidx.compose.material.MaterialTheme
1012import androidx.compose.material.MaterialTheme.colors
1113import androidx.compose.material.MaterialTheme.typography
14+ import androidx.compose.material.RadioButton
1215import androidx.compose.material.Text
1316import androidx.compose.runtime.Composable
1417import androidx.compose.ui.Alignment
@@ -20,6 +23,7 @@ import androidx.compose.ui.graphics.Color
2023import androidx.compose.ui.res.painterResource
2124import androidx.compose.ui.unit.dp
2225import processing.app.Base
26+ import processing.app.LocalPreferences
2327import processing.app.ui.theme.LocalLocale
2428import processing.app.ui.theme.PDEButton
2529import processing.app.ui.theme.PDEWindow
@@ -69,21 +73,42 @@ class Welcome @Throws(IOException::class) constructor(base: Base) {
6973 Column (
7074 verticalArrangement = Arrangement .spacedBy(16 .dp)
7175 ) {
72- Text (
73- text = locale[" welcome.action.examples" ],
74- )
75- Text (
76- text = locale[" welcome.action.tutorials" ],
77- )
76+ chip {
77+ Text (
78+ text = locale[" welcome.action.examples" ],
79+ )
80+ }
81+ chip {
82+ Text (
83+ text = locale[" welcome.action.tutorials" ],
84+ )
85+ }
7886 }
7987 Row (
8088 modifier = Modifier .fillMaxWidth(),
8189 horizontalArrangement = Arrangement .SpaceBetween ,
82- verticalAlignment = Alignment .CenterVertically
83- ){
84- Text (
85- text = locale[" welcome.action.startup" ],
86- )
90+ verticalAlignment = Alignment .Bottom
91+ ) {
92+ Row (
93+ horizontalArrangement = Arrangement .spacedBy(8 .dp),
94+ verticalAlignment = Alignment .CenterVertically ,
95+ modifier = Modifier
96+ .offset (- 32 .dp)
97+
98+ ) {
99+ val preferences = LocalPreferences .current
100+ Checkbox (
101+ checked = preferences[" welcome.four.show" ]?.equals(" true" ) ? : false ,
102+ onCheckedChange = {
103+ preferences.setProperty(" welcome.four.show" ,it.toString())
104+ },
105+ modifier = Modifier
106+ .size(24 .dp)
107+ )
108+ Text (
109+ text = locale[" welcome.action.startup" ],
110+ )
111+ }
87112 PDEButton (onClick = { println (" Open" ) }) {
88113 val locale = LocalLocale .current
89114 Text (locale[" welcome.action.go" ])
@@ -115,13 +140,19 @@ class Welcome @Throws(IOException::class) constructor(base: Base) {
115140 text = locale[" welcome.intro.suggestion" ],
116141 style = typography.body1,
117142 modifier = Modifier
118- .padding(vertical = 16 .dp)
143+ .padding(top = 16 .dp)
119144 .clip(RoundedCornerShape (12 .dp))
120145 .background(colors.primary)
121146 .padding(16 .dp)
122147 .sizeIn(maxWidth = 200 .dp)
123148
124149 )
150+ Image (
151+ painter = painterResource(" welcome/intro/bubble.svg" ),
152+ contentDescription = locale[" welcome.intro.long" ],
153+ modifier = Modifier
154+ .align{ _, space, _ -> space / 4 }
155+ )
125156 Row (
126157 modifier = Modifier
127158 .fillMaxWidth(),
@@ -165,6 +196,19 @@ class Welcome @Throws(IOException::class) constructor(base: Base) {
165196 }
166197 }
167198
199+ @Composable
200+ fun chip (content : @Composable () -> Unit ){
201+ Box (
202+ modifier = Modifier
203+ .clip(RoundedCornerShape (12 .dp))
204+ .background(colors.surface)
205+ .border(1 .dp, colors.primary, RoundedCornerShape (12 .dp))
206+ .padding(vertical = 4 .dp, horizontal = 12 .dp)
207+ ){
208+ content()
209+ }
210+ }
211+
168212 @JvmStatic
169213 fun main (args : Array <String >) {
170214 pdeapplication(" menu.help.welcome" ) {
0 commit comments