refactoring
This commit is contained in:
@@ -21,10 +21,10 @@ class _FeedbackPageState extends State<FeedbackPage> {
|
||||
bool _isSending = false;
|
||||
|
||||
static const _categories = [
|
||||
_FeedbackCategory('suggestion', 'Suggestion', Icons.lightbulb, Color(0xFF6C5CE7)),
|
||||
_FeedbackCategory('bug', 'Bug / Problème', Icons.bug_report, Color(0xFFE17055)),
|
||||
_FeedbackCategory('amelioration', 'Amélioration', Icons.trending_up, Color(0xFF00B894)),
|
||||
_FeedbackCategory('autre', 'Autre', Icons.help_outline, Color(0xFF0984E3)),
|
||||
_FeedbackCategory('suggestion', 'Suggestion', Icons.lightbulb, AppColors.primaryGreen),
|
||||
_FeedbackCategory('bug', 'Bug / Problème', Icons.bug_report, AppColors.error),
|
||||
_FeedbackCategory('amelioration', 'Amélioration', Icons.trending_up, AppColors.success),
|
||||
_FeedbackCategory('autre', 'Autre', Icons.help_outline, AppColors.brandGreen),
|
||||
];
|
||||
|
||||
@override
|
||||
@@ -69,7 +69,7 @@ class _FeedbackPageState extends State<FeedbackPage> {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(message),
|
||||
backgroundColor: isError ? Colors.red : const Color(0xFF00B894),
|
||||
backgroundColor: isError ? AppColors.error : AppColors.success,
|
||||
behavior: SnackBarBehavior.floating,
|
||||
),
|
||||
);
|
||||
@@ -78,7 +78,7 @@ class _FeedbackPageState extends State<FeedbackPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFFF8F9FA),
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
body: Column(
|
||||
children: [
|
||||
_buildHeader(),
|
||||
@@ -87,11 +87,11 @@ class _FeedbackPageState extends State<FeedbackPage> {
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
_buildCategorySection(),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
_buildMessageSection(),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
_buildSubmitButton(),
|
||||
const SizedBox(height: 80),
|
||||
],
|
||||
@@ -105,18 +105,18 @@ class _FeedbackPageState extends State<FeedbackPage> {
|
||||
|
||||
Widget _buildHeader() {
|
||||
return Container(
|
||||
margin: const EdgeInsets.all(SpacingTokens.lg),
|
||||
padding: const EdgeInsets.all(SpacingTokens.xxl),
|
||||
margin: const EdgeInsets.symmetric(horizontal: SpacingTokens.sm, vertical: SpacingTokens.xs),
|
||||
padding: const EdgeInsets.all(SpacingTokens.md),
|
||||
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),
|
||||
),
|
||||
@@ -131,14 +131,14 @@ class _FeedbackPageState extends State<FeedbackPage> {
|
||||
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.feedback, color: Colors.white, size: 24),
|
||||
child: const Icon(Icons.feedback, color: Colors.white, size: 20),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
const SizedBox(width: 12),
|
||||
const Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -168,11 +168,14 @@ class _FeedbackPageState extends State<FeedbackPage> {
|
||||
}
|
||||
|
||||
Widget _buildCategorySection() {
|
||||
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),
|
||||
color: isDark ? AppColors.darkSurface : Colors.white,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.05),
|
||||
@@ -186,19 +189,15 @@ class _FeedbackPageState extends State<FeedbackPage> {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.category, color: Colors.grey[600], size: 20),
|
||||
Icon(Icons.category, color: textSecondary, size: 20),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'Type de retour',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.grey[800],
|
||||
),
|
||||
style: AppTypography.headerSmall.copyWith(fontWeight: FontWeight.w600, color: textPrimary),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
Wrap(
|
||||
spacing: 10,
|
||||
runSpacing: 10,
|
||||
@@ -210,31 +209,34 @@ class _FeedbackPageState extends State<FeedbackPage> {
|
||||
}
|
||||
|
||||
Widget _buildCategoryChip(_FeedbackCategory cat) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final isSelected = _selectedCategory == cat.id;
|
||||
final textSecondary = isDark ? AppColors.textSecondaryDark : AppColors.textSecondaryLight;
|
||||
return InkWell(
|
||||
onTap: () => setState(() => _selectedCategory = cat.id),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected ? cat.color.withOpacity(0.12) : Colors.grey[50],
|
||||
color: isSelected
|
||||
? cat.color.withOpacity(0.12)
|
||||
: (isDark ? AppColors.darkBackground : Colors.grey[50]),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: isSelected ? cat.color.withOpacity(0.5) : Colors.grey[200]!,
|
||||
color: isSelected ? cat.color.withOpacity(0.5) : (isDark ? AppColors.darkBorder : Colors.grey[200]!),
|
||||
width: isSelected ? 1.5 : 1,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(cat.icon, size: 18, color: isSelected ? cat.color : Colors.grey[500]),
|
||||
Icon(cat.icon, size: 18, color: isSelected ? cat.color : textSecondary),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
cat.label,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
style: AppTypography.bodyTextSmall.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: isSelected ? cat.color : Colors.grey[700],
|
||||
color: isSelected ? cat.color : textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -244,11 +246,14 @@ class _FeedbackPageState extends State<FeedbackPage> {
|
||||
}
|
||||
|
||||
Widget _buildMessageSection() {
|
||||
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),
|
||||
color: isDark ? AppColors.darkSurface : Colors.white,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.05),
|
||||
@@ -262,38 +267,36 @@ class _FeedbackPageState extends State<FeedbackPage> {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.edit_note, color: Colors.grey[600], size: 20),
|
||||
Icon(Icons.edit_note, color: textSecondary, size: 20),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'Votre message',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.grey[800],
|
||||
),
|
||||
style: AppTypography.headerSmall.copyWith(fontWeight: FontWeight.w600, color: textPrimary),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
TextField(
|
||||
controller: _messageController,
|
||||
maxLines: 6,
|
||||
style: AppTypography.bodyTextSmall.copyWith(color: textPrimary),
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Décrivez votre suggestion, problème ou idée...',
|
||||
hintStyle: AppTypography.subtitleSmall.copyWith(color: textSecondary),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(color: Colors.grey[300]!),
|
||||
borderSide: BorderSide(color: isDark ? AppColors.darkBorder : Colors.grey[300]!),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(color: Colors.grey[300]!),
|
||||
borderSide: BorderSide(color: isDark ? AppColors.darkBorder : Colors.grey[300]!),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: const BorderSide(color: ColorTokens.primary, width: 1.5),
|
||||
borderSide: const BorderSide(color: AppColors.primaryGreen, width: 1.5),
|
||||
),
|
||||
filled: true,
|
||||
fillColor: Colors.grey[50],
|
||||
fillColor: isDark ? AppColors.darkBackground : Colors.grey[50],
|
||||
alignLabelWithHint: true,
|
||||
),
|
||||
),
|
||||
@@ -323,10 +326,10 @@ class _FeedbackPageState extends State<FeedbackPage> {
|
||||
),
|
||||
),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: ColorTokens.primary,
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
backgroundColor: AppColors.primaryGreen,
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
elevation: 2,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user