fluttercandies / flutter-interactive-chart

A candlestick chart that supports pinch-to-zoom and panning.
https://pub.dev/packages/interactive_chart
MIT License
209 stars 66 forks source link

example unable to run, cause cannot find icon #1

Closed liaovq closed 3 years ago

liaovq commented 3 years ago
IconButton(
  icon: Icon(_darkMode ? Icons.dark_mode : Icons.light_mode),
  onPressed: () => setState(() => _darkMode = !_darkMode),
),

The above code is in example/lib/main.dart, where Icons.dark_mode and Icons.light_mode will prompt an error:

The getter 'dark_mode' isn't defined for the type 'Icons'. Try importing the library that defines 'dark_mode', correcting the name to the name of an existing getter, or defining a getter or field named 'dark_mode'.

and I didn't find the corresponding icon in the following two sites either

version:

h65wang commented 3 years ago

It's part of the material icon font: https://fonts.google.com/icons?icon.query=dark+mode

Also, you can see the icon in the flutter framework source code; search for dark_mode in this file: https://raw.githubusercontent.com/flutter/flutter/master/packages/flutter/lib/src/material/icons.dart

liaovq commented 3 years ago

Also, you can see the icon in the flutter framework source code; search for dark_mode in this file: https://raw.githubusercontent.com/flutter/flutter/master/packages/flutter/lib/src/material/icons.dart

Through this link, I realized that our flutter sdk has a different channel, and I also saw the added icon after switching from stable to master, thanks