feat(ui): add premium PluriWave redesign
This commit is contained in:
+40
-35
@@ -1,12 +1,14 @@
|
||||
import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'estado/estado_radio.dart';
|
||||
import 'pantallas/pantalla_inicio.dart';
|
||||
import 'pantallas/pantalla_buscar.dart';
|
||||
import 'pantallas/pantalla_favoritos.dart';
|
||||
import 'pantallas/pantalla_ajustes.dart';
|
||||
import 'tema/pluriwave_theme.dart';
|
||||
import 'widgets/mini_reproductor.dart';
|
||||
import 'widgets/pluri_icon.dart';
|
||||
|
||||
class PluriWaveApp extends StatelessWidget {
|
||||
const PluriWaveApp({super.key});
|
||||
@@ -18,36 +20,13 @@ class PluriWaveApp extends StatelessWidget {
|
||||
child: MaterialApp(
|
||||
title: 'PluriWave',
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: _buildTheme(Brightness.dark),
|
||||
darkTheme: _buildTheme(Brightness.dark),
|
||||
theme: PluriWaveTheme.dark(),
|
||||
darkTheme: PluriWaveTheme.dark(),
|
||||
themeMode: ThemeMode.dark,
|
||||
home: const _PaginaPrincipal(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
ThemeData _buildTheme(Brightness brightness) {
|
||||
final colorScheme = ColorScheme.fromSeed(
|
||||
seedColor: const Color(0xFF6750A4),
|
||||
brightness: brightness,
|
||||
);
|
||||
return ThemeData(
|
||||
useMaterial3: true,
|
||||
colorScheme: colorScheme,
|
||||
textTheme: GoogleFonts.interTextTheme(
|
||||
ThemeData(brightness: brightness).textTheme,
|
||||
),
|
||||
cardTheme: CardThemeData(
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
color: colorScheme.surfaceContainerLow,
|
||||
),
|
||||
snackBarTheme: SnackBarThemeData(
|
||||
behavior: SnackBarBehavior.floating,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _PaginaPrincipal extends StatefulWidget {
|
||||
@@ -59,6 +38,8 @@ class _PaginaPrincipal extends StatefulWidget {
|
||||
|
||||
class _PaginaPrincipalState extends State<_PaginaPrincipal> {
|
||||
int _indice = 0;
|
||||
StreamSubscription<String>? _errorSubscription;
|
||||
EstadoRadio? _estadoSuscrito;
|
||||
|
||||
static const _paginas = [
|
||||
PantallaInicio(),
|
||||
@@ -69,23 +50,35 @@ class _PaginaPrincipalState extends State<_PaginaPrincipal> {
|
||||
|
||||
static const _destinos = [
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.home_outlined),
|
||||
selectedIcon: Icon(Icons.home),
|
||||
icon: PluriIcon(glyph: PluriIconGlyph.home),
|
||||
selectedIcon: PluriIcon(
|
||||
glyph: PluriIconGlyph.home,
|
||||
variant: PluriIconVariant.activeGlow,
|
||||
),
|
||||
label: 'Inicio',
|
||||
),
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.search_outlined),
|
||||
selectedIcon: Icon(Icons.search),
|
||||
icon: PluriIcon(glyph: PluriIconGlyph.search),
|
||||
selectedIcon: PluriIcon(
|
||||
glyph: PluriIconGlyph.search,
|
||||
variant: PluriIconVariant.activeGlow,
|
||||
),
|
||||
label: 'Buscar',
|
||||
),
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.favorite_outline),
|
||||
selectedIcon: Icon(Icons.favorite),
|
||||
icon: PluriIcon(glyph: PluriIconGlyph.favorites),
|
||||
selectedIcon: PluriIcon(
|
||||
glyph: PluriIconGlyph.favorites,
|
||||
variant: PluriIconVariant.activeGlow,
|
||||
),
|
||||
label: 'Favoritos',
|
||||
),
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.settings_outlined),
|
||||
selectedIcon: Icon(Icons.settings),
|
||||
icon: PluriIcon(glyph: PluriIconGlyph.settings),
|
||||
selectedIcon: PluriIcon(
|
||||
glyph: PluriIconGlyph.settings,
|
||||
variant: PluriIconVariant.activeGlow,
|
||||
),
|
||||
label: 'Ajustes',
|
||||
),
|
||||
];
|
||||
@@ -93,7 +86,13 @@ class _PaginaPrincipalState extends State<_PaginaPrincipal> {
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
context.read<EstadoRadio>().errorStream.listen((msg) {
|
||||
final estado = context.read<EstadoRadio>();
|
||||
if (identical(_estadoSuscrito, estado) && _errorSubscription != null) {
|
||||
return;
|
||||
}
|
||||
_errorSubscription?.cancel();
|
||||
_estadoSuscrito = estado;
|
||||
_errorSubscription = estado.errorStream.listen((msg) {
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
@@ -105,6 +104,12 @@ class _PaginaPrincipalState extends State<_PaginaPrincipal> {
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_errorSubscription?.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
|
||||
Reference in New Issue
Block a user