Add component for button
parent
ab24995360
commit
34656cfac3
|
@ -12,6 +12,7 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import main.component.buttonComponent
|
||||
|
||||
var mostUsedWordList = mutableMapOf<String, Int>()
|
||||
|
||||
|
@ -60,27 +61,9 @@ fun homePage(
|
|||
Row(
|
||||
horizontalArrangement = Arrangement.spacedBy(16.dp)
|
||||
) {
|
||||
Button(
|
||||
onClick = onProjectClick,
|
||||
modifier = Modifier.width(200.dp),
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
backgroundColor = customRedColor,
|
||||
contentColor = Color.White
|
||||
)
|
||||
) {
|
||||
Text(languageManager.getGlossaryText())
|
||||
}
|
||||
buttonComponent(languageManager.getGlossaryText(), onProjectClick)
|
||||
|
||||
Button(
|
||||
onClick = onCodeToVerifyClick,
|
||||
modifier = Modifier.width(200.dp),
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
backgroundColor = customRedColor,
|
||||
contentColor = Color.White
|
||||
)
|
||||
) {
|
||||
Text(languageManager.getCodeToVerifyText())
|
||||
}
|
||||
buttonComponent(languageManager.getCodeToVerifyText(), onCodeToVerifyClick)
|
||||
|
||||
Button(
|
||||
onClick = {
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
package main.component
|
||||
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.material.Button
|
||||
import androidx.compose.material.ButtonDefaults
|
||||
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.unit.dp
|
||||
import main.customRedColor
|
||||
|
||||
@Composable
|
||||
fun buttonComponent(
|
||||
text: String,
|
||||
onClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Button(
|
||||
onClick = onClick,
|
||||
modifier = modifier.width(200.dp),
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
backgroundColor = customRedColor,
|
||||
contentColor = Color.White
|
||||
)
|
||||
) {
|
||||
Text(text)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue