Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
feat: add shortcut to network settings on error screen
Browse files Browse the repository at this point in the history
  • Loading branch information
SuhasDissa committed Oct 13, 2023
1 parent cd6e728 commit 750a3f0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ import app.suhasdissa.vibeyou.R
fun IllustratedMessageScreen(
@DrawableRes image: Int,
@StringRes message: Int? = null,
messageColor: Color = MaterialTheme.colorScheme.error
messageColor: Color = MaterialTheme.colorScheme.error,
action: @Composable () -> Unit = {}
) {
Column(
Modifier.fillMaxSize(),
Expand Down Expand Up @@ -63,6 +64,7 @@ fun IllustratedMessageScreen(
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onErrorContainer)
)
}
action()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.filled.Clear
import androidx.compose.material.icons.filled.History
import androidx.compose.material.icons.filled.Search
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.ListItem
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.SearchBar
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
Expand Down Expand Up @@ -200,7 +202,20 @@ fun SearchScreen(
is SearchState.Error -> {
IllustratedMessageScreen(
image = R.drawable.sad_mellow,
message = R.string.something_went_wrong
message = R.string.something_went_wrong,
action = {
TextButton(
onClick = {
onNavigate(Destination.NetworkSettings)
},
colors = ButtonDefaults.textButtonColors(
containerColor = MaterialTheme.colorScheme.errorContainer,
contentColor = MaterialTheme.colorScheme.onErrorContainer
)
) {
Text(stringResource(id = R.string.network_settings))
}
}
)
}

Expand Down

0 comments on commit 750a3f0

Please sign in to comment.