refresh icon not visible when not using one-time password (#9791)

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages 2024-10-31 10:11:42 +08:00 committed by GitHub
parent 697dd87383
commit f86c88b3d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 37 additions and 24 deletions

View File

@ -272,10 +272,21 @@ class _DesktopHomePageState extends State<DesktopHomePage>
}
buildPasswordBoard(BuildContext context) {
final model = gFFI.serverModel;
return ChangeNotifierProvider.value(
value: gFFI.serverModel,
child: Consumer<ServerModel>(
builder: (context, model, child) {
return buildPasswordBoard2(context, model);
},
));
}
buildPasswordBoard2(BuildContext context, ServerModel model) {
RxBool refreshHover = false.obs;
RxBool editHover = false.obs;
final textColor = Theme.of(context).textTheme.titleLarge?.color;
final showOneTime = model.approveMode != 'click' &&
model.verificationMethod != kUsePermanentPassword;
return Container(
margin: EdgeInsets.only(left: 20.0, right: 16, top: 13, bottom: 13),
child: Row(
@ -304,8 +315,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
Expanded(
child: GestureDetector(
onDoubleTap: () {
if (model.verificationMethod !=
kUsePermanentPassword) {
if (showOneTime) {
Clipboard.setData(
ClipboardData(text: model.serverPasswd.text));
showToast(translate("Copied"));
@ -323,6 +333,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
),
),
),
if (showOneTime)
AnimatedRotationWidget(
onPressed: () => bind.mainUpdateTemporaryPassword(),
child: Tooltip(

View File

@ -446,7 +446,6 @@ class ServerInfo extends StatelessWidget {
@override
Widget build(BuildContext context) {
final isPermanent = model.verificationMethod == kUsePermanentPassword;
final serverModel = Provider.of<ServerModel>(context);
const Color colorPositive = Colors.green;
@ -486,6 +485,8 @@ class ServerInfo extends StatelessWidget {
}
}
final showOneTime = serverModel.approveMode != 'click' &&
serverModel.verificationMethod != kUsePermanentPassword;
return PaddingCard(
title: translate('Your Device'),
child: Column(
@ -523,10 +524,10 @@ class ServerInfo extends StatelessWidget {
]),
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
Text(
isPermanent ? '-' : model.serverPasswd.value.text,
!showOneTime ? '-' : model.serverPasswd.value.text,
style: textStyleValue,
),
isPermanent
!showOneTime
? SizedBox.shrink()
: Row(children: [
IconButton(

View File

@ -831,11 +831,12 @@ class PasswordEyeArea : Reactor.Component {
render() {
var method = handler.get_option('verification-method');
var mode= handler.get_option('approve-mode');
var value = mode == 'click' || method == 'use-permanent-password' ? "-" : password_cache[0];
var hide_one_time = mode == 'click' || method == 'use-permanent-password';
var value = hide_one_time ? "-" : password_cache[0];
return
<div .eye-area style="width: *">
<input|text @{this.input} readonly value={value} />
{svg_refresh_password}
{hide_one_time ? "" : svg_refresh_password}
</div>;
}