Browse Source

修改我的页面,设置页面样式,优化重新登录逻辑

ios
王子贤 3 months ago
parent
commit
3e4a3c216c
10 changed files with 202 additions and 118 deletions
  1. BIN
      assets/images/cert.png
  2. BIN
      assets/images/matchmaker.png
  3. BIN
      assets/images/rose.png
  4. BIN
      assets/images/vip_banner.png
  5. BIN
      assets/images/wallet.png
  6. 12
      lib/controller/global.dart
  7. 1
      lib/controller/home/home_controller.dart
  8. 4
      lib/network/network_config.dart
  9. 126
      lib/pages/mine/mine_page.dart
  10. 177
      lib/pages/setting/setting_page.dart

BIN
assets/images/cert.png

Before After
Width: 85  |  Height: 85  |  Size: 2.0 KiB Width: 90  |  Height: 90  |  Size: 3.4 KiB

BIN
assets/images/matchmaker.png

Before After
Width: 85  |  Height: 85  |  Size: 2.0 KiB Width: 90  |  Height: 90  |  Size: 4.6 KiB

BIN
assets/images/rose.png

Before After
Width: 85  |  Height: 85  |  Size: 2.0 KiB Width: 90  |  Height: 90  |  Size: 3.8 KiB

BIN
assets/images/vip_banner.png

Before After
Width: 2139  |  Height: 385  |  Size: 79 KiB Width: 1426  |  Height: 257  |  Size: 41 KiB

BIN
assets/images/wallet.png

Before After
Width: 85  |  Height: 85  |  Size: 2.0 KiB Width: 90  |  Height: 90  |  Size: 3.1 KiB

12
lib/controller/global.dart

