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: '')); var _controller = TextEditingController.fromValue(TextEditingValue(text: ''));
Future<String?> displayTextInputDialog( Future<String?> displayTextInputDialog(BuildContext context,
BuildContext context, {String? title, String src = "", String? hint, String? desc}) {
String title,
String hint,
String src,
String desc,
) {
_controller.text = src; _controller.text = src;
return showDialog( return showDialog(
context: context, context: context,
builder: (context) { builder: (context) {
return AlertDialog( return AlertDialog(
title: Text(title), title: title == null ? null : Text(title),
content: SingleChildScrollView( content: SingleChildScrollView(
child: ListBody( child: ListBody(
children: [ children: [
@ -167,9 +162,10 @@ Future<String?> displayTextInputDialog(
controller: _controller, controller: _controller,
decoration: InputDecoration(hintText: hint), decoration: InputDecoration(hintText: hint),
), ),
desc.isEmpty ...(desc == null
? Container() ? []
: Container( : [
Container(
padding: EdgeInsets.only(top: 20, bottom: 10), padding: EdgeInsets.only(top: 20, bottom: 10),
child: Text( child: Text(
desc, desc,
@ -181,7 +177,8 @@ Future<String?> displayTextInputDialog(
?.color ?.color
?.withOpacity(.5)), ?.withOpacity(.5)),
), ),
), )
]),
], ],
), ),
), ),

View File

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

View File

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

View File

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

View File

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

View File

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