Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

Commit

Permalink
Adding in Type.kt and updating README screenshots
Browse files Browse the repository at this point in the history
  • Loading branch information
MagicalMeghan committed Aug 23, 2023
1 parent cd0bb28 commit 6949be7
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 9 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ This sample showcases:
* `CollapsingToolbarLayout` behavior implemented manually with Compose.
* Showing [Snackbars](https://material.io/components/snackbars) with Compose.
* Using Compose within a `RecyclerView` ([#766](https://github.com/android/sunflower/pull/766))
* Material3 Theming

**Note**: To see the original View implementation of Sunflower, checkout the [`views`](https://github.com/android/sunflower/tree/views) branch.

## Screenshots

<img src="screenshots/screenshots.png"/>
<img src="screenshots/SunflowerM3Screenshots.png"/>

## Features

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.items
import androidx.compose.foundation.lazy.grid.rememberLazyGridState
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.CardColors
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.ElevatedCard
import androidx.compose.material3.ExperimentalMaterial3Api
Expand Down Expand Up @@ -164,13 +162,12 @@ private fun GardenListItem(
Text(
text = stringResource(id = R.string.plant_date_header),
Modifier.align(Alignment.CenterHorizontally),
fontWeight = FontWeight.Bold,
style = MaterialTheme.typography.titleSmall
)
Text(
text = vm.plantDateString,
Modifier.align(Alignment.CenterHorizontally),
style = MaterialTheme.typography.titleSmall
style = MaterialTheme.typography.labelSmall
)

// Last Watered
Expand All @@ -179,13 +176,12 @@ private fun GardenListItem(
Modifier
.align(Alignment.CenterHorizontally)
.padding(top = marginNormal),
fontWeight = FontWeight.Bold,
style = MaterialTheme.typography.titleSmall
)
Text(
text = vm.waterDateString,
Modifier.align(Alignment.CenterHorizontally),
style = MaterialTheme.typography.titleSmall
style = MaterialTheme.typography.labelSmall
)
Text(
text = pluralStringResource(
Expand All @@ -196,7 +192,7 @@ private fun GardenListItem(
Modifier
.align(Alignment.CenterHorizontally)
.padding(bottom = marginNormal),
style = MaterialTheme.typography.titleSmall
style = MaterialTheme.typography.labelSmall
)
}
}
Expand All @@ -221,7 +217,8 @@ private fun EmptyGarden(onAddPlantClick: () -> Unit, modifier: Modifier = Modifi
onClick = onAddPlantClick
) {
Text(
text = stringResource(id = R.string.add_plant)
text = stringResource(id = R.string.add_plant),
style = MaterialTheme.typography.titleSmall
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ fun SunflowerTheme(
MaterialTheme(
colorScheme = colorScheme,
shapes = Shapes,
typography = Typography,
content = content
)
}
51 changes: 51 additions & 0 deletions app/src/main/java/com/google/samples/apps/sunflower/ui/Type.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.samples.apps.sunflower.ui

import androidx.compose.material3.Typography
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.sp


val Typography = Typography(
displaySmall = TextStyle(
fontWeight = FontWeight.Normal,
fontSize = 36.sp
),
headlineSmall = TextStyle(
fontWeight = FontWeight.Normal,
fontSize = 30.sp
),
labelSmall = TextStyle(
fontWeight = FontWeight.Normal,
fontSize = 13.sp
),
titleSmall = TextStyle(
fontWeight = FontWeight.Bold,
fontSize = 14.sp
),
titleMedium = TextStyle(
fontWeight = FontWeight.SemiBold,
letterSpacing = (.5).sp,
fontSize = 18.sp
),
titleLarge = TextStyle(
fontWeight = FontWeight.Normal,
fontSize = 24.sp
),
)
File renamed without changes.
Binary file added screenshots/SunflowerM3Screenshots.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6949be7

Please sign in to comment.