•  


Guide - Accompanist
Skip to content

Jetpack Navigation Compose Material

Maven Central

A library which provides Compose Material support for Jetpack Navigation Compose . This features composable bottom sheet destinations.

Warning

**This library is deprecated, with official material-navigation support in

androidx.compose.material.navigation .** The original documentation is below the migration guide.

Migration

The official androidx.compose.material.navigation version 1.7.0-alpha04+ offers all of the same functionality as Accompanist Navigation Material.

All class names are the same, the only needed changes are import related.

  1. Replace dependency com.google.accompanist:accompanist-navigation-material:<version> with androidx.compose.material:material-navigation:<version>
  2. Change import for ModalBottomSheetLayout from com.google.accompanist.navigation.material.ModalBottomSheetLayout to androidx.compose.material.navigation.ModalBottomSheetLayout
  3. Change import for bottomSheet from com.google.accompanist.navigation.material.bottomSheet to androidx.compose.material.navigation.bottomSheet
  4. Change import for rememberBottomSheetNavigator from com.google.accompanist.navigation.material.rememberBottomSheetNavigator to androidx.compose.material.navigation.rememberBottomSheetNavigator
  5. Change import for BottomSheetNavigator from com.google.accompanist.navigation.material.BottomSheetNavigator to androidx.compose.material.navigation.BottomSheetNavigator
  6. Change import for BottomSheetNavigatorSheetState from com.google.accompanist.navigation.material.BottomSheetNavigatorSheetState to androidx.compose.material.navigation.BottomSheetNavigatorSheetState

Deprecated Guidance for Accompanist Navigation Material

The following is the deprecated guide for using Navigation Material in Accompanist. Please see above migration section for how to use the androidx.compose.material.navigation Material Navigation.

Usage

Bottom Sheet Destinations

  1. Create a BottomSheetNavigator and add it to the NavController :

    @Composable
    
    fun
     MyApp
    ()
     {
    
        val
     bottomSheetNavigator
     =
     rememberBottomSheetNavigator
    ()
    
        val
     navController
     =
     rememberNavController
    (
    bottomSheetNavigator
    )
    
    }
    
    
  2. Wrap your NavHost in the ModalBottomSheetLayout composable that accepts a BottomSheetNavigator .

    @Composable
    
    fun
     MyApp
    ()
     {
    
        val
     bottomSheetNavigator
     =
     rememberBottomSheetNavigator
    ()
    
        val
     navController
     =
     rememberNavController
    (
    bottomSheetNavigator
    )
    
        ModalBottomSheetLayout
    (
    bottomSheetNavigator
    )
     {
    
            NavHost
    (
    navController
    ,
     "home"
    )
     {
    
               // We'll define our graph here in a bit!
    
            }
    
        }
    
    }
    
    
  3. Register a bottom sheet destination

    @Composable
    
    fun
     MyApp
    ()
     {
    
        val
     bottomSheetNavigator
     =
     rememberBottomSheetNavigator
    ()
    
        val
     navController
     =
     rememberNavController
    (
    bottomSheetNavigator
    )
    
        ModalBottomSheetLayout
    (
    bottomSheetNavigator
    )
     {
    
            NavHost
    (
    navController
    ,
     "home"
    )
     {
    
               composable
    (
    route
     =
     "home"
    )
     {
    
                   ...
    
               }
    
               bottomSheet
    (
    route
     =
     "sheet"
    )
     {
    
                   Text
    (
    "This is a cool bottom sheet!"
    )
    
               }
    
            }
    
        }
    
    }
    
    

For more examples, refer to the samples .

Download

Maven Central

repositories
 {

    mavenCentral
()

}


dependencies
 {

    implementation
 "com.google.accompanist:accompanist-navigation-material:<version>"

}

Snapshots of the development version are available in Sonatype's snapshots repository . These are updated on every commit.

- "漢字路" 한글한자자동변환 서비스는 교육부 고전문헌국역지원사업의 지원으로 구축되었습니다.
- "漢字路" 한글한자자동변환 서비스는 전통문화연구회 "울산대학교한국어처리연구실 옥철영(IT융합전공)교수팀"에서 개발한 한글한자자동변환기를 바탕하여 지속적으로 공동 연구 개발하고 있는 서비스입니다.
- 현재 고유명사(인명, 지명등)을 비롯한 여러 변환오류가 있으며 이를 해결하고자 많은 연구 개발을 진행하고자 하고 있습니다. 이를 인지하시고 다른 곳에서 인용시 한자 변환 결과를 한번 더 검토하시고 사용해 주시기 바랍니다.
- 변환오류 및 건의,문의사항은 juntong@juntong.or.kr로 메일로 보내주시면 감사하겠습니다. .
Copyright ⓒ 2020 By '전통문화연구회(傳統文化硏究會)' All Rights reserved.
 한국   대만   중국   일본