Clara Bayarri | 5bace4e | 2020-02-06 16:42:21 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2020 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package androidx.ui.material.studies.rally |
| 18 | |
| 19 | import androidx.compose.Composable |
| 20 | import androidx.ui.core.Modifier |
| 21 | import androidx.ui.foundation.Box |
| 22 | import androidx.ui.foundation.Clickable |
| 23 | import androidx.ui.graphics.Color |
| 24 | import androidx.ui.graphics.vector.DrawVector |
| 25 | import androidx.ui.graphics.vector.VectorAsset |
| 26 | import androidx.ui.layout.LayoutHeight |
| 27 | import androidx.ui.layout.LayoutWidth |
| 28 | import androidx.ui.material.ripple.Ripple |
| 29 | import androidx.ui.unit.dp |
| 30 | |
| 31 | @Composable |
| 32 | fun RallyIconButton( |
| 33 | vectorImage: VectorAsset, |
| 34 | onClick: () -> Unit, |
| 35 | modifier: Modifier = Modifier.None |
| 36 | ) { |
| 37 | Box(modifier = modifier) { |
| 38 | Ripple(bounded = false) { |
| 39 | Clickable(onClick) { |
| 40 | Box(modifier = LayoutHeight(24.dp) + LayoutWidth(24.dp)) { |
| 41 | DrawVector(vectorImage = vectorImage, tintColor = Color.White) |
| 42 | } |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | } |