refactoring
This commit is contained in:
@@ -52,7 +52,7 @@ class _PrivacySettingsPageState extends State<PrivacySettingsPage> {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(message),
|
||||
backgroundColor: const Color(0xFF00B894),
|
||||
backgroundColor: AppColors.success,
|
||||
behavior: SnackBarBehavior.floating,
|
||||
),
|
||||
);
|
||||
@@ -61,7 +61,7 @@ class _PrivacySettingsPageState extends State<PrivacySettingsPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFFF8F9FA),
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
body: Column(
|
||||
children: [
|
||||
_buildHeader(),
|
||||
@@ -70,11 +70,11 @@ class _PrivacySettingsPageState extends State<PrivacySettingsPage> {
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
_buildVisibilitySection(),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
_buildDataSection(),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
_buildDangerSection(),
|
||||
const SizedBox(height: 80),
|
||||
],
|
||||
@@ -92,14 +92,14 @@ class _PrivacySettingsPageState extends State<PrivacySettingsPage> {
|
||||
padding: const EdgeInsets.all(SpacingTokens.xxl),
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
colors: ColorTokens.primaryGradient,
|
||||
colors: [AppColors.brandGreen, AppColors.primaryGreen],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(SpacingTokens.xl),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: ColorTokens.primary.withOpacity(0.3),
|
||||
color: AppColors.primaryGreen.withOpacity(0.3),
|
||||
blurRadius: 20,
|
||||
offset: const Offset(0, 8),
|
||||
),
|
||||
@@ -114,12 +114,12 @@ class _PrivacySettingsPageState extends State<PrivacySettingsPage> {
|
||||
icon: const Icon(Icons.arrow_back, color: Colors.white),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: const Icon(Icons.privacy_tip, color: Colors.white, size: 24),
|
||||
child: const Icon(Icons.privacy_tip, color: Colors.white, size: 20),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
const Expanded(
|
||||
@@ -218,12 +218,12 @@ class _PrivacySettingsPageState extends State<PrivacySettingsPage> {
|
||||
[
|
||||
InkWell(
|
||||
onTap: _showDeleteAccountDialog,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 7),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red.withOpacity(0.05),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: Colors.red.withOpacity(0.2)),
|
||||
),
|
||||
child: Row(
|
||||
@@ -242,14 +242,21 @@ class _PrivacySettingsPageState extends State<PrivacySettingsPage> {
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Supprimer définitivement toutes vos données',
|
||||
style: TextStyle(fontSize: 12, color: Colors.grey[600]),
|
||||
Builder(
|
||||
builder: (ctx) {
|
||||
final isDark = Theme.of(ctx).brightness == Brightness.dark;
|
||||
return Text(
|
||||
'Supprimer définitivement toutes vos données',
|
||||
style: AppTypography.subtitleSmall.copyWith(
|
||||
color: isDark ? AppColors.textSecondaryDark : AppColors.textSecondaryLight,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Icon(Icons.arrow_forward_ios, color: Colors.grey[400], size: 16),
|
||||
const Icon(Icons.arrow_forward_ios, color: Colors.red, size: 16),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -295,25 +302,21 @@ class _PrivacySettingsPageState extends State<PrivacySettingsPage> {
|
||||
}
|
||||
|
||||
Widget _buildSection(String title, String subtitle, IconData icon, List<Widget> children) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final textPrimary = isDark ? AppColors.textPrimaryDark : AppColors.textPrimaryLight;
|
||||
final textSecondary = isDark ? AppColors.textSecondaryDark : AppColors.textSecondaryLight;
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.05),
|
||||
blurRadius: 10,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
color: isDark ? AppColors.darkSurface : Colors.white,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(icon, color: Colors.grey[600], size: 20),
|
||||
Icon(icon, color: textSecondary, size: 20),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Column(
|
||||
@@ -321,24 +324,20 @@ class _PrivacySettingsPageState extends State<PrivacySettingsPage> {
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.grey[800],
|
||||
),
|
||||
style: AppTypography.headerSmall.copyWith(fontWeight: FontWeight.w600, color: textPrimary),
|
||||
),
|
||||
Text(
|
||||
subtitle,
|
||||
style: TextStyle(fontSize: 12, color: Colors.grey[600]),
|
||||
style: AppTypography.subtitleSmall.copyWith(color: textSecondary),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
...children.map((child) => Padding(
|
||||
padding: const EdgeInsets.only(bottom: 12),
|
||||
padding: const EdgeInsets.only(bottom: 6),
|
||||
child: child,
|
||||
)),
|
||||
],
|
||||
@@ -352,15 +351,18 @@ class _PrivacySettingsPageState extends State<PrivacySettingsPage> {
|
||||
bool value,
|
||||
ValueChanged<bool> onChanged,
|
||||
) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final textPrimary = isDark ? AppColors.textPrimaryDark : AppColors.textPrimaryLight;
|
||||
final textSecondary = isDark ? AppColors.textSecondaryDark : AppColors.textSecondaryLight;
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 7),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey[50],
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
color: isDark ? AppColors.darkBackground : Colors.grey[50],
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.toggle_on, color: ColorTokens.primary, size: 20),
|
||||
const Icon(Icons.toggle_on, color: AppColors.primaryGreen, size: 20),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
@@ -368,15 +370,11 @@ class _PrivacySettingsPageState extends State<PrivacySettingsPage> {
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF1F2937),
|
||||
),
|
||||
style: AppTypography.bodyTextSmall.copyWith(fontWeight: FontWeight.w600, color: textPrimary),
|
||||
),
|
||||
Text(
|
||||
subtitle,
|
||||
style: TextStyle(fontSize: 12, color: Colors.grey[600]),
|
||||
style: AppTypography.subtitleSmall.copyWith(color: textSecondary),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -384,7 +382,7 @@ class _PrivacySettingsPageState extends State<PrivacySettingsPage> {
|
||||
Switch(
|
||||
value: value,
|
||||
onChanged: onChanged,
|
||||
activeTrackColor: ColorTokens.primary,
|
||||
activeTrackColor: AppColors.primaryGreen,
|
||||
thumbColor: WidgetStateProperty.resolveWith((states) =>
|
||||
states.contains(WidgetState.selected) ? Colors.white : null),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user