Merge pull request #3513 from grummbeer/fix-shared-dialog-change-id

fix. Mobile. Style of input on "changeID" dialog
This commit is contained in:
RustDesk 2023-03-05 11:14:07 +08:00 committed by GitHub
commit 9031f8cbd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -63,8 +63,9 @@ void changeIdDialog() {
final Iterable violations = rules.where((r) => !r.validate(newId)); final Iterable violations = rules.where((r) => !r.validate(newId));
if (violations.isNotEmpty) { if (violations.isNotEmpty) {
setState(() { setState(() {
msg = msg = isDesktop
'${translate('Prompt')}: ${violations.map((r) => r.name).join(', ')}'; ? '${translate('Prompt')}: ${violations.map((r) => r.name).join(', ')}'
: violations.map((r) => r.name).join(', ');
}); });
return; return;
} }
@ -87,7 +88,9 @@ void changeIdDialog() {
} }
setState(() { setState(() {
isInProgress = false; isInProgress = false;
msg = '${translate('Prompt')}: ${translate(status)}'; msg = isDesktop
? '${translate('Prompt')}: ${translate(status)}'
: translate(status);
}); });
} }
@ -103,7 +106,7 @@ void changeIdDialog() {
TextField( TextField(
decoration: InputDecoration( decoration: InputDecoration(
labelText: translate('Your new ID'), labelText: translate('Your new ID'),
border: const OutlineInputBorder(), border: isDesktop ? const OutlineInputBorder() : null,
errorText: msg.isEmpty ? null : translate(msg), errorText: msg.isEmpty ? null : translate(msg),
suffixText: '${rxId.value.length}/16', suffixText: '${rxId.value.length}/16',
suffixStyle: const TextStyle(fontSize: 12, color: Colors.grey)), suffixStyle: const TextStyle(fontSize: 12, color: Colors.grey)),
@ -123,27 +126,26 @@ void changeIdDialog() {
const SizedBox( const SizedBox(
height: 8.0, height: 8.0,
), ),
Obx(() => Wrap( isDesktop
runSpacing: 8, ? Obx(() => Wrap(
spacing: 4, runSpacing: 8,
children: rules.map((e) { spacing: 4,
var checked = e.validate(rxId.value); children: rules.map((e) {
return Chip( var checked = e.validate(rxId.value);
label: Text( return Chip(
e.name, label: Text(
style: TextStyle( e.name,
color: checked style: TextStyle(
? const Color(0xFF0A9471) color: checked
: Color.fromARGB(255, 198, 86, 157)), ? const Color(0xFF0A9471)
), : Color.fromARGB(255, 198, 86, 157)),
backgroundColor: checked ),
? const Color(0xFFD0F7ED) backgroundColor: checked
: Color.fromARGB(255, 247, 205, 232)); ? const Color(0xFFD0F7ED)
}).toList(), : Color.fromARGB(255, 247, 205, 232));
)), }).toList(),
const SizedBox( )).marginOnly(bottom: 8)
height: 8.0, : SizedBox.shrink(),
),
Offstage( Offstage(
offstage: !isInProgress, child: const LinearProgressIndicator()) offstage: !isInProgress, child: const LinearProgressIndicator())
], ],