import 'package:agrilink_vocpro/core/constant/app_color.dart'; import 'package:agrilink_vocpro/core/constant/app_theme.dart'; import 'package:agrilink_vocpro/core/route/app_route.dart'; import 'package:agrilink_vocpro/core/state/result_state.dart'; import 'package:agrilink_vocpro/features/setting/provider/setting_provider.dart'; import 'package:bootstrap_icons/bootstrap_icons.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:go_router/go_router.dart'; import 'package:provider/provider.dart'; class SettingScreen extends StatelessWidget { const SettingScreen({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Setting', style: AppTheme.labelMedium), centerTitle: true, backgroundColor: Colors.white, scrolledUnderElevation: 0, ), body: Consumer(builder: (context, provider, child) { return SafeArea( child: ListView( padding: EdgeInsets.all(16.r), children: [ Row( children: [ const CircleAvatar( radius: 30, backgroundColor: AppColor.secondary, child: Icon(BootstrapIcons.person_fill, color: Colors.white), ), SizedBox(width: 8.w), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(provider.userFullName, style: AppTheme.labelMedium), Text(provider.userEmail, style: AppTheme.labelSmall) ], ) ], ), SizedBox(height: 16.h), Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(8.r), ), child: Column( children: [ ListTile( tileColor: Colors.white, title: Text('Account', style: AppTheme.labelSmall .copyWith(color: Colors.black87)), leading: const Icon(BootstrapIcons.person), trailing: Icon( Icons.arrow_forward_ios, size: 16.r, ), onTap: () {}, ), ListTile( tileColor: Colors.white, title: Text('Kebijakan & privasi', style: AppTheme.labelSmall .copyWith(color: Colors.black87)), leading: const Icon(BootstrapIcons.shield_check), trailing: Icon( Icons.arrow_forward_ios, size: 16.r, ), onTap: () {}, ), ListTile( tileColor: Colors.white, title: Text('Syarat & ketentuan', style: AppTheme.labelSmall .copyWith(color: Colors.black87)), leading: const Icon(BootstrapIcons.file_text), trailing: Icon( Icons.arrow_forward_ios, size: 16.r, ), onTap: () {}, ), ListTile( tileColor: Colors.white, title: Text('Logout', style: AppTheme.labelSmall.copyWith(color: Colors.red)), leading: const Icon( BootstrapIcons.box_arrow_right, color: Colors.red, ), trailing: Icon( Icons.arrow_forward_ios, size: 16.r, ), onTap: () { showDialog( context: context, builder: (context) => AlertDialog( title: Text('Logout'), content: Text('Apakah anda yakin ingin logout?'), actions: [ TextButton( child: Text('Batal'), onPressed: () { Navigator.pop(context); }, ), TextButton( child: Text('Ya'), onPressed: () async { await provider.logout(); if (context.mounted) { if (provider.logoutState == ResultState.hasData) { context.go(AppRoute.root); } } }, ), ], ), ); }, ), ], ), ), ], )); }), ); } }