Skip to content

Commit

Permalink
fix back button connection throughout the app (#126)
Browse files Browse the repository at this point in the history
* fix back button connection throughout the app

* remove TODO comment
  • Loading branch information
raizo07 authored Nov 5, 2024
1 parent 7920ed1 commit a6a959a
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,20 @@ fun WalletApp(tokenViewModel: TokenViewModel) {
}
composable<CreateAccount> {
CreateAccountScreen(
onContinue = { navController.navigate( route = FinalizeAccountCreation )}
onContinue = { navController.navigate( route = FinalizeAccountCreation )},
onBackButtonPressed = {navController.navigateUp()}
)
}
composable<FinalizeAccountCreation> {
FinalizeAccountCreationScreen(
onContinue = { navController.navigate( route = CreatePin )}
onContinue = { navController.navigate( route = CreatePin )},
onBackButtonPressed = { navController.navigateUp() }
)
}
composable<ImportAccount> {
ImportAccountScreen(
onFinishAccountImport = { navController.navigate( route = CreatePin ) }
onFinishAccountImport = { navController.navigate( route = CreatePin ) },
onBackButtonPressed = { navController.navigateUp() }
)
}
composable<CreatePin> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.filled.ArrowForward
import androidx.compose.material.icons.filled.Refresh
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.IconButton
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.SheetState
import androidx.compose.material3.TopAppBarDefaults
Expand Down Expand Up @@ -57,12 +58,47 @@ import kotlinx.coroutines.CoroutineScope
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun CreateAccountScreen(
onContinue: () -> Unit
onContinue: () -> Unit,
onBackButtonPressed: () -> Unit
) {
var progress by remember { mutableStateOf(0.5f) }
Scaffold(
topBar = {
TopAppBar(
backgroundColor = Color("#0C0C4F".toColorInt()),
contentColor = Color.White,
elevation = 4.dp
) {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(top = 32.dp, start = 16.dp, end = 16.dp),

) {
IconButton(onClick = onBackButtonPressed) {
Icon(
imageVector = Icons.Filled.ArrowBack,
contentDescription = "Backward Arrow",
modifier = Modifier.padding(start = 8.dp),
tint = Color.White
)
}

Box(
modifier = Modifier.fillMaxWidth(),
contentAlignment = Alignment.Center,
) {

Text(
text = "Create Account",
color = Color.White,
fontSize = 20.sp
)

}

}
}
title = { Text("Create Account", color = Color.White, fontSize = 20.sp) },
navigationIcon = {
Icon(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,47 @@ import com.example.walletapp.R

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun FinalizeAccountCreationScreen(onContinue: () -> Unit) {
fun FinalizeAccountCreationScreen(
onContinue: () -> Unit,
onBackButtonPressed: () -> Unit
) {
Scaffold(
topBar = {
TopAppBar(
backgroundColor = Color("#0C0C4F".toColorInt()),
contentColor = Color.White,
elevation = 4.dp
) {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(top = 32.dp, start = 16.dp, end = 16.dp),

) {
IconButton(onClick = onBackButtonPressed) {
Icon(
imageVector = Icons.Filled.ArrowBack,
contentDescription = "Backward Arrow",
modifier = Modifier.padding(start = 8.dp),
tint = Color.White
)
}

Box(
modifier = Modifier.fillMaxWidth(),
contentAlignment = Alignment.Center,
) {

Text(
text = "Create Account",
color = Color.White,
fontSize = 20.sp
)

}

}
}
title = { Text("Create Account", color = Color.White, fontSize = 20.sp) },
navigationIcon = {
Icon(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import androidx.compose.material3.Text
import androidx.compose.material3.TextFieldDefaults
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.IconButton
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.SheetState
import androidx.compose.material3.rememberModalBottomSheetState
Expand Down Expand Up @@ -55,11 +56,49 @@ import kotlinx.coroutines.CoroutineScope

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun ImportAccountScreen(
onFinishAccountImport: () -> Unit,
onBackButtonPressed: () -> Unit
) {
fun ImportAccountScreen(onFinishAccountImport: () -> Unit) {
var progress by remember { mutableStateOf(0.5f) }
Scaffold(
topBar = {
TopAppBar(
backgroundColor = Color("#0C0C4F".toColorInt()),
contentColor = Color.White,
elevation = 4.dp
) {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(top = 32.dp, start = 16.dp, end = 16.dp),

) {
IconButton(onClick = onBackButtonPressed) {
Icon(
imageVector = Icons.Filled.ArrowBack,
contentDescription = "Backward Arrow",
modifier = Modifier.padding(start = 8.dp),
tint = Color.White
)
}

Box(
modifier = Modifier.fillMaxWidth(),
contentAlignment = Alignment.Center,
) {

Text(
text = "Import existing wallet",
color = Color.White,
fontSize = 20.sp
)

}

}
}
title = { Text("Import existing wallet", color = Color.White, fontSize = 20.sp) },
navigationIcon = {
Icon(
Expand Down

0 comments on commit a6a959a

Please sign in to comment.