修复 修改名称 无token不退出登录的逻辑

This commit is contained in:
mmc
2026-03-05 09:22:28 +08:00
parent ac9ee670ec
commit 612b128f7a
2 changed files with 17 additions and 3 deletions

View File

@@ -1,6 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_webrtc/flutter_webrtc.dart';
import 'package:go_router/go_router.dart';
import 'package:maibu_satabot_v2/core/router/route_paths.dart';
import 'package:maibu_satabot_v2/features/devices/presentation/bloc/devices_cubit.dart';
import 'package:maibu_satabot_v2/features/my/presentation/bloc/my_cubit.dart';
import 'package:maibu_satabot_v2/features/my/presentation/bloc/my_state.dart';
@@ -67,6 +69,9 @@ class _UserInfoCardState extends State<UserInfoCard> {
child: BlocBuilder<MyCubit, MyState>(
builder: (context, myState) {
final cubit = context.read<MyCubit>();
if (myState.errorMessage == '登录状态失效,请重新登录') {
context.go(RoutePaths.login);
}
return Padding(
padding: EdgeInsets.only(left: 16, right: 16, top: 20, bottom: MediaQuery.of(context).viewInsets.bottom + 80),
@@ -150,7 +155,7 @@ class _UserInfoCardState extends State<UserInfoCard> {
// 提交新昵称的业务逻辑
Future<void> _submitNewNickname(BuildContext context) async {
final newNickname = _nicknameController.text.trim();
if (newNickname.isEmpty ) {
if (newNickname.isEmpty) {
Navigator.pop(context);
return;
}