Skip to content

Commit

Permalink
lib: src: updated accentColor to colorScheme.secondary (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
shivangsorout authored Jan 3, 2022
1 parent a02cf30 commit f8ac044
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 35 deletions.
2 changes: 1 addition & 1 deletion lib/src/data/simulations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Simulations with ChangeNotifier {

getFavorites() async {
prefs = await SharedPreferences.getInstance();
List<String> myList = (prefs.getStringList('favorites') ?? List<String>());
List<String> myList = (prefs.getStringList('favorites') ?? <String>[]);
if (myList.length != 0) {
_favorites = myList.map((i) => int.parse(i)).toList();
if (allSimulations().length > _favorites.length) {
Expand Down
7 changes: 5 additions & 2 deletions lib/src/data/themedata.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/simulations/bubble_sort.dart
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class _BubbleSortBarsState extends State<BubbleSortBars> {
Slider(
min: 2,
max: 200,
activeColor: Theme.of(context).accentColor,
activeColor: Theme.of(context).colorScheme.secondary,
inactiveColor: Colors.grey,
onChanged: (value) {
doNotRefresh = false;
Expand All @@ -224,7 +224,7 @@ class _BubbleSortBarsState extends State<BubbleSortBars> {
min: 0,
max: 100,
divisions: 10,
activeColor: Theme.of(context).accentColor,
activeColor: Theme.of(context).colorScheme.secondary,
inactiveColor: Colors.grey,
onChanged: (value) {
setState(() {
Expand Down
10 changes: 5 additions & 5 deletions lib/src/simulations/epicycloid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class _NormalEpicycloidCurveState extends State<NormalEpicycloidCurve> {
Slider(
min: 0,
max: 50,
activeColor: Theme.of(context).accentColor,
activeColor: Theme.of(context).colorScheme.secondary,
inactiveColor: Colors.grey,
onChanged: (value) {
setState(() {
Expand All @@ -227,7 +227,7 @@ class _NormalEpicycloidCurveState extends State<NormalEpicycloidCurve> {
Slider(
min: 50,
max: 100,
activeColor: Theme.of(context).accentColor,
activeColor: Theme.of(context).colorScheme.secondary,
inactiveColor: Colors.grey,
onChanged: (value) {
setState(() {
Expand All @@ -250,7 +250,7 @@ class _NormalEpicycloidCurveState extends State<NormalEpicycloidCurve> {
Slider(
min: 0,
max: 0.1,
activeColor: Theme.of(context).accentColor,
activeColor: Theme.of(context).colorScheme.secondary,
inactiveColor: Colors.grey,
onChanged: (value) {
setState(() {
Expand Down Expand Up @@ -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;
Expand All @@ -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))
Expand Down
6 changes: 3 additions & 3 deletions lib/src/simulations/epicycloid_curve.dart
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ class _EpicycloidCurveState extends State<EpicycloidCurve> {
min: 0,
max: 500,
divisions: 500,
activeColor: Theme.of(context).accentColor,
activeColor: Theme.of(context).colorScheme.secondary,
inactiveColor: Colors.grey,
onChanged: (animating)
? null
Expand All @@ -239,7 +239,7 @@ class _EpicycloidCurveState extends State<EpicycloidCurve> {
min: 0,
max: 51,
divisions: 510,
activeColor: Theme.of(context).accentColor,
activeColor: Theme.of(context).colorScheme.secondary,
inactiveColor: Colors.grey,
onChanged: (animating)
? null
Expand Down Expand Up @@ -334,7 +334,7 @@ class _EpicycloidState extends State<Epicycloid> {
: 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(),
),
),
Expand Down
10 changes: 5 additions & 5 deletions lib/src/simulations/fourier_series.dart
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class _FourierSeriesState extends State<FourierSeries> {
Slider(
min: 1,
max: 100,
activeColor: Theme.of(context).accentColor,
activeColor: Theme.of(context).colorScheme.secondary,
inactiveColor: Colors.grey,
onChanged: (value) {
setState(() {
Expand All @@ -140,7 +140,7 @@ class _FourierSeriesState extends State<FourierSeries> {
Slider(
min: 10,
max: 200,
activeColor: Theme.of(context).accentColor,
activeColor: Theme.of(context).colorScheme.secondary,
inactiveColor: Colors.grey,
onChanged: (value) {
setState(() {
Expand All @@ -158,7 +158,7 @@ class _FourierSeriesState extends State<FourierSeries> {
Slider(
min: 0,
max: 0.3,
activeColor: Theme.of(context).accentColor,
activeColor: Theme.of(context).colorScheme.secondary,
inactiveColor: Colors.grey,
onChanged: (value) {
setState(() {
Expand Down Expand Up @@ -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++) {
Expand All @@ -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++;
Expand Down
4 changes: 2 additions & 2 deletions lib/src/simulations/insertion_sort.dart
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class _InsertionHomeState extends State<InsertionHome> {
Slider(
min: 2,
max: 149,
activeColor: Theme.of(context).accentColor,
activeColor: Theme.of(context).colorScheme.secondary,
inactiveColor: Colors.grey,
onChanged: (value) {
setState(() {
Expand All @@ -210,7 +210,7 @@ class _InsertionHomeState extends State<InsertionHome> {
Slider(
min: 0,
max: 500,
activeColor: Theme.of(context).accentColor,
activeColor: Theme.of(context).colorScheme.secondary,
inactiveColor: Colors.grey,
onChangeStart: (value) {
setState(() {
Expand Down
8 changes: 4 additions & 4 deletions lib/src/simulations/lissajous_curve.dart
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class _LissajousCurveState extends State<LissajousCurve> {
min: 0,
max: 10,
divisions: 100,
activeColor: Theme.of(context).accentColor,
activeColor: Theme.of(context).colorScheme.secondary,
inactiveColor: Colors.grey,
onChanged: (value) {
setState(() {
Expand All @@ -218,7 +218,7 @@ class _LissajousCurveState extends State<LissajousCurve> {
min: 0,
max: 10,
divisions: 100,
activeColor: Theme.of(context).accentColor,
activeColor: Theme.of(context).colorScheme.secondary,
inactiveColor: Colors.grey,
onChanged: (value) {
setState(() {
Expand All @@ -237,7 +237,7 @@ class _LissajousCurveState extends State<LissajousCurve> {
min: 0,
max: 6.28,
divisions: 100,
activeColor: Theme.of(context).accentColor,
activeColor: Theme.of(context).colorScheme.secondary,
inactiveColor: Colors.grey,
onChanged: (value) {
setState(() {
Expand All @@ -256,7 +256,7 @@ class _LissajousCurveState extends State<LissajousCurve> {
min: 2,
max: 6,
divisions: 100,
activeColor: Theme.of(context).accentColor,
activeColor: Theme.of(context).colorScheme.secondary,
inactiveColor: Colors.grey,
onChanged: (value) {
setState(() {
Expand Down
10 changes: 5 additions & 5 deletions lib/src/simulations/maurer_rose.dart
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class MaurerRoseCurveState extends State<MaurerRoseCurve> {
min: 0,
max: 20,
divisions: 200,
activeColor: Theme.of(context).accentColor,
activeColor: Theme.of(context).colorScheme.secondary,
inactiveColor: Colors.grey,
onChanged: (animating)
? null
Expand All @@ -243,7 +243,7 @@ class MaurerRoseCurveState extends State<MaurerRoseCurve> {
min: 0,
max: 100,
divisions: 100,
activeColor: Theme.of(context).accentColor,
activeColor: Theme.of(context).colorScheme.secondary,
inactiveColor: Colors.grey,
onChanged: (animating)
? null
Expand All @@ -266,7 +266,7 @@ class MaurerRoseCurveState extends State<MaurerRoseCurve> {
// 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(() {
Expand All @@ -285,7 +285,7 @@ class MaurerRoseCurveState extends State<MaurerRoseCurve> {
// 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(() {
Expand Down Expand Up @@ -376,7 +376,7 @@ class MaurerRoseState extends State<MaurerRose> {
: 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(),
),
Expand Down
6 changes: 3 additions & 3 deletions lib/src/simulations/rose_pattern.dart
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class _RosePatternState extends State<RosePattern> {
min: 0,
max: 10,
divisions: 1000,
activeColor: Theme.of(context).accentColor,
activeColor: Theme.of(context).colorScheme.secondary,
inactiveColor: Colors.grey,
onChanged: (value) {
setState(() {
Expand All @@ -212,7 +212,7 @@ class _RosePatternState extends State<RosePattern> {
min: 0,
max: 10,
divisions: 1000,
activeColor: Theme.of(context).accentColor,
activeColor: Theme.of(context).colorScheme.secondary,
inactiveColor: Colors.grey,
onChanged: (value) {
setState(() {
Expand All @@ -231,7 +231,7 @@ class _RosePatternState extends State<RosePattern> {
min: 0,
max: 1,
divisions: 100,
activeColor: Theme.of(context).accentColor,
activeColor: Theme.of(context).colorScheme.secondary,
inactiveColor: Colors.grey,
onChanged: (value) {
setState(() {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/simulations/selection_sort.dart
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class _SelectionSortBarsState extends State<SelectionSortBars> {
Slider(
min: 2,
max: 200,
activeColor: Theme.of(context).accentColor,
activeColor: Theme.of(context).colorScheme.secondary,
inactiveColor: Colors.grey,
onChanged: (value) {
doNotRefresh = false;
Expand All @@ -232,7 +232,7 @@ class _SelectionSortBarsState extends State<SelectionSortBars> {
min: 0,
max: 100,
divisions: 10,
activeColor: Theme.of(context).accentColor,
activeColor: Theme.of(context).colorScheme.secondary,
inactiveColor: Colors.grey,
onChanged: (value) {
setState(() {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/simulations/toothpick.dart
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ class _ToothpickPatternState extends State<ToothpickPattern> {
painter: ToothpickPainter(
activeToothPicks,
toothPicks,
Theme.of(context).accentColor,
Theme.of(context).colorScheme.secondary,
),
child: Container(),
),
Expand Down

0 comments on commit f8ac044

Please sign in to comment.