From ee247feb3d367d04b4054e072a165f65a4a32304 Mon Sep 17 00:00:00 2001 From: Emma Vandewalle Date: Wed, 24 Jul 2024 20:18:16 +0000 Subject: [PATCH] feat: frontend basics filled --- .../main/java/be/re/writand/MainActivity.kt | 2 +- .../re/writand/screens/components/Buttons.kt | 34 +++++++++++++++++++ .../main/java/be/re/writand/ui/theme/Theme.kt | 8 +++-- app/src/main/res/values/colors.xml | 9 +++-- app/src/main/res/values/themes.xml | 2 +- 5 files changed, 45 insertions(+), 10 deletions(-) create mode 100644 app/src/main/java/be/re/writand/screens/components/Buttons.kt diff --git a/app/src/main/java/be/re/writand/MainActivity.kt b/app/src/main/java/be/re/writand/MainActivity.kt index 9dfb089..b68edbc 100644 --- a/app/src/main/java/be/re/writand/MainActivity.kt +++ b/app/src/main/java/be/re/writand/MainActivity.kt @@ -20,7 +20,7 @@ class MainActivity : ComponentActivity() { // A surface container using the 'background' color from the theme Surface( modifier = Modifier.fillMaxSize(), - color = MaterialTheme.colors.background + color = MaterialTheme.colors.primary ) { Greeting("Android") } diff --git a/app/src/main/java/be/re/writand/screens/components/Buttons.kt b/app/src/main/java/be/re/writand/screens/components/Buttons.kt new file mode 100644 index 0000000..22e423e --- /dev/null +++ b/app/src/main/java/be/re/writand/screens/components/Buttons.kt @@ -0,0 +1,34 @@ +package be.re.writand.screens.components + +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.shape.RoundedCornerShape +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 be.re.writand.ui.theme.MainGreen + +/** + * A standard button with predefined color and shape. + * @param[text] the text that should be shown in the button. + * @param[onClick] the callback function to execute when the button is clicked. + * @param[enabled] boolean to express if the button is enabled to be clicked or not. + */ +@Composable +fun WritandButton( + text: String, + onClick: () -> Unit, + enabled: Boolean = true +) { + Button( + onClick = onClick, + colors = ButtonDefaults.buttonColors(backgroundColor = MainGreen), + shape = RoundedCornerShape(10.dp), + enabled = enabled + ) { + Text(text = text, color = Color.Black, modifier = Modifier.padding(5.dp)) + } +} \ No newline at end of file diff --git a/app/src/main/java/be/re/writand/ui/theme/Theme.kt b/app/src/main/java/be/re/writand/ui/theme/Theme.kt index ef16ebc..a791cfc 100644 --- a/app/src/main/java/be/re/writand/ui/theme/Theme.kt +++ b/app/src/main/java/be/re/writand/ui/theme/Theme.kt @@ -10,13 +10,15 @@ import androidx.compose.ui.graphics.Color private val DarkColorPalette = darkColors( primary = MainGrey, primaryVariant = VariantDarkGrey, - secondary = MainGreen + secondary = MainGreen, + onBackground = Color.White ) private val LightColorPalette = lightColors( primary = Color.White, primaryVariant = VariantLightGrey, - secondary = MainGreen + secondary = MainGreen, + onBackground = Color.Black /* Other default colors to override background = Color.White, @@ -40,6 +42,6 @@ fun WritandTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composabl colors = colors, typography = Typography, shapes = Shapes, - content = content + content = content, ) } \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index f8c6127..df1ed62 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,10 +1,9 @@ - #FFBB86FC - #FF6200EE - #FF3700B3 - #FF03DAC5 - #FF018786 + #FF13CE66 + #FF3F3F3F + #FF4F4F4F + #FFE3E3E3 #FF000000 #FFFFFFFF \ No newline at end of file diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 826be67..d7f57bb 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -2,6 +2,6 @@ \ No newline at end of file