-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Jordan Akinpelu (akinpelud)
committed
Apr 4, 2023
1 parent
e3d983a
commit ec574f3
Showing
2 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
PowerOf10/app/src/main/java/com/example/powerof10/MenuItems.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.example.powerof10 | ||
|
||
data class MenuItems( | ||
val id:Int, | ||
val title: String, | ||
val route:String | ||
) |
61 changes: 61 additions & 0 deletions
61
PowerOf10/app/src/main/java/com/example/powerof10/NavDrawer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.example.powerof10 | ||
|
||
import android.os.Bundle | ||
import androidx.activity.ComponentActivity | ||
import androidx.activity.compose.setContent | ||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.layout.* | ||
import androidx.compose.foundation.lazy.LazyColumn | ||
import androidx.compose.foundation.lazy.items | ||
import androidx.compose.material.MaterialTheme | ||
import androidx.compose.material.Surface | ||
import androidx.compose.material.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
import com.example.powerof10.ui.theme.PowerOf10Theme | ||
|
||
class NavDrawer : ComponentActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContent { | ||
PowerOf10Theme { | ||
// A surface container using the 'background' color from the theme | ||
Surface( | ||
modifier = Modifier.fillMaxSize(), | ||
color = MaterialTheme.colors.background | ||
) { | ||
|
||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
@Composable | ||
fun NavDrawerBody(items:List<MenuItems>,onItemClick: (MenuItems)->Unit) { | ||
|
||
LazyColumn(modifier = Modifier.fillMaxSize().background(Color(0xFFE5383B))){ | ||
items(items){item -> | ||
Row(modifier = Modifier | ||
.clickable { onItemClick(item) } | ||
.padding(20.dp)) { | ||
Text(text = item.title, fontSize = 24.sp, color = Color.White) | ||
Spacer(modifier = Modifier.fillMaxWidth()) | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
@Composable | ||
fun DefaultPreview2() { | ||
PowerOf10Theme { | ||
|
||
} | ||
} |