|
| 1 | +@file:OptIn(ExperimentalMaterial3Api::class) |
| 2 | + |
| 3 | +package com.shifthackz.aisdv1.presentation.screen.backup |
| 4 | + |
| 5 | +import androidx.compose.material.icons.Icons |
| 6 | +import androidx.compose.material.icons.automirrored.outlined.ArrowBack |
| 7 | +import androidx.compose.material3.CenterAlignedTopAppBar |
| 8 | +import androidx.compose.material3.ExperimentalMaterial3Api |
| 9 | +import androidx.compose.material3.Icon |
| 10 | +import androidx.compose.material3.IconButton |
| 11 | +import androidx.compose.material3.MaterialTheme |
| 12 | +import androidx.compose.material3.Scaffold |
| 13 | +import androidx.compose.material3.Text |
| 14 | +import androidx.compose.runtime.Composable |
| 15 | +import androidx.compose.ui.Modifier |
| 16 | +import androidx.compose.ui.res.stringResource |
| 17 | +import com.shifthackz.aisdv1.core.localization.R |
| 18 | +import com.shifthackz.aisdv1.core.ui.MviComponent |
| 19 | +import org.koin.androidx.compose.koinViewModel |
| 20 | + |
| 21 | +@Composable |
| 22 | +fun BackupScreen() { |
| 23 | + MviComponent( |
| 24 | + viewModel = koinViewModel<BackupViewModel>(), |
| 25 | + ) { state, processIntent -> |
| 26 | + BackupScreenContent( |
| 27 | + state = state, |
| 28 | + processIntent = processIntent, |
| 29 | + ) |
| 30 | + } |
| 31 | +} |
| 32 | + |
| 33 | +@Composable |
| 34 | +private fun BackupScreenContent( |
| 35 | + modifier: Modifier = Modifier, |
| 36 | + state: BackupState, |
| 37 | + processIntent: (BackupIntent) -> Unit, |
| 38 | +) { |
| 39 | + Scaffold( |
| 40 | + modifier = modifier, |
| 41 | + topBar = { |
| 42 | + CenterAlignedTopAppBar( |
| 43 | + title = { |
| 44 | + Text( |
| 45 | + text = stringResource(id = R.string.title_backup), |
| 46 | + style = MaterialTheme.typography.headlineMedium, |
| 47 | + ) |
| 48 | + }, |
| 49 | + navigationIcon = { |
| 50 | + IconButton( |
| 51 | + onClick = { processIntent(BackupIntent.NavigateBack) }, |
| 52 | + content = { |
| 53 | + Icon( |
| 54 | + Icons.AutoMirrored.Outlined.ArrowBack, |
| 55 | + contentDescription = "Back button", |
| 56 | + ) |
| 57 | + }, |
| 58 | + ) |
| 59 | + }, |
| 60 | + ) |
| 61 | + } |
| 62 | + ) { paddingValues -> |
| 63 | + |
| 64 | + } |
| 65 | +} |
0 commit comments