Skip to content

Commit f8ac044

Browse files
lib: src: updated accentColor to colorScheme.secondary (#195)
1 parent a02cf30 commit f8ac044

12 files changed

+38
-35
lines changed

lib/src/data/simulations.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class Simulations with ChangeNotifier {
3939

4040
getFavorites() async {
4141
prefs = await SharedPreferences.getInstance();
42-
List<String> myList = (prefs.getStringList('favorites') ?? List<String>());
42+
List<String> myList = (prefs.getStringList('favorites') ?? <String>[]);
4343
if (myList.length != 0) {
4444
_favorites = myList.map((i) => int.parse(i)).toList();
4545
if (allSimulations().length > _favorites.length) {

lib/src/data/themedata.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ class ThemeProvider with ChangeNotifier {
1818
}
1919

2020
ThemeData themeData() {
21-
return ThemeData(
21+
final ThemeData _theme = ThemeData(
2222
brightness: _darkTheme ? Brightness.dark : Brightness.light,
23-
accentColor: _counterColor,
2423
fontFamily: 'Ubuntu',
2524
indicatorColor: _counterColor,
2625
primaryColor: _primaryColor,
@@ -50,6 +49,10 @@ class ThemeProvider with ChangeNotifier {
5049
unselectedLabelColor: _counterColor.withOpacity(0.3),
5150
),
5251
);
52+
53+
return _theme.copyWith(
54+
colorScheme: _theme.colorScheme.copyWith(secondary: _counterColor),
55+
);
5356
}
5457

5558
bool get darkTheme {

lib/src/simulations/bubble_sort.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ class _BubbleSortBarsState extends State<BubbleSortBars> {
198198
Slider(
199199
min: 2,
200200
max: 200,
201-
activeColor: Theme.of(context).accentColor,
201+
activeColor: Theme.of(context).colorScheme.secondary,
202202
inactiveColor: Colors.grey,
203203
onChanged: (value) {
204204
doNotRefresh = false;
@@ -224,7 +224,7 @@ class _BubbleSortBarsState extends State<BubbleSortBars> {
224224
min: 0,
225225
max: 100,
226226
divisions: 10,
227-
activeColor: Theme.of(context).accentColor,
227+
activeColor: Theme.of(context).colorScheme.secondary,
228228
inactiveColor: Colors.grey,
229229
onChanged: (value) {
230230
setState(() {

lib/src/simulations/epicycloid.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ class _NormalEpicycloidCurveState extends State<NormalEpicycloidCurve> {
208208
Slider(
209209
min: 0,
210210
max: 50,
211-
activeColor: Theme.of(context).accentColor,
211+
activeColor: Theme.of(context).colorScheme.secondary,
212212
inactiveColor: Colors.grey,
213213
onChanged: (value) {
214214
setState(() {
@@ -227,7 +227,7 @@ class _NormalEpicycloidCurveState extends State<NormalEpicycloidCurve> {
227227
Slider(
228228
min: 50,
229229
max: 100,
230-
activeColor: Theme.of(context).accentColor,
230+
activeColor: Theme.of(context).colorScheme.secondary,
231231
inactiveColor: Colors.grey,
232232
onChanged: (value) {
233233
setState(() {
@@ -250,7 +250,7 @@ class _NormalEpicycloidCurveState extends State<NormalEpicycloidCurve> {
250250
Slider(
251251
min: 0,
252252
max: 0.1,
253-
activeColor: Theme.of(context).accentColor,
253+
activeColor: Theme.of(context).colorScheme.secondary,
254254
inactiveColor: Colors.grey,
255255
onChanged: (value) {
256256
setState(() {
@@ -398,7 +398,7 @@ class NormalEpicycloidPainter extends CustomPainter {
398398
paint.style = PaintingStyle.stroke;
399399
paint.strokeWidth = 2;
400400
this.points.clear();
401-
paint.color = Theme.of(context).accentColor;
401+
paint.color = Theme.of(context).colorScheme.secondary;
402402
canvas.drawCircle(
403403
Offset(transformx, transformy), innerRadius.toDouble(), paint);
404404
paint.color = Colors.red;
@@ -421,7 +421,7 @@ class NormalEpicycloidPainter extends CustomPainter {
421421
Paint paint = new Paint();
422422
paint.style = PaintingStyle.stroke;
423423
paint.strokeWidth = 2;
424-
paint.color = Theme.of(context).accentColor;
424+
paint.color = Theme.of(context).colorScheme.secondary;
425425
canvas.drawCircle(coor, innerRadius.toDouble(), paint);
426426
smallCenter = Offset((innerRadius + outerRadius) * cos(time),
427427
(innerRadius + outerRadius) * sin(time))

lib/src/simulations/epicycloid_curve.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ class _EpicycloidCurveState extends State<EpicycloidCurve> {
216216
min: 0,
217217
max: 500,
218218
divisions: 500,
219-
activeColor: Theme.of(context).accentColor,
219+
activeColor: Theme.of(context).colorScheme.secondary,
220220
inactiveColor: Colors.grey,
221221
onChanged: (animating)
222222
? null
@@ -239,7 +239,7 @@ class _EpicycloidCurveState extends State<EpicycloidCurve> {
239239
min: 0,
240240
max: 51,
241241
divisions: 510,
242-
activeColor: Theme.of(context).accentColor,
242+
activeColor: Theme.of(context).colorScheme.secondary,
243243
inactiveColor: Colors.grey,
244244
onChanged: (animating)
245245
? null
@@ -334,7 +334,7 @@ class _EpicycloidState extends State<Epicycloid> {
334334
: MediaQuery.of(context).size.width / 2)
335335
.roundToDouble(),
336336
(MediaQuery.of(context).size.height / 3).roundToDouble(),
337-
Theme.of(context).accentColor),
337+
Theme.of(context).colorScheme.secondary),
338338
child: Container(),
339339
),
340340
),

lib/src/simulations/fourier_series.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class _FourierSeriesState extends State<FourierSeries> {
122122
Slider(
123123
min: 1,
124124
max: 100,
125-
activeColor: Theme.of(context).accentColor,
125+
activeColor: Theme.of(context).colorScheme.secondary,
126126
inactiveColor: Colors.grey,
127127
onChanged: (value) {
128128
setState(() {
@@ -140,7 +140,7 @@ class _FourierSeriesState extends State<FourierSeries> {
140140
Slider(
141141
min: 10,
142142
max: 200,
143-
activeColor: Theme.of(context).accentColor,
143+
activeColor: Theme.of(context).colorScheme.secondary,
144144
inactiveColor: Colors.grey,
145145
onChanged: (value) {
146146
setState(() {
@@ -158,7 +158,7 @@ class _FourierSeriesState extends State<FourierSeries> {
158158
Slider(
159159
min: 0,
160160
max: 0.3,
161-
activeColor: Theme.of(context).accentColor,
161+
activeColor: Theme.of(context).colorScheme.secondary,
162162
inactiveColor: Colors.grey,
163163
onChanged: (value) {
164164
setState(() {
@@ -202,7 +202,7 @@ class FourierPainter extends CustomPainter {
202202
@override
203203
void paint(Canvas canvas, Size size) {
204204
Paint paint = new Paint();
205-
paint.color = Theme.of(context).accentColor;
205+
paint.color = Theme.of(context).colorScheme.secondary;
206206
paint.style = PaintingStyle.stroke;
207207
paint.strokeWidth = 2;
208208
for (int i = 0; i < _n; i++) {
@@ -226,7 +226,7 @@ class FourierPainter extends CustomPainter {
226226
paint.color = Colors.red;
227227
canvas.drawLine(coor, Offset(r, ys[0]), paint);
228228
int iterator = 0;
229-
paint.color = Theme.of(context).accentColor;
229+
paint.color = Theme.of(context).colorScheme.secondary;
230230
ys.forEach((value) {
231231
points.add(Offset(iterator.toDouble() + r, value));
232232
iterator++;

lib/src/simulations/insertion_sort.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class _InsertionHomeState extends State<InsertionHome> {
186186
Slider(
187187
min: 2,
188188
max: 149,
189-
activeColor: Theme.of(context).accentColor,
189+
activeColor: Theme.of(context).colorScheme.secondary,
190190
inactiveColor: Colors.grey,
191191
onChanged: (value) {
192192
setState(() {
@@ -210,7 +210,7 @@ class _InsertionHomeState extends State<InsertionHome> {
210210
Slider(
211211
min: 0,
212212
max: 500,
213-
activeColor: Theme.of(context).accentColor,
213+
activeColor: Theme.of(context).colorScheme.secondary,
214214
inactiveColor: Colors.grey,
215215
onChangeStart: (value) {
216216
setState(() {

lib/src/simulations/lissajous_curve.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ class _LissajousCurveState extends State<LissajousCurve> {
199199
min: 0,
200200
max: 10,
201201
divisions: 100,
202-
activeColor: Theme.of(context).accentColor,
202+
activeColor: Theme.of(context).colorScheme.secondary,
203203
inactiveColor: Colors.grey,
204204
onChanged: (value) {
205205
setState(() {
@@ -218,7 +218,7 @@ class _LissajousCurveState extends State<LissajousCurve> {
218218
min: 0,
219219
max: 10,
220220
divisions: 100,
221-
activeColor: Theme.of(context).accentColor,
221+
activeColor: Theme.of(context).colorScheme.secondary,
222222
inactiveColor: Colors.grey,
223223
onChanged: (value) {
224224
setState(() {
@@ -237,7 +237,7 @@ class _LissajousCurveState extends State<LissajousCurve> {
237237
min: 0,
238238
max: 6.28,
239239
divisions: 100,
240-
activeColor: Theme.of(context).accentColor,
240+
activeColor: Theme.of(context).colorScheme.secondary,
241241
inactiveColor: Colors.grey,
242242
onChanged: (value) {
243243
setState(() {
@@ -256,7 +256,7 @@ class _LissajousCurveState extends State<LissajousCurve> {
256256
min: 2,
257257
max: 6,
258258
divisions: 100,
259-
activeColor: Theme.of(context).accentColor,
259+
activeColor: Theme.of(context).colorScheme.secondary,
260260
inactiveColor: Colors.grey,
261261
onChanged: (value) {
262262
setState(() {

lib/src/simulations/maurer_rose.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ class MaurerRoseCurveState extends State<MaurerRoseCurve> {
220220
min: 0,
221221
max: 20,
222222
divisions: 200,
223-
activeColor: Theme.of(context).accentColor,
223+
activeColor: Theme.of(context).colorScheme.secondary,
224224
inactiveColor: Colors.grey,
225225
onChanged: (animating)
226226
? null
@@ -243,7 +243,7 @@ class MaurerRoseCurveState extends State<MaurerRoseCurve> {
243243
min: 0,
244244
max: 100,
245245
divisions: 100,
246-
activeColor: Theme.of(context).accentColor,
246+
activeColor: Theme.of(context).colorScheme.secondary,
247247
inactiveColor: Colors.grey,
248248
onChanged: (animating)
249249
? null
@@ -266,7 +266,7 @@ class MaurerRoseCurveState extends State<MaurerRoseCurve> {
266266
// min: 0.001,
267267
// max: 0.01,
268268
// divisions: 9,
269-
// activeColor: Theme.of(context).accentColor,
269+
// activeColor: Theme.of(context).colorScheme.secondary,
270270
// inactiveColor: Colors.grey,
271271
// onChanged: (value) {
272272
// setState(() {
@@ -285,7 +285,7 @@ class MaurerRoseCurveState extends State<MaurerRoseCurve> {
285285
// min: 0.001,
286286
// max: 0.01,
287287
// divisions: 9,
288-
// activeColor: Theme.of(context).accentColor,
288+
// activeColor: Theme.of(context).colorScheme.secondary,
289289
// inactiveColor: Colors.grey,
290290
// onChanged: (value) {
291291
// setState(() {
@@ -376,7 +376,7 @@ class MaurerRoseState extends State<MaurerRose> {
376376
: MediaQuery.of(context).size.width / 2)
377377
.roundToDouble(),
378378
(MediaQuery.of(context).size.height / 3).roundToDouble(),
379-
Theme.of(context).accentColor,
379+
Theme.of(context).colorScheme.secondary,
380380
),
381381
child: Container(),
382382
),

lib/src/simulations/rose_pattern.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ class _RosePatternState extends State<RosePattern> {
193193
min: 0,
194194
max: 10,
195195
divisions: 1000,
196-
activeColor: Theme.of(context).accentColor,
196+
activeColor: Theme.of(context).colorScheme.secondary,
197197
inactiveColor: Colors.grey,
198198
onChanged: (value) {
199199
setState(() {
@@ -212,7 +212,7 @@ class _RosePatternState extends State<RosePattern> {
212212
min: 0,
213213
max: 10,
214214
divisions: 1000,
215-
activeColor: Theme.of(context).accentColor,
215+
activeColor: Theme.of(context).colorScheme.secondary,
216216
inactiveColor: Colors.grey,
217217
onChanged: (value) {
218218
setState(() {
@@ -231,7 +231,7 @@ class _RosePatternState extends State<RosePattern> {
231231
min: 0,
232232
max: 1,
233233
divisions: 100,
234-
activeColor: Theme.of(context).accentColor,
234+
activeColor: Theme.of(context).colorScheme.secondary,
235235
inactiveColor: Colors.grey,
236236
onChanged: (value) {
237237
setState(() {

lib/src/simulations/selection_sort.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ class _SelectionSortBarsState extends State<SelectionSortBars> {
206206
Slider(
207207
min: 2,
208208
max: 200,
209-
activeColor: Theme.of(context).accentColor,
209+
activeColor: Theme.of(context).colorScheme.secondary,
210210
inactiveColor: Colors.grey,
211211
onChanged: (value) {
212212
doNotRefresh = false;
@@ -232,7 +232,7 @@ class _SelectionSortBarsState extends State<SelectionSortBars> {
232232
min: 0,
233233
max: 100,
234234
divisions: 10,
235-
activeColor: Theme.of(context).accentColor,
235+
activeColor: Theme.of(context).colorScheme.secondary,
236236
inactiveColor: Colors.grey,
237237
onChanged: (value) {
238238
setState(() {

lib/src/simulations/toothpick.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ class _ToothpickPatternState extends State<ToothpickPattern> {
245245
painter: ToothpickPainter(
246246
activeToothPicks,
247247
toothPicks,
248-
Theme.of(context).accentColor,
248+
Theme.of(context).colorScheme.secondary,
249249
),
250250
child: Container(),
251251
),

0 commit comments

Comments
 (0)