1
+ package com.egoriku.ladyhappy.adminconsole
2
+
3
+ import android.os.Bundle
4
+ import android.view.LayoutInflater
5
+ import android.view.View
6
+ import android.view.ViewGroup
7
+ import androidx.compose.foundation.layout.*
8
+ import androidx.compose.material.*
9
+ import androidx.compose.runtime.Composable
10
+ import androidx.compose.ui.Alignment
11
+ import androidx.compose.ui.Modifier
12
+ import androidx.compose.ui.tooling.preview.Preview
13
+ import androidx.compose.ui.unit.dp
14
+ import androidx.fragment.app.Fragment
15
+ import com.egoriku.ladyhappy.adminconsole.extension.setThemeContent
16
+
17
+ class AdminConsoleFragment : Fragment () {
18
+
19
+ override fun onCreateView (
20
+ inflater : LayoutInflater ,
21
+ container : ViewGroup ? ,
22
+ savedInstanceState : Bundle ?
23
+ ): View = setThemeContent {
24
+ Surface {
25
+ ConsoleScreen ()
26
+ }
27
+ }
28
+ }
29
+
30
+ @Preview
31
+ @Composable
32
+ fun ConsoleScreen () {
33
+ Column (
34
+ modifier = Modifier .fillMaxSize(),
35
+ verticalArrangement = Arrangement .Center
36
+ ) {
37
+ FeatureItem (onClick = {}, name = " Publish news" )
38
+ FeatureItem (onClick = {}, name = " Publish product" )
39
+ FeatureItem (onClick = {}, name = " Manage users and permissions" )
40
+ }
41
+ }
42
+
43
+ @OptIn(ExperimentalMaterialApi ::class )
44
+ @Composable
45
+ fun FeatureItem (
46
+ modifier : Modifier = Modifier ,
47
+ onClick : () -> Unit ,
48
+ name : String
49
+ ) {
50
+ Card (
51
+ elevation = 3 .dp,
52
+ onClick = onClick,
53
+ modifier = modifier
54
+ .fillMaxWidth()
55
+ .defaultMinSize(minHeight = 100 .dp)
56
+ .padding(all = 16 .dp)
57
+ ) {
58
+ Box (contentAlignment = Alignment .Center ) {
59
+ Text (text = name, style = MaterialTheme .typography.h6)
60
+ }
61
+ }
62
+ }
0 commit comments