-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from kaszabimre/core-domain
chore: add core and domain modules
- Loading branch information
Showing
29 changed files
with
333 additions
and
187 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
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
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
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,39 @@ | ||
package widget | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.aspectRatio | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.clip | ||
import coil3.compose.AsyncImage | ||
import eaplayers.composeapp.generated.resources.Res | ||
import eaplayers.composeapp.generated.resources.player_image_desc | ||
import io.imrekaszab.eaplayers.domain.model.Player | ||
import org.jetbrains.compose.resources.stringResource | ||
import theme.AppTheme | ||
|
||
@Composable | ||
fun PlayerImage(player: Player) { | ||
Box( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(vertical = AppTheme.dimens.margin.default) | ||
.aspectRatio(1f) | ||
.clip(AppTheme.shapes.default.roundedDefault) | ||
.background(AppTheme.colorScheme.surface) | ||
) { | ||
AsyncImage( | ||
model = player.shieldUrl, | ||
contentDescription = stringResource( | ||
Res.string.player_image_desc, | ||
player.firstName, | ||
player.lastName | ||
), | ||
modifier = Modifier.fillMaxSize() | ||
) | ||
} | ||
} |
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
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,76 @@ | ||
package widget | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.filled.KeyboardArrowUp | ||
import androidx.compose.material.icons.filled.Menu | ||
import androidx.compose.material.icons.filled.Star | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.clip | ||
import eaplayers.composeapp.generated.resources.Res | ||
import eaplayers.composeapp.generated.resources.height | ||
import eaplayers.composeapp.generated.resources.position | ||
import eaplayers.composeapp.generated.resources.rating | ||
import io.imrekaszab.eaplayers.domain.model.Player | ||
import org.jetbrains.compose.resources.stringResource | ||
import theme.AppTheme | ||
|
||
@Composable | ||
fun PlayerStatsRow(player: Player) { | ||
Row( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(horizontal = AppTheme.dimens.margin.default), | ||
horizontalArrangement = Arrangement.SpaceBetween | ||
) { | ||
PlayerStatItem( | ||
icon = Icons.Default.Star, | ||
stat = player.overallRating.toString(), | ||
label = stringResource(Res.string.rating) | ||
) | ||
PlayerStatItem( | ||
icon = Icons.Default.Menu, | ||
stat = player.position.shortLabel, | ||
label = stringResource(Res.string.position) | ||
) | ||
PlayerStatItem( | ||
icon = Icons.Default.KeyboardArrowUp, | ||
stat = "${player.height} cm", | ||
label = stringResource(Res.string.height) | ||
) | ||
} | ||
} | ||
|
||
@Composable | ||
fun PlayerStatRow(statItems: List<PlayerStat>) { | ||
Row( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.clip(AppTheme.shapes.default.roundedDefault) | ||
.background( | ||
color = AppTheme.colors.blue.default, | ||
shape = AppTheme.shapes.default.roundedDefault | ||
) | ||
.padding(AppTheme.dimens.margin.default), | ||
horizontalArrangement = Arrangement.SpaceEvenly | ||
) { | ||
statItems.forEach { statItem -> | ||
PlayerStatItem( | ||
imageUrl = statItem.imageUrl, | ||
stat = statItem.stat, | ||
label = statItem.label | ||
) | ||
} | ||
} | ||
} | ||
|
||
data class PlayerStat( | ||
val imageUrl: String, | ||
val stat: String, | ||
val label: String | ||
) |
Oops, something went wrong.