71 lines
2.1 KiB
Dart
71 lines
2.1 KiB
Dart
import 'package:flutter/material.dart';
|
||
|
||
/// Vue 2 — squelette étape 3 ; détails complets à l’étape 4.
|
||
class ProfileScreen extends StatelessWidget {
|
||
const ProfileScreen({super.key, required this.user});
|
||
|
||
final Map<String, dynamic> user;
|
||
|
||
String? _imageUrl() {
|
||
final image = user['image'];
|
||
if (image is Map<String, dynamic>) {
|
||
final link = image['link'];
|
||
if (link is String && link.isNotEmpty) return link;
|
||
}
|
||
final url = user['image_url'];
|
||
if (url is String && url.isNotEmpty) return url;
|
||
return null;
|
||
}
|
||
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
final login = user['login']?.toString() ?? '?';
|
||
final imageUrl = _imageUrl();
|
||
|
||
return Scaffold(
|
||
appBar: AppBar(
|
||
title: Text(login),
|
||
backgroundColor: const Color(0xFF00BABC),
|
||
foregroundColor: Colors.black,
|
||
),
|
||
body: SingleChildScrollView(
|
||
padding: const EdgeInsets.all(24),
|
||
child: Column(
|
||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||
children: [
|
||
Center(
|
||
child: CircleAvatar(
|
||
radius: 56,
|
||
backgroundImage:
|
||
imageUrl != null ? NetworkImage(imageUrl) : null,
|
||
child: imageUrl == null
|
||
? Text(
|
||
login.isNotEmpty ? login[0].toUpperCase() : '?',
|
||
style: const TextStyle(fontSize: 32),
|
||
)
|
||
: null,
|
||
),
|
||
),
|
||
const SizedBox(height: 16),
|
||
Text(
|
||
login,
|
||
textAlign: TextAlign.center,
|
||
style: Theme.of(context).textTheme.headlineSmall,
|
||
),
|
||
const SizedBox(height: 24),
|
||
Text(
|
||
'Étape 4 à venir : email, level, skills, projets (dont failed), etc.',
|
||
style: Theme.of(context).textTheme.bodyMedium,
|
||
),
|
||
const SizedBox(height: 8),
|
||
Text(
|
||
'ID Intra : ${user['id'] ?? '—'}',
|
||
style: Theme.of(context).textTheme.bodySmall,
|
||
),
|
||
],
|
||
),
|
||
),
|
||
);
|
||
}
|
||
}
|