Skip to content

Commit 2eb33f0

Browse files
committed
Apply theme colors to TopAppBar and remove LazyListState
This commit updates the `DiffCheckerScreen.kt` to apply theme colors to the `TopAppBar`. Specifically, the `containerColor` is set to `Color.White` and `titleContentColor` to `primary`. Additionally, the `rememberLazyListState` instances (`scrollStateOld` and `scrollStateNew`) have been removed from `CharDiffText.kt` as they were not being used to synchronize scrolling between the two `LazyColumn`s.
1 parent e7a995e commit 2eb33f0

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

app/src/main/java/dev/jahidhasanco/diffly/presentation/component/CharDiffText.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import androidx.compose.foundation.layout.padding
1111
import androidx.compose.foundation.layout.width
1212
import androidx.compose.foundation.lazy.LazyColumn
1313
import androidx.compose.foundation.lazy.items
14-
import androidx.compose.foundation.lazy.rememberLazyListState
1514
import androidx.compose.material3.MaterialTheme
1615
import androidx.compose.material3.Text
1716
import androidx.compose.runtime.Composable
@@ -27,12 +26,8 @@ import dev.jahidhasanco.diffly.presentation.theme.delete
2726

2827
@Composable
2928
fun CharDiffText(diffResult: List<DiffEntry>) {
30-
val scrollStateOld = rememberLazyListState()
31-
val scrollStateNew = rememberLazyListState()
32-
3329
Row(modifier = Modifier.fillMaxSize()) {
3430
LazyColumn(
35-
state = scrollStateOld,
3631
modifier = Modifier
3732
.weight(1f)
3833
.fillMaxHeight()
@@ -79,7 +74,6 @@ fun CharDiffText(diffResult: List<DiffEntry>) {
7974

8075
// New text column
8176
LazyColumn(
82-
state = scrollStateNew,
8377
modifier = Modifier
8478
.weight(1f)
8579
.fillMaxHeight()

app/src/main/java/dev/jahidhasanco/diffly/presentation/screen/DiffCheckerScreen.kt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import androidx.compose.material3.SwitchDefaults
2222
import androidx.compose.material3.Text
2323
import androidx.compose.material3.TextFieldDefaults
2424
import androidx.compose.material3.TopAppBar
25+
import androidx.compose.material3.TopAppBarDefaults
2526
import androidx.compose.runtime.Composable
2627
import androidx.compose.runtime.collectAsState
2728
import androidx.compose.runtime.getValue
@@ -47,11 +48,18 @@ fun DiffCheckerScreen(viewModel: MainViewModel) {
4748

4849
Scaffold(
4950
modifier = Modifier
50-
.fillMaxSize()
51-
.background(background),
51+
.fillMaxSize(),
52+
containerColor = background,
5253
topBar = {
5354
TopAppBar(
54-
title = { Text("Diffly") },
55+
title = {
56+
Text("Diffly")
57+
},
58+
59+
colors = TopAppBarDefaults.topAppBarColors(
60+
containerColor = Color.White,
61+
titleContentColor = primary
62+
),
5563
)
5664
}) { innerPadding ->
5765
Column(

0 commit comments

Comments
 (0)