| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283 |
- import 'package:flutter/material.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:get/get.dart';
- import 'package:nomo/app/base/base_view.dart';
- import 'package:nomo/app/widgets/click_opacity.dart';
- import 'package:nomo/config/theme/theme_extensions/theme_extension.dart';
- import '../controllers/precode_sendemail_controller.dart';
- class PrecodeSendemailView extends BaseView<PrecodeSendemailController> {
- const PrecodeSendemailView({super.key});
- @override
- Widget buildContent(BuildContext context) {
- return Padding(
- padding: EdgeInsets.symmetric(horizontal: 14.w),
- child: Column(
- children: [
- // 自定义标题栏
- _buildAppBar(),
- 40.verticalSpaceFromWidth,
- // 邮箱输入框
- _buildEmailInput(),
- 20.verticalSpaceFromWidth,
- // 发送按钮
- _buildSendButton(),
- 12.verticalSpaceFromWidth,
- // 说明文字
- Text(
- 'Your code will be backed up to this email.',
- textAlign: TextAlign.center,
- style: TextStyle(
- fontSize: 14.sp,
- color: Get.reactiveTheme.hintColor.withOpacity(0.6),
- ),
- ),
- 40.verticalSpaceFromWidth,
- // 信息卡片列表
- _buildInfoCardList(),
- ],
- ),
- );
- }
- /// 自定义标题栏
- Widget _buildAppBar() {
- return Container(
- height: 64.h,
- alignment: Alignment.center,
- child: Stack(
- children: [
- // 返回按钮
- Positioned(
- left: 0,
- top: 0,
- bottom: 0,
- child: ClickOpacity(
- onTap: () => Get.back(),
- child: Container(
- width: 48.w,
- height: 48.w,
- alignment: Alignment.center,
- child: Icon(
- Icons.arrow_back,
- color: Get.reactiveTheme.textTheme.bodyLarge!.color,
- size: 24.w,
- ),
- ),
- ),
- ),
- // 标题
- Center(
- child: Text(
- 'Send Pre Code to Email',
- style: TextStyle(
- fontSize: 20.sp,
- color: Get.reactiveTheme.textTheme.bodyLarge!.color,
- fontWeight: FontWeight.w600,
- ),
- ),
- ),
- ],
- ),
- );
- }
- /// 邮箱输入框
- Widget _buildEmailInput() {
- return Obx(
- () => Container(
- height: 56.h,
- decoration: BoxDecoration(
- color: Get.reactiveTheme.highlightColor,
- borderRadius: BorderRadius.circular(16.r),
- border: Border.all(
- color: controller.isFocused.value
- ? const Color(0xFF0A84FF)
- : Colors.transparent,
- width: 2,
- ),
- ),
- child: TextField(
- controller: controller.emailController,
- focusNode: controller.emailFocusNode,
- keyboardType: TextInputType.emailAddress,
- style: TextStyle(
- fontSize: 16.sp,
- color: Get.reactiveTheme.textTheme.bodyLarge!.color,
- ),
- decoration: InputDecoration(
- hintText: 'Enter your email',
- hintStyle: TextStyle(
- fontSize: 16.sp,
- color: Get.reactiveTheme.hintColor.withOpacity(0.5),
- ),
- border: InputBorder.none,
- contentPadding: EdgeInsets.symmetric(horizontal: 20.w),
- ),
- ),
- ),
- );
- }
- /// 发送按钮
- Widget _buildSendButton() {
- return Obx(() {
- final canSend = controller.canSend;
- final isSending = controller.isSending.value;
- return ClickOpacity(
- onTap: canSend ? controller.sendEmail : null,
- child: Container(
- height: 56.h,
- decoration: BoxDecoration(
- color: canSend
- ? const Color(0xFF0A84FF)
- : Get.reactiveTheme.highlightColor,
- borderRadius: BorderRadius.circular(16.r),
- ),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- if (isSending)
- SizedBox(
- width: 20.w,
- height: 20.w,
- child: const CircularProgressIndicator(
- strokeWidth: 2,
- valueColor: AlwaysStoppedAnimation<Color>(Colors.white),
- ),
- )
- else
- Icon(
- Icons.email_outlined,
- color: canSend
- ? Colors.white
- : Get.reactiveTheme.hintColor.withOpacity(0.5),
- size: 24.w,
- ),
- 12.horizontalSpace,
- Text(
- isSending ? 'Sending...' : 'Send your Email',
- style: TextStyle(
- fontSize: 16.sp,
- color: canSend
- ? Colors.white
- : Get.reactiveTheme.hintColor.withOpacity(0.5),
- fontWeight: FontWeight.w500,
- ),
- ),
- ],
- ),
- ),
- );
- });
- }
- /// 信息卡片列表(带连接线)
- Widget _buildInfoCardList() {
- final cards = [
- {
- 'icon': Icons.workspace_premium_outlined,
- 'title': 'Your Pre Credential',
- 'description':
- 'This is your VIP credential. Please store it securely and do not share it with anyone.',
- },
- {
- 'icon': Icons.mark_email_read_outlined,
- 'title': 'Secure Email Backup',
- 'description':
- 'We will send an email containing this credential to your specified email address for safekeeping.',
- },
- {
- 'icon': Icons.check_circle_outline,
- 'title': 'Send and Save',
- 'description':
- 'After the email is sent, we recommend you also save this credential to a secure location on your device.',
- },
- ];
- return Column(
- children: List.generate(cards.length, (index) {
- final card = cards[index];
- final isLast = index == cards.length - 1;
- return Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- // 左侧图标和连接线
- Column(
- children: [
- // 图标
- Container(
- width: 48.w,
- height: 48.w,
- decoration: BoxDecoration(
- color: const Color(0xFF0A84FF).withOpacity(0.15),
- borderRadius: BorderRadius.circular(12.r),
- ),
- child: Icon(
- card['icon'] as IconData,
- color: const Color(0xFF0A84FF),
- size: 28.w,
- ),
- ),
- // 连接线(最后一个不显示)
- if (!isLast)
- Container(
- width: 2.w,
- height: 60.h,
- margin: EdgeInsets.symmetric(vertical: 8.h),
- decoration: BoxDecoration(
- color: Get.reactiveTheme.hintColor.withOpacity(0.2),
- borderRadius: BorderRadius.circular(1.r),
- ),
- ),
- ],
- ),
- 16.horizontalSpace,
- // 右侧文字内容
- Expanded(
- child: Padding(
- padding: EdgeInsets.only(top: 4.h, bottom: isLast ? 0 : 24.h),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- card['title'] as String,
- style: TextStyle(
- fontSize: 18.sp,
- color: Get.reactiveTheme.textTheme.bodyLarge!.color,
- fontWeight: FontWeight.w600,
- ),
- ),
- 8.verticalSpaceFromWidth,
- Text(
- card['description'] as String,
- style: TextStyle(
- fontSize: 14.sp,
- color: Get.reactiveTheme.hintColor.withOpacity(0.6),
- height: 1.5,
- ),
- ),
- ],
- ),
- ),
- ),
- ],
- );
- }),
- );
- }
- }
|