1. mobile ab login.
2. typos 3. del rename dialog body padding
This commit is contained in:
parent
00077676f4
commit
51b02353c9
@ -7,6 +7,7 @@ import 'package:provider/provider.dart';
|
||||
|
||||
import '../../common.dart';
|
||||
import '../../desktop/pages/desktop_home_page.dart';
|
||||
import '../../mobile/pages/settings_page.dart';
|
||||
import '../../models/platform_model.dart';
|
||||
|
||||
class AddressBook extends StatefulWidget {
|
||||
@ -37,11 +38,16 @@ class _AddressBookState extends State<AddressBook> {
|
||||
});
|
||||
|
||||
handleLogin() {
|
||||
loginDialog().then((success) {
|
||||
if (success) {
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
// TODO refactor login dialog for desktop and mobile
|
||||
if (isDesktop) {
|
||||
loginDialog().then((success) {
|
||||
if (success) {
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
showLogin(gFFI.dialogManager);
|
||||
}
|
||||
}
|
||||
|
||||
Future<Widget> buildAddressBook(BuildContext context) async {
|
||||
|
@ -590,8 +590,6 @@ abstract class BasePeerCard extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
|
||||
child: Form(
|
||||
child: TextFormField(
|
||||
controller: controller,
|
||||
|
@ -331,7 +331,7 @@ Future<bool> loginDialog() async {
|
||||
var userNameMsg = "";
|
||||
String pass = "";
|
||||
var passMsg = "";
|
||||
var userContontroller = TextEditingController(text: userName);
|
||||
var userController = TextEditingController(text: userName);
|
||||
var pwdController = TextEditingController(text: pass);
|
||||
|
||||
var isInProgress = false;
|
||||
@ -349,7 +349,7 @@ Future<bool> loginDialog() async {
|
||||
});
|
||||
}
|
||||
|
||||
userName = userContontroller.text;
|
||||
userName = userController.text;
|
||||
pass = pwdController.text;
|
||||
if (userName.isEmpty) {
|
||||
userNameMsg = translate("Username missed");
|
||||
@ -385,6 +385,7 @@ Future<bool> loginDialog() async {
|
||||
close();
|
||||
}
|
||||
|
||||
// 登录dialog
|
||||
return CustomAlertDialog(
|
||||
title: Text(translate("Login")),
|
||||
content: ConstrainedBox(
|
||||
@ -411,7 +412,7 @@ Future<bool> loginDialog() async {
|
||||
decoration: InputDecoration(
|
||||
border: const OutlineInputBorder(),
|
||||
errorText: userNameMsg.isNotEmpty ? userNameMsg : null),
|
||||
controller: userContontroller,
|
||||
controller: userController,
|
||||
focusNode: FocusNode()..requestFocus(),
|
||||
),
|
||||
),
|
||||
|
@ -48,7 +48,7 @@ class _DesktopSettingPageState extends State<DesktopSettingPage>
|
||||
_TabInfo('Security', Icons.enhanced_encryption_outlined,
|
||||
Icons.enhanced_encryption),
|
||||
_TabInfo('Network', Icons.link_outlined, Icons.link),
|
||||
_TabInfo('Acount', Icons.person_outline, Icons.person),
|
||||
_TabInfo('Account', Icons.person_outline, Icons.person),
|
||||
_TabInfo('About', Icons.info_outline, Icons.info)
|
||||
];
|
||||
|
||||
@ -92,7 +92,7 @@ class _DesktopSettingPageState extends State<DesktopSettingPage>
|
||||
_General(),
|
||||
_Safety(),
|
||||
_Network(),
|
||||
_Acount(),
|
||||
_Account(),
|
||||
_About(),
|
||||
],
|
||||
)),
|
||||
@ -641,14 +641,14 @@ class _NetworkState extends State<_Network> with AutomaticKeepAliveClientMixin {
|
||||
}
|
||||
}
|
||||
|
||||
class _Acount extends StatefulWidget {
|
||||
const _Acount({Key? key}) : super(key: key);
|
||||
class _Account extends StatefulWidget {
|
||||
const _Account({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<_Acount> createState() => _AcountState();
|
||||
State<_Account> createState() => _AccountState();
|
||||
}
|
||||
|
||||
class _AcountState extends State<_Acount> {
|
||||
class _AccountState extends State<_Account> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final scrollController = ScrollController();
|
||||
@ -658,12 +658,12 @@ class _AcountState extends State<_Acount> {
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
controller: scrollController,
|
||||
children: [
|
||||
_Card(title: 'Acount', children: [login()]),
|
||||
_Card(title: 'Account', children: [accountAction()]),
|
||||
],
|
||||
).marginOnly(bottom: _kListViewBottomMargin));
|
||||
}
|
||||
|
||||
Widget login() {
|
||||
Widget accountAction() {
|
||||
return _futureBuilder(future: () async {
|
||||
return await gFFI.userModel.getUserName();
|
||||
}(), hasData: (data) {
|
||||
@ -671,12 +671,14 @@ class _AcountState extends State<_Acount> {
|
||||
return _Button(
|
||||
username.isEmpty ? 'Login' : 'Logout',
|
||||
() => {
|
||||
loginDialog().then((success) {
|
||||
if (success) {
|
||||
// refresh frame
|
||||
setState(() {});
|
||||
}
|
||||
})
|
||||
username.isEmpty
|
||||
? loginDialog().then((success) {
|
||||
if (success) {
|
||||
// refresh frame
|
||||
setState(() {});
|
||||
}
|
||||
})
|
||||
: gFFI.userModel.logOut()
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -451,7 +451,7 @@ void showLogin(OverlayDialogManager dialogManager) {
|
||||
),
|
||||
controller: nameController,
|
||||
),
|
||||
PasswordWidget(controller: passwordController),
|
||||
PasswordWidget(controller: passwordController, autoFocus: false),
|
||||
]),
|
||||
actions: (loading
|
||||
? <Widget>[CircularProgressIndicator()]
|
||||
|
@ -6,8 +6,7 @@ import '../../models/model.dart';
|
||||
import '../../models/platform_model.dart';
|
||||
|
||||
void clientClose(OverlayDialogManager dialogManager) {
|
||||
msgBox('', 'Close', 'Are you sure to close the connection?',
|
||||
dialogManager);
|
||||
msgBox('', 'Close', 'Are you sure to close the connection?', dialogManager);
|
||||
}
|
||||
|
||||
void showSuccess() {
|
||||
@ -131,7 +130,7 @@ void setTemporaryPasswordLengthDialog(
|
||||
if (index < 0) index = 0;
|
||||
length = lengths[index];
|
||||
dialogManager.show((setState, close) {
|
||||
final setLength = (newValue) {
|
||||
setLength(newValue) {
|
||||
final oldValue = length;
|
||||
if (oldValue == newValue) return;
|
||||
setState(() {
|
||||
@ -143,7 +142,8 @@ void setTemporaryPasswordLengthDialog(
|
||||
close();
|
||||
showSuccess();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
return CustomAlertDialog(
|
||||
title: Text(translate("Set temporary password length")),
|
||||
content: Column(
|
||||
@ -230,12 +230,14 @@ void wrongPasswordDialog(String id, OverlayDialogManager dialogManager) {
|
||||
}
|
||||
|
||||
class PasswordWidget extends StatefulWidget {
|
||||
PasswordWidget({Key? key, required this.controller}) : super(key: key);
|
||||
PasswordWidget({Key? key, required this.controller, this.autoFocus = true})
|
||||
: super(key: key);
|
||||
|
||||
final TextEditingController controller;
|
||||
final bool autoFocus;
|
||||
|
||||
@override
|
||||
_PasswordWidgetState createState() => _PasswordWidgetState();
|
||||
State<PasswordWidget> createState() => _PasswordWidgetState();
|
||||
}
|
||||
|
||||
class _PasswordWidgetState extends State<PasswordWidget> {
|
||||
@ -245,7 +247,9 @@ class _PasswordWidgetState extends State<PasswordWidget> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
Timer(Duration(milliseconds: 50), () => _focusNode.requestFocus());
|
||||
if (widget.autoFocus) {
|
||||
Timer(Duration(milliseconds: 50), () => _focusNode.requestFocus());
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -324,7 +324,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scale adaptive", "适应窗口"),
|
||||
("General", "常规"),
|
||||
("Security", "安全"),
|
||||
("Acount", "账户"),
|
||||
("Account", "账户"),
|
||||
("Theme", "主题"),
|
||||
("Dark Theme", "暗黑主题"),
|
||||
("Enable hardware codec", "使用硬件编解码"),
|
||||
|
@ -324,7 +324,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scale adaptive", "Měřítko adaptivní"),
|
||||
("General", ""),
|
||||
("Security", ""),
|
||||
("Acount", ""),
|
||||
("Account", ""),
|
||||
("Theme", ""),
|
||||
("Dark Theme", ""),
|
||||
("Enable hardware codec", ""),
|
||||
|
@ -324,7 +324,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scale adaptive", "Skala adaptiv"),
|
||||
("General", ""),
|
||||
("Security", ""),
|
||||
("Acount", ""),
|
||||
("Account", ""),
|
||||
("Theme", ""),
|
||||
("Dark Theme", ""),
|
||||
("Enable hardware codec", ""),
|
||||
|
@ -324,7 +324,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scale adaptive", "Adaptiv skalieren"),
|
||||
("General", ""),
|
||||
("Security", ""),
|
||||
("Acount", ""),
|
||||
("Account", ""),
|
||||
("Theme", ""),
|
||||
("Dark Theme", ""),
|
||||
("Enable hardware codec", ""),
|
||||
|
@ -324,7 +324,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scale adaptive", "Skalo adapta"),
|
||||
("General", ""),
|
||||
("Security", ""),
|
||||
("Acount", ""),
|
||||
("Account", ""),
|
||||
("Theme", ""),
|
||||
("Dark Theme", ""),
|
||||
("Enable hardware codec", ""),
|
||||
|
@ -337,7 +337,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scale adaptive", "Adaptable a escala"),
|
||||
("General", ""),
|
||||
("Security", ""),
|
||||
("Acount", ""),
|
||||
("Account", ""),
|
||||
("Theme", ""),
|
||||
("Dark Theme", ""),
|
||||
("Enable hardware codec", ""),
|
||||
|
@ -324,7 +324,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scale adaptive", "Échelle adaptative"),
|
||||
("General", ""),
|
||||
("Security", ""),
|
||||
("Acount", ""),
|
||||
("Account", ""),
|
||||
("Theme", ""),
|
||||
("Dark Theme", ""),
|
||||
("Enable hardware codec", ""),
|
||||
|
@ -324,7 +324,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scale adaptive", "Skála adaptív"),
|
||||
("General", ""),
|
||||
("Security", ""),
|
||||
("Acount", ""),
|
||||
("Account", ""),
|
||||
("Theme", ""),
|
||||
("Dark Theme", ""),
|
||||
("Enable hardware codec", ""),
|
||||
|
@ -337,7 +337,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scale adaptive", "Skala adaptif"),
|
||||
("General", ""),
|
||||
("Security", ""),
|
||||
("Acount", ""),
|
||||
("Account", ""),
|
||||
("Theme", ""),
|
||||
("Dark Theme", ""),
|
||||
("Enable hardware codec", ""),
|
||||
|
@ -323,7 +323,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Translate mode", ""),
|
||||
("General", ""),
|
||||
("Security", ""),
|
||||
("Acount", ""),
|
||||
("Account", ""),
|
||||
("Theme", ""),
|
||||
("Dark Theme", ""),
|
||||
("Enable hardware codec", ""),
|
||||
|
@ -321,7 +321,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scale adaptive", "フィットウィンドウ"),
|
||||
("General", ""),
|
||||
("Security", ""),
|
||||
("Acount", ""),
|
||||
("Account", ""),
|
||||
("Theme", ""),
|
||||
("Dark Theme", ""),
|
||||
("Enable hardware codec", ""),
|
||||
|
@ -318,7 +318,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scale adaptive", "맞는 창"),
|
||||
("General", ""),
|
||||
("Security", ""),
|
||||
("Acount", ""),
|
||||
("Account", ""),
|
||||
("Theme", ""),
|
||||
("Dark Theme", ""),
|
||||
("Enable hardware codec", ""),
|
||||
|
@ -322,7 +322,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scale adaptive", "Skala adaptacyjna"),
|
||||
("General", ""),
|
||||
("Security", ""),
|
||||
("Acount", ""),
|
||||
("Account", ""),
|
||||
("Theme", ""),
|
||||
("Dark Theme", ""),
|
||||
("Enable hardware codec", ""),
|
||||
|
@ -318,7 +318,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scale adaptive", "Escala adaptável"),
|
||||
("General", ""),
|
||||
("Security", ""),
|
||||
("Acount", ""),
|
||||
("Account", ""),
|
||||
("Theme", ""),
|
||||
("Dark Theme", ""),
|
||||
("Enable hardware codec", ""),
|
||||
|
@ -324,7 +324,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scale adaptive", ""),
|
||||
("General", ""),
|
||||
("Security", ""),
|
||||
("Acount", ""),
|
||||
("Account", ""),
|
||||
("Theme", ""),
|
||||
("Dark Theme", ""),
|
||||
("Enable hardware codec", ""),
|
||||
|
@ -324,7 +324,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scale adaptive", "Масштаб адаптивный"),
|
||||
("General", ""),
|
||||
("Security", ""),
|
||||
("Acount", ""),
|
||||
("Account", ""),
|
||||
("Theme", ""),
|
||||
("Dark Theme", ""),
|
||||
("Enable hardware codec", ""),
|
||||
|
@ -324,7 +324,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scale adaptive", "Prispôsobivá mierka"),
|
||||
("General", ""),
|
||||
("Security", ""),
|
||||
("Acount", ""),
|
||||
("Account", ""),
|
||||
("Theme", ""),
|
||||
("Dark Theme", ""),
|
||||
("Enable hardware codec", ""),
|
||||
|
@ -324,7 +324,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scale adaptive", ""),
|
||||
("General", ""),
|
||||
("Security", ""),
|
||||
("Acount", ""),
|
||||
("Account", ""),
|
||||
("Theme", ""),
|
||||
("Dark Theme", ""),
|
||||
("Enable hardware codec", ""),
|
||||
|
@ -337,7 +337,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scale adaptive", "Ölçek uyarlanabilir"),
|
||||
("General", ""),
|
||||
("Security", ""),
|
||||
("Acount", ""),
|
||||
("Account", ""),
|
||||
("Theme", ""),
|
||||
("Dark Theme", ""),
|
||||
("Enable hardware codec", ""),
|
||||
|
@ -324,7 +324,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scale adaptive", "適應窗口"),
|
||||
("General", "常規"),
|
||||
("Security", "安全"),
|
||||
("Acount", "賬戶"),
|
||||
("Account", "賬戶"),
|
||||
("Theme", "主題"),
|
||||
("Dark Theme", "暗黑主題"),
|
||||
("Enable hardware codec", "使用硬件編解碼"),
|
||||
|
@ -324,7 +324,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Scale adaptive", "Quy mô thích ứng"),
|
||||
("General", ""),
|
||||
("Security", ""),
|
||||
("Acount", ""),
|
||||
("Account", ""),
|
||||
("Theme", ""),
|
||||
("Dark Theme", ""),
|
||||
("Enable hardware codec", ""),
|
||||
|
Loading…
Reference in New Issue
Block a user