Skip to content

Commit

Permalink
chore: add back button to AddTokenScreen (#127)
Browse files Browse the repository at this point in the history
chore: add back button to AddToken
  • Loading branch information
Iwueseiter authored Nov 6, 2024
1 parent 9372f6b commit e270fd7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ fun WalletApp(tokenViewModel: TokenViewModel) {
composable<AddToken> {
AddTokenScreen(
tokenViewModel=tokenViewModel,
navController: navController,
onConfirm = { navController.navigateUp() }
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
package com.example.walletapp.ui.account

import android.app.Activity
import android.widget.Toast
import androidx.compose.foundation.background
Expand All @@ -11,6 +10,16 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Button
import androidx.compose.material.ButtonDefaults
import androidx.compose.material.Icon
import androidx.compose.material.IconButton
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.material.TextField
import androidx.compose.material.TextFieldDefaults
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.OutlinedTextFieldDefaults
Expand All @@ -35,13 +44,16 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.core.graphics.toColorInt
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation.NavController
import com.example.walletapp.R
import com.example.walletapp.model.Token
import com.example.walletapp.model.TokenIdsResponse
import com.swmansion.starknet.data.types.Felt

@Composable
fun AddTokenScreen(tokenViewModel:TokenViewModel,onConfirm: () -> Unit) {
fun AddTokenScreen(tokenViewModel:TokenViewModel, onConfirm: () -> Unit, navController: NavController,
) {

Surface(modifier = Modifier.fillMaxSize()) {
val contactAddress = rememberSaveable { mutableStateOf("") }
val name = rememberSaveable { mutableStateOf("") }
Expand All @@ -64,6 +76,20 @@ fun AddTokenScreen(tokenViewModel:TokenViewModel,onConfirm: () -> Unit) {
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Top
) {


// Back Button
IconButton(
onClick = { navController.navigateUp() },
modifier = Modifier.align(Alignment.Start)
) {
Icon(
imageVector = Icons.Default.ArrowBack,
contentDescription = "Back",
tint = Color.White
)
}

Text(
text = "Add Token",
fontFamily = FontFamily(Font(R.font.publicsans_bold)),
Expand Down Expand Up @@ -120,7 +146,7 @@ fun AddTokenScreen(tokenViewModel:TokenViewModel,onConfirm: () -> Unit) {
Toast.makeText(context, "Please enter name", Toast.LENGTH_LONG)
.show()
}
else if (symbol.value.isEmpty()) {
else if (symbol.value.isEmpty()) {
Toast.makeText(context, "Please enter symbol", Toast.LENGTH_LONG)
.show()
} else if (decimalValue == null || decimalValue !in 0..18) {
Expand Down

0 comments on commit e270fd7

Please sign in to comment.