Skip to content

Commit

Permalink
Merge pull request #132 from MetaMask/feat/add-chainId-account-info-e…
Browse files Browse the repository at this point in the history
…xample-dapp

feat: Add an option label prefix for the example dapp to make testing easier
  • Loading branch information
christopherferreira9 authored Jul 24, 2024
2 parents aad8a58 + 8787a4d commit 3cd2181
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/src/main/java/com/metamask/dapp/DappActionsScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,19 @@ fun DappActionsScreen(
Heading("Dapp Actions")

DappLabel(
heading = "Account:",
text = ethereumState.selectedAddress,
color = Color.Unspecified,
modifier = Modifier.padding(bottom = 36.dp)
)

DappLabel(
heading = "ChainId:",
text = ethereumState.chainId,
color = Color.Unspecified,
modifier = Modifier.padding(bottom = 36.dp)
)

Spacer(modifier = Modifier.weight(1f))

// Sign message button
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/java/com/metamask/dapp/DappLabel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,20 @@ import androidx.compose.ui.unit.sp

@Composable
fun DappLabel(
heading: String = "",
text: String,
color: Color = Color.White,
fontSize: TextUnit = 14.sp,
modifier: Modifier = Modifier.padding(bottom = 12.dp)
) {
if (heading.isNotEmpty()) {
Text(
text = heading,
color = color,
fontSize = 18.sp,
modifier = Modifier.padding(bottom = 5.dp)
)
}
Text(
text = text,
color = color,
Expand Down

0 comments on commit 3cd2181

Please sign in to comment.