1+ /*
2+ * Copyright 2024 The Android Open Source Project
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * https://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+
117package com.example.compose.snippets.components
218
319import androidx.compose.animation.AnimatedVisibility
@@ -27,17 +43,17 @@ import androidx.compose.ui.text.style.TextAlign
2743import androidx.compose.ui.tooling.preview.Preview
2844import androidx.compose.ui.unit.dp
2945
30- enum class ExampleStrings (val description : String ){
46+ enum class ExampleStrings (val description : String ) {
3147 SIMPLE (" simple navigation drawer example" ),
3248 NESTED (" navigation drawer with nested items" )
3349}
3450
3551@Composable
36- fun NavigationDrawerExamples (){
52+ fun NavigationDrawerExamples () {
3753 var currentExample by remember { mutableStateOf<ExampleStrings ?>(null ) }
3854
39- if (currentExample == null ){
40- Column (){
55+ if (currentExample == null ) {
56+ Column () {
4157 Text (
4258 text = " Select which example you'd like to see." ,
4359 textAlign = TextAlign .Center ,
@@ -46,18 +62,18 @@ fun NavigationDrawerExamples(){
4662 .padding(16 .dp)
4763 )
4864
49- Button (onClick = {currentExample = ExampleStrings .SIMPLE }) {
65+ Button (onClick = { currentExample = ExampleStrings .SIMPLE }) {
5066 Text (" Simple navigation drawer." )
5167 }
52- Button (onClick = {currentExample = ExampleStrings .NESTED }) {
68+ Button (onClick = { currentExample = ExampleStrings .NESTED }) {
5369 Text (" Navigation drawer with nested items." )
5470 }
5571 }
5672
5773 return
5874 }
5975
60- Column (modifier = Modifier .fillMaxSize()){
76+ Column (modifier = Modifier .fillMaxSize()) {
6177 Text (
6278 text = " Swipe from left to open the ${currentExample!! .description} ." ,
6379 textAlign = TextAlign .Center ,
@@ -67,7 +83,7 @@ fun NavigationDrawerExamples(){
6783 )
6884 }
6985
70- when (currentExample){
86+ when (currentExample) {
7187 null ,
7288 ExampleStrings .SIMPLE -> SimpleNavigationDrawerExample ()
7389 ExampleStrings .NESTED -> NestedNavigationDrawerExample ()
@@ -76,7 +92,7 @@ fun NavigationDrawerExamples(){
7692
7793@Preview
7894@Composable
79- private fun NavigationDrawerExamplesPreview (){
95+ private fun NavigationDrawerExamplesPreview () {
8096 NavigationDrawerExamples ()
8197}
8298
@@ -133,7 +149,7 @@ fun SimpleNavigationDrawerExample() {
133149
134150@Preview
135151@Composable
136- private fun SimpleNavigationDrawerExamplePreview (){
152+ private fun SimpleNavigationDrawerExamplePreview () {
137153 SimpleNavigationDrawerExample ()
138154}
139155
@@ -190,6 +206,6 @@ fun NestedNavigationDrawerExample() {
190206
191207@Preview
192208@Composable
193- private fun NestedNavigationDrawerExamplePreview (){
209+ private fun NestedNavigationDrawerExamplePreview () {
194210 NestedNavigationDrawerExample ()
195211}
0 commit comments