11package com.example.flutter_alarm_manager_poc.screens
22
3- import androidx.compose.animation.core.FastOutSlowInEasing
4- import androidx.compose.animation.core.RepeatMode
5- import androidx.compose.animation.core.animateDpAsState
6- import androidx.compose.animation.core.infiniteRepeatable
7- import androidx.compose.animation.core.repeatable
8- import androidx.compose.animation.core.tween
93import androidx.compose.foundation.background
104import androidx.compose.foundation.clickable
115import androidx.compose.foundation.layout.Arrangement
@@ -14,23 +8,20 @@ import androidx.compose.foundation.layout.Column
148import androidx.compose.foundation.layout.Row
159import androidx.compose.foundation.layout.fillMaxSize
1610import androidx.compose.foundation.layout.fillMaxWidth
17- import androidx.compose.foundation.layout.height
1811import androidx.compose.foundation.layout.padding
1912import androidx.compose.foundation.layout.size
20- import androidx.compose.foundation.layout.width
2113import androidx.compose.foundation.shape.CircleShape
22- import androidx.compose.foundation.shape.RoundedCornerShape
2314import androidx.compose.material.icons.Icons
24- import androidx.compose.material.icons.filled.Check
2515import androidx.compose.material.icons.filled.Close
2616import androidx.compose.material.icons.filled.Snooze
27- import androidx.compose.material3.Button
2817import androidx.compose.material3.Icon
2918import androidx.compose.material3.MaterialTheme
19+ import androidx.compose.material3.OutlinedTextField
3020import androidx.compose.material3.RadioButton
3121import androidx.compose.material3.RadioButtonDefaults
3222import androidx.compose.material3.Surface
3323import androidx.compose.material3.Text
24+ import androidx.compose.material3.TextFieldDefaults
3425import androidx.compose.runtime.Composable
3526import androidx.compose.runtime.LaunchedEffect
3627import androidx.compose.runtime.getValue
@@ -39,38 +30,34 @@ import androidx.compose.runtime.remember
3930import androidx.compose.runtime.setValue
4031import androidx.compose.ui.Alignment
4132import androidx.compose.ui.Modifier
42- import androidx.compose.ui.draw.clip
43- import androidx.compose.ui.draw.shadow
4433import androidx.compose.ui.graphics.Color
4534import androidx.compose.ui.graphics.vector.ImageVector
46- import androidx.compose.ui.layout.ContentScale
4735import androidx.compose.ui.text.TextStyle
4836import androidx.compose.ui.text.font.FontStyle
4937import androidx.compose.ui.tooling.preview.Preview
5038import androidx.compose.ui.unit.dp
51- import coil.compose.AsyncImage
5239import com.example.flutter_alarm_manager_poc.utils.convertMillisToDate
5340import com.example.flutter_alarm_manager_poc.utils.convertMillisToTime
54- import org.w3c.dom.Text
5541
5642@Composable
5743fun AlarmScreen (
58- onAccept : (Int , Int ) -> Unit ,
44+ onAccept : (Int , Int , String ) -> Unit ,
5945 onDecline : () -> Unit ,
6046 onSnooze : () -> Unit
6147) {
6248 var question1Selection by remember { mutableStateOf<Int ?>(null ) }
6349 var question2Selection by remember { mutableStateOf<Int ?>(null ) }
50+ var additionalText by remember { mutableStateOf(" " ) }
6451
65- // Exit condition 1: Answering all questions automatically triggers the accept action.
52+ // Reinstated Exit Condition 1: Answering all questions automatically triggers the accept action.
6653 LaunchedEffect (question1Selection, question2Selection) {
6754 // Storing in local variables for stability within the coroutine scope
6855 val q1 = question1Selection
6956 val q2 = question2Selection
7057
71- // If both questions have been answered, trigger the accept action.
58+ // If both questions have been answered, trigger the accept action, including any text .
7259 if (q1 != null && q2 != null ) {
73- onAccept(q1, q2)
60+ onAccept(q1, q2, additionalText )
7461 }
7562 }
7663
@@ -113,6 +100,26 @@ fun AlarmScreen(
113100 selectedOption = question2Selection,
114101 onOptionSelected = { question2Selection = it }
115102 )
103+ OutlinedTextField (
104+ value = additionalText,
105+ onValueChange = { additionalText = it },
106+ label = { Text (" Additional information (optional)" ) },
107+ modifier = Modifier
108+ .fillMaxWidth()
109+ .padding(top = 8 .dp),
110+ colors = TextFieldDefaults .colors(
111+ focusedTextColor = Color .White ,
112+ unfocusedTextColor = Color .White ,
113+ cursorColor = Color .White ,
114+ focusedContainerColor = Color .Transparent ,
115+ unfocusedContainerColor = Color .Transparent ,
116+ focusedIndicatorColor = Color .White ,
117+ unfocusedIndicatorColor = Color .Gray ,
118+ focusedLabelColor = Color .White ,
119+ unfocusedLabelColor = Color .Gray ,
120+ ),
121+ maxLines = 3
122+ )
116123 }
117124
118125 Row (
@@ -156,12 +163,11 @@ fun ButtonAction(
156163 Icon (
157164 imageVector = icon,
158165 contentDescription = text,
159- tint = Color (0xFF8A2BE2 ), // This makes the icon white
166+ tint = Color (0xFF8A2BE2 ),
160167 modifier = Modifier
161168 .size(40 .dp)
162- .align(Alignment .Center ) // Adjust the size of the icon as needed
169+ .align(Alignment .Center )
163170 )
164-
165171 }
166172 Text (
167173 modifier = Modifier .padding(top = 8 .dp),
0 commit comments