kopia lustrzana https://github.com/vitorpamplona/amethyst
50 wiersze
1.7 KiB
Kotlin
50 wiersze
1.7 KiB
Kotlin
package com.vitorpamplona.amethyst.buttons
|
|
|
|
import androidx.compose.foundation.layout.PaddingValues
|
|
import androidx.compose.foundation.layout.size
|
|
import androidx.compose.foundation.shape.CircleShape
|
|
import androidx.compose.material.ButtonDefaults
|
|
import androidx.compose.material.Icon
|
|
import androidx.compose.material.MaterialTheme
|
|
import androidx.compose.material.OutlinedButton
|
|
import androidx.compose.material.icons.Icons
|
|
import androidx.compose.material.icons.outlined.Add
|
|
import androidx.compose.runtime.Composable
|
|
import androidx.compose.runtime.getValue
|
|
import androidx.compose.runtime.mutableStateOf
|
|
import androidx.compose.runtime.remember
|
|
import androidx.compose.runtime.setValue
|
|
import androidx.compose.ui.Modifier
|
|
import androidx.compose.ui.graphics.Color
|
|
import androidx.compose.ui.res.stringResource
|
|
import androidx.compose.ui.unit.dp
|
|
import com.vitorpamplona.amethyst.R
|
|
import com.vitorpamplona.amethyst.model.Account
|
|
import com.vitorpamplona.amethyst.ui.actions.NewChannelView
|
|
|
|
@Composable
|
|
fun NewChannelButton(account: Account) {
|
|
var wantsToPost by remember {
|
|
mutableStateOf(false)
|
|
}
|
|
|
|
if (wantsToPost) {
|
|
NewChannelView({ wantsToPost = false }, account = account)
|
|
}
|
|
|
|
OutlinedButton(
|
|
onClick = { wantsToPost = true },
|
|
modifier = Modifier.size(55.dp),
|
|
shape = CircleShape,
|
|
colors = ButtonDefaults.outlinedButtonColors(backgroundColor = MaterialTheme.colors.primary),
|
|
contentPadding = PaddingValues(0.dp)
|
|
) {
|
|
Icon(
|
|
imageVector = Icons.Outlined.Add,
|
|
contentDescription = stringResource(R.string.new_channel),
|
|
modifier = Modifier.size(26.dp),
|
|
tint = Color.White
|
|
)
|
|
}
|
|
}
|