taler-android

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

Banner.kt (2105B)


      1 /*
      2  * This file is part of GNU Taler
      3  * (C) 2025 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.layout.Box
     20 import androidx.compose.foundation.layout.fillMaxWidth
     21 import androidx.compose.foundation.layout.padding
     22 import androidx.compose.material3.Card
     23 import androidx.compose.material3.CardColors
     24 import androidx.compose.material3.CardDefaults
     25 import androidx.compose.material3.MaterialTheme
     26 import androidx.compose.material3.ProvideTextStyle
     27 import androidx.compose.material3.ShapeDefaults
     28 import androidx.compose.runtime.Composable
     29 import androidx.compose.ui.Alignment
     30 import androidx.compose.ui.Modifier
     31 import androidx.compose.ui.graphics.Shape
     32 import androidx.compose.ui.text.style.TextAlign
     33 import androidx.compose.ui.unit.dp
     34 
     35 @Composable
     36 fun Banner(
     37     modifier: Modifier = Modifier,
     38     colors: CardColors = CardDefaults.cardColors(),
     39     shape: Shape = ShapeDefaults.ExtraSmall,
     40     content: @Composable () -> Unit,
     41 ) {
     42     Card(
     43         modifier = modifier
     44             .safeHorizontalPadding()
     45             .fillMaxWidth(),
     46         colors = colors,
     47         shape = shape,
     48     ) {
     49         Box(Modifier
     50             .padding(10.dp)
     51             .fillMaxWidth(),
     52             contentAlignment = Alignment.Center,
     53         ) {
     54             ProvideTextStyle(MaterialTheme.typography.labelLarge.copy(
     55                 textAlign = TextAlign.Center,
     56             )) {
     57                 content()
     58             }
     59         }
     60     }
     61 }