hidden login screen password

This commit is contained in:
niuhuan 2021-12-15 12:22:40 +08:00
parent bb24045709
commit f91601661d
6 changed files with 66 additions and 79 deletions

View File

@ -147,19 +147,14 @@ Future<T?> chooseMapDialog<T>(
var _controller = TextEditingController.fromValue(TextEditingValue(text: ''));
Future<String?> displayTextInputDialog(
BuildContext context,
String title,
String hint,
String src,
String desc,
) {
Future<String?> displayTextInputDialog(BuildContext context,
{String? title, String src = "", String? hint, String? desc}) {
_controller.text = src;
return showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text(title),
title: title == null ? null : Text(title),
content: SingleChildScrollView(
child: ListBody(
children: [
@ -167,21 +162,23 @@ Future<String?> displayTextInputDialog(
controller: _controller,
decoration: InputDecoration(hintText: hint),
),
desc.isEmpty
? Container()
: Container(
padding: EdgeInsets.only(top: 20, bottom: 10),
child: Text(
desc,
style: TextStyle(
fontSize: 12,
color: Theme.of(context)
.textTheme
.bodyText1
?.color
?.withOpacity(.5)),
),
),
...(desc == null
? []
: [
Container(
padding: EdgeInsets.only(top: 20, bottom: 10),
child: Text(
desc,
style: TextStyle(
fontSize: 12,
color: Theme.of(context)
.textTheme
.bodyText1
?.color
?.withOpacity(.5)),
),
)
]),
],
),
),

View File

@ -51,10 +51,10 @@ Future<String> currentChooserRoot() async {
Future<dynamic> _inputChooserRoot(BuildContext context) async {
String? input = await displayTextInputDialog(
context,
'文件夹选择器根路径',
'请输入文件夹选择器根路径',
_chooserRoot,
"导出时选择目录的默认路径, 同时也是根路径, 不能正常导出时也可以尝试设置此选项。",
src: _chooserRoot,
title: '文件夹选择器根路径',
hint: '请输入文件夹选择器根路径',
desc: "导出时选择目录的默认路径, 同时也是根路径, 不能正常导出时也可以尝试设置此选项。",
);
if (input != null) {
await method.saveProperty(_propertyName, input);

View File

@ -18,10 +18,10 @@ String currentProxyName() {
Future<dynamic> inputProxy(BuildContext context) async {
String? input = await displayTextInputDialog(
context,
'代理服务器',
'请输入代理服务器',
_currentProxy,
" ( 例如 socks5://127.0.0.1:1080/ ) ",
src: _currentProxy,
title: '代理服务器',
hint: '请输入代理服务器',
desc: " ( 例如 socks5://127.0.0.1:1080/ ) ",
);
if (input != null) {
await method.setProxy(input);

View File

@ -28,8 +28,8 @@ ThemeData _fontThemeData(bool dark) {
Future<void> inputFont(BuildContext context) async {
var font = await displayTextInputDialog(
context, "字体", "请输入字体", "$_fontFamily",
"请输入字体的名称, 例如宋体/黑体, 如果您保存后没有发生变化, 说明字体无法使用或名称错误, 可以去参考C:\\Windows\\Fonts寻找您的字体。",
context, src: "$_fontFamily", title: "字体", hint: "请输入字体",
desc: "请输入字体的名称, 例如宋体/黑体, 如果您保存后没有发生变化, 说明字体无法使用或名称错误, 可以去参考C:\\Windows\\Fonts寻找您的字体。",
);
if (font != null) {
await method.saveProperty(_fontFamilyProperty, font);
@ -174,7 +174,8 @@ class _DustyBlueTheme extends _ThemePackage {
@override
ThemeData themeData(ThemeData rawData) =>
rawData.copyWith(
scaffoldBackgroundColor: Color.alphaBlend(Color(0x11999999), Color(0xff20253b)),
scaffoldBackgroundColor: Color.alphaBlend(
Color(0x11999999), Color(0xff20253b)),
cardColor: Color.alphaBlend(Color(0x11AAAAAA), Color(0xff20253b)),
brightness: Brightness.light,
colorScheme: ColorScheme.light(

View File

@ -81,10 +81,9 @@ class _AccountScreenState extends State<AccountScreen> {
onTap: () async {
String? input = await displayTextInputDialog(
context,
'账号',
'请输入账号',
_username,
"",
src: _username,
title: '账号',
hint: '请输入账号',
);
if (input != null) {
await method.setUsername(input);
@ -96,14 +95,13 @@ class _AccountScreenState extends State<AccountScreen> {
),
ListTile(
title: Text("密码"),
subtitle: Text(_password == "" ? "未设置" : _password),
subtitle: Text(_password == "" ? "未设置" : "******"),
onTap: () async {
String? input = await displayTextInputDialog(
context,
'密码',
'请输入密码',
_password,
"",
src: _password,
title: '密码',
hint: '请输入密码',
);
if (input != null) {
await method.setPassword(input);

View File

@ -127,10 +127,9 @@ class _RegisterScreenState extends State<RegisterScreen> {
onTap: () async {
String? input = await displayTextInputDialog(
context,
'账号',
'请输入账号',
_email,
"",
src: _email,
title: '账号',
hint: '请输入账号',
);
if (input != null) {
setState(() {
@ -145,10 +144,9 @@ class _RegisterScreenState extends State<RegisterScreen> {
onTap: () async {
String? input = await displayTextInputDialog(
context,
'密码',
'请输入密码',
_password,
"",
src: _password,
title: '密码',
hint: '请输入密码',
);
if (input != null) {
setState(() {
@ -163,10 +161,9 @@ class _RegisterScreenState extends State<RegisterScreen> {
onTap: () async {
String? input = await displayTextInputDialog(
context,
'昵称',
'请输入昵称',
_name,
"",
src: _name,
title: '昵称',
hint: '请输入昵称',
);
if (input != null) {
setState(() {
@ -237,10 +234,9 @@ class _RegisterScreenState extends State<RegisterScreen> {
onTap: () async {
String? input = await displayTextInputDialog(
context,
'问题1',
'请输入问题1',
_question1,
"",
src: _question1,
title: '问题1',
hint: '请输入问题1',
);
if (input != null) {
setState(() {
@ -255,10 +251,9 @@ class _RegisterScreenState extends State<RegisterScreen> {
onTap: () async {
String? input = await displayTextInputDialog(
context,
'回答1',
'请输入回答1',
_answer1,
"",
src: _answer1,
title: '回答1',
hint: '请输入回答1',
);
if (input != null) {
setState(() {
@ -273,10 +268,9 @@ class _RegisterScreenState extends State<RegisterScreen> {
onTap: () async {
String? input = await displayTextInputDialog(
context,
'问题2',
'请输入问题2',
_question2,
"",
src: _question2,
title: '问题2',
hint: '请输入问题2',
);
if (input != null) {
setState(() {
@ -291,10 +285,9 @@ class _RegisterScreenState extends State<RegisterScreen> {
onTap: () async {
String? input = await displayTextInputDialog(
context,
'回答2',
'请输入回答2',
_answer2,
"",
src: _answer2,
title: '回答2',
hint: '请输入回答2',
);
if (input != null) {
setState(() {
@ -309,10 +302,9 @@ class _RegisterScreenState extends State<RegisterScreen> {
onTap: () async {
String? input = await displayTextInputDialog(
context,
'问题3',
'请输入问题3',
_question3,
"",
src: _question3,
title: '问题3',
hint: '请输入问题3',
);
if (input != null) {
setState(() {
@ -327,10 +319,9 @@ class _RegisterScreenState extends State<RegisterScreen> {
onTap: () async {
String? input = await displayTextInputDialog(
context,
'回答3',
'请输入回答3',
_answer3,
"",
src: _answer3,
title: '回答3',
hint: '请输入回答3',
);
if (input != null) {
setState(() {