-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: thêm custom thư viện cắt ảnh (#106)
- Tối ưu lại giao diện thêm và sửa flashcard - Sửa các lỗi liên quan đến UX - Tối ưu lại thư viện sao cho phù hợp với ứng dụng
- Loading branch information
Showing
46 changed files
with
2,697 additions
and
406 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
app/src/main/java/com/pwhs/quickmem/presentation/app/flashcard/component/ExplanationCard.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package com.pwhs.quickmem.presentation.app.flashcard.component | ||
|
||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.filled.Clear | ||
import androidx.compose.material3.Card | ||
import androidx.compose.material3.CardDefaults | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.IconButton | ||
import androidx.compose.material3.MaterialTheme.colorScheme | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.unit.dp | ||
import com.pwhs.quickmem.R | ||
|
||
@Composable | ||
fun ExplanationCard( | ||
modifier: Modifier = Modifier, | ||
explanation: String, | ||
onExplanationChanged: (String) -> Unit, | ||
onShowExplanationClicked: (Boolean) -> Unit | ||
) { | ||
Card( | ||
modifier = modifier | ||
.fillMaxWidth() | ||
.padding(16.dp), | ||
elevation = CardDefaults.elevatedCardElevation( | ||
defaultElevation = 5.dp, | ||
focusedElevation = 8.dp | ||
), | ||
colors = CardDefaults.cardColors( | ||
containerColor = colorScheme.surface | ||
), | ||
) { | ||
Box( | ||
contentAlignment = Alignment.Center | ||
) { | ||
Column( | ||
modifier = Modifier.padding(16.dp) | ||
) { | ||
FlashCardTextField( | ||
value = explanation, | ||
onValueChange = onExplanationChanged, | ||
hint = stringResource(R.string.txt_explanation) | ||
) | ||
} | ||
|
||
IconButton( | ||
onClick = { | ||
onShowExplanationClicked(false) | ||
onExplanationChanged("") | ||
}, | ||
modifier = Modifier.align(Alignment.TopEnd) | ||
) { | ||
Icon( | ||
imageVector = Icons.Filled.Clear, | ||
contentDescription = stringResource(R.string.txt_close), | ||
) | ||
} | ||
} | ||
} | ||
|
||
} |
67 changes: 67 additions & 0 deletions
67
app/src/main/java/com/pwhs/quickmem/presentation/app/flashcard/component/HintCard.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package com.pwhs.quickmem.presentation.app.flashcard.component | ||
|
||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.filled.Clear | ||
import androidx.compose.material3.Card | ||
import androidx.compose.material3.CardDefaults | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.IconButton | ||
import androidx.compose.material3.MaterialTheme.colorScheme | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.unit.dp | ||
import com.pwhs.quickmem.R | ||
|
||
@Composable | ||
fun HintCard( | ||
modifier: Modifier = Modifier, | ||
hint: String, | ||
onHintChanged: (String) -> Unit, | ||
onShowHintClicked: (Boolean) -> Unit | ||
) { | ||
Card( | ||
modifier = modifier | ||
.fillMaxWidth() | ||
.padding(16.dp), | ||
elevation = CardDefaults.elevatedCardElevation( | ||
defaultElevation = 5.dp, | ||
focusedElevation = 8.dp | ||
), | ||
colors = CardDefaults.cardColors( | ||
containerColor = colorScheme.surface | ||
), | ||
) { | ||
Box( | ||
contentAlignment = Alignment.Center | ||
) { | ||
Column( | ||
modifier = Modifier.padding(16.dp) | ||
) { | ||
FlashCardTextField( | ||
value = hint, | ||
onValueChange = onHintChanged, | ||
hint = stringResource(R.string.txt_hint) | ||
) | ||
} | ||
|
||
IconButton( | ||
onClick = { | ||
onShowHintClicked(false) | ||
onHintChanged("") | ||
}, | ||
modifier = Modifier.align(Alignment.TopEnd) | ||
) { | ||
Icon( | ||
imageVector = Icons.Filled.Clear, | ||
contentDescription = stringResource(R.string.txt_close), | ||
) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.