Skip to content

Commit

Permalink
lib:simulations:Merge_sort :Merge Sort implemented #174 (#185)
Browse files Browse the repository at this point in the history
* added: mergesort

* added merge sort

* mergesort update
  • Loading branch information
mrmayurgithub authored Jun 4, 2021
1 parent 2b2796e commit 6377d31
Show file tree
Hide file tree
Showing 6 changed files with 353 additions and 5 deletions.
Binary file added assets/simulations/MergeSortDark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/simulations/MergeSortLight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion lib/src/custom_items/simulation_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ class _SimulationCardState extends State<SimulationCard> {
Widget build(BuildContext context) {
final appState = Provider.of<Simulations>(context);
return Container(
width: MediaQuery.of(context).size.height > MediaQuery.of(context).size.width ? ScreenUtil().setWidth(200) : 200,
width:
MediaQuery.of(context).size.height > MediaQuery.of(context).size.width
? ScreenUtil().setWidth(200)
: 200,
child: GestureDetector(
onTap: () {
Navigator.push(
Expand Down
16 changes: 14 additions & 2 deletions lib/src/data/simulations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:simulate/src/data/themedata.dart';
import 'package:simulate/src/simulations/bubble_sort.dart';
import 'package:simulate/src/simulations/epicycloid.dart';
import 'package:simulate/src/simulations/fourier_series.dart';
import 'package:simulate/src/simulations/merge_sort.dart';
import 'package:simulate/src/simulations/rose_pattern.dart';
import 'package:simulate/src/simulations/toothpick.dart';
import 'package:simulate/src/simulations/insertion_sort.dart';
Expand All @@ -13,8 +14,8 @@ import 'package:simulate/src/simulations/epicycloid_curve.dart';
import 'package:simulate/src/simulations/maurer_rose.dart';

class Simulations with ChangeNotifier {
static var _favorites = [-1, -1, -1, -1, -1, -1, -1, -1, -1];
final _algorithm = [0, 1, 2];
static var _favorites = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1];
final _algorithm = [0, 1, 2, 9];
final _mathematics = [3, 4, 5, 6, 7, 8];
final _physics = [];
final _chemistry = [];
Expand All @@ -29,6 +30,7 @@ class Simulations with ChangeNotifier {
6: "epicycloid curve pattern mathematics animation pencil lines ",
7: "epicycloid curve pattern mathematics animation ",
8: "maurer rose pattern mathematics animation",
9: "merge sort algorithm sorting bars ",
};

Simulations() {
Expand Down Expand Up @@ -141,6 +143,16 @@ class Simulations with ChangeNotifier {
infoLink: 'https://en.wikipedia.org/wiki/Maurer_rose',
fav: _favorites[8],
),
SimulationCard(
id: 9,
simulationName: 'Merge Sort',
image: theme.darkTheme
? 'assets/simulations/MergeSortDark.png'
: 'assets/simulations/MergeSortLight.png',
direct: MergeSort(),
infoLink: 'https://en.wikipedia.org/wiki/Insertion_sort',
fav: _favorites[9],
),
];
}

Expand Down
4 changes: 2 additions & 2 deletions lib/src/simulations/langton_ant.dart
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ class _LangtonAntState extends State<LangtonAnt> {
size: 24,
),
onPressed: () => setState(() {
shouldWork = !shouldWork;
}),
shouldWork = !shouldWork;
}),
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
);
Expand Down
Loading

0 comments on commit 6377d31

Please sign in to comment.