106 lines
3.3 KiB
Dart
106 lines
3.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:google_sign_in/google_sign_in.dart';
|
|
import 'package:pvt15/pages/profile_settings.dart';
|
|
|
|
class ProfilePage extends StatelessWidget {
|
|
final GoogleSignInAccount? user;
|
|
|
|
const ProfilePage({super.key, required this.user});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final name = user?.displayName ?? 'Ej inloggad';
|
|
|
|
return Scaffold(
|
|
appBar: AppBar(title: const Text('Profil')),
|
|
|
|
body: Container(
|
|
decoration: const BoxDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment.topCenter,
|
|
end: Alignment.bottomCenter,
|
|
colors: [Color(0xFFA800DB), Color(0xFFFF31E0)],
|
|
),
|
|
),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
ListView(
|
|
shrinkWrap: true,
|
|
padding: const EdgeInsets.all(16),
|
|
children: [
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
const Icon(
|
|
Icons.account_circle,
|
|
size: 96,
|
|
color: Colors.grey,
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
name,
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.white,
|
|
fontSize: 32,
|
|
),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
],
|
|
),
|
|
Container(
|
|
width: 32,
|
|
margin: const EdgeInsets.all(16),
|
|
decoration: BoxDecoration(
|
|
color: const Color.fromARGB(255, 255, 123, 167),
|
|
borderRadius: BorderRadius.circular(32),
|
|
),
|
|
child: ListTile(
|
|
leading: const Icon(Icons.settings, color: Colors.white),
|
|
title: const Text(
|
|
'Kontoinställningar',
|
|
style: TextStyle(color: Colors.white),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
onTap: () async {
|
|
Navigator.of(context).push(
|
|
MaterialPageRoute(
|
|
builder: (context) => ProfileSettings(user: user),
|
|
),
|
|
);
|
|
},
|
|
),
|
|
),
|
|
_statsCard(Icons.play_arrow, 'Spelade rundor:', Colors.amber),
|
|
_statsCard(
|
|
Icons.emoji_events,
|
|
'Slutförda utmaningar:',
|
|
Colors.amber,
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _statsCard(IconData icon, String text, Color iconColor) {
|
|
return Card(
|
|
color: Colors.white,
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(32)),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(16),
|
|
child: Column(
|
|
children: [
|
|
Icon(icon, size: 36, color: iconColor),
|
|
const SizedBox(height: 24),
|
|
Text(text),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|