@@ -22,7 +22,8 @@ import androidx.compose.foundation.lazy.LazyColumn
2222import androidx.compose.foundation.lazy.items
2323import androidx.compose.material3.Card
2424import androidx.compose.material3.CardDefaults
25- import androidx.compose.material3.Divider
25+ import androidx.compose.material3.DividerDefaults
26+ import androidx.compose.material3.HorizontalDivider
2627import androidx.compose.material3.Icon
2728import androidx.compose.material3.MaterialTheme
2829import androidx.compose.material3.Text
@@ -94,6 +95,17 @@ private fun HistoryItemCard(
9495 historyItem : AutoPayHistoryItem ,
9596 modifier : Modifier = Modifier ,
9697) {
98+ val statusColor = when (historyItem.status) {
99+ " Completed" -> Color (0xFF4CAF50 ) // Green color for success
100+ " Failed" -> MaterialTheme .colorScheme.error
101+ null -> when (historyItem.title) {
102+ " Schedule Created" -> MaterialTheme .colorScheme.primary
103+ " Schedule Cancelled" -> MaterialTheme .colorScheme.tertiary
104+ else -> MaterialTheme .colorScheme.primary
105+ }
106+ else -> MaterialTheme .colorScheme.primary
107+ }
108+
97109 Card (
98110 modifier = modifier.fillMaxWidth(),
99111 colors = CardDefaults .cardColors(
@@ -112,7 +124,7 @@ private fun HistoryItemCard(
112124 imageVector = historyItem.icon,
113125 contentDescription = null ,
114126 modifier = Modifier .size(24 .dp),
115- tint = historyItem. statusColor,
127+ tint = statusColor,
116128 )
117129
118130 Spacer (modifier = Modifier .size(12 .dp))
@@ -153,14 +165,14 @@ private fun HistoryItemCard(
153165 if (historyItem.status != null ) {
154166 Spacer (modifier = Modifier .height(8 .dp))
155167
156- Divider ( )
168+ HorizontalDivider ( Modifier , DividerDefaults . Thickness , DividerDefaults .color )
157169
158170 Spacer (modifier = Modifier .height(8 .dp))
159171
160172 Text (
161173 text = " Status: ${historyItem.status} " ,
162174 style = MaterialTheme .typography.bodySmall,
163- color = historyItem. statusColor,
175+ color = statusColor,
164176 fontWeight = FontWeight .Medium ,
165177 )
166178 }
@@ -187,7 +199,7 @@ private fun getDummyHistoryItems(): List<AutoPayHistoryItem> {
187199 date = " Jan 15, 2024" ,
188200 status = " Completed" ,
189201 icon = MifosIcons .CheckCircle ,
190- statusColor = Color .Green ,
202+ statusColor = Color .Unspecified ,
191203 ),
192204 AutoPayHistoryItem (
193205 title = " Internet Bill" ,
@@ -196,7 +208,7 @@ private fun getDummyHistoryItems(): List<AutoPayHistoryItem> {
196208 date = " Jan 10, 2024" ,
197209 status = " Completed" ,
198210 icon = MifosIcons .CheckCircle ,
199- statusColor = Color .Green ,
211+ statusColor = Color .Unspecified ,
200212 ),
201213 AutoPayHistoryItem (
202214 title = " Electricity Bill" ,
@@ -205,7 +217,7 @@ private fun getDummyHistoryItems(): List<AutoPayHistoryItem> {
205217 date = " Jan 5, 2024" ,
206218 status = " Failed" ,
207219 icon = MifosIcons .Error ,
208- statusColor = Color .Red ,
220+ statusColor = Color .Unspecified ,
209221 ),
210222 AutoPayHistoryItem (
211223 title = " Phone Bill" ,
@@ -214,7 +226,7 @@ private fun getDummyHistoryItems(): List<AutoPayHistoryItem> {
214226 date = " Dec 28, 2023" ,
215227 status = " Completed" ,
216228 icon = MifosIcons .CheckCircle ,
217- statusColor = Color .Green ,
229+ statusColor = Color .Unspecified ,
218230 ),
219231 AutoPayHistoryItem (
220232 title = " Gym Membership" ,
@@ -223,7 +235,7 @@ private fun getDummyHistoryItems(): List<AutoPayHistoryItem> {
223235 date = " Dec 20, 2023" ,
224236 status = " Completed" ,
225237 icon = MifosIcons .CheckCircle ,
226- statusColor = Color .Green ,
238+ statusColor = Color .Unspecified ,
227239 ),
228240 AutoPayHistoryItem (
229241 title = " Schedule Created" ,
@@ -232,7 +244,7 @@ private fun getDummyHistoryItems(): List<AutoPayHistoryItem> {
232244 date = " Dec 15, 2023" ,
233245 status = null ,
234246 icon = MifosIcons .Add ,
235- statusColor = Color .Blue ,
247+ statusColor = Color .Unspecified ,
236248 ),
237249 AutoPayHistoryItem (
238250 title = " Schedule Cancelled" ,
@@ -241,7 +253,7 @@ private fun getDummyHistoryItems(): List<AutoPayHistoryItem> {
241253 date = " Dec 10, 2023" ,
242254 status = null ,
243255 icon = MifosIcons .Cancel ,
244- statusColor = Color .Yellow ,
256+ statusColor = Color .Unspecified ,
245257 ),
246258 )
247259}
0 commit comments