Skip to content

Commit

Permalink
feat: added PersonalInfoPopup
Browse files Browse the repository at this point in the history
Added a popup for collecting personal information including gender selection. Also added a general-purpose bottom sheet component.
The PersonalInfoPopup component is called on the main screen.
  • Loading branch information
alwinsDen committed Jan 14, 2025
1 parent 96849f8 commit 1d8bce4
Show file tree
Hide file tree
Showing 3 changed files with 179 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import org.alwinsden.remnant.ui.MainScreens.SpecialColoredBckBox
import org.alwinsden.remnant.ui.PopsUps.PersonalInfoPopup
import org.jetbrains.compose.resources.painterResource
import remnant.composeapp.generated.resources.*

Expand Down Expand Up @@ -145,9 +146,5 @@ actual val mainScreenColumnWidth: Dp = Dp.Unspecified
@Preview
@Composable
fun test() {
SpecialColoredBckBox(
bckColor = 0xff000000,
header = "Things we should about you?",
content = "Things we should about you? Things we should about you? Things we should about you? Things we should about you? Things we should about you? Things we should about you? Things we should about you? Things we should about you? Things we should about you? "
)
PersonalInfoPopup()
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package org.alwinsden.remnant.ui.MainScreens
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Text
Expand All @@ -19,6 +20,7 @@ import org.alwinsden.remnant.InterFontFamily
import org.alwinsden.remnant.JudsonFontFamily
import org.alwinsden.remnant.PowerButtonPadding
import org.alwinsden.remnant.mainScreenColumnWidth
import org.alwinsden.remnant.ui.PopsUps.PersonalInfoPopup

@Composable
fun MainScreen1() {
Expand Down Expand Up @@ -51,22 +53,28 @@ fun MainScreen1() {
ColoredBckBox(
bckColor = 0xff76BF00,
header = "Personalize mental health guidance.",
content = "Gender: not specified."
content = "Gender: not specified.",
onClick = {
println("This button was click")
}
)
ColoredBckBox(
bckColor = 0xffA9C1ED,
header = "Adapts advice for location context.",
content = "city: not selected."
content = "city: not selected.",
onClick = {}
)
ColoredBckBox(
bckColor = 0xffC88DE3,
header = "Tailors suggestions for age.",
content = "age: not specified."
content = "age: not specified.",
onClick = {}
)
ColoredBckBox(
bckColor = 0xffB56161,
header = "Helps us determine how busy you are.",
content = "specify work hours: 9am-6:30pm."
content = "specify work hours: 9am-6:30pm.",
onClick = {}
)
SpecialColoredBckBox(
bckColor = 0xff000000,
Expand All @@ -76,10 +84,11 @@ fun MainScreen1() {
}
}
}
PersonalInfoPopup()
}

@Composable
private fun ColoredBckBox(bckColor: Long, header: String, content: String) {
private fun ColoredBckBox(bckColor: Long, header: String, content: String, onClick: ()->Unit) {
Box(
modifier = Modifier
.fillMaxWidth()
Expand Down Expand Up @@ -124,6 +133,9 @@ private fun ColoredBckBox(bckColor: Long, header: String, content: String) {
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier.fillMaxWidth()
.clickable {
onClick()
}
) {
Column {
Text(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
package org.alwinsden.remnant.ui.PopsUps

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Button
import androidx.compose.material.ButtonDefaults
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import com.composables.icons.lucide.Lucide
import com.composables.icons.lucide.MoveUpLeft
import org.alwinsden.remnant.InterFontFamily

@Composable
fun PersonalInfoPopup() {
BottomControllerComponent(
onOuterClick = {
println("TRIGGER logs")
},
) {
Column(
modifier = Modifier
.background(
color = Color(0xffffffff),
shape = RoundedCornerShape(
topStart = 25.dp,
topEnd = 25.dp
)
)
.fillMaxWidth()
.padding(vertical = 15.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(10.dp),
) {
Text(
text = "Select gender: ",
fontFamily = InterFontFamily,
modifier = Modifier.fillMaxWidth(.9f)
)

//this is the selection component
Button(
onClick = {
//
},
colors = ButtonDefaults.buttonColors(
backgroundColor = Color(0xffD9D9D9)
),
shape = RoundedCornerShape(50),
modifier = Modifier.fillMaxWidth(.9f)
) {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 5.dp, horizontal = 5.dp),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically
) {
Text("Male", fontFamily = InterFontFamily)
Image(
Lucide.MoveUpLeft,
contentDescription = null,
modifier = Modifier
.width(20.dp),
)
}
}

//this is the selection component
Button(
onClick = {
//
},
colors = ButtonDefaults.buttonColors(
backgroundColor = Color(0xffD9D9D9)
),
shape = RoundedCornerShape(50),
modifier = Modifier.fillMaxWidth(.9f)
) {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 5.dp, horizontal = 5.dp),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically
) {
Text("Female", fontFamily = InterFontFamily)
Image(
Lucide.MoveUpLeft,
contentDescription = null,
modifier = Modifier
.width(20.dp),
)
}
}

//this is the selection component
Button(
onClick = {
//
},
colors = ButtonDefaults.buttonColors(
backgroundColor = Color(0xffD9D9D9)
),
shape = RoundedCornerShape(50),
modifier = Modifier.fillMaxWidth(.9f)
) {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 5.dp, horizontal = 5.dp),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically
) {
Text("rather not say. ", fontFamily = InterFontFamily)
Image(
Lucide.MoveUpLeft,
contentDescription = null,
modifier = Modifier
.width(20.dp),
)
}
}
}
}
}

@Composable
fun BottomControllerComponent(onOuterClick: () -> Unit, content: @Composable () -> Unit) {
Column(
modifier = Modifier
.fillMaxHeight()
.background(
color = Color(0xff2B2B2B).copy(alpha = .57f)
)
.clickable(
indication = null,
interactionSource = remember { MutableInteractionSource() }
) {
onOuterClick()
},
verticalArrangement = Arrangement.Bottom
) {
content()
}
}

0 comments on commit 1d8bce4

Please sign in to comment.