import 'package:flutter/material.dart'; import 'package:geosector_app/presentation/widgets/backgrounds/dots_painter.dart'; /// Widget de fond dégradé avec points décoratifs /// Utilisé comme fond pour les pages admin et user avec des couleurs différentes class GradientBackground extends StatelessWidget { /// Indique si le fond est pour un admin (rouge) ou user (vert) final bool isAdmin; /// Afficher ou non les points décoratifs final bool showDots; /// Opacité des points (0.0 à 1.0) final double dotsOpacity; const GradientBackground({ super.key, required this.isAdmin, this.showDots = true, this.dotsOpacity = 0.5, }); @override Widget build(BuildContext context) { // Couleurs de fond selon le rôle final gradientColors = isAdmin ? [Colors.white, Colors.red.shade300] // Admin: dégradé rouge : [Colors.white, Colors.green.shade300]; // User: dégradé vert return Container( decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: gradientColors, ), ), child: showDots ? CustomPaint( painter: DotsPainter(opacity: dotsOpacity), child: const SizedBox( width: double.infinity, height: double.infinity, ), ) : null, ); } }