@@ -49,15 +49,20 @@ fun PasswordEntryScreen(
49
49
)
50
50
},
51
51
) { paddingValues ->
52
- val clipboard = LocalClipboardManager .current
53
52
Box (modifier = modifier.fillMaxSize().padding(paddingValues)) {
54
53
Column (modifier = Modifier .padding(8 .dp)) {
55
54
Text (
56
55
text = entryName,
57
56
style = MaterialTheme .typography.headlineSmall,
57
+ modifier = Modifier .padding(bottom = 8 .dp),
58
58
)
59
59
if (entry.password != null ) {
60
- PasswordField (value = entry.password!! , label = " Password" , initialVisibility = false )
60
+ PasswordField (
61
+ value = entry.password!! ,
62
+ label = " Password" ,
63
+ initialVisibility = false ,
64
+ modifier = Modifier .padding(bottom = 8 .dp),
65
+ )
61
66
}
62
67
if (entry.hasTotp()) {
63
68
val totp by entry.totp.collectAsState(runBlocking { entry.totp.first() })
@@ -66,7 +71,8 @@ fun PasswordEntryScreen(
66
71
onValueChange = {},
67
72
readOnly = true ,
68
73
label = { Text (" OTP (expires in ${totp.remainingTime.inWholeSeconds} s)" ) },
69
- trailingIcon = { CopyButton { clipboard.setText(AnnotatedString (totp.value)) } }
74
+ trailingIcon = { CopyButton ({ totp.value }) },
75
+ modifier = Modifier .padding(bottom = 8 .dp),
70
76
)
71
77
}
72
78
if (entry.username != null ) {
@@ -75,7 +81,8 @@ fun PasswordEntryScreen(
75
81
onValueChange = {},
76
82
readOnly = true ,
77
83
label = { Text (" Username" ) },
78
- trailingIcon = { CopyButton { clipboard.setText(AnnotatedString (entry.username!! )) } },
84
+ trailingIcon = { CopyButton ({ entry.username!! }) },
85
+ modifier = Modifier .padding(bottom = 8 .dp),
79
86
)
80
87
}
81
88
}
@@ -84,9 +91,14 @@ fun PasswordEntryScreen(
84
91
}
85
92
86
93
@Composable
87
- private fun CopyButton (onClick : () -> Unit ) {
94
+ private fun CopyButton (
95
+ textToCopy : () -> String ,
96
+ modifier : Modifier = Modifier ,
97
+ ) {
98
+ val clipboard = LocalClipboardManager .current
88
99
IconButton (
89
- onClick = onClick,
100
+ onClick = { clipboard.setText(AnnotatedString (textToCopy())) },
101
+ modifier = modifier,
90
102
) {
91
103
Icon (
92
104
painter = painterResource(R .drawable.ic_content_copy),
0 commit comments