Skip to content

Commit

Permalink
feat: thêm custom thư viện cắt ảnh (#106)
Browse files Browse the repository at this point in the history
- 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
nqmgaming authored Dec 19, 2024
1 parent fc8172d commit 7c0ccfd
Show file tree
Hide file tree
Showing 46 changed files with 2,697 additions and 406 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ android {
dependencies {
implementation(libs.purchases)
implementation(libs.purchases.ui)
implementation(libs.easycrop)
implementation(libs.accompanist.permissions)
implementation(platform(libs.firebase.bom))
implementation(libs.firebase.analytics)
Expand All @@ -103,6 +102,7 @@ dependencies {
implementation(libs.play.services.ads)

implementation(projects.composeCardstack)
implementation(projects.easycrop)
implementation(libs.lottie.compose)

// Compose
Expand Down
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),
)
}
}
}

}
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),
)
}
}
}
}
Loading

0 comments on commit 7c0ccfd

Please sign in to comment.