v8
This commit is contained in:
@@ -7,17 +7,20 @@ class SortConfig {
|
||||
final int seed;
|
||||
final Duration duration;
|
||||
final String name;
|
||||
final int colorIndex;
|
||||
|
||||
SortConfig({
|
||||
this.count = 100,
|
||||
this.duration = const Duration(microseconds: 1500),
|
||||
this.seed = -1,
|
||||
this.colorIndex = 0,
|
||||
this.name = 'insertion',
|
||||
});
|
||||
|
||||
SortConfig copyWith({
|
||||
int? count,
|
||||
int? seed,
|
||||
int? colorIndex,
|
||||
Duration? duration,
|
||||
String? name,
|
||||
}) =>
|
||||
@@ -26,6 +29,7 @@ class SortConfig {
|
||||
seed:seed??this.seed,
|
||||
duration:duration??this.duration,
|
||||
name:name??this.name,
|
||||
colorIndex:colorIndex??this.colorIndex,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../functions.dart';
|
||||
import 'sort_config.dart';
|
||||
@@ -11,6 +11,20 @@ enum SortStatus{
|
||||
sorted, // 排序完成
|
||||
}
|
||||
|
||||
List<MaterialColor> kColorSupport = [
|
||||
Colors.blue,
|
||||
Colors.lightBlue,
|
||||
Colors.cyan,
|
||||
Colors.red,
|
||||
Colors.pink,
|
||||
Colors.orange,
|
||||
Colors.yellow,
|
||||
Colors.green,
|
||||
Colors.indigo,
|
||||
Colors.purple,
|
||||
Colors.deepPurple,
|
||||
];
|
||||
|
||||
class SortState with ChangeNotifier{
|
||||
|
||||
SortState(){
|
||||
@@ -37,6 +51,11 @@ class SortState with ChangeNotifier{
|
||||
config = config.copyWith(name: name);
|
||||
}
|
||||
|
||||
void selectColor(int colorIndex){
|
||||
if(colorIndex==config.colorIndex) return;
|
||||
config = config.copyWith(colorIndex: colorIndex);
|
||||
}
|
||||
|
||||
void reset(){
|
||||
data.clear();
|
||||
status = SortStatus.none;
|
||||
|
||||
Reference in New Issue
Block a user