@ -1,7 +1,14 @@
// ignore_for_file: constant_identifier_names, non_constant_identifier_names
import 'dart:io';
import 'package:dating_touchme_app/controller/discover/discover_controller.dart';
import 'package:dating_touchme_app/controller/home/home_controller.dart';
import 'package:dating_touchme_app/controller/message/conversation_controller.dart';
import 'package:get/get.dart';
import 'package:get/get_core/src/get_main.dart';
import '../model/mine/user_data.dart';
import 'mine/mine_controller.dart';
class GlobalData {
String? qnToken;//uec接口的Token
@ -15,6 +22,11 @@ class GlobalData {
userId = null;
qnToken = null;
userData = null;
Get.delete<HomeController>(force: true);
Get.delete<DiscoverController>(force: true);
Get.delete<ConversationController>(force: true);
Get.delete<MineController>(force: true);
}
static GlobalData getInstance() {

1
lib/controller/home/home_controller.dart

@ -40,6 +40,7 @@ class HomeController extends GetxController {
///
void loadInitialData() async {
//
print(12121);
await Future.wait([
loadRecommendInitialData(),
loadNearbyInitialData(),

4
lib/network/network_config.dart

@ -1,5 +1,8 @@
import 'package:dating_touchme_app/controller/discover/discover_controller.dart';
import 'package:dating_touchme_app/controller/global.dart';
import 'package:dating_touchme_app/controller/home/home_controller.dart';
import 'package:dating_touchme_app/controller/message/conversation_controller.dart';
import 'package:dating_touchme_app/controller/mine/mine_controller.dart';
import 'package:dating_touchme_app/im/im_manager.dart';
import 'package:dio/dio.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
@ -170,6 +173,7 @@ class ResponseInterceptor extends Interceptor {
GetStorage().erase();
//
GlobalData().logout();
Get.offAll(() => LoginPage());
}
}

126
lib/pages/mine/mine_page.dart

@ -267,19 +267,27 @@ class _MinePageState extends State<MinePage> with AutomaticKeepAliveClientMixin{
],
),
SizedBox(height: 12.w,),
Wrap(
spacing: 8.w,
runSpacing: 8.w,
children: [
...controller.blockList.map((e){
return BlockItem(item: e, showWaring: e["title"] == "认证中心" && (GlobalData().userData?.identityCard == null || GlobalData().userData?.profilePhoto == null), path: e["path"],);
}),
],
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(9.w)),
child: Column(
children: [
...controller.blockList.map((e){
return BlockItem(item: e, showWaring: e["title"] == "认证中心" && (GlobalData().userData?.identityCard == null || GlobalData().userData?.profilePhoto == null), path: e["path"],);
}),
],
),
),
SizedBox(height: 12.w,),
...controller.settingList.map((e){
return SettingItem(item: e, path: e["path"],);
}),
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(9.w)),
child: Column(
children: [
...controller.settingList.map((e){
return SettingItem(item: e, path: e["path"],);
})
],
),
),
],
),
);
@ -400,54 +408,66 @@ class _BlockItemState extends State<BlockItem> {
// RouteGuardService.to.toWithAuth(widget.path, null);
},
child: Container(
width: 170.w,
height: 38.w,
padding: EdgeInsets.symmetric(horizontal: 7.w),
height: 48.w,
padding: EdgeInsets.only(left: 16.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(9.w)),
color: Colors.white
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Image.asset(
widget.item["icon"],
width: 21.w,
height: 21.w,
),
SizedBox(width: 2.w,),
Text(
widget.item["title"],
style: TextStyle(
fontSize: 12.w,
color: Colors.black,
child: Container(
padding: EdgeInsets.only(right: 16.w),
decoration: BoxDecoration(
border: widget.item["title"] != "红娘等级" ? Border(
bottom: BorderSide(width: 1, color: const Color.fromRGBO(238, 238, 238, 1))
) : null
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Image.asset(
widget.item["icon"],
height: 22.w,
width: 22.w,
),
)
],
),
Row(
children: [
if(widget.showWaring) Container(
width: 5.w,
height: 5.w,
margin: EdgeInsets.only(right: 4.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(5.w)),
color: const Color.fromRGBO(255, 87, 51, 1)
SizedBox(width: 16.w,),
Text(
widget.item["title"],
style: TextStyle(
fontSize: 14.w,
color: Colors.black,
fontWeight: FontWeight.w500
),
)
],
),
Row(
children: [
if(widget.showWaring) Container(
width: 5.w,
height: 5.w,
margin: EdgeInsets.only(right: 4.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(5.w)),
color: const Color.fromRGBO(255, 87, 51, 1)
),
),
),
Text(
widget.item["subTitle"],
style: TextStyle(
fontSize: 9.w,
color: const Color.fromRGBO(166, 166, 166, 1)
if(widget.item["title"] == "认证中心") Text(
widget.item["subTitle"],
style: TextStyle(
fontSize: 9.w,
color: const Color.fromRGBO(166, 166, 166, 1)
),
),
)
],
)
],
SizedBox(width: 10.w,),
Image.asset(
Assets.imagesArrow,
width: 4.w,
)
],
)
],
),
),
),
);

177
lib/pages/setting/setting_page.dart

