State Is Authenticated
This commit is contained in:
parent
3c596461c6
commit
a5d66c63b7
@ -1,13 +1,26 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../../application/auth/auth_bloc.dart';
|
||||
import '../../router/app_router.gr.dart';
|
||||
import 'widgets/bottom_navbar.dart';
|
||||
|
||||
@RoutePage()
|
||||
class MainPage extends StatelessWidget {
|
||||
class MainPage extends StatefulWidget {
|
||||
const MainPage({super.key});
|
||||
|
||||
@override
|
||||
State<MainPage> createState() => _MainPageState();
|
||||
}
|
||||
|
||||
class _MainPageState extends State<MainPage> {
|
||||
@override
|
||||
initState() {
|
||||
super.initState();
|
||||
context.read<AuthBloc>().add(const AuthEvent.fetchCurrentUser());
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AutoTabsRouter.pageView(
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import '../../../../../../application/auth/auth_bloc.dart';
|
||||
import '../../../../../router/app_router.gr.dart';
|
||||
import 'feature_card.dart';
|
||||
|
||||
@ -8,37 +10,43 @@ class HomeFeatureSection extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
HomeFeatureCard(
|
||||
icon: Icons.card_giftcard,
|
||||
title: 'Reward',
|
||||
iconColor: const Color(0xFF1976D2),
|
||||
onTap: () => context.router.push(RewardRoute()),
|
||||
return BlocBuilder<AuthBloc, AuthState>(
|
||||
builder: (context, state) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
HomeFeatureCard(
|
||||
icon: Icons.card_giftcard,
|
||||
title: 'Reward',
|
||||
iconColor: const Color(0xFF1976D2),
|
||||
onTap: () => context.router.push(RewardRoute()),
|
||||
),
|
||||
HomeFeatureCard(
|
||||
icon: Icons.casino,
|
||||
title: 'Undian',
|
||||
iconColor: const Color(0xFF7B1FA2),
|
||||
onTap: () => context.router.push(DrawRoute()),
|
||||
),
|
||||
HomeFeatureCard(
|
||||
icon: Icons.store,
|
||||
title: 'Merchant',
|
||||
iconColor: const Color(0xFF388E3C),
|
||||
onTap: () => context.router.push(MerchantRoute()),
|
||||
),
|
||||
HomeFeatureCard(
|
||||
icon: Icons.blur_circular,
|
||||
title: 'Wheels',
|
||||
iconColor: const Color(0xFF388E3C),
|
||||
onTap: () => state.isAuthenticated
|
||||
? context.router.push(FerrisWheelRoute())
|
||||
: context.router.push(OnboardingRoute()),
|
||||
),
|
||||
],
|
||||
),
|
||||
HomeFeatureCard(
|
||||
icon: Icons.casino,
|
||||
title: 'Undian',
|
||||
iconColor: const Color(0xFF7B1FA2),
|
||||
onTap: () => context.router.push(DrawRoute()),
|
||||
),
|
||||
HomeFeatureCard(
|
||||
icon: Icons.store,
|
||||
title: 'Merchant',
|
||||
iconColor: const Color(0xFF388E3C),
|
||||
onTap: () => context.router.push(MerchantRoute()),
|
||||
),
|
||||
HomeFeatureCard(
|
||||
icon: Icons.blur_circular,
|
||||
title: 'Wheels',
|
||||
iconColor: const Color(0xFF388E3C),
|
||||
onTap: () => context.router.push(FerrisWheelRoute()),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../../../../../application/auth/auth_bloc.dart';
|
||||
import '../../../../../../common/theme/theme.dart';
|
||||
import '../../../../../router/app_router.gr.dart';
|
||||
|
||||
@ -9,137 +11,160 @@ class HomePointCard extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () => context.router.push(PoinRoute()),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColor.textLight.withOpacity(0.15),
|
||||
spreadRadius: 0,
|
||||
blurRadius: 20,
|
||||
offset: const Offset(0, 8),
|
||||
return BlocBuilder<AuthBloc, AuthState>(
|
||||
builder: (context, state) {
|
||||
return GestureDetector(
|
||||
onTap: () => state.isAuthenticated
|
||||
? context.router.push(PoinRoute())
|
||||
: context.router.push(OnboardingRoute()),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColor.textLight.withOpacity(0.15),
|
||||
spreadRadius: 0,
|
||||
blurRadius: 20,
|
||||
offset: const Offset(0, 8),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Stack(
|
||||
children: [
|
||||
_buildCoinPattern(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
child: Stack(
|
||||
children: [
|
||||
_buildCoinPattern(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 10,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.primary,
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.stars,
|
||||
color: AppColor.white,
|
||||
size: 18,
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Text(
|
||||
'148 Poin',
|
||||
style: AppStyle.md.copyWith(
|
||||
color: AppColor.white,
|
||||
fontWeight: FontWeight.w600,
|
||||
!state.isAuthenticated
|
||||
? Expanded(
|
||||
child: Text(
|
||||
'Hi, Selamat Datang Di Enaklo',
|
||||
style: AppStyle.md.copyWith(
|
||||
color: AppColor.primary,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
)
|
||||
: Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 10,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.primary,
|
||||
borderRadius: BorderRadius.circular(
|
||||
25,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.stars,
|
||||
color: AppColor.white,
|
||||
size: 18,
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Text(
|
||||
'148 Poin',
|
||||
style: AppStyle.md.copyWith(
|
||||
color: AppColor.white,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'Kamu punya 148 poin',
|
||||
style: AppStyle.sm.copyWith(
|
||||
color: AppColor.textSecondary,
|
||||
fontSize: 11,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
width: 120,
|
||||
height: 40,
|
||||
child: Stack(
|
||||
children: [
|
||||
_buildCoin(
|
||||
right: 0,
|
||||
top: 0,
|
||||
size: 24,
|
||||
color: Colors.amber,
|
||||
),
|
||||
_buildCoin(
|
||||
right: 20,
|
||||
top: 8,
|
||||
size: 20,
|
||||
color: Colors.orange,
|
||||
),
|
||||
_buildCoin(
|
||||
right: 40,
|
||||
top: 4,
|
||||
size: 18,
|
||||
color: Colors.amber,
|
||||
),
|
||||
_buildCoin(
|
||||
right: 60,
|
||||
top: 12,
|
||||
size: 16,
|
||||
color: Colors.orange,
|
||||
),
|
||||
_buildCoin(
|
||||
right: 80,
|
||||
top: 8,
|
||||
size: 14,
|
||||
color: Colors.amber,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
'Kamu punya 148 poin',
|
||||
state.isAuthenticated
|
||||
? 'Tukarkan poinmu dengan hadiah menarik'
|
||||
: 'Silahkan login untuk tukarkan poinmu',
|
||||
style: AppStyle.sm.copyWith(
|
||||
color: AppColor.textSecondary,
|
||||
fontSize: 11,
|
||||
color: AppColor.textPrimary,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
color: AppColor.textSecondary,
|
||||
size: 16,
|
||||
),
|
||||
],
|
||||
),
|
||||
const Spacer(),
|
||||
SizedBox(
|
||||
width: 120,
|
||||
height: 40,
|
||||
child: Stack(
|
||||
children: [
|
||||
_buildCoin(
|
||||
right: 0,
|
||||
top: 0,
|
||||
size: 24,
|
||||
color: Colors.amber,
|
||||
),
|
||||
_buildCoin(
|
||||
right: 20,
|
||||
top: 8,
|
||||
size: 20,
|
||||
color: Colors.orange,
|
||||
),
|
||||
_buildCoin(
|
||||
right: 40,
|
||||
top: 4,
|
||||
size: 18,
|
||||
color: Colors.amber,
|
||||
),
|
||||
_buildCoin(
|
||||
right: 60,
|
||||
top: 12,
|
||||
size: 16,
|
||||
color: Colors.orange,
|
||||
),
|
||||
_buildCoin(
|
||||
right: 80,
|
||||
top: 8,
|
||||
size: 14,
|
||||
color: Colors.amber,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
'Tukarkan poinmu dengan hadiah menarik',
|
||||
style: AppStyle.sm.copyWith(
|
||||
color: AppColor.textPrimary,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
color: AppColor.textSecondary,
|
||||
size: 16,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../../../../application/auth/auth_bloc.dart';
|
||||
import '../../../../../application/auth/logout_form/logout_form_bloc.dart';
|
||||
import '../../../../../common/theme/theme.dart';
|
||||
import '../../../../../injection.dart';
|
||||
@ -20,7 +21,7 @@ class ProfilePage extends StatelessWidget implements AutoRouteWrapper {
|
||||
() => null,
|
||||
(either) => either.fold(
|
||||
(f) => AppFlushbar.showAuthFailureToast(context, f),
|
||||
(_) => context.router.replaceAll([LoginRoute()]),
|
||||
(_) => context.router.replaceAll([OnboardingRoute()]),
|
||||
),
|
||||
);
|
||||
},
|
||||
@ -28,341 +29,363 @@ class ProfilePage extends StatelessWidget implements AutoRouteWrapper {
|
||||
child: Scaffold(
|
||||
backgroundColor: AppColor.background,
|
||||
appBar: AppBar(title: Text('Profil'), automaticallyImplyLeading: false),
|
||||
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
|
||||
GestureDetector(
|
||||
onTap: () => context.router.push(AccountMyRoute()),
|
||||
child: 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),
|
||||
),
|
||||
body: BlocBuilder<AuthBloc, AuthState>(
|
||||
builder: (context, state) {
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
// Profile Header
|
||||
Container(
|
||||
width: double.infinity,
|
||||
color: AppColor.white,
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
children: [
|
||||
// Profile Avatar & Info
|
||||
GestureDetector(
|
||||
onTap: () => state.isAuthenticated
|
||||
? context.router.push(AccountMyRoute())
|
||||
: context.router.push(OnboardingRoute()),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: AppColor.primaryGradient,
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
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),
|
||||
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(
|
||||
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),
|
||||
Positioned(
|
||||
top: 30,
|
||||
right: 20,
|
||||
child: Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: AppColor.white.withOpacity(0.08),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// Main Content
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Row(
|
||||
children: [
|
||||
// Avatar
|
||||
Container(
|
||||
Positioned(
|
||||
bottom: -10,
|
||||
left: -10,
|
||||
child: 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),
|
||||
),
|
||||
],
|
||||
color: AppColor.white.withOpacity(0.06),
|
||||
),
|
||||
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: 8),
|
||||
|
||||
// Menu Items
|
||||
Container(
|
||||
color: AppColor.white,
|
||||
child: Column(
|
||||
children: [
|
||||
_buildMenuItem(
|
||||
icon: Icons.location_on_outlined,
|
||||
title: 'Alamat Tersimpan',
|
||||
onTap: () => context.router.push(AddressRoute()),
|
||||
),
|
||||
_buildMenuItem(
|
||||
icon: Icons.payment_outlined,
|
||||
title: 'Pembayaran',
|
||||
onTap: () => context.router.push(PaymentRoute()),
|
||||
),
|
||||
_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),
|
||||
|
||||
// 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(
|
||||
'Enaklo 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,
|
||||
// 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: !state.isAuthenticated
|
||||
? Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Silahkan Masuk',
|
||||
style: AppStyle.lg.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColor.white,
|
||||
letterSpacing: 0.5,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
: 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(
|
||||
state.user.name,
|
||||
style: AppStyle.lg.copyWith(
|
||||
fontWeight:
|
||||
FontWeight.bold,
|
||||
color: AppColor.white,
|
||||
letterSpacing: 0.5,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
state.user.phoneNumber,
|
||||
style: AppStyle.sm.copyWith(
|
||||
color: AppColor.white
|
||||
.withOpacity(0.9),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// Arrow Icon
|
||||
Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
color: AppColor.white,
|
||||
size: 14,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
color: AppColor.textSecondary,
|
||||
size: 14,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 8),
|
||||
|
||||
// Menu Items
|
||||
if (state.isAuthenticated) ...[
|
||||
Container(
|
||||
color: AppColor.white,
|
||||
child: Column(
|
||||
children: [
|
||||
_buildMenuItem(
|
||||
icon: Icons.location_on_outlined,
|
||||
title: 'Alamat Tersimpan',
|
||||
onTap: () => context.router.push(AddressRoute()),
|
||||
),
|
||||
_buildMenuItem(
|
||||
icon: Icons.payment_outlined,
|
||||
title: 'Pembayaran',
|
||||
onTap: () => context.router.push(PaymentRoute()),
|
||||
),
|
||||
_buildMenuItem(
|
||||
icon: Icons.help_outline,
|
||||
title: 'Pusat Bantuan',
|
||||
onTap: () {},
|
||||
),
|
||||
_buildMenuItem(
|
||||
icon: Icons.settings_outlined,
|
||||
title: 'Pengaturan',
|
||||
onTap: () {},
|
||||
showDivider: false,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 20),
|
||||
// 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,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// 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,
|
||||
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(
|
||||
'Enaklo 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
|
||||
if (state.isAuthenticated)
|
||||
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,
|
||||
onLogout: () => context
|
||||
.read<LogoutFormBloc>()
|
||||
.add(const LogoutFormEvent.submitted()),
|
||||
),
|
||||
child: Text(
|
||||
'Logout',
|
||||
style: AppStyle.sm.copyWith(
|
||||
color: AppColor.primary,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () => _showLogoutDialog(
|
||||
context,
|
||||
onLogout: () => context.read<LogoutFormBloc>().add(
|
||||
const LogoutFormEvent.submitted(),
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
'Logout',
|
||||
style: AppStyle.sm.copyWith(
|
||||
color: AppColor.primary,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 100), // Bottom spacing
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 100), // Bottom spacing
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user