Skip to content

Commit 313d060

Browse files
committed
Enable scheme card clicks and Apply button in Govt Subsidies screen to redirect directly to official government portals
1 parent a7cad42 commit 313d060

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

app/src/main/java/com/example/LoanScreen.kt

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.example
22

33
import androidx.compose.foundation.background
44
import androidx.compose.foundation.border
5+
import androidx.compose.foundation.clickable
56
import androidx.compose.foundation.layout.*
67
import androidx.compose.foundation.rememberScrollState
78
import androidx.compose.foundation.shape.RoundedCornerShape
@@ -126,7 +127,7 @@ fun LoanScreen(onNavigateBack: () -> Unit) {
126127

127128
val colors = listOf(Color(0xFF64B5F6), NuKropWarning, NuKropAccent, Color(0xFFBA68C8))
128129
realSubsidies.forEachIndexed { index, subsidy ->
129-
SchemeCard(subsidy.name, subsidy.amount, subsidy.description, colors[index % colors.size])
130+
SchemeCard(subsidy.name, subsidy.amount, subsidy.description, subsidy.url, colors[index % colors.size])
130131
Spacer(Modifier.height(12.dp))
131132
}
132133
Spacer(Modifier.height(40.dp))
@@ -137,13 +138,25 @@ fun LoanScreen(onNavigateBack: () -> Unit) {
137138
}
138139

139140
@Composable
140-
fun SchemeCard(title: String, amount: String, desc: String, accent: Color) {
141+
fun SchemeCard(title: String, amount: String, desc: String, url: String, accent: Color) {
142+
val context = LocalContext.current
143+
144+
val openUrl = {
145+
if (url.isNotBlank()) {
146+
try {
147+
val intent = android.content.Intent(android.content.Intent.ACTION_VIEW, android.net.Uri.parse(url))
148+
context.startActivity(intent)
149+
} catch (e: Exception) { }
150+
}
151+
}
152+
141153
Box(
142154
modifier = Modifier
143155
.fillMaxWidth()
144156
.clip(RoundedCornerShape(16.dp))
145157
.background(NuKropCard)
146158
.border(1.dp, accent.copy(alpha = 0.3f), RoundedCornerShape(16.dp))
159+
.clickable { openUrl() }
147160
.padding(16.dp)
148161
) {
149162
Column {
@@ -158,14 +171,14 @@ fun SchemeCard(title: String, amount: String, desc: String, accent: Color) {
158171
Text(desc, fontSize = 12.sp, color = NuKropTextMuted, lineHeight = 19.sp)
159172
Spacer(Modifier.height(14.dp))
160173
Button(
161-
onClick = {},
174+
onClick = openUrl,
162175
modifier = Modifier.fillMaxWidth().height(42.dp),
163176
shape = RoundedCornerShape(12.dp),
164177
colors = ButtonDefaults.buttonColors(containerColor = accent.copy(alpha = 0.15f))
165178
) {
166179
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp)) {
167-
Icon(Icons.Default.Edit, null, tint = accent, modifier = Modifier.size(16.dp))
168-
Text("Apply Now", color = accent, fontSize = 12.sp, fontWeight = FontWeight.Bold)
180+
Icon(Icons.Default.OpenInNew, null, tint = accent, modifier = Modifier.size(16.dp))
181+
Text("Apply on Official Portal 🌐", color = accent, fontSize = 12.sp, fontWeight = FontWeight.Bold)
169182
}
170183
}
171184
}

web/public/NuKropAI_v1.0.apk

996 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)