implement delayed FAB text display in MainVocabularyScreen
This commit is contained in:
@@ -75,8 +75,6 @@ enum class VocabularyTab(
|
|||||||
Statistics(title = "label_all_vocabulary", icon = AppIcons.BarChart, route = "statistics")
|
Statistics(title = "label_all_vocabulary", icon = AppIcons.BarChart, route = "statistics")
|
||||||
}
|
}
|
||||||
|
|
||||||
//Used to avoid the warning of unused variables in strings.xml
|
|
||||||
|
|
||||||
@Suppress("unused", "HardCodedStringLiteral", "UnusedVariable")
|
@Suppress("unused", "HardCodedStringLiteral", "UnusedVariable")
|
||||||
@Composable
|
@Composable
|
||||||
fun Dummy() {
|
fun Dummy() {
|
||||||
@@ -297,7 +295,18 @@ fun MainVocabularyScreen(
|
|||||||
VocabularyTab.entries.find { it.route == currentRoute } ?: VocabularyTab.Dashboard
|
VocabularyTab.entries.find { it.route == currentRoute } ?: VocabularyTab.Dashboard
|
||||||
}
|
}
|
||||||
|
|
||||||
val showFabText = selectedTab == VocabularyTab.Dashboard && !isScrolling
|
val rawShowFabText = selectedTab == VocabularyTab.Dashboard && !isScrolling
|
||||||
|
var showFabText by remember { mutableStateOf(rawShowFabText) }
|
||||||
|
|
||||||
|
LaunchedEffect(rawShowFabText) {
|
||||||
|
if (rawShowFabText) {
|
||||||
|
// Only delay when showing (true), hide immediately
|
||||||
|
kotlinx.coroutines.delay(2000)
|
||||||
|
showFabText = true
|
||||||
|
} else {
|
||||||
|
showFabText = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val repoEmpty =
|
val repoEmpty =
|
||||||
vocabularyViewModel.vocabularyItems.collectAsState(initial = emptyList()).value.isEmpty()
|
vocabularyViewModel.vocabularyItems.collectAsState(initial = emptyList()).value.isEmpty()
|
||||||
|
|||||||
Reference in New Issue
Block a user