修改导航栏组件自定义返回事件、增加完善资料返回事件

This commit is contained in:
CYH 2023-08-11 17:25:56 +03:00
parent 76969fa785
commit 39cc3a830f
3 changed files with 31 additions and 8 deletions

View File

@ -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(

View File

@ -450,13 +450,15 @@ class _TIMConversationState extends TIMUIKitState<TIMConversation> {
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;
}
}
}

View File

@ -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);