@ -1,3 +1,7 @@
import 'package:dating_touchme_app/controller/discover/discover_controller.dart';
import 'package:dating_touchme_app/controller/home/home_controller.dart';
import 'package:dating_touchme_app/controller/message/conversation_controller.dart';
import 'package:dating_touchme_app/controller/mine/mine_controller.dart';
import 'package:dating_touchme_app/pages/mine/login_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -27,13 +31,6 @@ class SettingPage extends StatelessWidget {
TDCellGroup(
theme: TDCellGroupTheme.cardTheme,
cells: [
TDCell(
arrow: false,
title: '允许中间邀请弹窗',
rightIconWidget: TDSwitch(isOn: false,trackOnColor: const Color.fromRGBO(117, 98, 249, 1),onChanged: (bool e) {
return false;
})
),
TDCell(
arrow: false,
title: '后台播放',
@ -59,12 +56,11 @@ class SettingPage extends StatelessWidget {
TDCellGroup(
theme: TDCellGroupTheme.cardTheme,
cells: [
TDCell(arrow: true, title: '安全中心', onClick: (cell) {
print('安全中心');
}),
TDCell(arrow: true, title: '黑名单', onClick: (cell) {
Get.to(() => BlacklistPage());
}),
TDCell(arrow: true, title: '隐私设置'),
TDCell(arrow: true, title: '青少年模式'),
],
),
const SizedBox(height: 12),
@ -83,62 +79,113 @@ class SettingPage extends StatelessWidget {
)
],
),
const SizedBox(height: 64),
TDButton(
text: '退出登录',
width: MediaQuery.of(context).size.width - 40,
size: TDButtonSize.large,
type: TDButtonType.fill,
shape: TDButtonShape.round,
theme: TDButtonTheme.danger,
onTap: () {
showGeneralDialog(
context: context,
pageBuilder: (BuildContext buildContext, Animation<
double> animation,
Animation<double> secondaryAnimation) {
return TDAlertDialog(
title: '是否退出当前账号?',
buttonWidget: Container(
padding: EdgeInsetsGeometry.only(top: 16.w,
right: 30.w,
left: 30.w,
bottom: 32.w),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
TDButton(
text: '取 消',
width: 120,
size: TDButtonSize.large,
type: TDButtonType.fill,
shape: TDButtonShape.round,
theme: TDButtonTheme.defaultTheme,
onTap: () {
Navigator.of(context).pop();
},
),
TDButton(
text: '确 定',
width: 120,
size: TDButtonSize.large,
type: TDButtonType.fill,
shape: TDButtonShape.round,
theme: TDButtonTheme.danger,
onTap: () {
controller.logout();
Get.offAll(() => LoginPage());
},
),
],
),
)
);
},
);
},
const SizedBox(height: 12),
TDCellGroup(
theme: TDCellGroupTheme.cardTheme,
cells: [
TDCell(arrow: true, title: '退出登录', onClick: (cell){
showGeneralDialog(
context: context,
pageBuilder: (BuildContext buildContext, Animation<
double> animation,
Animation<double> secondaryAnimation) {
return TDAlertDialog(
title: '是否退出当前账号?',
buttonWidget: Container(
padding: EdgeInsetsGeometry.only(top: 16.w,
right: 30.w,
left: 30.w,
bottom: 32.w),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
TDButton(
text: '取 消',
width: 120,
size: TDButtonSize.large,
type: TDButtonType.fill,
shape: TDButtonShape.round,
theme: TDButtonTheme.defaultTheme,
onTap: () {
Navigator.of(context).pop();
},
),
TDButton(
text: '确 定',
width: 120,
size: TDButtonSize.large,
type: TDButtonType.fill,
shape: TDButtonShape.round,
theme: TDButtonTheme.danger,
onTap: () {
controller.logout();
Get.offAll(() => LoginPage());
},
),
],
),
)
);
},
);
},),
TDCell(arrow: true, title: '退出登录', titleWidget: Text(
"账号注销",
style: TextStyle(
color: const Color.fromRGBO(248, 85, 66, 1),
fontSize: TDTheme.of(context).fontBodyLarge?.size ?? 16,
height: TDTheme.of(context).fontBodyLarge?.height ?? 24,
fontWeight: FontWeight.w400,
),
), onClick: (cell){
showGeneralDialog(
context: context,
pageBuilder: (BuildContext buildContext, Animation<
double> animation,
Animation<double> secondaryAnimation) {
return TDAlertDialog(
title: '是否退出当前账号?',
buttonWidget: Container(
padding: EdgeInsetsGeometry.only(top: 16.w,
right: 30.w,
left: 30.w,
bottom: 32.w),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
TDButton(
text: '取 消',
width: 120,
size: TDButtonSize.large,
type: TDButtonType.fill,
shape: TDButtonShape.round,
theme: TDButtonTheme.defaultTheme,
onTap: () {
Navigator.of(context).pop();
},
),
TDButton(
text: '确 定',
width: 120,
size: TDButtonSize.large,
type: TDButtonType.fill,
shape: TDButtonShape.round,
theme: TDButtonTheme.danger,
onTap: () {
controller.logout();
Get.offAll(() => LoginPage());
},
),
],
),
)
);
},
);
},),
],
),
const SizedBox(height: 24),
],
);
}),

Loading…
Cancel
Save