-
Notifications
You must be signed in to change notification settings - Fork 440
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
175 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
v1.7.9 | ||
- [x] ✨ 下载批量删除 | ||
- [x] ✨ 桌面端密码 | ||
|
||
v1.7.8 | ||
- [x] ♻️ iOS可以使用FaceID进行解锁App | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:pikapika/basic/Method.dart'; | ||
|
||
const _key = "desktopAuthPassword"; | ||
|
||
Future<bool> needDesktopAuthentication() async { | ||
return await method.loadProperty(_key, "") != ""; | ||
} | ||
|
||
class VerifyPassword extends StatefulWidget { | ||
const VerifyPassword({Key? key}) : super(key: key); | ||
|
||
@override | ||
State<StatefulWidget> createState() => _VerifyPasswordState(); | ||
} | ||
|
||
class _VerifyPasswordState extends State<VerifyPassword> { | ||
String _password = ""; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Column( | ||
children: [ | ||
TextField( | ||
decoration: const InputDecoration(labelText: "当前密码"), | ||
onChanged: (value) { | ||
_password = value; | ||
}, | ||
), | ||
ElevatedButton( | ||
onPressed: () async { | ||
String savedPassword = await method.loadProperty(_key, ""); | ||
if (_password == savedPassword) { | ||
Navigator.of(context).pop(true); | ||
} else { | ||
ScaffoldMessenger.of(context) | ||
.showSnackBar(const SnackBar(content: Text("密码错误"))); | ||
} | ||
}, | ||
child: const Text("确定"), | ||
), | ||
], | ||
); | ||
} | ||
} | ||
|
||
class SetPassword extends StatefulWidget { | ||
const SetPassword({Key? key}) : super(key: key); | ||
|
||
@override | ||
State<StatefulWidget> createState() => _SetPasswordState(); | ||
} | ||
|
||
class _SetPasswordState extends State<SetPassword> { | ||
String _password = ""; | ||
String _password2 = ""; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Center( | ||
child: Padding( | ||
padding: const EdgeInsets.all(30), | ||
child: Column( | ||
children: [ | ||
const Text( | ||
"密码初始化", | ||
style: TextStyle( | ||
height: 18, | ||
), | ||
), | ||
Container( | ||
height: 10, | ||
), | ||
TextField( | ||
decoration: const InputDecoration(labelText: "密码"), | ||
onChanged: (value) { | ||
_password = value; | ||
}, | ||
), | ||
Container( | ||
height: 10, | ||
), | ||
TextField( | ||
decoration: const InputDecoration(labelText: "再次输入密码"), | ||
onChanged: (value) { | ||
_password2 = value; | ||
}, | ||
), | ||
Container( | ||
height: 10, | ||
), | ||
Row( | ||
children: [ | ||
ElevatedButton( | ||
onPressed: () async { | ||
Navigator.of(context).pop(false); | ||
}, | ||
child: const Text("取消"), | ||
), | ||
Container(width: 10), | ||
Expanded( | ||
child: ElevatedButton( | ||
onPressed: () async { | ||
if (_password != _password2) { | ||
ScaffoldMessenger.of(context).showSnackBar( | ||
const SnackBar(content: Text("两次输入的密码不一致"))); | ||
return; | ||
} | ||
await method.saveProperty(_key, _password); | ||
Navigator.of(context).pop(true); | ||
}, | ||
child: const Text("设置密码"), | ||
), | ||
), | ||
], | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters