feat: profile page

This commit is contained in:
efrilm
2025-08-27 20:12:38 +07:00
parent 09d8f6af69
commit d3120c1bf2
8 changed files with 613 additions and 1 deletions
@@ -1,5 +1,8 @@
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../../../../common/theme/theme.dart';
@RoutePage()
class ProfilePage extends StatelessWidget {
@@ -7,6 +10,539 @@ class ProfilePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(child: Text('Profile Page'));
return Scaffold(
backgroundColor: AppColor.background,
appBar: AppBar(title: Text('Akun')),
body: SingleChildScrollView(
child: Column(
children: [
// Profile Header
Container(
width: double.infinity,
color: AppColor.white,
padding: const EdgeInsets.all(20),
child: Column(
children: [
// Profile Avatar & Info
Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: AppColor.primaryGradient,
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
borderRadius: BorderRadius.circular(16),
),
child: Stack(
children: [
// Background Pattern
Positioned(
top: -20,
right: -20,
child: Container(
width: 80,
height: 80,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: AppColor.white.withOpacity(0.1),
),
),
),
Positioned(
top: 30,
right: 20,
child: Container(
width: 40,
height: 40,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: AppColor.white.withOpacity(0.08),
),
),
),
Positioned(
bottom: -10,
left: -10,
child: Container(
width: 60,
height: 60,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: AppColor.white.withOpacity(0.06),
),
),
),
// Decorative Lines
Positioned(
top: 10,
left: -5,
child: Transform.rotate(
angle: 0.5,
child: Container(
width: 30,
height: 2,
decoration: BoxDecoration(
color: AppColor.white.withOpacity(0.15),
borderRadius: BorderRadius.circular(1),
),
),
),
),
Positioned(
bottom: 15,
right: 10,
child: Transform.rotate(
angle: -0.5,
child: Container(
width: 25,
height: 2,
decoration: BoxDecoration(
color: AppColor.white.withOpacity(0.15),
borderRadius: BorderRadius.circular(1),
),
),
),
),
// Main Content
Padding(
padding: const EdgeInsets.all(16.0),
child: Row(
children: [
// Avatar
Container(
width: 60,
height: 60,
decoration: BoxDecoration(
color: AppColor.white,
shape: BoxShape.circle,
boxShadow: [
BoxShadow(
color: AppColor.black.withOpacity(0.1),
blurRadius: 8,
offset: const Offset(0, 2),
),
],
),
child: Icon(
Icons.person,
size: 30,
color: AppColor.primary,
),
),
const SizedBox(width: 16),
// User Info
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'EFRIL',
style: AppStyle.lg.copyWith(
fontWeight: FontWeight.bold,
color: AppColor.white,
letterSpacing: 0.5,
),
),
const SizedBox(height: 4),
Text(
'+6283873987851',
style: AppStyle.sm.copyWith(
color: AppColor.white.withOpacity(0.9),
),
),
],
),
),
// Arrow Icon
Icon(
Icons.arrow_forward_ios,
color: AppColor.white,
size: 14,
),
],
),
),
],
),
),
const SizedBox(height: 20),
// Share the Sip Card
Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: AppColor.backgroundLight,
borderRadius: BorderRadius.circular(12),
border: Border.all(color: AppColor.borderLight),
),
child: Row(
children: [
// Share Icon
Container(
width: 40,
height: 40,
decoration: BoxDecoration(
color: AppColor.success.withOpacity(0.1),
borderRadius: BorderRadius.circular(8),
),
child: Icon(
Icons.share,
color: AppColor.success,
size: 20,
),
),
const SizedBox(width: 12),
// Share Info
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Share the Sip',
style: AppStyle.md.copyWith(
fontWeight: FontWeight.w600,
color: AppColor.textPrimary,
),
),
Text(
'Bagikan kode referral, dapatkan hadiah',
style: AppStyle.sm.copyWith(
color: AppColor.textSecondary,
),
),
],
),
),
Icon(
Icons.arrow_forward_ios,
color: AppColor.textSecondary,
size: 14,
),
],
),
),
],
),
),
const SizedBox(height: 8),
// Menu Items
Container(
color: AppColor.white,
child: Column(
children: [
_buildMenuItem(
icon: Icons.location_on_outlined,
title: 'Alamat Tersimpan',
onTap: () {},
),
_buildMenuItem(
icon: Icons.payment_outlined,
title: 'Pembayaran',
onTap: () {},
),
_buildMenuItem(
icon: Icons.help_outline,
title: 'Pusat Bantuan',
onTap: () {},
),
_buildMenuItem(
icon: Icons.settings_outlined,
title: 'Pengaturan',
onTap: () {},
showDivider: false,
),
],
),
),
const SizedBox(height: 8),
// Legal & Privacy Section
Container(
color: AppColor.white,
child: Column(
children: [
_buildMenuItem(
icon: Icons.description_outlined,
title: 'Syarat dan Ketentuan',
onTap: () {},
),
_buildMenuItem(
icon: Icons.privacy_tip_outlined,
title: 'Kebijakan Privasi',
onTap: () {},
showDivider: false,
),
],
),
),
const SizedBox(height: 8),
// Social Media Section
Container(
color: AppColor.white,
padding: const EdgeInsets.all(20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Media Sosial',
style: AppStyle.md.copyWith(
fontWeight: FontWeight.w600,
color: AppColor.textPrimary,
),
),
const SizedBox(height: 16),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
_buildSocialButton(
icon: Icons.camera_alt,
color: Colors.purple,
onTap: () => _launchSocialMedia('instagram'),
),
_buildSocialButton(
icon: Icons.facebook,
color: Colors.blue,
onTap: () => _launchSocialMedia('facebook'),
),
_buildSocialButton(
icon: Icons.play_arrow,
color: Colors.red,
onTap: () => _launchSocialMedia('youtube'),
),
_buildSocialButton(
icon: Icons.close,
color: Colors.black,
onTap: () => _launchSocialMedia('twitter'),
),
],
),
],
),
),
const SizedBox(height: 8),
// Customer Service Section
Container(
color: AppColor.white,
padding: const EdgeInsets.all(20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Butuh Bantuan?',
style: AppStyle.lg.copyWith(
fontWeight: FontWeight.w600,
color: AppColor.textPrimary,
),
),
const SizedBox(height: 8),
Text(
'Customer Service kami siap untuk membantu',
style: AppStyle.sm.copyWith(color: AppColor.textSecondary),
),
const SizedBox(height: 16),
// WhatsApp Customer Service
Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: AppColor.backgroundLight,
borderRadius: BorderRadius.circular(12),
border: Border.all(color: AppColor.borderLight),
),
child: Row(
children: [
Container(
width: 40,
height: 40,
decoration: BoxDecoration(
color: Colors.green,
borderRadius: BorderRadius.circular(8),
),
child: Icon(
Icons.chat,
color: AppColor.white,
size: 20,
),
),
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Fore Customer Service (chat only)',
style: AppStyle.sm.copyWith(
color: AppColor.textSecondary,
),
),
Text(
'0812-1111-8456',
style: AppStyle.md.copyWith(
fontWeight: FontWeight.w600,
color: AppColor.success,
),
),
],
),
),
Icon(
Icons.arrow_forward_ios,
color: AppColor.textSecondary,
size: 14,
),
],
),
),
],
),
),
const SizedBox(height: 20),
// Footer Section
Container(
color: AppColor.white,
padding: const EdgeInsets.all(20),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Version 4.6.1',
style: AppStyle.sm.copyWith(color: AppColor.textSecondary),
),
GestureDetector(
onTap: () => _showLogoutDialog(context),
child: Text(
'Logout',
style: AppStyle.sm.copyWith(
color: AppColor.primary,
fontWeight: FontWeight.w600,
),
),
),
],
),
),
const SizedBox(height: 100), // Bottom spacing
],
),
),
);
}
Widget _buildMenuItem({
required IconData icon,
required String title,
required VoidCallback onTap,
bool showDivider = true,
}) {
return Column(
children: [
ListTile(
leading: Icon(icon, color: AppColor.textSecondary, size: 24),
title: Text(
title,
style: AppStyle.md.copyWith(color: AppColor.textPrimary),
),
trailing: Icon(
Icons.arrow_forward_ios,
color: AppColor.textSecondary,
size: 16,
),
onTap: onTap,
contentPadding: const EdgeInsets.symmetric(
horizontal: 20,
vertical: 4,
),
),
if (showDivider)
Divider(height: 1, color: AppColor.borderLight, indent: 60),
],
);
}
Widget _buildSocialButton({
required IconData icon,
required Color color,
required VoidCallback onTap,
}) {
return GestureDetector(
onTap: onTap,
child: Container(
width: 48,
height: 48,
decoration: BoxDecoration(color: color, shape: BoxShape.circle),
child: Icon(icon, color: AppColor.white, size: 24),
),
);
}
void _launchSocialMedia(String platform) async {
String url = '';
switch (platform) {
case 'instagram':
url = 'https://instagram.com/';
break;
case 'facebook':
url = 'https://facebook.com/';
break;
case 'youtube':
url = 'https://youtube.com/';
break;
case 'twitter':
url = 'https://twitter.com/';
break;
}
if (await canLaunch(url)) {
await launch(url);
}
}
void _showLogoutDialog(BuildContext context) {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text(
'Logout',
style: AppStyle.lg.copyWith(fontWeight: FontWeight.w600),
),
content: Text(
'Apakah Anda yakin ingin keluar dari aplikasi?',
style: AppStyle.md,
),
actions: [
TextButton(
child: Text(
'Batal',
style: AppStyle.md.copyWith(color: AppColor.textSecondary),
),
onPressed: () => Navigator.of(context).pop(),
),
TextButton(
child: Text(
'Logout',
style: AppStyle.md.copyWith(
color: AppColor.primary,
fontWeight: FontWeight.w600,
),
),
onPressed: () {
Navigator.of(context).pop();
// Add logout logic here
// Example: context.router.pushAndClearStack('/login');
},
),
],
);
},
);
}
}