Initial commit
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'theme.dart';
|
||||
|
||||
/// Cover-Bild aus einer file-URI, mit Noten-Platzhalter als Fallback.
|
||||
class CoverImage extends StatelessWidget {
|
||||
const CoverImage({super.key, required this.artUri, this.size, this.radius = 8});
|
||||
final Uri? artUri;
|
||||
final double? size;
|
||||
final double radius;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final placeholder = Container(
|
||||
width: size,
|
||||
height: size,
|
||||
color: MeloTheme.surface,
|
||||
child: LayoutBuilder(
|
||||
builder: (_, c) {
|
||||
final s = size ?? (c.hasBoundedWidth ? c.maxWidth : 48.0);
|
||||
return Icon(Icons.music_note, size: s * 0.4, color: MeloTheme.red);
|
||||
},
|
||||
),
|
||||
);
|
||||
Widget child = placeholder;
|
||||
if (artUri != null && artUri!.scheme == 'file') {
|
||||
child = Image.file(
|
||||
File(artUri!.toFilePath()),
|
||||
width: size,
|
||||
height: size,
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (_, _, _) => placeholder,
|
||||
);
|
||||
}
|
||||
return ClipRRect(borderRadius: BorderRadius.circular(radius), child: child);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Melo-Theme: Schwarz + Rot.
|
||||
class MeloTheme {
|
||||
static const Color red = Color(0xFFE50914);
|
||||
static const Color black = Color(0xFF0A0A0A);
|
||||
static const Color surface = Color(0xFF161616);
|
||||
|
||||
static ThemeData get dark {
|
||||
final scheme = ColorScheme.fromSeed(
|
||||
seedColor: red,
|
||||
brightness: Brightness.dark,
|
||||
).copyWith(
|
||||
primary: red,
|
||||
surface: black,
|
||||
);
|
||||
return ThemeData(
|
||||
useMaterial3: true,
|
||||
colorScheme: scheme,
|
||||
scaffoldBackgroundColor: black,
|
||||
cardColor: surface,
|
||||
sliderTheme: const SliderThemeData(
|
||||
activeTrackColor: red,
|
||||
thumbColor: red,
|
||||
trackHeight: 3,
|
||||
),
|
||||
bottomNavigationBarTheme: const BottomNavigationBarThemeData(
|
||||
backgroundColor: surface,
|
||||
selectedItemColor: red,
|
||||
unselectedItemColor: Colors.white54,
|
||||
type: BottomNavigationBarType.fixed,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user