王子贤 1 month ago
parent
commit
008dfab81a
6 changed files with 305 additions and 25 deletions
  1. BIN
      assets/images/element_border.png
  2. BIN
      assets/images/results_bg.png
  3. 12
      lib/controller/home/user_information_controller.dart
  4. 2
      lib/generated/assets.dart
  5. 131
      lib/pages/home/test_page.dart
  6. 185
      lib/pages/home/user_information_page.dart

BIN
assets/images/element_border.png

Before After
Width: 366  |  Height: 210  |  Size: 64 KiB

BIN
assets/images/results_bg.png

Before After
Width: 1504  |  Height: 1570  |  Size: 2.8 MiB

12
lib/controller/home/user_information_controller.dart

@ -2,17 +2,20 @@ import 'package:dating_touchme_app/controller/global.dart';
import 'package:dating_touchme_app/model/home/user_info_data.dart';
import 'package:dating_touchme_app/network/user_api.dart';
import 'package:easy_refresh/easy_refresh.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import '../../model/home/post_data.dart';
class UserInformationController extends GetxController {
class UserInformationController extends GetxController with GetTickerProviderStateMixin {
final String miId;
final String userId;
UserInformationController({required this.miId, required this.userId});
late final TabController tabController;
final nowSelect = 0.obs;
final userData = UserInfoData().obs;
@ -39,10 +42,13 @@ class UserInformationController extends GetxController {
late final EasyRefreshController listRefreshController;
final tab = 0.obs;
@override
void onInit() {
super.onInit();
tabController = TabController(length: 2, vsync: this);
listRefreshController = EasyRefreshController(
controlFinishRefresh: true,
@ -75,6 +81,10 @@ class UserInformationController extends GetxController {
getPostList();
}
changeTab(int i){
tab.value = i;
update();
}
getPostList() async {
try{

2
lib/generated/assets.dart

@ -102,6 +102,7 @@ class Assets {
static const String imagesEdit = 'assets/images/edit.png';
static const String imagesEditAvatar = 'assets/images/edit_avatar.png';
static const String imagesEditAvatarsIcon = 'assets/images/edit_avatars_icon.png';
static const String imagesElementBorder = 'assets/images/element_border.png';
static const String imagesEmoji = 'assets/images/emoji.png';
static const String imagesEmojiTab = 'assets/images/emoji_tab.png';
static const String imagesEmptyIcon = 'assets/images/empty_icon.png';
@ -180,6 +181,7 @@ class Assets {
static const String imagesRealUncheck = 'assets/images/real_uncheck.png';
static const String imagesRealnameHelp = 'assets/images/realname_help.png';
static const String imagesRejectCall = 'assets/images/reject_call.png';
static const String imagesResultsBg = 'assets/images/results_bg.png';
static const String imagesRocket1 = 'assets/images/rocket1.svga';
static const String imagesRocket2 = 'assets/images/rocket2.svga';
static const String imagesRocket3 = 'assets/images/rocket3.svga';

131
lib/pages/home/test_page.dart

@ -2,6 +2,7 @@ import 'package:dating_touchme_app/components/page_appbar.dart';
import 'package:dating_touchme_app/generated/assets.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:tdesign_flutter/tdesign_flutter.dart';
class TestPage extends StatelessWidget {
const TestPage({super.key});
@ -29,6 +30,7 @@ class TestPage extends StatelessWidget {
Container(
width: 350.w,
padding: EdgeInsets.all(30.w),
margin: EdgeInsets.only(bottom: 5.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(16.w)),
color: const Color.fromRGBO(39, 48, 89, 1)
@ -42,6 +44,135 @@ class TestPage extends StatelessWidget {
),
),
),
),
Container(
width: 350.w,
margin: EdgeInsets.only(bottom: 5.w),
padding: EdgeInsets.only(
top: 10.w,
right: 10.w,
bottom: 5.w,
left: 10.w
),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(16.w)),
color: const Color.fromRGBO(0, 0, 0, .5)
),
child: Column(
children: [
Container(
width: 330.w,
height: 35.w,
margin: EdgeInsets.only(bottom: 5.w),
padding: EdgeInsets.symmetric(horizontal: 24.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(35.w)),
color: const Color.fromRGBO(255, 255, 255, .1)
),
alignment: Alignment.centerLeft,
child: Text(
"A.主动与人交流",
style: TextStyle(
fontSize: 14.w,
color: Colors.white
),
),
),
Container(
width: 330.w,
height: 35.w,
margin: EdgeInsets.only(bottom: 5.w),
padding: EdgeInsets.symmetric(horizontal: 24.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(35.w)),
color: const Color.fromRGBO(255, 255, 255, .1)
),
alignment: Alignment.centerLeft,
child: Text(
"A.主动与人交流",
style: TextStyle(
fontSize: 14.w,
color: Colors.white
),
),
),
Container(
width: 330.w,
height: 35.w,
margin: EdgeInsets.only(bottom: 5.w),
padding: EdgeInsets.symmetric(horizontal: 24.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(35.w)),
color: const Color.fromRGBO(255, 255, 255, .1)
),
alignment: Alignment.centerLeft,
child: Text(
"A.主动与人交流",
style: TextStyle(
fontSize: 14.w,
color: Colors.white
),
),
),
Container(
width: 330.w,
height: 35.w,
margin: EdgeInsets.only(bottom: 5.w),
padding: EdgeInsets.symmetric(horizontal: 24.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(35.w)),
color: const Color.fromRGBO(255, 255, 255, .1)
),
alignment: Alignment.centerLeft,
child: Text(
"A.主动与人交流",
style: TextStyle(
fontSize: 14.w,
color: Colors.white
),
),
),
],
),
),
TDProgress(
type: TDProgressType.linear,
value: 0.5,
strokeWidth: 6,
color: const Color.fromRGBO(117, 98, 249, 1),
progressLabelPosition: TDProgressLabelPosition.right,
label: TDTextLabel(
"5/25",
style: TextStyle(
color: Colors.white
),
),
),
SizedBox(height: 5.w,),
Text(
"注:本测试仅用于人格偏好探索与自我了解,不代表任何心理学诊断或专业评估。",
style: TextStyle(
fontSize: 12.w,
color: const Color.fromRGBO(255, 255, 255, .5 )
),
),
Spacer(),
Container(
width: 350.w,
height: 45.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(45.w)),
color: const Color.fromRGBO(117, 98, 249, 1),
),
child: Center(
child: Text(
"查看结果",
style: TextStyle(
fontSize: 19.w,
color: Colors.white
),
),
),
)
],
),

