Update Button structure
parent
8d46370f42
commit
c3a9a8bbf9
|
@ -6,8 +6,6 @@ import androidx.compose.foundation.layout.*
|
|||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||
import androidx.compose.material.Button
|
||||
import androidx.compose.material.Icon
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material.icons.Icons
|
||||
|
@ -35,7 +33,7 @@ fun glossaryDetailedPage(glossary: List<Word>, onBackClick: () -> Unit) {
|
|||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
buttonComponent(text = "Retour", onClick = { onBackClick() })
|
||||
buttonComponent(text = "Retour", onClick = { onBackClick() }, icon = Icons.Filled.ArrowBack, width = 150)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ fun glossaryList(glossaries: List<Glossary>, onGlossarySelected: (Glossary) -> U
|
|||
modifier = Modifier.width(200.dp).fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
buttonComponent(glossary.name, { onGlossarySelected(glossary) })
|
||||
buttonComponent(glossary.name, { onGlossarySelected(glossary) }, width = 150)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ fun projectList(projects: List<Project>, onProjectSelected: (Project) -> Unit, o
|
|||
modifier = Modifier.width(200.dp).fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
buttonComponent(project.name, { onProjectSelected(project) })
|
||||
buttonComponent(project.name, { onProjectSelected(project) }, width = 150)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,10 @@ import androidx.compose.runtime.Composable
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.material.Icon
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.ArrowBack
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import main.customRedColor
|
||||
|
||||
@Composable
|
||||
|
@ -15,15 +19,21 @@ fun buttonComponent(
|
|||
text: String,
|
||||
onClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
icon: ImageVector? = null,
|
||||
width: Int = 200
|
||||
|
||||
) {
|
||||
Button(
|
||||
onClick = onClick,
|
||||
modifier = modifier.width(200.dp),
|
||||
modifier = modifier.width(width.dp),
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
backgroundColor = customRedColor,
|
||||
contentColor = Color.White
|
||||
)
|
||||
) {
|
||||
if (icon != null) {
|
||||
Icon(imageVector = icon, contentDescription = null)
|
||||
}
|
||||
Text(text)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue