24
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:iroute/components/project/colors_panel.dart';
|
||||
import '../../app/navigation/router/app_router_delegate.dart';
|
||||
|
||||
class ColorPage extends StatefulWidget {
|
||||
const ColorPage({super.key});
|
||||
@@ -11,10 +11,26 @@ class ColorPage extends StatefulWidget {
|
||||
|
||||
class _ColorPageState extends State<ColorPage> {
|
||||
final List<Color> _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,
|
||||
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,
|
||||
];
|
||||
|
||||
@override
|
||||
@@ -47,20 +63,19 @@ class _ColorPageState extends State<ColorPage> {
|
||||
);
|
||||
}
|
||||
|
||||
void _selectColor(Color color){
|
||||
void _selectColor(Color color) {
|
||||
String value = color.value.toRadixString(16);
|
||||
String path = '/app/color/detail?color=$value';
|
||||
// router.changePath('/app/color/detail',extra: color);
|
||||
router.changePath(path,recordHistory: true);
|
||||
|
||||
context.push('/color/detail?color=$value');
|
||||
// GoRouter.of(context) .pushNamed('colorDetail', queryParameters: {'color': value});
|
||||
}
|
||||
|
||||
void _toAddPage() async {
|
||||
Color? color = await router.changePath('/app/color/add',forResult: true,recordHistory: false);
|
||||
if (color != null) {
|
||||
setState(() {
|
||||
_colors.add(color);
|
||||
});
|
||||
}
|
||||
Color? color = await context.push('/color/add');
|
||||
|
||||
if (color != null) {
|
||||
setState(() {
|
||||
_colors.add(color);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user