Fix Spell / Action padding.
This commit is contained in:
		
							parent
							
								
									717436e081
								
							
						
					
					
						commit
						a45ce54ea3
					
				
					 3 changed files with 65 additions and 67 deletions
				
			
		| 
						 | 
				
			
			@ -93,40 +93,18 @@ fun Attack(
 | 
			
		|||
            }
 | 
			
		||||
        }
 | 
			
		||||
        weapon.hit?.let { dice ->
 | 
			
		||||
            Column(
 | 
			
		||||
                modifier = Modifier
 | 
			
		||||
                    .sizeIn(minWidth = 42.dp)
 | 
			
		||||
                    .clickable { weapon.name.let(onHit) },
 | 
			
		||||
                horizontalAlignment = Alignment.CenterHorizontally,
 | 
			
		||||
            ) {
 | 
			
		||||
                Icon(
 | 
			
		||||
                    painter = painterResource(id = dice.icon),
 | 
			
		||||
                    tint = MaterialTheme.colorScheme.primary,
 | 
			
		||||
                    contentDescription = null,
 | 
			
		||||
                )
 | 
			
		||||
                Text(
 | 
			
		||||
                    style = MaterialTheme.typography.labelSmall,
 | 
			
		||||
                    text = dice.label,
 | 
			
		||||
                )
 | 
			
		||||
            }
 | 
			
		||||
            DiceButton(
 | 
			
		||||
                icon = dice.icon,
 | 
			
		||||
                text = dice.label,
 | 
			
		||||
                onClick = { weapon.name.let(onHit) }
 | 
			
		||||
            )
 | 
			
		||||
        }
 | 
			
		||||
        weapon.damage?.let { dice ->
 | 
			
		||||
            Column(
 | 
			
		||||
                modifier = Modifier
 | 
			
		||||
                    .sizeIn(minWidth = 42.dp)
 | 
			
		||||
                    .clickable { weapon.name.let(onDamage) },
 | 
			
		||||
                horizontalAlignment = Alignment.CenterHorizontally,
 | 
			
		||||
            ) {
 | 
			
		||||
                Icon(
 | 
			
		||||
                    painter = painterResource(id = dice.icon),
 | 
			
		||||
                    tint = MaterialTheme.colorScheme.primary,
 | 
			
		||||
                    contentDescription = null,
 | 
			
		||||
                )
 | 
			
		||||
                Text(
 | 
			
		||||
                    style = MaterialTheme.typography.labelSmall,
 | 
			
		||||
                    text = dice.label,
 | 
			
		||||
                )
 | 
			
		||||
            }
 | 
			
		||||
            DiceButton(
 | 
			
		||||
                icon = dice.icon,
 | 
			
		||||
                text = dice.label,
 | 
			
		||||
                onClick = { weapon.name.let(onDamage) }
 | 
			
		||||
            )
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,41 @@
 | 
			
		|||
package com.pixelized.rplexicon.ui.screens.character.composable.actions
 | 
			
		||||
 | 
			
		||||
import androidx.annotation.DrawableRes
 | 
			
		||||
import androidx.compose.foundation.clickable
 | 
			
		||||
import androidx.compose.foundation.layout.Column
 | 
			
		||||
import androidx.compose.foundation.layout.sizeIn
 | 
			
		||||
import androidx.compose.material3.Icon
 | 
			
		||||
import androidx.compose.material3.MaterialTheme
 | 
			
		||||
import androidx.compose.material3.Text
 | 
			
		||||
import androidx.compose.runtime.Composable
 | 
			
		||||
import androidx.compose.ui.Alignment
 | 
			
		||||
import androidx.compose.ui.Modifier
 | 
			
		||||
import androidx.compose.ui.res.painterResource
 | 
			
		||||
import androidx.compose.ui.unit.Dp
 | 
			
		||||
import androidx.compose.ui.unit.dp
 | 
			
		||||
 | 
			
		||||
@Composable
 | 
			
		||||
fun DiceButton(
 | 
			
		||||
    modifier: Modifier = Modifier,
 | 
			
		||||
    minWidth: Dp = 42.dp,
 | 
			
		||||
    @DrawableRes icon: Int,
 | 
			
		||||
    text: String,
 | 
			
		||||
    onClick: () -> Unit,
 | 
			
		||||
) {
 | 
			
		||||
    Column(
 | 
			
		||||
        modifier = modifier
 | 
			
		||||
            .sizeIn(minWidth = minWidth)
 | 
			
		||||
            .clickable(onClick = onClick),
 | 
			
		||||
        horizontalAlignment = Alignment.CenterHorizontally,
 | 
			
		||||
    ) {
 | 
			
		||||
        Icon(
 | 
			
		||||
            painter = painterResource(id = icon),
 | 
			
		||||
            tint = MaterialTheme.colorScheme.primary,
 | 
			
		||||
            contentDescription = null,
 | 
			
		||||
        )
 | 
			
		||||
        Text(
 | 
			
		||||
            style = MaterialTheme.typography.labelSmall,
 | 
			
		||||
            text = text,
 | 
			
		||||
        )
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -66,7 +66,7 @@ fun Spell(
 | 
			
		|||
) {
 | 
			
		||||
    Row(
 | 
			
		||||
        modifier = modifier.clickable { onClick(spell.name) },
 | 
			
		||||
        horizontalArrangement = Arrangement.spacedBy(space = 10.dp),
 | 
			
		||||
        horizontalArrangement = Arrangement.spacedBy(space = 12.dp),
 | 
			
		||||
        verticalAlignment = Alignment.CenterVertically,
 | 
			
		||||
    ) {
 | 
			
		||||
        Icon(
 | 
			
		||||
| 
						 | 
				
			
			@ -136,25 +136,15 @@ fun Spell(
 | 
			
		|||
            )
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        spell.hit?.let {
 | 
			
		||||
            Column(
 | 
			
		||||
                modifier = Modifier
 | 
			
		||||
                    .sizeIn(minWidth = 42.dp)
 | 
			
		||||
                    .clickable { spell.name.let(onHit) },
 | 
			
		||||
                horizontalAlignment = Alignment.CenterHorizontally,
 | 
			
		||||
            ) {
 | 
			
		||||
                Icon(
 | 
			
		||||
                    painter = painterResource(id = it.icon),
 | 
			
		||||
                    tint = MaterialTheme.colorScheme.primary,
 | 
			
		||||
                    contentDescription = null,
 | 
			
		||||
                )
 | 
			
		||||
                Text(
 | 
			
		||||
                    style = MaterialTheme.typography.labelSmall,
 | 
			
		||||
                    text = it.label,
 | 
			
		||||
                )
 | 
			
		||||
            }
 | 
			
		||||
        spell.hit?.let { dice ->
 | 
			
		||||
            DiceButton(
 | 
			
		||||
                modifier = Modifier.padding(end = 4.dp),
 | 
			
		||||
                icon = dice.icon,
 | 
			
		||||
                text = dice.label,
 | 
			
		||||
                onClick = { spell.name.let(onHit) }
 | 
			
		||||
            )
 | 
			
		||||
        }
 | 
			
		||||
        spell.effect?.let {
 | 
			
		||||
        spell.effect?.let { dice ->
 | 
			
		||||
            if (spell.changeWithLevel) {
 | 
			
		||||
                OutlinedButton(
 | 
			
		||||
                    border = BorderStroke(
 | 
			
		||||
| 
						 | 
				
			
			@ -168,22 +158,11 @@ fun Spell(
 | 
			
		|||
                    )
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
                Column(
 | 
			
		||||
                    modifier = Modifier
 | 
			
		||||
                        .sizeIn(minWidth = 42.dp)
 | 
			
		||||
                        .clickable { spell.name.let(onEffect) },
 | 
			
		||||
                    horizontalAlignment = Alignment.CenterHorizontally,
 | 
			
		||||
                ) {
 | 
			
		||||
                    Icon(
 | 
			
		||||
                        painter = painterResource(id = it.icon),
 | 
			
		||||
                        tint = MaterialTheme.colorScheme.primary,
 | 
			
		||||
                        contentDescription = null,
 | 
			
		||||
                    )
 | 
			
		||||
                    Text(
 | 
			
		||||
                        style = MaterialTheme.typography.labelSmall,
 | 
			
		||||
                        text = it.label,
 | 
			
		||||
                    )
 | 
			
		||||
                }
 | 
			
		||||
                DiceButton(
 | 
			
		||||
                    icon = dice.icon,
 | 
			
		||||
                    text = dice.label,
 | 
			
		||||
                    onClick = { spell.name.let(onEffect) }
 | 
			
		||||
                )
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue