登录逻辑
This commit is contained in:
@@ -46,93 +46,95 @@ class _AuthCreatePageState extends State<AuthCreatePage>
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('备份助记词'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
child: const Text('跳过备份'),
|
||||
),
|
||||
],
|
||||
),
|
||||
body: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
TabBar(
|
||||
controller: _tabController,
|
||||
isScrollable: true,
|
||||
indicatorColor: AppColors.primary,
|
||||
indicatorWeight: 5,
|
||||
indicatorSize: TabBarIndicatorSize.label,
|
||||
tabs: const [
|
||||
Tab(
|
||||
text: 'English',
|
||||
),
|
||||
Tab(
|
||||
text: '中文',
|
||||
),
|
||||
],
|
||||
),
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(right: 8.0),
|
||||
child: Text(
|
||||
'请务必抄下助记词,确定之后将进行校验',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('备份助记词'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
child: const Text('跳过备份'),
|
||||
),
|
||||
],
|
||||
),
|
||||
body: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
TabBar(
|
||||
controller: _tabController,
|
||||
isScrollable: true,
|
||||
indicatorColor: AppColors.primary,
|
||||
indicatorWeight: 5,
|
||||
indicatorSize: TabBarIndicatorSize.label,
|
||||
tabs: const [
|
||||
Tab(
|
||||
text: 'English',
|
||||
),
|
||||
Tab(
|
||||
text: '中文',
|
||||
),
|
||||
],
|
||||
),
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(right: 8.0),
|
||||
child: Text(
|
||||
'请务必抄下助记词,确定之后将进行校验',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
controller: _tabController,
|
||||
children: [
|
||||
_moArea(_englishMnemonic),
|
||||
_moArea(_chineseMnemonic),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: Get.height * 0.382,
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: const Text(
|
||||
'提示:请勿截图!如果有人获取您的助记词将直接获取您的资产,请抄写助记词并存放在安全的地方,我们会在下一屏幕进行校验,',
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
controller: _tabController,
|
||||
children: [
|
||||
_moArea(_englishMnemonic),
|
||||
_moArea(_chineseMnemonic),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
_generateMnemonic();
|
||||
},
|
||||
child: const Text('更换助记词'),
|
||||
Container(
|
||||
height: Get.height * 0.382,
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: const Text(
|
||||
'提示:请勿截图!如果有人获取您的助记词将直接获取您的资产,请抄写助记词并存放在安全的地方,我们会在下一屏幕进行校验,',
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
var language = _tabController.index;
|
||||
Get.toNamed(
|
||||
AuthRoutes.createVerify,
|
||||
arguments: {
|
||||
'language': language == 0 ? 'english' : 'chinese',
|
||||
'mnemonic':
|
||||
language == 0 ? _englishMnemonic : _chineseMnemonic
|
||||
},
|
||||
);
|
||||
},
|
||||
child: const Text('开始备份'),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
_generateMnemonic();
|
||||
},
|
||||
child: const Text('更换助记词'),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
var language = _tabController.index;
|
||||
Get.toNamed(
|
||||
AuthRoutes.createVerify,
|
||||
arguments: {
|
||||
'language': language == 0 ? 'english' : 'chinese',
|
||||
'mnemonic':
|
||||
language == 0 ? _englishMnemonic : _chineseMnemonic
|
||||
},
|
||||
);
|
||||
},
|
||||
child: const Text('开始备份'),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -37,36 +37,41 @@ class _AuthImportPageState extends State<AuthImportPage> {
|
||||
appBar: AppBar(
|
||||
title: const Text('导入账户'),
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
TextField(
|
||||
controller: _editingController,
|
||||
maxLines: 4,
|
||||
decoration: const InputDecoration(
|
||||
hintText: '请输入您的助记词',
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: AppColors.border,
|
||||
width: 0.4,
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
children: [
|
||||
TextField(
|
||||
controller: _editingController,
|
||||
maxLines: 5,
|
||||
decoration: const InputDecoration(
|
||||
hintText: '请输入您的助记词,以空格分割单词或汉字',
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: AppColors.border,
|
||||
width: 0.4,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const Text('支持导入所有遵循BIP标准生成的助记词'),
|
||||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
String? address =
|
||||
HDWallet.mnemonicToAddress(_editingController.text);
|
||||
if (address != null) {
|
||||
var result = await AuthService.to.login(address);
|
||||
if (result) {
|
||||
Get.offAllNamed(AppRoutes.app);
|
||||
const SizedBox(height: 16),
|
||||
const Text('支持导入所有遵循BIP标准生成的助记词'),
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
String? address =
|
||||
HDWallet.mnemonicToAddress(_editingController.text);
|
||||
if (address != null) {
|
||||
var result = await AuthService.to.login(address);
|
||||
if (result) {
|
||||
Get.offAllNamed(AppRoutes.app);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
child: const Text('开始导入'),
|
||||
),
|
||||
],
|
||||
},
|
||||
child: const Text('开始导入'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -18,17 +18,22 @@ class _AuthPageState extends State<AuthPage> {
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
Get.toNamed(AuthRoutes.create);
|
||||
},
|
||||
child: const Text('创建账户'),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
Get.toNamed(AuthRoutes.import);
|
||||
},
|
||||
child: const Text('导入账户'),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
Get.toNamed(AuthRoutes.create);
|
||||
},
|
||||
child: const Text('创建账户'),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
Get.toNamed(AuthRoutes.import);
|
||||
},
|
||||
child: const Text('导入账户'),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user