|
| 1 | +# Jetsnack sample |
| 2 | + |
| 3 | +Jetsnack is a sample snack ordering app built with [Jetpack Compose][compose]. This sample showcases: |
| 4 | + |
| 5 | +* How to implement a custom design system |
| 6 | +* Custom layout |
| 7 | +* Animation |
| 8 | + |
| 9 | +<img src="screenshots/jetsnack.gif"/> |
| 10 | + |
| 11 | +### Status: 🚧 In progress 🚧 |
| 12 | + |
| 13 | +Jetsnack is still under development and some screens are not yet implemented. |
| 14 | + |
| 15 | +## Features |
| 16 | + |
| 17 | +### Custom Design System |
| 18 | + |
| 19 | +Jetsnack's major feature is demonstrating how to implement a custom design system. Jetsnack has a bespoke color system and does not use [Material color theming](https://material.io/design/color/the-color-system.html). |
| 20 | + |
| 21 | +<img src="screenshots/color_system.png"/> |
| 22 | + |
| 23 | +This is implemented by: |
| 24 | + |
| 25 | +* [`JetsnackColorPalette`](app/src/main/java/com/example/jetsnack/ui/theme/Theme.kt#L114) a class modelling the desired color system. |
| 26 | +* [`JetsnackColorAmbient`](app/src/main/java/com/example/jetsnack/ui/theme/Theme.kt#L231) an [ambient](https://developer.android.com/reference/kotlin/androidx/compose/Ambient) holding the current color set. |
| 27 | +* [`ProvideJetsnackColors`](app/src/main/java/com/example/jetsnack/ui/theme/Theme.kt#L222) a composable function [providing](https://developer.android.com/reference/kotlin/androidx/compose/package-summary#Providers(androidx.compose.ProvidedValue,%20kotlin.Function0)) a `JetsnackColorPalette` |
| 28 | +* [`JetsnackTheme` object](app/src/main/java/com/example/jetsnack/ui/theme/Theme.kt#L104), providing convenient access to the current theme colors. |
| 29 | +* [`JetsnackTheme` composable](app/src/main/java/com/example/jetsnack/ui/theme/Theme.kt#L81), the app's theme. Note that while Jetsnack implements a custom color system, it still uses Material's shape and type theming. |
| 30 | + |
| 31 | +Jetsnack wraps Material components, customizing them to use its color system. See the [components package](app/src/main/java/com/example/jetsnack/ui/components) e.g. [`JetsnackButton`](app/src/main/java/com/example/jetsnack/ui/components/Button.kt). Jetsnack makes heavy use of gradients, see [`Gradient`](app/src/main/java/com/example/jetsnack/ui/components/Gradient.kt) for a number of helpful [`Modifier`](https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier)s. |
| 32 | + |
| 33 | +### Custom Layout |
| 34 | + |
| 35 | +<img src="screenshots/snack_details.gif"/> |
| 36 | + |
| 37 | +Jetsnack utilizes custom [`Layout`](https://developer.android.com/reference/kotlin/androidx/compose/ui/package-summary#layout_1)s to achieve its design. See: |
| 38 | + |
| 39 | +* [`CollapsingImageLayout`](app/src/main/java/com/example/jetsnack/ui/snackdetail/SnackDetail.kt#L274) shown above. |
| 40 | +* [`SearchCategory`](app/src/main/java/com/example/jetsnack/ui/home/search/Categories.kt#L97) custom positioning of an image and text items. |
| 41 | +* [`JetsnackBottomNavLayout`](app/src/main/java/com/example/jetsnack/ui/home/Home.kt#L170) a custom Bottom Navigation implementation which animates the width of selected/unselected items. |
| 42 | + |
| 43 | +## Data |
| 44 | +Domain types are modelled in the [model package](app/src/main/java/com/example/jetsnack/model), each containing static sample data exposed using fake `Repo`s objects. |
| 45 | + |
| 46 | +Imagery is sourced from [Unsplash](https://unsplash.com/) and loaded using [coil-accompanist][coil-accompanist]. |
| 47 | + |
| 48 | + |
| 49 | +## License |
| 50 | + |
| 51 | +``` |
| 52 | +Copyright 2020 The Android Open Source Project |
| 53 | +
|
| 54 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 55 | +you may not use this file except in compliance with the License. |
| 56 | +You may obtain a copy of the License at |
| 57 | +
|
| 58 | + https://www.apache.org/licenses/LICENSE-2.0 |
| 59 | +
|
| 60 | +Unless required by applicable law or agreed to in writing, software |
| 61 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 62 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 63 | +See the License for the specific language governing permissions and |
| 64 | +limitations under the License. |
| 65 | +``` |
| 66 | + |
| 67 | +[compose]: https://developer.android.com/jetpack/compose |
| 68 | +[coil-accompanist]: https://github.com/chrisbanes/accompanist |
0 commit comments