diff --git a/assets/images/phone_checked.png b/assets/images/phone_checked.png new file mode 100644 index 0000000..9b9000c Binary files /dev/null and b/assets/images/phone_checked.png differ diff --git a/assets/images/photo_checked.png b/assets/images/photo_checked.png new file mode 100644 index 0000000..cbd42ee Binary files /dev/null and b/assets/images/photo_checked.png differ diff --git a/assets/images/photo_uncheck.png b/assets/images/photo_uncheck.png new file mode 100644 index 0000000..cc52ca3 Binary files /dev/null and b/assets/images/photo_uncheck.png differ diff --git a/assets/images/real_checked.png b/assets/images/real_checked.png new file mode 100644 index 0000000..bcdfaf3 Binary files /dev/null and b/assets/images/real_checked.png differ diff --git a/assets/images/real_uncheck.png b/assets/images/real_uncheck.png new file mode 100644 index 0000000..1020d14 Binary files /dev/null and b/assets/images/real_uncheck.png differ diff --git a/lib/controller/mine/auth_controller.dart b/lib/controller/mine/auth_controller.dart index 900cb14..e713cb1 100644 --- a/lib/controller/mine/auth_controller.dart +++ b/lib/controller/mine/auth_controller.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:get/get.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import '../../generated/assets.dart'; import '../../network/user_api.dart'; import '../global.dart'; @@ -38,9 +39,9 @@ class AuthController extends GetxController { } } dataList.assignAll([ - AuthCard( title: '手机绑定', desc: '防止账号丢失', index: 1, authed: true), - AuthCard( title: '真实头像', desc: '提高交友成功率', index: 2, authed: checkPhoto), - AuthCard( title: '实名认证', desc: '提高交友成功率', index: 3, authed: realAuth), + AuthCard( title: '手机绑定', desc: '防止账号丢失', index: 1, authed: true, defaultIcon: Assets.imagesPhoneChecked, activeIcon: Assets.imagesPhoneChecked, width: 28,height: 40), + AuthCard( title: '真实头像', desc: '提高交友成功率', index: 2, authed: checkPhoto, defaultIcon: Assets.imagesPhotoUncheck, activeIcon: Assets.imagesPhotoChecked, width: 38,height: 37), + AuthCard( title: '实名认证', desc: '提高交友成功率', index: 3, authed: realAuth, defaultIcon: Assets.imagesRealUncheck, activeIcon: Assets.imagesRealChecked, width: 36,height: 40), ]); } catch (e) { SmartDialog.showToast('网络请求失败,请检查网络连接'); @@ -128,11 +129,19 @@ class AuthCard { final String desc; final int index; bool authed; + final String defaultIcon; + final String activeIcon; + final double height; + final double width; AuthCard({ required this.desc, required this.title, required this.index, required this.authed, + required this.defaultIcon, + required this.activeIcon, + required this.height, + required this.width, }); } diff --git a/lib/generated/assets.dart b/lib/generated/assets.dart index ad13fa5..b5fefa0 100644 --- a/lib/generated/assets.dart +++ b/lib/generated/assets.dart @@ -124,10 +124,15 @@ class Assets { static const String imagesMore = 'assets/images/more.png'; static const String imagesMoreIcon = 'assets/images/more_icon.png'; static const String imagesOnlineIcon = 'assets/images/online_icon.png'; + static const String imagesPhoneChecked = 'assets/images/phone_checked.png'; static const String imagesPhoto = 'assets/images/photo.png'; + static const String imagesPhotoChecked = 'assets/images/photo_checked.png'; + static const String imagesPhotoUncheck = 'assets/images/photo_uncheck.png'; static const String imagesPlayIcon = 'assets/images/play_icon.png'; static const String imagesPlayer = 'assets/images/player.png'; + static const String imagesRealChecked = 'assets/images/real_checked.png'; static const String imagesRealName = 'assets/images/real_name.png'; + static const String imagesRealUncheck = 'assets/images/real_uncheck.png'; static const String imagesRose = 'assets/images/rose.png'; static const String imagesRoseBanner = 'assets/images/rose_banner.png'; static const String imagesRoseGift = 'assets/images/rose_gift.png'; diff --git a/lib/pages/discover/visitor_list_page.dart b/lib/pages/discover/visitor_list_page.dart index b62c827..5a703cc 100644 --- a/lib/pages/discover/visitor_list_page.dart +++ b/lib/pages/discover/visitor_list_page.dart @@ -224,7 +224,7 @@ class VisitorListItem extends StatelessWidget { ), Spacer(), Text( - visitor.visitTime!, + _formatTime(visitor.visitTime!), style: TextStyle( color: Colors.grey[500], fontSize: 13, @@ -255,4 +255,22 @@ class VisitorListItem extends StatelessWidget { }); } + String _formatTime(String timestamp) { + var time = DateTime.parse(timestamp); + final now = DateTime.now(); + final difference = now.difference(time); + + if (difference.inMinutes < 1) { + return '刚刚'; + } else if (difference.inHours < 1) { + return '${difference.inMinutes}分钟前'; + } else if (difference.inDays < 1) { + return '${difference.inHours}小时前'; + } else if (difference.inDays < 7) { + return '${difference.inDays}天前'; + } else { + return '${time.month}/${time.day}'; + } + } + } \ No newline at end of file diff --git a/lib/pages/mine/auth_center_page.dart b/lib/pages/mine/auth_center_page.dart index 5db9b89..9cfbc51 100644 --- a/lib/pages/mine/auth_center_page.dart +++ b/lib/pages/mine/auth_center_page.dart @@ -6,6 +6,7 @@ import 'package:get/get.dart'; import '../../controller/mine/auth_controller.dart'; import '../../extension/router_service.dart'; +import '../../generated/assets.dart'; import 'edit_info_page.dart'; class AuthCenterPage extends StatelessWidget { @@ -40,7 +41,7 @@ class AuthCenterPage extends StatelessWidget { Widget _buildListItem(AuthCard item) { return Container( margin: EdgeInsets.only(bottom: 12), - padding: EdgeInsets.all(24), + padding: EdgeInsets.only(left: 16, top: 24, bottom: 24, right: 12), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(12), @@ -50,14 +51,17 @@ class AuthCenterPage extends StatelessWidget { children: [ // 左侧图片 Container( - width: 40, - height: 40, + width: 72, + height: 72, decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8), - color: Colors.blue[100], - image: DecorationImage( - image: NetworkImage('https://picsum.photos/40/40?random=$item.index'), - fit: BoxFit.cover, + borderRadius: BorderRadius.circular(72), + color: Color(0xFFF7F7F7), + ), + child: Center( + child: Image.asset( + item.authed ? item.activeIcon : item.defaultIcon, + width: item.width, + height: item.height, ), ), ), @@ -93,29 +97,22 @@ class AuthCenterPage extends StatelessWidget { item.authed ? '已认证' : '去认证', style: TextStyle( fontSize: 12, - color: item.authed ? Color(0xff26C77C) : Colors.grey[500] + color: item.authed ? Color(0xFF7562F9) : Colors.grey[500] ) ), - SizedBox(width: 4), - item.authed ? SizedBox(width: 24) : Icon( - Icons.navigate_next, // Material Icons - // size: 128.0, // 设置图标大小#26C77C - color: Colors.grey[500] - ), + Icon(Icons.navigate_next, color: Colors.grey[400]), ], ) ], ), ).onTap(() async{ - if(!item.authed){ - if(item.index == 2){ - await Get.to(() => EditInfoPage()); + if(item.index == 2){ + await Get.to(() => EditInfoPage()); + controller.loadInitialData(); + } else if(item.index == 3){ + final result = await Get.to(() => RealNamePage()); + if(result > 0){ controller.loadInitialData(); - } else if(item.index == 3){ - final result = await Get.to(() => RealNamePage()); - if(result > 0){ - controller.loadInitialData(); - } } } }); diff --git a/lib/pages/mine/mine_page.dart b/lib/pages/mine/mine_page.dart index d60952c..7fe3c85 100644 --- a/lib/pages/mine/mine_page.dart +++ b/lib/pages/mine/mine_page.dart @@ -1,6 +1,5 @@ import 'package:dating_touchme_app/controller/mine/mine_controller.dart'; import 'package:dating_touchme_app/extension/ex_widget.dart'; -import 'package:dating_touchme_app/pages/discover/visitor_list_page.dart'; import 'package:dating_touchme_app/pages/mine/edit_info_page.dart'; import 'package:dating_touchme_app/pages/mine/vip_page.dart'; import 'package:flutter/material.dart'; @@ -10,6 +9,7 @@ import 'package:get/get.dart'; import 'package:get_storage/get_storage.dart'; import '../../extension/router_service.dart'; +import '../discover/visitor_list_page.dart'; class MinePage extends StatefulWidget { const MinePage({super.key}); diff --git a/lib/pages/mine/real_name_page.dart b/lib/pages/mine/real_name_page.dart index 2fa66be..14669fa 100644 --- a/lib/pages/mine/real_name_page.dart +++ b/lib/pages/mine/real_name_page.dart @@ -21,40 +21,41 @@ class RealNamePage extends StatelessWidget { body: Column( children: [ Container( - height: 48, - decoration: BoxDecoration(color: Color(0xffE7E7E7)), + height: 56, + decoration: BoxDecoration(color: Color(0xffFFFFFF)), padding: const EdgeInsets.only(left: 16), - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, // 垂直居中 - children: [ - Text( - '*请填写本人实名信息', - style: TextStyle( - fontSize: 14, - color: Colors.black87, - ), + child: Center( + child: Text( + '*请填写本人实名信息', + style: TextStyle( + fontSize: 14, + color: Colors.black87, ), - ], + ), ), ), + // SizedBox(height: 12), Container( - height: 56, // 固定高度确保垂直居中 + height: 52, // 固定高度确保垂直居中 + width: MediaQuery.of(context).size.width - 40, decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey[400]!, - width: 0.5, - ), - ), + border: Border.all(color: Colors.grey.shade300), + borderRadius: BorderRadius.circular(28), + // border: Border( + // bottom: BorderSide( + // color: Colors.grey[400]!, + // width: 0.5, + // ), + // ), ), child: Row( crossAxisAlignment: CrossAxisAlignment.center, // 垂直居中 children: [ // 左侧标签 - 固定宽度 + 垂直居中 Container( - width: 100, + width: 98, alignment: Alignment.centerLeft, - padding: const EdgeInsets.only(left: 16), + padding: const EdgeInsets.only(left: 20), child: Text( '姓名:', style: TextStyle( @@ -63,7 +64,7 @@ class RealNamePage extends StatelessWidget { ), ), ), - SizedBox(width: 12), + // SizedBox(width: 4), // 输入框区域 - 使用Expanded填充剩余空间 Expanded( @@ -90,25 +91,28 @@ class RealNamePage extends StatelessWidget { ], ), ), - // SizedBox(height: 30), + SizedBox(height: 24), Container( - height: 56, // 固定高度确保垂直居中 + height: 52, // 固定高度确保垂直居中 + width: MediaQuery.of(context).size.width - 40, decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey[400]!, - width: 0.5, - ), - ), + border: Border.all(color: Colors.grey.shade300), + borderRadius: BorderRadius.circular(28), + // border: Border( + // bottom: BorderSide( + // color: Colors.grey[400]!, + // width: 0.5, + // ), + // ), ), child: Row( crossAxisAlignment: CrossAxisAlignment.center, // 垂直居中 children: [ // 左侧标签 - 固定宽度 + 垂直居中 Container( - width: 100, + width: 98, alignment: Alignment.centerLeft, - padding: const EdgeInsets.only(left: 16), + padding: const EdgeInsets.only(left: 20), child: Text( '身份证号:', style: TextStyle( @@ -117,7 +121,7 @@ class RealNamePage extends StatelessWidget { ), ), ), - SizedBox(width: 12), + // SizedBox(width: 4), // 输入框区域 - 使用Expanded填充剩余空间 Expanded( @@ -169,7 +173,7 @@ class RealNamePage extends StatelessWidget { ) ], ), - SizedBox(height: 48), + SizedBox(height: 32), TDButton( text: '立即认证', @@ -177,7 +181,14 @@ class RealNamePage extends StatelessWidget { size: TDButtonSize.large, type: TDButtonType.fill, shape: TDButtonShape.round, - theme: TDButtonTheme.primary, + style: TDButtonStyle( + textColor: Colors.white, + backgroundColor: Color(0xFF7562F9), + ), + activeStyle: TDButtonStyle( + textColor: Colors.white, + backgroundColor: Color(0xC37562F9), + ), onTap: (){ controller.startAuthing(); },