48 lines
1.0 KiB
Dart
48 lines
1.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
@immutable
|
|
class ShellBackdropState {
|
|
final String primaryImageUrl;
|
|
final List<String> fallbackImageUrls;
|
|
final Color accentColor;
|
|
|
|
const ShellBackdropState({
|
|
required this.primaryImageUrl,
|
|
this.fallbackImageUrls = const <String>[],
|
|
required this.accentColor,
|
|
});
|
|
}
|
|
|
|
class ShellBackdropNotifier extends Notifier<ShellBackdropState?> {
|
|
@override
|
|
ShellBackdropState? build() => null;
|
|
|
|
void show(ShellBackdropState backdrop) {
|
|
state = backdrop;
|
|
}
|
|
|
|
void clear() {
|
|
state = null;
|
|
}
|
|
}
|
|
|
|
final shellBackdropProvider =
|
|
NotifierProvider<ShellBackdropNotifier, ShellBackdropState?>(
|
|
ShellBackdropNotifier.new,
|
|
);
|
|
|
|
|
|
class ShellLocationNotifier extends Notifier<String> {
|
|
@override
|
|
String build() => '/';
|
|
|
|
void set(String loc) {
|
|
if (state != loc) state = loc;
|
|
}
|
|
}
|
|
|
|
final shellLocationProvider = NotifierProvider<ShellLocationNotifier, String>(
|
|
ShellLocationNotifier.new,
|
|
);
|