taler-android

Android apps for GNU Taler (wallet, PoS, cashier)
Log | Files | Refs | README | LICENSE

WarningLabel.kt (2155B)


      1 /*
      2  * This file is part of GNU Taler
      3  * (C) 2024 Taler Systems S.A.
      4  *
      5  * GNU Taler is free software; you can redistribute it and/or modify it under the
      6  * terms of the GNU General Public License as published by the Free Software
      7  * Foundation; either version 3, or (at your option) any later version.
      8  *
      9  * GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
     10  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     11  * A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
     12  *
     13  * You should have received a copy of the GNU General Public License along with
     14  * GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
     15  */
     16 
     17 package net.taler.wallet.compose
     18 
     19 import androidx.compose.foundation.BorderStroke
     20 import androidx.compose.foundation.background
     21 import androidx.compose.foundation.border
     22 import androidx.compose.foundation.layout.Row
     23 import androidx.compose.foundation.layout.padding
     24 import androidx.compose.material.icons.Icons
     25 import androidx.compose.material.icons.outlined.WarningAmber
     26 import androidx.compose.material3.Icon
     27 import androidx.compose.material3.MaterialTheme
     28 import androidx.compose.material3.Text
     29 import androidx.compose.runtime.Composable
     30 import androidx.compose.ui.Alignment
     31 import androidx.compose.ui.Modifier
     32 import androidx.compose.ui.res.colorResource
     33 import androidx.compose.ui.unit.dp
     34 import net.taler.wallet.R
     35 
     36 @Composable
     37 fun WarningLabel(
     38     label: String,
     39     modifier: Modifier = Modifier,
     40 ) {
     41     Row (modifier
     42         .background(colorResource(R.color.notice_background))
     43         .border(BorderStroke(2.dp, colorResource(R.color.notice_border)))
     44         .padding(all = 16.dp),
     45         verticalAlignment = Alignment.CenterVertically,
     46     ) {
     47         Icon(
     48             Icons.Outlined.WarningAmber,
     49             contentDescription = null,
     50             modifier = Modifier.padding(end = 10.dp),
     51             tint = colorResource(R.color.notice_text),
     52         )
     53 
     54         Text(
     55             text = label,
     56             style = MaterialTheme.typography.bodyMedium,
     57             color = colorResource(R.color.notice_text),
     58         )
     59     }
     60 }