@@ -2,6 +2,7 @@ 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.shape.RoundedCornerShape
78import androidx.compose.material.*
@@ -16,8 +17,10 @@ import androidx.compose.ui.draw.clip
1617import androidx.compose.ui.geometry.Offset
1718import androidx.compose.ui.graphics.Brush
1819import androidx.compose.ui.graphics.Color
20+ import androidx.compose.ui.graphics.ColorFilter
1921import androidx.compose.ui.res.painterResource
2022import androidx.compose.ui.unit.dp
23+ import androidx.compose.ui.unit.min
2124import com.formdev.flatlaf.util.SystemInfo
2225import processing.app.*
2326import processing.app.ui.components.LanguageChip
@@ -46,7 +49,7 @@ class Welcome @Throws(IOException::class) constructor(base: Base) {
4649 val LocalBase = compositionLocalOf<Base ?> { null }
4750 @Composable
4851 fun welcome () {
49- Column (
52+ Column (
5053 modifier = Modifier
5154 .background(
5255 Brush .linearGradient(
@@ -57,8 +60,10 @@ class Welcome @Throws(IOException::class) constructor(base: Base) {
5760 )
5861 .padding(horizontal = 32 .dp)
5962 .padding(bottom = 32 .dp)
60- .padding(top = if (SystemInfo .isMacFullWindowContentSupported) 22 .dp else 0 .dp),
61- ){
63+ .padding(top = if (SystemInfo .isMacFullWindowContentSupported) 22 .dp else 0 .dp)
64+ .height(IntrinsicSize .Max )
65+ .width(IntrinsicSize .Max )
66+ ) {
6267 Column (
6368 horizontalAlignment = Alignment .End ,
6469 modifier = Modifier
@@ -67,25 +72,25 @@ class Welcome @Throws(IOException::class) constructor(base: Base) {
6772 LanguageChip ()
6873 }
6974 Row (
70- horizontalArrangement = Arrangement .spacedBy(32 .dp),
71- modifier = Modifier
72- .size(815 .dp, 450 .dp)
75+ horizontalArrangement = Arrangement .spacedBy(48 .dp),
7376 ) {
74- Box (
75- modifier = Modifier
76- .weight(1f )
77- .fillMaxHeight()
78- ) {
77+ Column {
7978 intro()
8079 }
81- Column (
82- modifier = Modifier
83- .weight(1.25f )
84- .fillMaxHeight(),
85- verticalArrangement = Arrangement .SpaceBetween
86- ) {
87- examples()
88- actions()
80+ Box {
81+ Column {
82+ examples()
83+ actions()
84+ }
85+ val locale = LocalLocale .current
86+ Image (
87+ painter = painterResource(" welcome/intro/wavy.svg" ),
88+ contentDescription = locale[" welcome.intro.long" ],
89+ modifier = Modifier
90+ .height(200 .dp)
91+ .offset (32 .dp)
92+ .align(Alignment .BottomEnd )
93+ )
8994 }
9095 }
9196 }
@@ -95,30 +100,40 @@ class Welcome @Throws(IOException::class) constructor(base: Base) {
95100 fun intro (){
96101 val locale = LocalLocale .current
97102 Column (
103+ verticalArrangement = Arrangement .SpaceBetween ,
98104 modifier = Modifier
99- .fillMaxHeight(),
100- verticalArrangement = Arrangement .SpaceBetween ) {
105+ .fillMaxHeight()
106+ .width(IntrinsicSize .Max )
107+ ) {
101108 Column {
102109 Text (
103110 text = locale[" welcome.intro.title" ],
104111 style = typography.h4,
112+ modifier = Modifier
113+ .sizeIn(maxWidth = 305 .dp)
105114 )
106115 Text (
107116 text = locale[" welcome.intro.message" ],
108117 style = typography.body1,
118+ modifier = Modifier
119+ .sizeIn(maxWidth = 305 .dp)
109120 )
110121 }
111- Column {
122+ Column (
123+ modifier = Modifier
124+ .offset(y = 32 .dp)
125+ ){
112126 Text (
113127 text = locale[" welcome.intro.suggestion" ],
114128 style = typography.body1,
129+ color = colors.onPrimary,
115130 modifier = Modifier
116131 .padding(top = 16 .dp)
117132 .clip(RoundedCornerShape (12 .dp))
118133 .background(colors.primary)
119- .padding(16 .dp)
134+ .padding(horizontal = 24 .dp)
135+ .padding(top = 16 .dp, bottom = 24 .dp)
120136 .sizeIn(maxWidth = 200 .dp)
121-
122137 )
123138 Image (
124139 painter = painterResource(" welcome/intro/bubble.svg" ),
@@ -127,9 +142,9 @@ class Welcome @Throws(IOException::class) constructor(base: Base) {
127142 .align{ _, space, _ -> space / 4 }
128143 )
129144 Row (
130- modifier = Modifier
131- .fillMaxWidth(),
132- horizontalArrangement = Arrangement . SpaceBetween
145+ horizontalArrangement = Arrangement . SpaceBetween ,
146+ modifier = Modifier .
147+ fillMaxWidth()
133148 ) {
134149 Image (
135150 painter = painterResource(" welcome/intro/long.svg" ),
@@ -142,6 +157,7 @@ class Welcome @Throws(IOException::class) constructor(base: Base) {
142157 contentDescription = locale[" welcome.intro.short" ],
143158 modifier = Modifier
144159 .align(Alignment .Bottom )
160+ .offset(x = 16 .dp, y = - 16 .dp)
145161 )
146162 }
147163 }
@@ -151,57 +167,55 @@ class Welcome @Throws(IOException::class) constructor(base: Base) {
151167 @Composable
152168 fun actions (){
153169 val locale = LocalLocale .current
154- Column (
155- verticalArrangement = Arrangement .spacedBy(16 .dp)
156- ) {
157- val base = LocalBase .current
158- PDEChip (onClick = {
159- base?.defaultMode?.showExamplesFrame()
160- }) {
161- Text (
162- text = locale[" welcome.action.examples" ],
163- )
164- Image (
165- imageVector = Icons .AutoMirrored .Default .ArrowForward ,
166- contentDescription = locale[" welcome.action.tutorials" ],
167- modifier = Modifier
168- .padding(start = 8 .dp)
169- .size(typography.body1.fontSize.value.dp)
170- )
171- }
172- PDEChip (onClick = {
173- if (! Desktop .isDesktopSupported()) return @PDEChip
174- val desktop = Desktop .getDesktop()
175- if (! desktop.isSupported(Desktop .Action .BROWSE )) return @PDEChip
176- try {
177- desktop.browse(URI (System .getProperty(" processing.tutorials" )))
178- } catch (e: Exception ) {
179- e.printStackTrace()
180- }
181- }) {
182- Text (
183- text = locale[" welcome.action.tutorials" ],
184- )
185- Image (
186- imageVector = Icons .AutoMirrored .Default .ArrowForward ,
187- contentDescription = locale[" welcome.action.tutorials" ],
188- modifier = Modifier
189- .padding(start = 8 .dp)
190- .size(typography.body1.fontSize.value.dp)
191- )
170+ val base = LocalBase .current
171+ PDEChip (onClick = {
172+ base?.defaultMode?.showExamplesFrame()
173+ }) {
174+ Text (
175+ text = locale[" welcome.action.examples" ],
176+ )
177+ Image (
178+ imageVector = Icons .AutoMirrored .Default .ArrowForward ,
179+ contentDescription = locale[" welcome.action.tutorials" ],
180+ colorFilter = ColorFilter .tint(color = LocalContentColor .current),
181+ modifier = Modifier
182+ .padding(start = 8 .dp)
183+ .size(typography.body1.fontSize.value.dp)
184+ )
185+ }
186+ PDEChip (onClick = {
187+ if (! Desktop .isDesktopSupported()) return @PDEChip
188+ val desktop = Desktop .getDesktop()
189+ if (! desktop.isSupported(Desktop .Action .BROWSE )) return @PDEChip
190+ try {
191+ desktop.browse(URI (System .getProperty(" processing.tutorials" )))
192+ } catch (e: Exception ) {
193+ e.printStackTrace()
192194 }
195+ }) {
196+ Text (
197+ text = locale[" welcome.action.tutorials" ],
198+ )
199+ Image (
200+ imageVector = Icons .AutoMirrored .Default .ArrowForward ,
201+ contentDescription = locale[" welcome.action.tutorials" ],
202+ colorFilter = ColorFilter .tint(color = LocalContentColor .current),
203+ modifier = Modifier
204+ .padding(start = 8 .dp)
205+ .size(typography.body1.fontSize.value.dp)
206+ )
193207 }
194208 Row (
195- modifier = Modifier .fillMaxWidth(),
196209 horizontalArrangement = Arrangement .SpaceBetween ,
197- verticalAlignment = Alignment .Bottom
210+ verticalAlignment = Alignment .CenterVertically ,
211+ modifier = Modifier
212+ .fillMaxWidth()
198213 ) {
199214 Row (
200215 horizontalArrangement = Arrangement .spacedBy(8 .dp),
201216 verticalAlignment = Alignment .CenterVertically ,
202217 modifier = Modifier
203218 .offset(- 32 .dp)
204-
205219 ) {
206220 val preferences = LocalPreferences .current
207221 Checkbox (
@@ -217,8 +231,10 @@ class Welcome @Throws(IOException::class) constructor(base: Base) {
217231 )
218232 }
219233 PDEButton (onClick = { println (" Open" ) }) {
220- val locale = LocalLocale .current
221- Text (locale[" welcome.action.go" ])
234+ Text (
235+ text = locale[" welcome.action.go" ],
236+ modifier = Modifier
237+ )
222238 }
223239 }
224240 }
0 commit comments