diff --git a/lib/src/tree_node.dart b/lib/src/tree_node.dart index 3c55f59..9014b60 100644 --- a/lib/src/tree_node.dart +++ b/lib/src/tree_node.dart @@ -1,6 +1,7 @@ import 'dart:math' show pi; import 'package:flutter/material.dart'; +import 'package:flutter_treeview/flutter_treeview.dart'; import 'tree_view.dart'; import 'tree_view_theme.dart'; @@ -398,10 +399,12 @@ class _TreeNodeExpanderState extends State<_TreeNodeExpander> Color? _onColor(Color? color) { if (color != null) { - if (color.computeLuminance() > 0.6) { - return Colors.black; + if (color.computeLuminance() > 0.75) { + return Utilities.BLACK; + } else if (color.computeLuminance() > 0.25) { + return Utilities.GREY; } else { - return Colors.white; + return Utilities.WHITE; } } return null; diff --git a/lib/src/tree_view.dart b/lib/src/tree_view.dart index 0e17054..28f644a 100644 --- a/lib/src/tree_view.dart +++ b/lib/src/tree_view.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter_treeview/flutter_treeview.dart'; import 'tree_view_controller.dart'; import 'tree_view_theme.dart'; @@ -132,7 +133,10 @@ class _TreeViewData extends StatelessWidget { Widget build(BuildContext context) { ThemeData _parentTheme = Theme.of(context); return Theme( - data: _parentTheme.copyWith(hoverColor: Colors.grey.shade100), + data: _parentTheme.copyWith( + hoverColor: _parentTheme == ThemeData.dark() + ? Utilities.GREY + : Utilities.WHITE), child: ListView( shrinkWrap: shrinkWrap!, primary: primary, diff --git a/lib/src/utilities.dart b/lib/src/utilities.dart index c78c760..5bae436 100644 --- a/lib/src/utilities.dart +++ b/lib/src/utilities.dart @@ -7,14 +7,17 @@ import 'package:flutter/material.dart'; class Utilities { static const Color BLACK = Color.fromARGB(255, 0, 0, 0); static const Color WHITE = Color.fromARGB(255, 255, 255, 255); + static const Color GREY = Color.fromARGB(255, 80, 80, 80); static String toRGBA(Color color) { return 'rgba(${color.r},${color.g},${color.b},${color.a / 255})'; } static Color textColor(Color color) { - if (color.computeLuminance() > 0.6) { + if (color.computeLuminance() > 0.75) { return BLACK; + } else if (color.computeLuminance() > 0.25) { + return GREY; } else { return WHITE; } diff --git a/pubspec.yaml b/pubspec.yaml index bf6089e..53d1ddc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_treeview description: A tree widget for Flutter that can be used to display nested, hierarchical data. It includes a number of features like styling labels, icons, and import and export utilities. -version: 1.2.020425+1239 +version: 1.2.020525+0254 repository: https://git.zontreck.com/AriasCreations/flutter_treeview issue_tracker: https://git.zontreck.com/AriasCreations/flutter_treeview/issues #author: kevinandre.com