mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-08 23:18:16 -07:00
chore: Fix dart deprecation messages
This commit is contained in:
parent
607dea3de1
commit
39a7537116
81 changed files with 258 additions and 195 deletions
|
|
@ -13,7 +13,7 @@ class AbsorbEvents extends ConsumerWidget {
|
|||
onDoubleTap: () {},
|
||||
onTap: () {},
|
||||
onLongPress: () {},
|
||||
child: Container(color: Colors.black.withOpacity(0), child: child),
|
||||
child: Container(color: Colors.black.withValues(alpha: 0), child: child),
|
||||
);
|
||||
} else {
|
||||
return child;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,37 @@ import 'package:flutter/material.dart';
|
|||
|
||||
import 'package:fladder/util/localization_helper.dart';
|
||||
|
||||
Color? colorFromJson(dynamic color) {
|
||||
if (color == null) return null;
|
||||
|
||||
if (color is Map<String, dynamic>) {
|
||||
return Color.from(
|
||||
alpha: color['alpha'] ?? 1.0,
|
||||
red: color['red'] ?? 1.0,
|
||||
green: color['green'] ?? 1.0,
|
||||
blue: color['blue'] ?? 1.0,
|
||||
);
|
||||
}
|
||||
|
||||
// Deprecated format (integer value)
|
||||
if (color is int) {
|
||||
return Color(color);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
extension ColorExtensions on Color {
|
||||
Map<String, dynamic> get toMap {
|
||||
return {
|
||||
'alpha': a,
|
||||
'red': r,
|
||||
'green': g,
|
||||
'blue': b,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
extension DynamicSchemeVariantExtension on DynamicSchemeVariant {
|
||||
String label(BuildContext context) => switch (this) {
|
||||
DynamicSchemeVariant.tonalSpot => context.localized.schemeSettingsTonalSpot,
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class DebugBanner extends ConsumerWidget {
|
|||
padding: const EdgeInsets.all(4.0),
|
||||
child: Card(
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(6)),
|
||||
color: Colors.purpleAccent.withOpacity(0.8),
|
||||
color: Colors.purpleAccent.withValues(alpha: 0.8),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2),
|
||||
child: Text(
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
class FloatingActionButtonAnimated extends ConsumerWidget {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
import 'package:collection/collection.dart';
|
||||
|
||||
extension DurationExtensions on Duration? {
|
||||
String? get humanize {
|
||||
if (this == null) return null;
|
||||
|
|
@ -7,7 +5,7 @@ extension DurationExtensions on Duration? {
|
|||
final hours = duration.inHours != 0 ? '${duration.inHours.toString()}h' : null;
|
||||
final minutes = duration.inMinutes % 60 != 0 ? '${duration.inMinutes % 60}m'.padLeft(3, '0') : null;
|
||||
final seconds = duration.inSeconds % 60 != 0 ? '${duration.inSeconds % 60}s'.padLeft(3, '0') : null;
|
||||
final result = [hours, minutes, seconds].whereNotNull().map((e) => e).join(' ');
|
||||
final result = [hours, minutes, seconds].nonNulls.map((e) => e).join(' ');
|
||||
return result.isNotEmpty ? result : null;
|
||||
}
|
||||
|
||||
|
|
@ -18,7 +16,7 @@ extension DurationExtensions on Duration? {
|
|||
final minutes = (duration.inMinutes % 60).toString().padLeft(2, '0');
|
||||
final seconds = (duration.inHours == 0 ? duration.inSeconds % 60 : null)?.toString().padLeft(2, '0');
|
||||
|
||||
final result = [hours, minutes, seconds].whereNotNull().map((e) => e).join(':');
|
||||
final result = [hours, minutes, seconds].nonNulls.map((e) => e).join(':');
|
||||
return result.isNotEmpty ? result : null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
||||
|
||||
|
|
@ -69,9 +70,12 @@ class _KeyedListViewState extends ConsumerState<KeyedListView> {
|
|||
style: TextButton.styleFrom(
|
||||
padding: EdgeInsets.zero,
|
||||
textStyle: Theme.of(context).textTheme.titleSmall?.copyWith(fontWeight: FontWeight.bold),
|
||||
iconColor: atPosition
|
||||
? Theme.of(context).colorScheme.onSecondary
|
||||
: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.35),
|
||||
foregroundColor: atPosition
|
||||
? Theme.of(context).colorScheme.onSecondary
|
||||
: Theme.of(context).colorScheme.onSurface.withOpacity(0.35),
|
||||
: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.35),
|
||||
),
|
||||
onPressed: () {
|
||||
itemScrollController.scrollTo(
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class _MouseParkingState extends ConsumerState<MouseParking> {
|
|||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.only(topLeft: Radius.circular(20)),
|
||||
color: parked ? Theme.of(context).colorScheme.primary.withOpacity(0.5) : Colors.black12,
|
||||
color: parked ? Theme.of(context).colorScheme.primary.withValues(alpha: 0.5) : Colors.black12,
|
||||
),
|
||||
child: const Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
import 'package:collection/collection.dart';
|
||||
|
||||
import 'package:fladder/models/items/item_shared_models.dart';
|
||||
|
||||
extension StringExtensions on String {
|
||||
|
|
@ -64,6 +62,6 @@ extension GenreExtensions on List<GenreItems> {
|
|||
|
||||
extension StringListExtension on List<String?> {
|
||||
String get detailsTitle {
|
||||
return whereNotNull().join(" ● ");
|
||||
return nonNulls.join(" ● ");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue