In flutter_treeview how to change the color of selected node

102

I was facing the same problem as the author, and I found some working solution on my own, but I don't think that its the most correct one. But I will use it as a work around for now.

The idea is to define the colorScheme: attribute of TreeViewTheme under theme: attribute, and setting the primary field.

return TreeView(
  theme: TreeViewTheme(
    colorScheme: ColorScheme.light(
      primary: Colors.grey, # put whatever color in here.
    ),
  )
)

hopefully someone have a better answer, because I Imagine this will fail while app is in dark mode for example.

Share:
102
preeti
Author by

preeti

Updated on December 17, 2022

Comments

  • preeti
    preeti over 1 year

    In Flutter flutter_treeview package

    How we change the color of selected node

    or (selected node background color)

    Thankyou

    • shehata
      shehata over 2 years
      I am having the same problem, have you figured it out?