You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
object AccountTab : Tab {
override val options: TabOptions @composable
get() {
val title = "History"
val icon = rememberVectorPainter(Icons.Default.AccountBox)
return remember {
TabOptions(
index = 0u,
title = title,
icon = icon
)
}
}
@Composable
override fun Content() {
BasicText("Home Tab Content", modifier = Modifier.fillMaxSize())
}
@composable
fun BottomNavItem(tab: Tab, tabNavigator: TabNavigator) {
val isSelected = tabNavigator.current == tab
val color = if (isSelected) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onBackground
package au.nd52solution.ethnic.features.home.tabs
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.text.BasicText
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.AccountBox
import androidx.compose.material.icons.filled.History
import androidx.compose.material.icons.filled.Home
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.rememberVectorPainter
import cafe.adriel.voyager.navigator.tab.Tab
import cafe.adriel.voyager.navigator.tab.TabOptions
object AccountTab : Tab {
override val options: TabOptions
@composable
get() {
val title = "History"
val icon = rememberVectorPainter(Icons.Default.AccountBox)
}
package au.nd52solution.ethnic.features.home
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.text.BasicText
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Tab
import androidx.compose.material3.TabRow
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import au.nd52solution.ethnic.features.home.tabs.AccountTab
import au.nd52solution.ethnic.features.home.tabs.AvailabilityTab
import au.nd52solution.ethnic.features.home.tabs.HistoryTab
import au.nd52solution.ethnic.features.home.tabs.HomeTab
import cafe.adriel.voyager.core.screen.Screen
import cafe.adriel.voyager.navigator.tab.CurrentTab
import cafe.adriel.voyager.navigator.tab.Tab
import cafe.adriel.voyager.navigator.tab.TabNavigator
class HomeScreen: Screen {
@composable
override fun Content() {
TabNavigator(HomeTab) {tabNavigator ->
Scaffold(
content = {
CurrentTab()
},
bottomBar = {
BottomNavigationBar(tabNavigator)
}
)
}
}
@composable
fun BottomNavigationBar(tabNavigator: TabNavigator) {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(8.dp),
horizontalArrangement = Arrangement.SpaceEvenly,
verticalAlignment = Alignment.CenterVertically
) {
// Create a custom "bottom navigation item" for each tab
BottomNavItem(tab = HomeTab, tabNavigator = tabNavigator)
BottomNavItem(tab = HistoryTab, tabNavigator = tabNavigator)
BottomNavItem(tab = AvailabilityTab, tabNavigator = tabNavigator)
BottomNavItem(tab = AccountTab, tabNavigator = tabNavigator)
}
@composable
fun BottomNavItem(tab: Tab, tabNavigator: TabNavigator) {
val isSelected = tabNavigator.current == tab
val color = if (isSelected) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onBackground
} icons not display
The text was updated successfully, but these errors were encountered: