[go: nahoru, domu]

blob: 13a5d769c5f2f50fb4e9c47fb4c6b14a4b4a1075 [file] [log] [blame]
Anastasia Soboleva1de1d102019-09-30 16:48:31 +01001/*
2 * Copyright 2019 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
17package androidx.ui.layout.samples
18
19import androidx.annotation.Sampled
Anastasia Soboleva1de1d102019-09-30 16:48:31 +010020import androidx.compose.Composable
Anastasia Soboleva1de1d102019-09-30 16:48:31 +010021import androidx.ui.foundation.ColoredRect
22import androidx.ui.graphics.Color
Anastasia Soboleva1de1d102019-09-30 16:48:31 +010023import androidx.ui.layout.Container
24import androidx.ui.layout.DpConstraints
George Mount842c8c12020-01-08 16:03:42 -080025import androidx.ui.layout.LayoutAspectRatio
26import androidx.ui.unit.dp
Anastasia Soboleva1de1d102019-09-30 16:48:31 +010027
28@Sampled
29@Composable
30fun SimpleAspectRatio() {
31 Container(constraints = DpConstraints.tightConstraintsForWidth(100.dp)) {
Adam Powell712dc992019-12-04 12:48:30 -080032 ColoredRect(color = Color.Gray, modifier = LayoutAspectRatio(2f))
Anastasia Soboleva1de1d102019-09-30 16:48:31 +010033 }
34}