feat: add FAB in contributors screen

This commit is contained in:
Ushie 2022-10-10 19:34:48 +03:00
parent 546c46d01b
commit ebe238caaa
No known key found for this signature in database
GPG Key ID: 0EF73F1CA38B2D5F

View File

@ -1,8 +1,6 @@
package app.revanced.manager.ui.screen.subscreens package app.revanced.manager.ui.screen.subscreens
import android.annotation.SuppressLint
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll import androidx.compose.foundation.verticalScroll
@ -11,29 +9,31 @@ import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material3.* import androidx.compose.material3.*
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import app.revanced.manager.R import app.revanced.manager.R
import app.revanced.manager.ui.component.ContributorsCard import app.revanced.manager.ui.component.ContributorsCard
import app.revanced.manager.ui.navigation.AppDestination import app.revanced.manager.ui.navigation.AppDestination
import app.revanced.manager.ui.viewmodel.ContributorsViewModel import app.revanced.manager.ui.viewmodel.ContributorsViewModel
import app.revanced.manager.util.ghOrganization
import app.revanced.manager.util.openUrl
import com.xinto.taxi.BackstackNavigator import com.xinto.taxi.BackstackNavigator
import org.koin.androidx.compose.getViewModel import org.koin.androidx.compose.getViewModel
@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter")
@Composable @Composable
@OptIn(ExperimentalMaterial3Api::class) @OptIn(ExperimentalMaterial3Api::class)
fun ContributorsSubscreen( fun ContributorsSubscreen(
navigator: BackstackNavigator<AppDestination>, navigator: BackstackNavigator<AppDestination>,
vm: ContributorsViewModel = getViewModel() vm: ContributorsViewModel = getViewModel()
) { ) {
val ctx = LocalContext.current.applicationContext
Scaffold( Scaffold(
topBar = { topBar = {
MediumTopAppBar( MediumTopAppBar(
title = { title = {
Text( Text(
text = stringResource(R.string.screen_contributors_title), text = stringResource(R.string.screen_contributors_title)
style = MaterialTheme.typography.headlineLarge
) )
}, },
navigationIcon = { navigationIcon = {
@ -45,12 +45,16 @@ fun ContributorsSubscreen(
} }
} }
) )
},
floatingActionButton = {
FloatingActionButton(onClick = { ctx.openUrl(ghOrganization) }) {
Icon(painterResource(id = R.drawable.ic_github), contentDescription = null)
}
} }
) { ) { paddingValues ->
Column( Column(
Modifier Modifier
.padding(it) .padding(paddingValues)
.height(1400.dp)
.verticalScroll(rememberScrollState()) .verticalScroll(rememberScrollState())
) { ) {
ContributorsCard( ContributorsCard(