Mobile. Share Screen. Remove readonly textinput for ID/password
This commit is contained in:
parent
1c634aa7d7
commit
4d95ada300
@ -1,6 +1,7 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_hbb/mobile/widgets/dialog.dart';
|
import 'package:flutter_hbb/mobile/widgets/dialog.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
@ -205,7 +206,7 @@ class ServerInfo extends StatelessWidget {
|
|||||||
Widget ConnectionStateNotification() {
|
Widget ConnectionStateNotification() {
|
||||||
const Color colorPositive = Colors.greenAccent;
|
const Color colorPositive = Colors.greenAccent;
|
||||||
const Color colorNegative = Colors.redAccent;
|
const Color colorNegative = Colors.redAccent;
|
||||||
const double paddingRight = 15;
|
const double paddingRight = 12;
|
||||||
|
|
||||||
if (serverModel.connectStatus == -1) {
|
if (serverModel.connectStatus == -1) {
|
||||||
return Row(children: [
|
return Row(children: [
|
||||||
@ -229,40 +230,78 @@ class ServerInfo extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return PaddingCard(
|
return PaddingCard(
|
||||||
|
title: translate('Your Device'),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
// mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
|
||||||
TextFormField(
|
// ID
|
||||||
readOnly: true,
|
children: [
|
||||||
style: const TextStyle(fontSize: 25.0, fontWeight: FontWeight.bold),
|
Row(children: [
|
||||||
controller: model.serverId,
|
const Icon(Icons.perm_identity, color: Colors.grey, size: 24)
|
||||||
decoration: InputDecoration(
|
.marginOnly(right: 12),
|
||||||
icon: const Icon(Icons.perm_identity),
|
Text(
|
||||||
labelText: translate("ID"),
|
translate('ID'),
|
||||||
labelStyle: const TextStyle(fontWeight: FontWeight.bold),
|
style: const TextStyle(
|
||||||
),
|
fontSize: 16.0,
|
||||||
onSaved: (String? value) {},
|
fontWeight: FontWeight.bold,
|
||||||
),
|
color: Colors.grey),
|
||||||
TextFormField(
|
)
|
||||||
readOnly: true,
|
]),
|
||||||
style: const TextStyle(fontSize: 25.0, fontWeight: FontWeight.bold),
|
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||||
controller: isPermanent ? emptyController : model.serverPasswd,
|
Text(
|
||||||
decoration: InputDecoration(
|
model.serverId.value.text,
|
||||||
icon: const Icon(Icons.lock),
|
style: const TextStyle(
|
||||||
labelText: translate("Password"),
|
fontSize: 25.0, fontWeight: FontWeight.bold),
|
||||||
labelStyle: const TextStyle(
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
),
|
||||||
suffix: isPermanent
|
IconButton(
|
||||||
? null
|
visualDensity: VisualDensity.compact,
|
||||||
: IconButton(
|
icon: Icon(Icons.copy_outlined),
|
||||||
icon: const Icon(Icons.refresh),
|
onPressed: () {
|
||||||
onPressed: () => bind.mainUpdateTemporaryPassword())),
|
Clipboard.setData(
|
||||||
onSaved: (String? value) {},
|
ClipboardData(text: model.serverId.value.text.trim()));
|
||||||
),
|
showToast(translate('ID copied'));
|
||||||
ConnectionStateNotification().marginOnly(top: 20)
|
})
|
||||||
],
|
]).marginOnly(left: 35, bottom: 10),
|
||||||
));
|
|
||||||
|
// Password
|
||||||
|
Row(children: [
|
||||||
|
const Icon(Icons.lock_outline, color: Colors.grey, size: 24)
|
||||||
|
.marginOnly(right: 12),
|
||||||
|
Text(
|
||||||
|
translate('One-time Password'),
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Colors.grey),
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||||
|
Text(
|
||||||
|
isPermanent ? '-' : model.serverPasswd.value.text,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 25.0, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
isPermanent
|
||||||
|
? SizedBox.shrink()
|
||||||
|
: Row(children: [
|
||||||
|
IconButton(
|
||||||
|
visualDensity: VisualDensity.compact,
|
||||||
|
icon: const Icon(Icons.refresh),
|
||||||
|
onPressed: () => bind.mainUpdateTemporaryPassword()),
|
||||||
|
IconButton(
|
||||||
|
visualDensity: VisualDensity.compact,
|
||||||
|
icon: Icon(Icons.copy_outlined),
|
||||||
|
onPressed: () {
|
||||||
|
Clipboard.setData(ClipboardData(
|
||||||
|
text: model.serverPasswd.value.text.trim()));
|
||||||
|
showToast(translate('Password copied'));
|
||||||
|
})
|
||||||
|
])
|
||||||
|
]).marginOnly(left: 35, bottom: 10),
|
||||||
|
|
||||||
|
ConnectionStateNotification()
|
||||||
|
],
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user