Files
zh-chat-flutter/lib/views/auth/import/index_page.dart
2022-10-26 17:29:01 +08:00

63 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: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> {
String _mn = '';
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('导入账户'),
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
TextField(
maxLines: 5,
decoration: const InputDecoration(
hintText: '请输入您的助记词,以空格分割单词或汉字',
border: OutlineInputBorder(
borderSide: BorderSide(
color: AppColors.border,
width: 0.4,
),
),
),
onChanged: (e) {
setState(() {
_mn = e;
});
},
),
const SizedBox(height: 16),
const Text('支持导入所有遵循BIP标准生成的助记词'),
const SizedBox(height: 16),
ElevatedButton(
onPressed: _mn.isNotEmpty
? () async {
var result = await AuthService.to.login(_mn);
if (result) {
Get.offAllNamed(AppRoutes.app);
}
}
: null,
child: const Text('开始导入'),
),
],
),
),
);
}
}