fix
This commit is contained in:
@@ -412,7 +412,12 @@ class AgentDetailNotifier extends StateNotifier<AgentDetailState> {
|
||||
);
|
||||
} catch (e) {
|
||||
if (!mounted) return;
|
||||
state = state.copyWith(isLoading: false, error: e.toString());
|
||||
final errStr = e.toString();
|
||||
if (errStr.contains('403') || errStr.contains('Forbidden') || errStr.contains('permission') || errStr.contains('only visible')) {
|
||||
state = state.copyWith(isLoading: false, error: 'PERMISSION_DENIED');
|
||||
} else {
|
||||
state = state.copyWith(isLoading: false, error: errStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,27 +56,40 @@ class _AgentDetailScreenState extends ConsumerState<AgentDetailScreen> {
|
||||
}
|
||||
|
||||
Widget _buildError(String error) {
|
||||
final isPermissionError = error == 'PERMISSION_DENIED';
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.error_outline,
|
||||
Icon(
|
||||
isPermissionError ? Icons.lock_outline : Icons.error_outline,
|
||||
size: 48,
|
||||
color: AppColors.accentOrange,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const Text(
|
||||
'Unable to Load Profile',
|
||||
style: TextStyle(
|
||||
Text(
|
||||
isPermissionError ? 'Profile Not Available' : 'Unable to Load Profile',
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Fractul',
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppColors.primaryDark,
|
||||
),
|
||||
),
|
||||
if (isPermissionError) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'This profile is private. You don\u2019t have permission to view it.',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontFamily: 'SourceSerif4',
|
||||
fontSize: 14,
|
||||
color: AppColors.primaryDark.withValues(alpha: 0.7),
|
||||
),
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 12),
|
||||
TextButton(
|
||||
onPressed: () => context.pop(),
|
||||
@@ -1580,9 +1593,7 @@ class _SpecializationCardWidgetState extends State<_SpecializationCardWidget> {
|
||||
|
||||
return Container(
|
||||
width: 298,
|
||||
height: _expanded ? null : 236,
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
@@ -1592,7 +1603,7 @@ class _SpecializationCardWidgetState extends State<_SpecializationCardWidget> {
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: _expanded ? MainAxisSize.min : MainAxisSize.max,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(_icon, size: 32, color: AppColors.accentOrange),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
@@ -1215,16 +1215,14 @@ class _AgentHomeContentState extends ConsumerState<_AgentHomeContent> {
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 66, vertical: 8),
|
||||
width: 298,
|
||||
height: isExpanded ? null : 236,
|
||||
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 20),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
border: Border.all(color: AppColors.primaryDark, width: 0.7),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: isExpanded ? MainAxisSize.min : MainAxisSize.max,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(Icons.category_outlined,
|
||||
size: 28, color: AppColors.accentOrange),
|
||||
|
||||
Reference in New Issue
Block a user