This commit is contained in:
toly
2023-12-10 15:25:12 +08:00
parent 2ceed8b9b5
commit 7b16b52761
86 changed files with 3635 additions and 930 deletions

View File

@@ -99,6 +99,7 @@ class SortStateScope extends InheritedNotifier<SortState> {
static SortState of(BuildContext context) =>
context.dependOnInheritedWidgetOfExactType<SortStateScope>()!.notifier!;
static SortState read(BuildContext context) =>
context.getInheritedWidgetOfExactType<SortStateScope>()!.notifier!;
static SortState read(BuildContext context) {
return context.getInheritedWidgetOfExactType<SortStateScope>()!.notifier!;
}
}

View File

@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import '../../provider/state.dart';
import 'color_picker.dart';
class SortSettings extends StatefulWidget {
@@ -66,8 +67,9 @@ class _SortSettingsState extends State<SortSettings> {
child: IconButton(
splashRadius: 20,
onPressed: (){
SortState state = SortStateScope.of(context);
state.config =state.config.copyWith(
SortState state = SortStateScope.read(context);
state.config = state.config.copyWith(
count: int.parse(_count.text),
duration: Duration(
microseconds: int.parse(_duration.text),
@@ -75,7 +77,8 @@ class _SortSettingsState extends State<SortSettings> {
seed: int.parse(_seed.text),
colorIndex: _colorIndex
);
Navigator.of(context).pop();
GoRouter.of(context).pop();
// Navigator.of(context).pop();
}, icon: Icon(Icons.check)),
)],
iconTheme: IconThemeData(color: Colors.black),

View File

@@ -1,8 +1,7 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../../app/navigation/router/iroute_config.dart';
import '../../../../app/navigation/router/app_router_delegate.dart';
import 'package:go_router/go_router.dart';
import 'sort_button.dart';
import '../../functions.dart';
@@ -62,7 +61,8 @@ class SortRailPanel extends StatelessWidget {
cursor: SystemMouseCursors.click,
child: GestureDetector(
onTap: () {
router.changePath('/app/sort/settings',style: RouteStyle.push);
GoRouter.of(context).push('/sort/settings');
// router.changePath('/app/sort/settings',style: RouteStyle.push);
},
child: const Icon(
CupertinoIcons.settings,
@@ -81,7 +81,7 @@ class SortRailPanel extends StatelessWidget {
options: sortNameMap.values.toList(),
onSelected: (name) {
state.selectName(name);
router.changePath('/app/sort/${name}',recordHistory: true);
GoRouter.of(context).go('/sort/player/$name');
},
),
),