mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-18 06:47:02 +05:30
Switch addition over to FAB
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
d2ca717f48
commit
04f2b20503
1 changed files with 13 additions and 4 deletions
|
@ -4,14 +4,17 @@ import android.os.Bundle
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.compose.foundation.Box
|
import androidx.compose.foundation.Box
|
||||||
import androidx.compose.foundation.ContentGravity
|
import androidx.compose.foundation.ContentGravity
|
||||||
|
import androidx.compose.foundation.Icon
|
||||||
import androidx.compose.foundation.Text
|
import androidx.compose.foundation.Text
|
||||||
import androidx.compose.foundation.clickable
|
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.lazy.LazyColumnFor
|
import androidx.compose.foundation.lazy.LazyColumnFor
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material.Card
|
import androidx.compose.material.Card
|
||||||
|
import androidx.compose.material.FloatingActionButton
|
||||||
import androidx.compose.material.TopAppBar
|
import androidx.compose.material.TopAppBar
|
||||||
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.filled.ExposurePlus1
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.mutableStateListOf
|
import androidx.compose.runtime.mutableStateListOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
|
@ -54,9 +57,7 @@ fun TodoApp() {
|
||||||
) {
|
) {
|
||||||
Card(
|
Card(
|
||||||
shape = RoundedCornerShape(8.dp),
|
shape = RoundedCornerShape(8.dp),
|
||||||
modifier = Modifier
|
modifier = Modifier.fillParentMaxWidth(),
|
||||||
.fillParentMaxWidth()
|
|
||||||
.clickable(onClick = { items.add(TodoItem("Item ${items.size + 1}")) }),
|
|
||||||
backgroundColor = Color.Black
|
backgroundColor = Color.Black
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
|
@ -71,5 +72,13 @@ fun TodoApp() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FloatingActionButton(
|
||||||
|
onClick = {
|
||||||
|
items.add(TodoItem("Item ${items.size + 1}"))
|
||||||
|
},
|
||||||
|
elevation = 8.dp,
|
||||||
|
) {
|
||||||
|
Icon(asset = Icons.Filled.ExposurePlus1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue