support for flutter 3.27 and removed deprecation warnings
This commit is contained in:
parent
41356d7a78
commit
6985aa366b
7 changed files with 116 additions and 80 deletions
|
@ -55,11 +55,11 @@ class ExpanderThemeData {
|
|||
|
||||
const ExpanderThemeData({
|
||||
this.color,
|
||||
this.position: ExpanderPosition.start,
|
||||
this.type: ExpanderType.caret,
|
||||
this.size: _kDefaultExpanderSize,
|
||||
this.modifier: ExpanderModifier.none,
|
||||
this.animated: true,
|
||||
this.position = ExpanderPosition.start,
|
||||
this.type = ExpanderType.caret,
|
||||
this.size = _kDefaultExpanderSize,
|
||||
this.modifier = ExpanderModifier.none,
|
||||
this.animated = true,
|
||||
});
|
||||
|
||||
/// Creates an expander icon theme with some reasonable default values.
|
||||
|
@ -129,5 +129,5 @@ class ExpanderThemeData {
|
|||
|
||||
@override
|
||||
int get hashCode =>
|
||||
hashValues(color, position, type, size, modifier, animated);
|
||||
Object.hash(color, position, type, size, modifier, animated);
|
||||
}
|
||||
|
|
|
@ -41,9 +41,9 @@ class Node<T> {
|
|||
const Node({
|
||||
required this.key,
|
||||
required this.label,
|
||||
this.children: const [],
|
||||
this.expanded: false,
|
||||
this.parent: false,
|
||||
this.children = const [],
|
||||
this.expanded = false,
|
||||
this.parent = false,
|
||||
this.icon,
|
||||
this.data,
|
||||
});
|
||||
|
@ -152,7 +152,7 @@ class Node<T> {
|
|||
|
||||
@override
|
||||
int get hashCode {
|
||||
return hashValues(
|
||||
return Object.hash(
|
||||
key,
|
||||
label,
|
||||
icon,
|
||||
|
|
|
@ -87,10 +87,10 @@ class TreeView<T> extends InheritedWidget {
|
|||
this.onNodeLongPress,
|
||||
this.physics,
|
||||
this.onExpansionChanged,
|
||||
this.allowParentSelect: false,
|
||||
this.supportParentDoubleTap: false,
|
||||
this.shrinkWrap: false,
|
||||
this.primary: true,
|
||||
this.allowParentSelect = false,
|
||||
this.supportParentDoubleTap = false,
|
||||
this.shrinkWrap = false,
|
||||
this.primary = true,
|
||||
this.nodeBuilder,
|
||||
TreeViewTheme? theme,
|
||||
}) : this.theme = theme ?? const TreeViewTheme(),
|
||||
|
|
|
@ -38,7 +38,7 @@ class TreeViewController<T> {
|
|||
final String? selectedKey;
|
||||
|
||||
TreeViewController({
|
||||
this.children: const [],
|
||||
this.children = const [],
|
||||
this.selectedKey,
|
||||
});
|
||||
|
||||
|
@ -60,7 +60,7 @@ class TreeViewController<T> {
|
|||
/// controller = controller.loadJSON(json: jsonString);
|
||||
/// });
|
||||
/// ```
|
||||
TreeViewController loadJSON({String json: '[]'}) {
|
||||
TreeViewController loadJSON({String json = '[]'}) {
|
||||
List jsonList = jsonDecode(json);
|
||||
List<Map<String, dynamic>> list = List<Map<String, dynamic>>.from(jsonList);
|
||||
return loadMap(list: list);
|
||||
|
@ -74,7 +74,7 @@ class TreeViewController<T> {
|
|||
/// controller = controller.loadMap(map: dataMap);
|
||||
/// });
|
||||
/// ```
|
||||
TreeViewController loadMap({List<Map<String, dynamic>> list: const []}) {
|
||||
TreeViewController loadMap({List<Map<String, dynamic>> list = const []}) {
|
||||
List<Node<T>> treeData =
|
||||
list.map((Map<String, dynamic> item) => Node<T>.fromMap(item)).toList();
|
||||
return TreeViewController(
|
||||
|
@ -100,7 +100,7 @@ class TreeViewController<T> {
|
|||
Node<T> newNode, {
|
||||
Node<T>? parent,
|
||||
int? index,
|
||||
InsertMode mode: InsertMode.append,
|
||||
InsertMode mode = InsertMode.append,
|
||||
}) {
|
||||
List<Node<T>> _data =
|
||||
addNode(key, newNode, parent: parent, mode: mode, index: index);
|
||||
|
@ -394,7 +394,7 @@ class TreeViewController<T> {
|
|||
Node<T> newNode, {
|
||||
Node<T>? parent,
|
||||
int? index,
|
||||
InsertMode mode: InsertMode.append,
|
||||
InsertMode mode = InsertMode.append,
|
||||
}) {
|
||||
List<Node<T>> _children = parent == null ? this.children : parent.children;
|
||||
return _children.map((Node<T> child) {
|
||||
|
|
|
@ -59,19 +59,19 @@ class TreeViewTheme {
|
|||
final Duration expandSpeed;
|
||||
|
||||
const TreeViewTheme({
|
||||
this.colorScheme: const ColorScheme.light(),
|
||||
this.iconTheme: const IconThemeData.fallback(),
|
||||
this.expanderTheme: const ExpanderThemeData.fallback(),
|
||||
this.labelStyle: const TextStyle(),
|
||||
this.parentLabelStyle: const TextStyle(fontWeight: FontWeight.bold),
|
||||
this.colorScheme = const ColorScheme.light(),
|
||||
this.iconTheme = const IconThemeData.fallback(),
|
||||
this.expanderTheme = const ExpanderThemeData.fallback(),
|
||||
this.labelStyle = const TextStyle(),
|
||||
this.parentLabelStyle = const TextStyle(fontWeight: FontWeight.bold),
|
||||
this.labelOverflow,
|
||||
this.parentLabelOverflow,
|
||||
this.levelPadding: _kDefaultLevelPadding,
|
||||
this.dense: true,
|
||||
this.levelPadding = _kDefaultLevelPadding,
|
||||
this.dense = true,
|
||||
this.verticalSpacing,
|
||||
this.horizontalSpacing,
|
||||
this.iconPadding: 8,
|
||||
this.expandSpeed: const Duration(milliseconds: _kExpandSpeed),
|
||||
this.iconPadding = 8,
|
||||
this.expandSpeed = const Duration(milliseconds: _kExpandSpeed),
|
||||
});
|
||||
|
||||
/// Creates a [TreeView] theme with some reasonable default values.
|
||||
|
@ -154,7 +154,7 @@ class TreeViewTheme {
|
|||
|
||||
@override
|
||||
int get hashCode {
|
||||
return hashValues(
|
||||
return Object.hash(
|
||||
colorScheme,
|
||||
levelPadding,
|
||||
iconPadding,
|
||||
|
|
|
@ -9,7 +9,7 @@ class Utilities {
|
|||
static const Color WHITE = Color.fromARGB(255, 255, 255, 255);
|
||||
|
||||
static String toRGBA(Color color) {
|
||||
return 'rgba(${color.red},${color.green},${color.blue},${color.alpha / 255})';
|
||||
return 'rgba(${color.r},${color.g},${color.b},${color.a / 255})';
|
||||
}
|
||||
|
||||
static Color textColor(Color color) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue