67 lines
1.8 KiB
Dart
67 lines
1.8 KiB
Dart
import 'package:chat/configs/app_colors.dart';
|
|
import 'package:chat/routes/app_routes.dart';
|
|
import 'package:chat/services/auth_service.dart';
|
|
import 'package:chat/utils/hd_wallet.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
class AuthImportPage extends StatefulWidget {
|
|
const AuthImportPage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<AuthImportPage> createState() => _AuthImportPageState();
|
|
}
|
|
|
|
class _AuthImportPageState extends State<AuthImportPage> {
|
|
final TextEditingController _editingController = TextEditingController();
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_editingController.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
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,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
const Text('支持导入所有遵循BIP标准生成的助记词'),
|
|
ElevatedButton(
|
|
onPressed: () {
|
|
String? address =
|
|
HDWallet.mnemonicToAddress(_editingController.text);
|
|
if (address != null) {
|
|
AuthService.to.login(address);
|
|
Get.offAllNamed(AppRoutes.app);
|
|
}
|
|
},
|
|
child: const Text('开始导入'),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|