From 39cc3a830f70a2cde5f923df787247289074cc35 Mon Sep 17 00:00:00 2001 From: CYH <13923927013@163.com> Date: Fri, 11 Aug 2023 17:25:56 +0300 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AF=BC=E8=88=AA=E6=A0=8F?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E8=87=AA=E5=AE=9A=E4=B9=89=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E3=80=81=E5=A2=9E=E5=8A=A0=E5=AE=8C=E5=96=84?= =?UTF-8?q?=E8=B5=84=E6=96=99=E8=BF=94=E5=9B=9E=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/app/login/complete_material/view.dart | 12 +++++++++++- .../tim_uikit_conversation.dart | 12 +++++++----- circle_app/lib/components/my_app_bar.dart | 15 +++++++++++++-- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/circle_app/lib/app/login/complete_material/view.dart b/circle_app/lib/app/login/complete_material/view.dart index c63e08f..fb439cf 100644 --- a/circle_app/lib/app/login/complete_material/view.dart +++ b/circle_app/lib/app/login/complete_material/view.dart @@ -34,9 +34,19 @@ class Complete_materialPage extends StatelessWidget { ), ), Scaffold( - appBar: const MyAppBar( + appBar: MyAppBar( centerTitle: '完善您的个人形象', isBack: true, + isDiyBack: true, + backPressed: () async { + final isBack = await Navigator.maybePop(context); + if (isBack) { + + } else { + Get.offNamed(AppRoutes.Login); + } + + } ), backgroundColor: Colors.transparent, body: GestureDetector( diff --git a/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation.dart b/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation.dart index b2ead9b..7d89586 100644 --- a/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation.dart +++ b/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation.dart @@ -450,13 +450,15 @@ class _TIMConversationState extends TIMUIKitState { var otherInfo = jsonDecode(userFullInfo! .customInfo!['Label'] .toString()); - var myInfo = jsonDecode(myuserFullInfo! + Map myInfo = jsonDecode(myuserFullInfo! .customInfo!['Label'] .toString()); - if (myInfo['city'] - .toString() - .contains(otherInfo['city'].toString())) { - isSameCity = true; + if (myInfo.containsKey('city')) { + if (myInfo['city'] + .toString() + .contains(otherInfo['city'].toString())) { + isSameCity = true; + } } } diff --git a/circle_app/lib/components/my_app_bar.dart b/circle_app/lib/components/my_app_bar.dart index 63f155e..58f7b9d 100644 --- a/circle_app/lib/components/my_app_bar.dart +++ b/circle_app/lib/components/my_app_bar.dart @@ -1,7 +1,9 @@ +import 'package:circle_app/router/app_routers.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; /// 自定义AppBar class MyAppBar extends StatelessWidget implements PreferredSizeWidget { @@ -16,6 +18,7 @@ class MyAppBar extends StatelessWidget implements PreferredSizeWidget { this.backImgColor, this.onPressed, this.isDiyBack = false, + this.backPressed, this.onCenterTitlePressed, this.superContext, this.isBack = true @@ -31,6 +34,8 @@ class MyAppBar extends StatelessWidget implements PreferredSizeWidget { final VoidCallback? onCenterTitlePressed; final bool isBack; final bool isDiyBack; + + final VoidCallback? backPressed; final BuildContext? superContext; @override @@ -46,9 +51,15 @@ class MyAppBar extends StatelessWidget implements PreferredSizeWidget { ); final Widget back = isBack ? IconButton( - onPressed: () async { + onPressed: isDiyBack ? backPressed : () async { if (isDiyBack) { - Navigator.pop(superContext!); + if (backPressed != null) { + + + } else { + Navigator.pop(superContext!); + } + } else { FocusManager.instance.primaryFocus?.unfocus(); final isBack = await Navigator.maybePop(context);