This commit is contained in:
toly
2023-09-22 09:15:11 +08:00
parent d456e3c523
commit e95c34018e
132 changed files with 8527 additions and 17 deletions

View File

@@ -0,0 +1,32 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class AppState extends ChangeNotifier{
final List<Color> colors;
AppState({required this.colors,});
AppState.initial():colors=[
Colors.red, Colors.black, Colors.blue, Colors.green, Colors.orange,
Colors.pink, Colors.purple, Colors.indigo, Colors.amber, Colors.cyan,
Colors.redAccent, Colors.grey, Colors.blueAccent, Colors.greenAccent, Colors.orangeAccent,
Colors.pinkAccent, Colors.purpleAccent, Colors.indigoAccent, Colors.amberAccent, Colors.cyanAccent,
];
void addColor(Color color){
colors.add(color);
notifyListeners();
}
}
/// Provides the current [RouteState] to descendant widgets in the tree.
class AppStateScope extends InheritedNotifier<AppState> {
const AppStateScope({super.key, required super.child, required super.notifier,});
static AppState of(BuildContext context) =>
context.dependOnInheritedWidgetOfExactType<AppStateScope>()!.notifier!;
}