💄 Optimize unauthorized status

This commit is contained in:
2026-01-02 14:33:41 +08:00
parent 3b13a63e7b
commit 800815c721
4 changed files with 84 additions and 34 deletions

View File

@@ -358,7 +358,7 @@
"accountSettingsHelp": "Account Settings Help",
"accountSettingsHelpContent": "This page allows you to manage your account security, privacy, and other settings. If you need assistance, please contact support.",
"unauthorized": "Unauthorized",
"unauthorizedHint": "You're not signed in or session expired, please sign in again.",
"unauthorizedHint": "You're not signed in or session expired, please sign in and try again.",
"publisherBelongsTo": "Belongs to {}",
"postContent": "Content",
"postSettings": "Settings",

View File

@@ -603,7 +603,9 @@ class ChatListScreen extends HookConsumerWidget {
),
),
),
body: ChatListBodyWidget(
body: userInfo.value == null
? const ResponseUnauthorizedWidget()
: ChatListBodyWidget(
isFloating: false,
tabController: tabController,
selectedTab: selectedTab,

View File

@@ -121,7 +121,9 @@ class RealmListScreen extends HookConsumerWidget {
MediaQuery.of(context).padding.bottom,
)
: null,
body: ExtendedRefreshIndicator(
body: userInfo.value == null
? const ResponseUnauthorizedWidget()
: ExtendedRefreshIndicator(
child: realms.when(
data: (value) => Column(
children: [

View File

@@ -2,6 +2,7 @@ import 'package:dio/dio.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:island/screens/auth/login_modal.dart';
import 'package:material_symbols_icons/symbols.dart';
import 'package:styled_widget/styled_widget.dart';
@@ -73,3 +74,48 @@ class ResponseLoadingWidget extends StatelessWidget {
return const Center(child: CircularProgressIndicator());
}
}
class ResponseUnauthorizedWidget extends StatelessWidget {
const ResponseUnauthorizedWidget({super.key});
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(Symbols.error_outline, size: 48),
const Gap(4),
ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 320),
child: Column(
children: [
Text(
'unauthorized'.tr(),
textAlign: TextAlign.center,
style: const TextStyle(color: Color(0xFF757575)),
).bold(),
Text(
'unauthorizedHint'.tr(),
textAlign: TextAlign.center,
style: const TextStyle(color: Color(0xFF757575)),
),
const Gap(8),
TextButton.icon(
onPressed: () {
showModalBottomSheet(
context: context,
useRootNavigator: true,
isScrollControlled: true,
builder: (context) => const LoginModal(),
);
},
icon: const Icon(Symbols.login),
label: Text('login').tr(),
),
],
),
).center(),
],
);
}
}