Update codebase
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../../core/design/tokens.dart';
|
||||
import '../../../core/design/tripz_colors.dart';
|
||||
import '../../../core/design/typography.dart';
|
||||
import '../../../core/di.dart';
|
||||
import '../../../core/l10n/l10n.dart';
|
||||
import '../../../core/session/session_cubit.dart';
|
||||
@@ -54,6 +55,16 @@ class _ProfileEditPageState extends State<ProfileEditPage> {
|
||||
),
|
||||
child: ListView(
|
||||
children: [
|
||||
// ترويسة الحساب — الاسم والرقم والتقييم في مكان واحد.
|
||||
// **التقييم كان يصل ولا يُعرض أبداً**: `AppUser.rating` مقروء
|
||||
// من `GET /users/me` (docs/38 §2) ولم تكن أي شاشة تستعمله،
|
||||
// بينما الراكب يُقيَّم من السائق ويحقّ له أن يرى نتيجته.
|
||||
_ProfileHeader(
|
||||
name: user?.name ?? '',
|
||||
phone: user?.phone ?? '',
|
||||
rating: user?.rating,
|
||||
),
|
||||
const SizedBox(height: Space.lg),
|
||||
TripzTextField(
|
||||
controller: _name,
|
||||
label: l10n.profileNameLabel,
|
||||
@@ -91,3 +102,78 @@ class _ProfileEditPageState extends State<ProfileEditPage> {
|
||||
messenger.showSnackBar(SnackBar(content: Text(l10n.profileSaved)));
|
||||
}
|
||||
}
|
||||
|
||||
/// ترويسة الحساب: حرف الاسم الأول في دائرة، ثم الاسم والرقم والتقييم.
|
||||
///
|
||||
/// لا صورة شخصية: الخادم لا يوفّر رفع صور للمستخدم (سيرو يفعل عبر PHP)،
|
||||
/// وحرفُ الاسم أصدق من رمزٍ عام يوحي بإمكانية لا توجد.
|
||||
class _ProfileHeader extends StatelessWidget {
|
||||
const _ProfileHeader({
|
||||
required this.name,
|
||||
required this.phone,
|
||||
this.rating,
|
||||
});
|
||||
|
||||
final String name;
|
||||
final String phone;
|
||||
final String? rating;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final initial = name.trim().isEmpty ? '?' : name.trim().characters.first;
|
||||
return Row(
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 32,
|
||||
backgroundColor: context.colors.primaryContainer,
|
||||
child: Text(
|
||||
initial,
|
||||
style: context.texts.headlineSmall?.copyWith(
|
||||
color: context.colors.onPrimaryContainer,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: Space.md),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (name.trim().isNotEmpty)
|
||||
Text(
|
||||
name,
|
||||
style: context.texts.titleMedium,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
Text(
|
||||
phone,
|
||||
// الرقم يُقرأ يساراً-يميناً حتى في واجهة عربية.
|
||||
textDirection: TextDirection.ltr,
|
||||
style: numericStyle(context.texts.bodySmall).copyWith(
|
||||
color: context.colors.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
if (rating != null && rating!.isNotEmpty) ...[
|
||||
const SizedBox(height: Space.xxs),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.star_rounded,
|
||||
size: Sizes.iconSm,
|
||||
color: context.tripzColors.warning,
|
||||
),
|
||||
const SizedBox(width: Space.xxs),
|
||||
Text(
|
||||
rating!,
|
||||
style: numericStyle(context.texts.bodySmall),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user