@@ -68,20 +68,16 @@ import com.example.jetlagged.ui.theme.JetLaggedTheme
6868import com.example.jetlagged.ui.theme.SmallHeadingStyle
6969
7070@Composable
71- fun BasicInformationalCard (
72- modifier : Modifier = Modifier ,
73- borderColor : Color ,
74- content : @Composable () -> Unit
75- ) {
71+ fun BasicInformationalCard (modifier : Modifier = Modifier , borderColor : Color , content : @Composable () -> Unit ) {
7672 val shape = RoundedCornerShape (24 .dp)
7773 Card (
7874 shape = shape,
7975 colors = CardDefaults .cardColors(
80- containerColor = JetLaggedTheme .extraColors.cardBackground
76+ containerColor = JetLaggedTheme .extraColors.cardBackground,
8177 ),
8278 modifier = modifier
8379 .padding(8 .dp),
84- border = BorderStroke (2 .dp, borderColor)
80+ border = BorderStroke (2 .dp, borderColor),
8581 ) {
8682 Box {
8783 content()
@@ -90,20 +86,14 @@ fun BasicInformationalCard(
9086}
9187
9288@Composable
93- fun TwoLineInfoCard (
94- borderColor : Color ,
95- firstLineText : String ,
96- secondLineText : String ,
97- icon : ImageVector ,
98- modifier : Modifier = Modifier
99- ) {
89+ fun TwoLineInfoCard (borderColor : Color , firstLineText : String , secondLineText : String , icon : ImageVector , modifier : Modifier = Modifier ) {
10090 BasicInformationalCard (
10191 borderColor = borderColor,
102- modifier = modifier.size(200 .dp)
92+ modifier = modifier.size(200 .dp),
10393 ) {
10494 BubbleBackground (
10595 modifier = Modifier .fillMaxSize(),
106- numberBubbles = 3 , bubbleColor = borderColor.copy(0.25f )
96+ numberBubbles = 3 , bubbleColor = borderColor.copy(0.25f ),
10797 )
10898 BoxWithConstraints (
10999 modifier = Modifier
@@ -114,23 +104,23 @@ fun TwoLineInfoCard(
114104 Row (
115105 modifier = Modifier
116106 .wrapContentSize()
117- .align(CenterStart )
107+ .align(CenterStart ),
118108 ) {
119109 Icon (
120110 icon, contentDescription = null ,
121111 modifier = Modifier
122112 .size(50 .dp)
123- .align(CenterVertically )
113+ .align(CenterVertically ),
124114 )
125115 Spacer (modifier = Modifier .width(16 .dp))
126116 Column (
127117 modifier = Modifier
128118 .align(CenterVertically )
129- .wrapContentSize()
119+ .wrapContentSize(),
130120 ) {
131121 Text (
132122 firstLineText,
133- style = SmallHeadingStyle
123+ style = SmallHeadingStyle ,
134124 )
135125 Text (
136126 secondLineText,
@@ -142,25 +132,25 @@ fun TwoLineInfoCard(
142132 Column (
143133 modifier = Modifier
144134 .wrapContentSize()
145- .align(Center )
135+ .align(Center ),
146136 ) {
147137 Icon (
148138 icon, contentDescription = null ,
149139 modifier = Modifier
150140 .size(50 .dp)
151- .align(CenterHorizontally )
141+ .align(CenterHorizontally ),
152142 )
153143 Spacer (modifier = Modifier .height(16 .dp))
154144 Column (modifier = Modifier .align(CenterHorizontally )) {
155145 Text (
156146 firstLineText,
157147 style = SmallHeadingStyle ,
158- modifier = Modifier .align(CenterHorizontally )
148+ modifier = Modifier .align(CenterHorizontally ),
159149 )
160150 Text (
161151 secondLineText,
162152 style = HeadingStyle ,
163- modifier = Modifier .align(CenterHorizontally )
153+ modifier = Modifier .align(CenterHorizontally ),
164154 )
165155 }
166156 }
@@ -180,7 +170,7 @@ fun AverageTimeInBedCard(modifier: Modifier = Modifier) {
180170 icon = Icons .Default .Watch ,
181171 modifier = modifier
182172 .wrapContentWidth()
183- .heightIn(min = 156 .dp)
173+ .heightIn(min = 156 .dp),
184174 )
185175}
186176
@@ -195,49 +185,46 @@ fun AverageTimeAsleepCard(modifier: Modifier = Modifier) {
195185 icon = Icons .Default .SingleBed ,
196186 modifier = modifier
197187 .wrapContentWidth()
198- .heightIn(min = 156 .dp)
188+ .heightIn(min = 156 .dp),
199189 )
200190}
201191
202192@OptIn(ExperimentalLayoutApi ::class )
203193@Preview
204194@Composable
205- fun WellnessCard (
206- modifier : Modifier = Modifier ,
207- wellnessData : WellnessData = WellnessData (0, 0, 0)
208- ) {
195+ fun WellnessCard (modifier : Modifier = Modifier , wellnessData : WellnessData = WellnessData (0, 0, 0)) {
209196 BasicInformationalCard (
210197 borderColor = JetLaggedTheme .extraColors.wellness,
211198 modifier = modifier
212199 .widthIn(max = 400 .dp)
213- .heightIn(min = 200 .dp)
200+ .heightIn(min = 200 .dp),
214201 ) {
215202 FadingCircleBackground (36 .dp, JetLaggedTheme .extraColors.wellness.copy(0.25f ))
216203 Column (
217204 horizontalAlignment = CenterHorizontally ,
218205 modifier = Modifier
219- .fillMaxWidth()
206+ .fillMaxWidth(),
220207 ) {
221208 HomeScreenCardHeading (text = stringResource(R .string.wellness_heading))
222209 FlowRow (
223210 horizontalArrangement = Arrangement .Center ,
224211 verticalArrangement = Arrangement .Center ,
225- modifier = Modifier .fillMaxHeight()
212+ modifier = Modifier .fillMaxHeight(),
226213 ) {
227214 WellnessBubble (
228215 titleText = stringResource(R .string.snoring_heading),
229216 countText = wellnessData.snoring.toString(),
230- metric = " min"
217+ metric = " min" ,
231218 )
232219 WellnessBubble (
233220 titleText = stringResource(R .string.coughing_heading),
234221 countText = wellnessData.coughing.toString(),
235- metric = " times"
222+ metric = " times" ,
236223 )
237224 WellnessBubble (
238225 titleText = stringResource(R .string.respiration_heading),
239226 countText = wellnessData.respiration.toString(),
240- metric = " rpm"
227+ metric = " rpm" ,
241228 )
242229 }
243230 }
@@ -250,7 +237,7 @@ fun WellnessBubble(
250237 countText : String ,
251238 metric : String ,
252239 modifier : Modifier = Modifier ,
253- bubbleColor : Color = JetLaggedTheme .extraColors.wellness
240+ bubbleColor : Color = JetLaggedTheme .extraColors.wellness,
254241) {
255242 Column (
256243 modifier = modifier
@@ -261,7 +248,7 @@ fun WellnessBubble(
261248 drawCircle(bubbleColor)
262249 },
263250 verticalArrangement = Arrangement .Center ,
264- horizontalAlignment = CenterHorizontally
251+ horizontalAlignment = CenterHorizontally ,
265252 ) {
266253 Text (titleText, fontSize = 12 .sp)
267254 Text (countText, fontSize = 36 .sp)
@@ -277,6 +264,6 @@ fun HomeScreenCardHeading(text: String) {
277264 .fillMaxWidth()
278265 .padding(top = 8 .dp),
279266 textAlign = TextAlign .Center ,
280- style = HeadingStyle
267+ style = HeadingStyle ,
281268 )
282269}
0 commit comments