Skip to content

Commit

Permalink
Implement toolbar to the demo
Browse files Browse the repository at this point in the history
  • Loading branch information
skydoves committed Mar 9, 2022
1 parent c8757fe commit 0a6aa86
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Text
import androidx.compose.material.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
Expand All @@ -33,6 +34,7 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.res.imageResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
Expand All @@ -50,6 +52,10 @@ fun MainScreen() {
val textColor = remember { mutableStateOf(Color.Transparent) }

Column {
MainToolBar()

Spacer(modifier = Modifier.height(10.dp))

PhotoPickerIcon(controller)

ImageColorPicker(
Expand Down Expand Up @@ -104,3 +110,22 @@ fun MainScreen() {
)
}
}

@Composable
fun MainToolBar() {
TopAppBar(
elevation = 6.dp,
backgroundColor = Color(0xFF6200EE),
modifier = Modifier.height(58.dp)
) {
Text(
modifier = Modifier
.padding(8.dp)
.align(Alignment.CenterVertically),
text = stringResource(R.string.app_name),
color = Color.White,
fontSize = 18.sp,
fontWeight = FontWeight.Bold
)
}
}
2 changes: 1 addition & 1 deletion app/src/main/res/values-night/themes.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.ColorPickerComposeDemo" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<style name="Theme.ColorPickerComposeDemo" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<resources>
<string name="app_name">ColorPickerComposeDemo</string>
<string name="app_name">ColorPickerCompose</string>
</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.ColorPickerComposeDemo" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<style name="Theme.ColorPickerComposeDemo" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
Expand Down

0 comments on commit 0a6aa86

Please sign in to comment.