95 lines
2.5 KiB
Dart
95 lines
2.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
// Classe privata per gestire i percorsi in modo ordinato
|
|
class _FluxLogoPaths {
|
|
// Nota: Usa l'estensione .svg
|
|
static const String logoLight = 'assets/images/flux_logo_light.png';
|
|
static const String logoDark = 'assets/images/flux_logo_dark.png';
|
|
}
|
|
|
|
/// Widget base generico per il logo FLUX in formato SVG.
|
|
/// Gestisce il dimensionamento vettoriale e la nitidezza.
|
|
class _FluxLogoBase extends StatelessWidget {
|
|
final String assetPath;
|
|
final double? width;
|
|
final double? height;
|
|
|
|
const _FluxLogoBase({required this.assetPath, this.width, this.height});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
// Usiamo SvgPicture.asset per gli SVG
|
|
return Image.asset(
|
|
assetPath,
|
|
width: width,
|
|
height: height,
|
|
// BoxFit.contain assicura che il logo si adatti perfettamente
|
|
// alle dimensioni fornite senza mai distorcersi.
|
|
fit: BoxFit.contain,
|
|
);
|
|
}
|
|
}
|
|
|
|
// --- I TUOI DUE WIDGET RICHIESTI ---
|
|
|
|
/// Logo FLUX per sfondi CHIARI (testo nero).
|
|
class FluxLogoLight extends StatelessWidget {
|
|
final double? width;
|
|
final double? height;
|
|
|
|
const FluxLogoLight({super.key, this.width, this.height});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return _FluxLogoBase(
|
|
assetPath: _FluxLogoPaths.logoLight,
|
|
width: width,
|
|
height: height,
|
|
);
|
|
}
|
|
}
|
|
|
|
/// Logo FLUX per sfondi SCURI (testo bianco).
|
|
class FluxLogoDark extends StatelessWidget {
|
|
final double? width;
|
|
final double? height;
|
|
|
|
const FluxLogoDark({super.key, this.width, this.height});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return _FluxLogoBase(
|
|
assetPath: _FluxLogoPaths.logoDark,
|
|
width: width,
|
|
height: height,
|
|
);
|
|
}
|
|
}
|
|
|
|
// --- BONUS: IL WIDGET INTELLIGENTE PER LA TUA APP ---
|
|
|
|
/// Un singolo widget che sceglie automaticamente il logo giusto
|
|
/// in base al tema attuale (Light o Dark Mode) dell'app.
|
|
/// Ideale per la dashboard o la splash screen.
|
|
class FluxLogoAuto extends StatelessWidget {
|
|
final double? width;
|
|
final double? height;
|
|
|
|
const FluxLogoAuto({super.key, this.width, this.height});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
// Controlla se il tema attuale è scuro
|
|
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
|
|
|
|
return _FluxLogoBase(
|
|
// Sceglie l'asset giusto
|
|
assetPath: isDarkMode
|
|
? _FluxLogoPaths.logoLight
|
|
: _FluxLogoPaths.logoDark,
|
|
width: width,
|
|
height: height,
|
|
);
|
|
}
|
|
}
|