@@ -9,27 +9,29 @@ import androidx.compose.foundation.layout.Box
99import androidx.compose.foundation.layout.Row
1010import androidx.compose.foundation.layout.fillMaxSize
1111import androidx.compose.foundation.layout.fillMaxWidth
12+ import androidx.compose.foundation.layout.height
1213import androidx.compose.foundation.layout.heightIn
1314import androidx.compose.foundation.layout.navigationBarsPadding
1415import androidx.compose.foundation.layout.padding
1516import androidx.compose.foundation.layout.size
1617import androidx.compose.foundation.layout.statusBarsPadding
17- import androidx.compose.material.BottomNavigation
18- import androidx.compose.material.BottomNavigationItem
19- import androidx.compose.material.Icon
20- import androidx.compose.material.IconButton
21- import androidx.compose.material.LocalContentAlpha
22- import androidx.compose.material.LocalContentColor
23- import androidx.compose.material.MaterialTheme
24- import androidx.compose.material.OutlinedTextField
25- import androidx.compose.material.Scaffold
26- import androidx.compose.material.Text
27- import androidx.compose.material.TextFieldDefaults
28- import androidx.compose.material.TopAppBar
2918import androidx.compose.material.icons.Icons
3019import androidx.compose.material.icons.filled.Close
3120import androidx.compose.material.icons.filled.Info
3221import androidx.compose.material.icons.filled.Search
22+ import androidx.compose.material3.ExperimentalMaterial3Api
23+ import androidx.compose.material3.Icon
24+ import androidx.compose.material3.IconButton
25+ import androidx.compose.material3.MaterialTheme
26+ import androidx.compose.material3.NavigationBar
27+ import androidx.compose.material3.NavigationBarItem
28+ import androidx.compose.material3.NavigationBarItemDefaults
29+ import androidx.compose.material3.OutlinedTextField
30+ import androidx.compose.material3.OutlinedTextFieldDefaults
31+ import androidx.compose.material3.Scaffold
32+ import androidx.compose.material3.Text
33+ import androidx.compose.material3.TopAppBar
34+ import androidx.compose.material3.TopAppBarDefaults
3335import androidx.compose.runtime.Composable
3436import androidx.compose.runtime.LaunchedEffect
3537import androidx.compose.runtime.MutableState
@@ -110,7 +112,7 @@ fun App(initialDeeplink: String? = null) {
110112 .statusBarsPadding()
111113 .background(LocalCustomColors .current.navBarBackground)
112114 .navigationBarsPadding()
113- .background(MaterialTheme .colors .background),
115+ .background(MaterialTheme .colorScheme .background),
114116 ) {
115117 LinuxApp (initialDeeplink = initialDeeplink)
116118 }
@@ -294,7 +296,7 @@ fun LinuxApp(initialDeeplink: String? = null) {
294296 enter = fadeIn(animationSpec = tween(300 )),
295297 exit = fadeOut(animationSpec = tween(durationMillis = 300 , delayMillis = 300 )),
296298 ) {
297- Box (modifier = Modifier .fillMaxSize().background(MaterialTheme .colors .background)) {
299+ Box (modifier = Modifier .fillMaxSize().background(MaterialTheme .colorScheme .background)) {
298300 val searchViewModel: SearchViewModel = koinInject()
299301 SearchScreen (
300302 searchText = searchTextValue.value.text,
@@ -351,6 +353,7 @@ private fun parseDeeplink(url: String?): Route? {
351353 }
352354}
353355
356+ @OptIn(ExperimentalMaterial3Api ::class )
354357@Composable
355358private fun GenericTopBar (
356359 title : String ,
@@ -361,6 +364,7 @@ private fun GenericTopBar(
361364 var showDialog by remember { mutableStateOf(false ) }
362365
363366 TopAppBar (
367+ expandedHeight = 56 .dp,
364368 title = {
365369 Text (
366370 title,
@@ -369,11 +373,14 @@ private fun GenericTopBar(
369373 overflow = TextOverflow .Ellipsis ,
370374 )
371375 },
372- backgroundColor = LocalCustomColors .current.topBarBackground,
373- contentColor = LocalCustomColors .current.topBarContent,
374- elevation = 0 .dp,
375- navigationIcon = if (showBackIcon) {
376- {
376+ colors = TopAppBarDefaults .topAppBarColors(
377+ containerColor = LocalCustomColors .current.topBarBackground,
378+ titleContentColor = LocalCustomColors .current.topBarContent,
379+ navigationIconContentColor = LocalCustomColors .current.topBarContent,
380+ actionIconContentColor = LocalCustomColors .current.topBarContent,
381+ ),
382+ navigationIcon = {
383+ if (showBackIcon) {
377384 IconButton (
378385 modifier = Modifier .pointerHoverIcon(PointerIcon .Hand ),
379386 onClick = { navController.popBackStack() },
@@ -384,8 +391,6 @@ private fun GenericTopBar(
384391 )
385392 }
386393 }
387- } else {
388- null
389394 },
390395 actions = {
391396 if (showAppInfoIcon) {
@@ -406,6 +411,7 @@ private fun GenericTopBar(
406411 }
407412}
408413
414+ @OptIn(ExperimentalMaterial3Api ::class )
409415@Composable
410416private fun DetailTopBar (
411417 commandName : String ,
@@ -421,6 +427,7 @@ private fun DetailTopBar(
421427 val bookmarkBorderPainter = rememberIconPainter(AppIcon .BOOKMARK_BORDER )
422428
423429 TopAppBar (
430+ expandedHeight = 56 .dp,
424431 title = {
425432 Text (
426433 commandName,
@@ -429,9 +436,12 @@ private fun DetailTopBar(
429436 overflow = TextOverflow .Ellipsis ,
430437 )
431438 },
432- backgroundColor = LocalCustomColors .current.topBarBackground,
433- contentColor = LocalCustomColors .current.topBarContent,
434- elevation = 0 .dp,
439+ colors = TopAppBarDefaults .topAppBarColors(
440+ containerColor = LocalCustomColors .current.topBarBackground,
441+ titleContentColor = LocalCustomColors .current.topBarContent,
442+ navigationIconContentColor = LocalCustomColors .current.topBarContent,
443+ actionIconContentColor = LocalCustomColors .current.topBarContent,
444+ ),
435445 navigationIcon = {
436446 IconButton (
437447 modifier = Modifier .pointerHoverIcon(PointerIcon .Hand ),
@@ -515,16 +525,20 @@ private fun SearchTopBar(
515525 .focusRequester(focusRequester)
516526 .padding(start = 8 .dp, end = 8 .dp),
517527 placeholder = { Text (" Search..." , color = topBarContent.copy(alpha = 0.7f )) },
518- textStyle = MaterialTheme .typography.subtitle1.copy(color = topBarContent),
519- colors = TextFieldDefaults .outlinedTextFieldColors(
520- textColor = topBarContent,
528+ textStyle = MaterialTheme .typography.titleMedium.copy(color = topBarContent),
529+ colors = OutlinedTextFieldDefaults .colors(
530+ focusedTextColor = topBarContent,
531+ unfocusedTextColor = topBarContent,
521532 cursorColor = topBarContent,
522533 focusedBorderColor = Color .Transparent ,
523534 unfocusedBorderColor = Color .Transparent ,
524535 disabledBorderColor = Color .Transparent ,
525- backgroundColor = Color .Transparent ,
526- trailingIconColor = topBarContent.copy(alpha = LocalContentAlpha .current),
527- placeholderColor = topBarContent.copy(alpha = 0.7f ),
536+ focusedContainerColor = Color .Transparent ,
537+ unfocusedContainerColor = Color .Transparent ,
538+ focusedTrailingIconColor = topBarContent,
539+ unfocusedTrailingIconColor = topBarContent,
540+ focusedPlaceholderColor = topBarContent.copy(alpha = 0.7f ),
541+ unfocusedPlaceholderColor = topBarContent.copy(alpha = 0.7f ),
528542 ),
529543 maxLines = 1 ,
530544 singleLine = true ,
@@ -548,7 +562,7 @@ private fun SearchTopBar(
548562 .weight(1f )
549563 .padding(start = 16 .dp)
550564 .semantics { contentDescription = " TopAppBarTitle" },
551- style = MaterialTheme .typography.h6 ,
565+ style = MaterialTheme .typography.titleLarge ,
552566 maxLines = 1 ,
553567 overflow = TextOverflow .Ellipsis ,
554568 color = topBarContent,
@@ -581,9 +595,10 @@ private fun BottomBar(
581595 isOnTips : Boolean ,
582596 onSelectTab : (Route ) -> Unit ,
583597) {
584- BottomNavigation (
585- backgroundColor = LocalCustomColors .current.navBarBackground,
586- elevation = 0 .dp,
598+ NavigationBar (
599+ modifier = Modifier .height(64 .dp),
600+ containerColor = LocalCustomColors .current.navBarBackground,
601+ tonalElevation = 0 .dp,
587602 ) {
588603 bottomBarItems.forEach { screen ->
589604 val painter = rememberIconPainter(screen.icon)
@@ -592,7 +607,7 @@ private fun BottomBar(
592607 Screen .Commands -> isOnCommands
593608 Screen .Tips -> isOnTips
594609 }
595- BottomNavigationItem (
610+ NavigationBarItem (
596611 modifier = Modifier .pointerHoverIcon(PointerIcon .Hand ),
597612 icon = {
598613 Icon (
@@ -603,8 +618,13 @@ private fun BottomBar(
603618 },
604619 label = { Text (screen.titleRes) },
605620 selected = isSelected,
606- selectedContentColor = MaterialTheme .colors.primary,
607- unselectedContentColor = MaterialTheme .colors.onSurface,
621+ colors = NavigationBarItemDefaults .colors(
622+ selectedIconColor = MaterialTheme .colorScheme.primary,
623+ selectedTextColor = MaterialTheme .colorScheme.primary,
624+ unselectedIconColor = MaterialTheme .colorScheme.onSurface,
625+ unselectedTextColor = MaterialTheme .colorScheme.onSurface,
626+ indicatorColor = Color .Transparent ,
627+ ),
608628 onClick = {
609629 val route = when (screen) {
610630 Screen .Basics -> Route .Basics
0 commit comments