Jolie 4 months ago
parent
commit
ca91bbf6c1
11 changed files with 103 additions and 63 deletions
  1. BIN
      assets/images/phone_checked.png
  2. BIN
      assets/images/photo_checked.png
  3. BIN
      assets/images/photo_uncheck.png
  4. BIN
      assets/images/real_checked.png
  5. BIN
      assets/images/real_uncheck.png
  6. 15
      lib/controller/mine/auth_controller.dart
  7. 5
      lib/generated/assets.dart
  8. 20
      lib/pages/discover/visitor_list_page.dart
  9. 43
      lib/pages/mine/auth_center_page.dart
  10. 2
      lib/pages/mine/mine_page.dart
  11. 81
      lib/pages/mine/real_name_page.dart

BIN
assets/images/phone_checked.png

Before After
Width: 110  |  Height: 156  |  Size: 3.0 KiB

BIN
assets/images/photo_checked.png

Before After
Width: 146  |  Height: 146  |  Size: 4.3 KiB

BIN
assets/images/photo_uncheck.png

Before After
Width: 146  |  Height: 146  |  Size: 2.2 KiB

BIN
assets/images/real_checked.png

Before After
Width: 144  |  Height: 160  |  Size: 4.9 KiB

BIN
assets/images/real_uncheck.png

Before After
Width: 144  |  Height: 160  |  Size: 2.7 KiB

15
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,
});
}

5
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';

20
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}';
}
}
}

43
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();
}
}
}
});

2
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});

81
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();
},

Loading…
Cancel
Save