feat: enhance user avatar display with S3Image and initial-based fallback, improve socket reconnection logic, and update splash screen layout, assets, and Android permissions.
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:real_estate_mobile/core/constants/app_colors.dart';
|
||||
import 'package:real_estate_mobile/core/widgets/s3_image.dart';
|
||||
import 'package:real_estate_mobile/features/auth/presentation/providers/auth_provider.dart';
|
||||
import 'package:real_estate_mobile/features/notifications/presentation/providers/notification_provider.dart';
|
||||
|
||||
@@ -195,22 +196,16 @@ class _MenuDrawer extends ConsumerWidget {
|
||||
),
|
||||
),
|
||||
child: ClipOval(
|
||||
child: user.avatar != null
|
||||
? Image.network(
|
||||
user.avatar!,
|
||||
child: user.avatar != null &&
|
||||
user.avatar!.isNotEmpty
|
||||
? S3Image(
|
||||
imageUrl: user.avatar!,
|
||||
width: 70,
|
||||
height: 70,
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (context, error, stackTrace) =>
|
||||
const Icon(
|
||||
Icons.person,
|
||||
size: 36,
|
||||
color: AppColors.hintText,
|
||||
),
|
||||
errorWidget: (_) => _buildInitialAvatar(user.firstName),
|
||||
)
|
||||
: const Icon(
|
||||
Icons.person,
|
||||
size: 36,
|
||||
color: AppColors.hintText,
|
||||
),
|
||||
: _buildInitialAvatar(user.firstName),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
@@ -488,6 +483,28 @@ class _MenuDrawer extends ConsumerWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildInitialAvatar(String? firstName) {
|
||||
final initial = (firstName != null && firstName.isNotEmpty)
|
||||
? firstName[0].toUpperCase()
|
||||
: '?';
|
||||
return Container(
|
||||
width: 70,
|
||||
height: 70,
|
||||
color: AppColors.primaryDark.withValues(alpha: 0.1),
|
||||
child: Center(
|
||||
child: Text(
|
||||
initial,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Fractul',
|
||||
fontSize: 28,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppColors.primaryDark,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMenuItem(
|
||||
BuildContext context, {
|
||||
required IconData icon,
|
||||
|
||||
Reference in New Issue
Block a user