Attempt to fix hover color to a more reasonable color for a dark theme
This commit is contained in:
parent
9201d9f214
commit
4082e126b6
4 changed files with 16 additions and 6 deletions
|
@ -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;
|
||||
|
|
|
@ -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<T> 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,
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 <kevin@codeninelabs.com>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue