- lib/presentation : pages legacy (explore/network, notifications) avec BLoC - lib/shared/design_system : UnionFlow Design System v2 (tokens, components) + MD3 tokens + module_colors par feature - lib/shared/widgets : widgets transversaux (core_card, core_shimmer, error_widget, loading_widget, powered_by_lions_dev, etc.) - lib/shared/constants + utils
91 lines
2.7 KiB
Dart
91 lines
2.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
import '../design_system/unionflow_design_system.dart';
|
|
|
|
/// Widget "Powered by Lions Dev" — affiche le logo Lions Dev adaptatif (dark/light)
|
|
/// avec lien cliquable vers https://www.lions.dev
|
|
///
|
|
/// Usage:
|
|
/// ```dart
|
|
/// const PoweredByLionsDev()
|
|
/// // ou compact:
|
|
/// const PoweredByLionsDev(compact: true)
|
|
/// ```
|
|
class PoweredByLionsDev extends StatelessWidget {
|
|
/// Si true, affichage compact (logo plus petit, sans label "Powered by")
|
|
final bool compact;
|
|
|
|
/// Couleur du label "Powered by" (par défaut : couleur secondaire du thème)
|
|
final Color? labelColor;
|
|
|
|
/// Hauteur du logo (par défaut : 28 normal, 20 compact)
|
|
final double? logoHeight;
|
|
|
|
/// Force une variante (utile sur fond toujours sombre/clair comme login).
|
|
/// Si null, suit le thème courant.
|
|
final Brightness? forceBrightness;
|
|
|
|
const PoweredByLionsDev({
|
|
super.key,
|
|
this.compact = false,
|
|
this.labelColor,
|
|
this.logoHeight,
|
|
this.forceBrightness,
|
|
});
|
|
|
|
Future<void> _openLionsDev() async {
|
|
final uri = Uri.parse('https://www.lions.dev');
|
|
if (await canLaunchUrl(uri)) {
|
|
await launchUrl(uri, mode: LaunchMode.externalApplication);
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final brightness = forceBrightness ?? Theme.of(context).brightness;
|
|
final isDark = brightness == Brightness.dark;
|
|
// Logo blanc sur fond sombre, logo noir sur fond clair
|
|
final logoAsset = isDark
|
|
? 'assets/images/branding/lions_dev_white.png'
|
|
: 'assets/images/branding/lions_dev_dark.png';
|
|
|
|
final effectiveLabelColor = labelColor ??
|
|
(isDark ? AppColors.textSecondaryDark : AppColors.textSecondary);
|
|
|
|
final effectiveHeight = logoHeight ?? (compact ? 20.0 : 28.0);
|
|
|
|
return InkWell(
|
|
onTap: _openLionsDev,
|
|
borderRadius: BorderRadius.circular(SpacingTokens.radiusMd),
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: SpacingTokens.md,
|
|
vertical: SpacingTokens.sm,
|
|
),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
if (!compact) ...[
|
|
Text(
|
|
'Powered by',
|
|
style: TextStyle(
|
|
fontSize: 11,
|
|
color: effectiveLabelColor,
|
|
letterSpacing: 0.3,
|
|
),
|
|
),
|
|
const SizedBox(width: SpacingTokens.sm),
|
|
],
|
|
Image.asset(
|
|
logoAsset,
|
|
height: effectiveHeight,
|
|
fit: BoxFit.contain,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|