185
lib/pages/home/user_information_page.dart

@ -402,32 +402,169 @@ class UserInformationPage extends StatelessWidget {
),
Container(
height: 1,
color: const Color.fromRGBO(144, 144, 144, 1),
color: const Color.fromRGBO(0, 0, 0, .3),
margin: EdgeInsets.symmetric(vertical: 15.w),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"动态",
style: TextStyle(
fontSize: 18.w
),
)
],
Obx(
() {
return Column(
children: [
TDTabBar(
tabs: [
TDTab(text: '我的动态'),
TDTab(text: '人格类型'),
],
physics: const NeverScrollableScrollPhysics(),
controller: controller.tabController,
showIndicator: true,
isScrollable: true,
onTap: (int i) async {
controller.changeTab(i);
},
),
SizedBox(height: 10.w,),
if(controller.tab.value == 0) ...[
...controller.postList.map((e){
return TimelineItem(item: e);
}),
if(controller.postList.isEmpty) Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('暂无数据'),
],
),
)
],
if(controller.tab.value == 1) ...[
Stack(
clipBehavior: Clip.none,
children: [
Container(),
Positioned(
left: -15.w,
child: Image.asset(
Assets.imagesResultsBg,
width: 375.w,
),
),
Positioned(
left: 0.w,
top: 32.w,
child: SizedBox(
width: 95.w,
child: Text(
"你的人格类型鉴定结果",
style: TextStyle(
fontSize: 16.w,
color: Colors.white
),
),
),
),
Positioned(
right: -9.w,
top: 20.w,
child: Text(
"温和感受型",
style: TextStyle(
fontSize: 44.w,
color: const Color.fromRGBO(117, 98, 249, 1),
fontWeight: FontWeight.w700
),
),
),
Positioned(
left: -4.w,
top: 134.w,
child: Stack(
alignment: Alignment.center,
children: [
Image.asset(
Assets.imagesElementBorder,
width: 91.w,
height: 52.w,
),
Text(
"内倾 0%",
style: TextStyle(
fontSize: 14.w,
color: Colors.white
),
)
],
),
),
Positioned(
left: -4.w,
top: 259.w,
child: Stack(
alignment: Alignment.center,
children: [
Image.asset(
Assets.imagesElementBorder,
width: 91.w,
height: 52.w,
),
Text(
"内倾 0%",
style: TextStyle(
fontSize: 14.w,
color: Colors.white
),
)
],
),
),
Positioned(
right: -13.w,
top: 134.w,
child: Stack(
alignment: Alignment.center,
children: [
Image.asset(
Assets.imagesElementBorder,
width: 91.w,
height: 52.w,
),
Text(
"内倾 0%",
style: TextStyle(
fontSize: 14.w,
color: Colors.white
),
)
],
),
),
Positioned(
right: -13.w,
top: 251.w,
child: Stack(
alignment: Alignment.center,
children: [
Image.asset(
Assets.imagesElementBorder,
width: 91.w,
height: 52.w,
),
Text(
"内倾 0%",
style: TextStyle(
fontSize: 14.w,
color: Colors.white
),
)
],
),
),
],
)
]
],
);
}
),
SizedBox(height: 10.w,),
...controller.postList.map((e){
return TimelineItem(item: e);
}),
if(controller.postList.isEmpty) Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('暂无数据'),
],
),
)
],
),
),
@ -564,7 +701,7 @@ class UserInformationPage extends StatelessWidget {
),
],
),
bottomNavigationBar: miId != GlobalData().userData!.id ? SafeArea(
bottomNavigationBar: false && miId != GlobalData().userData!.id ? SafeArea(
child: SizedBox(
height: 48.h,
child: Row(

Loading…
Cancel
Save