diff --git a/lib/src/data/simulations.dart b/lib/src/data/simulations.dart index d962f57..ad14e7d 100644 --- a/lib/src/data/simulations.dart +++ b/lib/src/data/simulations.dart @@ -39,7 +39,7 @@ class Simulations with ChangeNotifier { getFavorites() async { prefs = await SharedPreferences.getInstance(); - List myList = (prefs.getStringList('favorites') ?? List()); + List myList = (prefs.getStringList('favorites') ?? []); if (myList.length != 0) { _favorites = myList.map((i) => int.parse(i)).toList(); if (allSimulations().length > _favorites.length) { diff --git a/lib/src/data/themedata.dart b/lib/src/data/themedata.dart index a3a20b6..5bc0085 100644 --- a/lib/src/data/themedata.dart +++ b/lib/src/data/themedata.dart @@ -18,9 +18,8 @@ class ThemeProvider with ChangeNotifier { } ThemeData themeData() { - return ThemeData( + final ThemeData _theme = ThemeData( brightness: _darkTheme ? Brightness.dark : Brightness.light, - accentColor: _counterColor, fontFamily: 'Ubuntu', indicatorColor: _counterColor, primaryColor: _primaryColor, @@ -50,6 +49,10 @@ class ThemeProvider with ChangeNotifier { unselectedLabelColor: _counterColor.withOpacity(0.3), ), ); + + return _theme.copyWith( + colorScheme: _theme.colorScheme.copyWith(secondary: _counterColor), + ); } bool get darkTheme { diff --git a/lib/src/simulations/bubble_sort.dart b/lib/src/simulations/bubble_sort.dart index ca5c228..cebf95a 100644 --- a/lib/src/simulations/bubble_sort.dart +++ b/lib/src/simulations/bubble_sort.dart @@ -198,7 +198,7 @@ class _BubbleSortBarsState extends State { Slider( min: 2, max: 200, - activeColor: Theme.of(context).accentColor, + activeColor: Theme.of(context).colorScheme.secondary, inactiveColor: Colors.grey, onChanged: (value) { doNotRefresh = false; @@ -224,7 +224,7 @@ class _BubbleSortBarsState extends State { min: 0, max: 100, divisions: 10, - activeColor: Theme.of(context).accentColor, + activeColor: Theme.of(context).colorScheme.secondary, inactiveColor: Colors.grey, onChanged: (value) { setState(() { diff --git a/lib/src/simulations/epicycloid.dart b/lib/src/simulations/epicycloid.dart index cc71055..d1cd2fb 100644 --- a/lib/src/simulations/epicycloid.dart +++ b/lib/src/simulations/epicycloid.dart @@ -208,7 +208,7 @@ class _NormalEpicycloidCurveState extends State { Slider( min: 0, max: 50, - activeColor: Theme.of(context).accentColor, + activeColor: Theme.of(context).colorScheme.secondary, inactiveColor: Colors.grey, onChanged: (value) { setState(() { @@ -227,7 +227,7 @@ class _NormalEpicycloidCurveState extends State { Slider( min: 50, max: 100, - activeColor: Theme.of(context).accentColor, + activeColor: Theme.of(context).colorScheme.secondary, inactiveColor: Colors.grey, onChanged: (value) { setState(() { @@ -250,7 +250,7 @@ class _NormalEpicycloidCurveState extends State { Slider( min: 0, max: 0.1, - activeColor: Theme.of(context).accentColor, + activeColor: Theme.of(context).colorScheme.secondary, inactiveColor: Colors.grey, onChanged: (value) { setState(() { @@ -398,7 +398,7 @@ class NormalEpicycloidPainter extends CustomPainter { paint.style = PaintingStyle.stroke; paint.strokeWidth = 2; this.points.clear(); - paint.color = Theme.of(context).accentColor; + paint.color = Theme.of(context).colorScheme.secondary; canvas.drawCircle( Offset(transformx, transformy), innerRadius.toDouble(), paint); paint.color = Colors.red; @@ -421,7 +421,7 @@ class NormalEpicycloidPainter extends CustomPainter { Paint paint = new Paint(); paint.style = PaintingStyle.stroke; paint.strokeWidth = 2; - paint.color = Theme.of(context).accentColor; + paint.color = Theme.of(context).colorScheme.secondary; canvas.drawCircle(coor, innerRadius.toDouble(), paint); smallCenter = Offset((innerRadius + outerRadius) * cos(time), (innerRadius + outerRadius) * sin(time)) diff --git a/lib/src/simulations/epicycloid_curve.dart b/lib/src/simulations/epicycloid_curve.dart index 82e4d92..20b7ee5 100644 --- a/lib/src/simulations/epicycloid_curve.dart +++ b/lib/src/simulations/epicycloid_curve.dart @@ -216,7 +216,7 @@ class _EpicycloidCurveState extends State { min: 0, max: 500, divisions: 500, - activeColor: Theme.of(context).accentColor, + activeColor: Theme.of(context).colorScheme.secondary, inactiveColor: Colors.grey, onChanged: (animating) ? null @@ -239,7 +239,7 @@ class _EpicycloidCurveState extends State { min: 0, max: 51, divisions: 510, - activeColor: Theme.of(context).accentColor, + activeColor: Theme.of(context).colorScheme.secondary, inactiveColor: Colors.grey, onChanged: (animating) ? null @@ -334,7 +334,7 @@ class _EpicycloidState extends State { : MediaQuery.of(context).size.width / 2) .roundToDouble(), (MediaQuery.of(context).size.height / 3).roundToDouble(), - Theme.of(context).accentColor), + Theme.of(context).colorScheme.secondary), child: Container(), ), ), diff --git a/lib/src/simulations/fourier_series.dart b/lib/src/simulations/fourier_series.dart index 09962c7..dfed02c 100644 --- a/lib/src/simulations/fourier_series.dart +++ b/lib/src/simulations/fourier_series.dart @@ -122,7 +122,7 @@ class _FourierSeriesState extends State { Slider( min: 1, max: 100, - activeColor: Theme.of(context).accentColor, + activeColor: Theme.of(context).colorScheme.secondary, inactiveColor: Colors.grey, onChanged: (value) { setState(() { @@ -140,7 +140,7 @@ class _FourierSeriesState extends State { Slider( min: 10, max: 200, - activeColor: Theme.of(context).accentColor, + activeColor: Theme.of(context).colorScheme.secondary, inactiveColor: Colors.grey, onChanged: (value) { setState(() { @@ -158,7 +158,7 @@ class _FourierSeriesState extends State { Slider( min: 0, max: 0.3, - activeColor: Theme.of(context).accentColor, + activeColor: Theme.of(context).colorScheme.secondary, inactiveColor: Colors.grey, onChanged: (value) { setState(() { @@ -202,7 +202,7 @@ class FourierPainter extends CustomPainter { @override void paint(Canvas canvas, Size size) { Paint paint = new Paint(); - paint.color = Theme.of(context).accentColor; + paint.color = Theme.of(context).colorScheme.secondary; paint.style = PaintingStyle.stroke; paint.strokeWidth = 2; for (int i = 0; i < _n; i++) { @@ -226,7 +226,7 @@ class FourierPainter extends CustomPainter { paint.color = Colors.red; canvas.drawLine(coor, Offset(r, ys[0]), paint); int iterator = 0; - paint.color = Theme.of(context).accentColor; + paint.color = Theme.of(context).colorScheme.secondary; ys.forEach((value) { points.add(Offset(iterator.toDouble() + r, value)); iterator++; diff --git a/lib/src/simulations/insertion_sort.dart b/lib/src/simulations/insertion_sort.dart index 53c75da..061acce 100644 --- a/lib/src/simulations/insertion_sort.dart +++ b/lib/src/simulations/insertion_sort.dart @@ -186,7 +186,7 @@ class _InsertionHomeState extends State { Slider( min: 2, max: 149, - activeColor: Theme.of(context).accentColor, + activeColor: Theme.of(context).colorScheme.secondary, inactiveColor: Colors.grey, onChanged: (value) { setState(() { @@ -210,7 +210,7 @@ class _InsertionHomeState extends State { Slider( min: 0, max: 500, - activeColor: Theme.of(context).accentColor, + activeColor: Theme.of(context).colorScheme.secondary, inactiveColor: Colors.grey, onChangeStart: (value) { setState(() { diff --git a/lib/src/simulations/lissajous_curve.dart b/lib/src/simulations/lissajous_curve.dart index 2d83468..0a47851 100644 --- a/lib/src/simulations/lissajous_curve.dart +++ b/lib/src/simulations/lissajous_curve.dart @@ -199,7 +199,7 @@ class _LissajousCurveState extends State { min: 0, max: 10, divisions: 100, - activeColor: Theme.of(context).accentColor, + activeColor: Theme.of(context).colorScheme.secondary, inactiveColor: Colors.grey, onChanged: (value) { setState(() { @@ -218,7 +218,7 @@ class _LissajousCurveState extends State { min: 0, max: 10, divisions: 100, - activeColor: Theme.of(context).accentColor, + activeColor: Theme.of(context).colorScheme.secondary, inactiveColor: Colors.grey, onChanged: (value) { setState(() { @@ -237,7 +237,7 @@ class _LissajousCurveState extends State { min: 0, max: 6.28, divisions: 100, - activeColor: Theme.of(context).accentColor, + activeColor: Theme.of(context).colorScheme.secondary, inactiveColor: Colors.grey, onChanged: (value) { setState(() { @@ -256,7 +256,7 @@ class _LissajousCurveState extends State { min: 2, max: 6, divisions: 100, - activeColor: Theme.of(context).accentColor, + activeColor: Theme.of(context).colorScheme.secondary, inactiveColor: Colors.grey, onChanged: (value) { setState(() { diff --git a/lib/src/simulations/maurer_rose.dart b/lib/src/simulations/maurer_rose.dart index 7c70097..4ef6b55 100644 --- a/lib/src/simulations/maurer_rose.dart +++ b/lib/src/simulations/maurer_rose.dart @@ -220,7 +220,7 @@ class MaurerRoseCurveState extends State { min: 0, max: 20, divisions: 200, - activeColor: Theme.of(context).accentColor, + activeColor: Theme.of(context).colorScheme.secondary, inactiveColor: Colors.grey, onChanged: (animating) ? null @@ -243,7 +243,7 @@ class MaurerRoseCurveState extends State { min: 0, max: 100, divisions: 100, - activeColor: Theme.of(context).accentColor, + activeColor: Theme.of(context).colorScheme.secondary, inactiveColor: Colors.grey, onChanged: (animating) ? null @@ -266,7 +266,7 @@ class MaurerRoseCurveState extends State { // min: 0.001, // max: 0.01, // divisions: 9, - // activeColor: Theme.of(context).accentColor, + // activeColor: Theme.of(context).colorScheme.secondary, // inactiveColor: Colors.grey, // onChanged: (value) { // setState(() { @@ -285,7 +285,7 @@ class MaurerRoseCurveState extends State { // min: 0.001, // max: 0.01, // divisions: 9, - // activeColor: Theme.of(context).accentColor, + // activeColor: Theme.of(context).colorScheme.secondary, // inactiveColor: Colors.grey, // onChanged: (value) { // setState(() { @@ -376,7 +376,7 @@ class MaurerRoseState extends State { : MediaQuery.of(context).size.width / 2) .roundToDouble(), (MediaQuery.of(context).size.height / 3).roundToDouble(), - Theme.of(context).accentColor, + Theme.of(context).colorScheme.secondary, ), child: Container(), ), diff --git a/lib/src/simulations/rose_pattern.dart b/lib/src/simulations/rose_pattern.dart index 5686258..131359c 100644 --- a/lib/src/simulations/rose_pattern.dart +++ b/lib/src/simulations/rose_pattern.dart @@ -193,7 +193,7 @@ class _RosePatternState extends State { min: 0, max: 10, divisions: 1000, - activeColor: Theme.of(context).accentColor, + activeColor: Theme.of(context).colorScheme.secondary, inactiveColor: Colors.grey, onChanged: (value) { setState(() { @@ -212,7 +212,7 @@ class _RosePatternState extends State { min: 0, max: 10, divisions: 1000, - activeColor: Theme.of(context).accentColor, + activeColor: Theme.of(context).colorScheme.secondary, inactiveColor: Colors.grey, onChanged: (value) { setState(() { @@ -231,7 +231,7 @@ class _RosePatternState extends State { min: 0, max: 1, divisions: 100, - activeColor: Theme.of(context).accentColor, + activeColor: Theme.of(context).colorScheme.secondary, inactiveColor: Colors.grey, onChanged: (value) { setState(() { diff --git a/lib/src/simulations/selection_sort.dart b/lib/src/simulations/selection_sort.dart index 8d2496f..1f99455 100644 --- a/lib/src/simulations/selection_sort.dart +++ b/lib/src/simulations/selection_sort.dart @@ -206,7 +206,7 @@ class _SelectionSortBarsState extends State { Slider( min: 2, max: 200, - activeColor: Theme.of(context).accentColor, + activeColor: Theme.of(context).colorScheme.secondary, inactiveColor: Colors.grey, onChanged: (value) { doNotRefresh = false; @@ -232,7 +232,7 @@ class _SelectionSortBarsState extends State { min: 0, max: 100, divisions: 10, - activeColor: Theme.of(context).accentColor, + activeColor: Theme.of(context).colorScheme.secondary, inactiveColor: Colors.grey, onChanged: (value) { setState(() { diff --git a/lib/src/simulations/toothpick.dart b/lib/src/simulations/toothpick.dart index 4aa901e..f00b7c2 100644 --- a/lib/src/simulations/toothpick.dart +++ b/lib/src/simulations/toothpick.dart @@ -245,7 +245,7 @@ class _ToothpickPatternState extends State { painter: ToothpickPainter( activeToothPicks, toothPicks, - Theme.of(context).accentColor, + Theme.of(context).colorScheme.secondary, ), child: Container(), ),