fix
This commit is contained in:
@@ -412,7 +412,12 @@ class AgentDetailNotifier extends StateNotifier<AgentDetailState> {
|
|||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (!mounted) return;
|
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) {
|
Widget _buildError(String error) {
|
||||||
|
final isPermissionError = error == 'PERMISSION_DENIED';
|
||||||
return Center(
|
return Center(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(24),
|
padding: const EdgeInsets.all(24),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
const Icon(
|
Icon(
|
||||||
Icons.error_outline,
|
isPermissionError ? Icons.lock_outline : Icons.error_outline,
|
||||||
size: 48,
|
size: 48,
|
||||||
color: AppColors.accentOrange,
|
color: AppColors.accentOrange,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
const Text(
|
Text(
|
||||||
'Unable to Load Profile',
|
isPermissionError ? 'Profile Not Available' : 'Unable to Load Profile',
|
||||||
style: TextStyle(
|
style: const TextStyle(
|
||||||
fontFamily: 'Fractul',
|
fontFamily: 'Fractul',
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w700,
|
||||||
color: AppColors.primaryDark,
|
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),
|
const SizedBox(height: 12),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => context.pop(),
|
onPressed: () => context.pop(),
|
||||||
@@ -1580,9 +1593,7 @@ class _SpecializationCardWidgetState extends State<_SpecializationCardWidget> {
|
|||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
width: 298,
|
width: 298,
|
||||||
height: _expanded ? null : 236,
|
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||||
clipBehavior: Clip.antiAlias,
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius: BorderRadius.circular(15),
|
borderRadius: BorderRadius.circular(15),
|
||||||
@@ -1592,7 +1603,7 @@ class _SpecializationCardWidgetState extends State<_SpecializationCardWidget> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: _expanded ? MainAxisSize.min : MainAxisSize.max,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Icon(_icon, size: 32, color: AppColors.accentOrange),
|
Icon(_icon, size: 32, color: AppColors.accentOrange),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
|
|||||||
@@ -1215,16 +1215,14 @@ class _AgentHomeContentState extends ConsumerState<_AgentHomeContent> {
|
|||||||
return Container(
|
return Container(
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 66, vertical: 8),
|
margin: const EdgeInsets.symmetric(horizontal: 66, vertical: 8),
|
||||||
width: 298,
|
width: 298,
|
||||||
height: isExpanded ? null : 236,
|
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 20),
|
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 20),
|
||||||
clipBehavior: Clip.antiAlias,
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius: BorderRadius.circular(15),
|
borderRadius: BorderRadius.circular(15),
|
||||||
border: Border.all(color: AppColors.primaryDark, width: 0.7),
|
border: Border.all(color: AppColors.primaryDark, width: 0.7),
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: isExpanded ? MainAxisSize.min : MainAxisSize.max,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
const Icon(Icons.category_outlined,
|
const Icon(Icons.category_outlined,
|
||||||
size: 28, color: AppColors.accentOrange),
|
size: 28, color: AppColors.accentOrange),
|
||||||
|
|||||||
Reference in New Issue
Block a user