Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redesign request screen UI #1795

Closed
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import androidx.compose.material3.OutlinedIconButton
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
Expand All @@ -28,17 +29,26 @@ fun IconBox(
icon: ImageVector,
onClick: () -> Unit,
modifier: Modifier = Modifier,
tint: Color? = null,
) {
OutlinedIconButton(
onClick = onClick,
modifier = modifier,
shape = RoundedCornerShape(12.dp),
border = BorderStroke(2.dp, MaterialTheme.colorScheme.onSurface.copy(alpha = 0.1f)),
) {
Icon(
imageVector = icon,
contentDescription = icon.name,
)
if (tint != null) {
Icon(
imageVector = icon,
contentDescription = icon.name,
tint = tint,
)
} else {
Icon(
imageVector = icon,
contentDescription = icon.name,
)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ fun MifosScaffold(
backPress: () -> Unit,
modifier: Modifier = Modifier,
topBarTitle: Int? = null,
titleColor: Color? = MaterialTheme.colorScheme.onSurface,
iconTint: Color? = null,
floatingActionButtonContent: FloatingActionButtonContent? = null,
snackbarHost: @Composable () -> Unit = {},
scaffoldContent: @Composable (PaddingValues) -> Unit = {},
Expand All @@ -35,6 +37,8 @@ fun MifosScaffold(
topBarTitle = topBarTitle,
backPress = backPress,
actions = actions,
titleColor = titleColor,
iconTint = iconTint,
)
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,24 @@ fun MifosTopBar(
backPress: () -> Unit,
modifier: Modifier = Modifier,
actions: @Composable RowScope.() -> Unit = {},
titleColor: Color? = null,
iconTint: Color? = null,
) {
CenterAlignedTopAppBar(
title = {
Text(
text = stringResource(id = topBarTitle),
style = MaterialTheme.typography.titleMedium,
)
if (titleColor != null) {
Text(
text = stringResource(id = topBarTitle),
style = MaterialTheme.typography.titleMedium,
color = titleColor,
)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing logic for titleColor == null

do

  Text(
                    text = stringResource(id = topBarTitle),
                    style = MaterialTheme.typography.titleMedium,
                    color = titleColor ?: ColorHere,
                )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From mifos scaffold I am passing default color so there is chance of getting null value

},
navigationIcon = {
IconBox(
icon = MifosIcons.ArrowBack2,
onClick = backPress,
tint = iconTint,
)
},
colors = TopAppBarDefaults.centerAlignedTopAppBarColors(
Expand Down
Loading
Loading