Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ritam #1

Merged
merged 33 commits into from
Jun 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
22b3b96
Update pubspec.yaml to remove comments
RitamChakraborty May 27, 2021
3790b1c
Reformat files
RitamChakraborty May 27, 2021
253e722
Format braces
RitamChakraborty May 27, 2021
82c5b78
Create separate service layer to hold the business logic
RitamChakraborty May 27, 2021
a010d5a
Change size
RitamChakraborty May 27, 2021
f24c010
Change duration
RitamChakraborty May 27, 2021
af0f49b
Set color from main.dart
RitamChakraborty May 27, 2021
83b6e17
Fix change color button
RitamChakraborty May 28, 2021
4e483b0
Fix change color button
RitamChakraborty May 30, 2021
da85095
Wrap the app under StatefulBuilder
RitamChakraborty May 30, 2021
963ea13
Update sort selection drop down with enums
RitamChakraborty May 30, 2021
0f2bed1
Simplify sort button on pressed function
RitamChakraborty May 30, 2021
81c2192
Fix bar width
RitamChakraborty May 30, 2021
a6258be
Fix bottom nav bar layout
RitamChakraborty May 30, 2021
88f5473
Fix arr size and duration slider
RitamChakraborty May 30, 2021
b4e706f
Update changeColor function
RitamChakraborty May 30, 2021
d5a56a0
Update update size and improve sorting_service implementation
RitamChakraborty May 30, 2021
4fbc184
Reformat sort functions
RitamChakraborty May 30, 2021
ee3bfdc
Stop sorting when needed
RitamChakraborty May 30, 2021
4b6fc30
Reformat packages
RitamChakraborty May 30, 2021
f3eaf9a
Optimize widget
RitamChakraborty May 30, 2021
87bff8f
Disable color change while sorting is in progress
RitamChakraborty May 30, 2021
56ada41
Change slider background colors with color change
RitamChakraborty May 30, 2021
962878f
Update main.dart
RitamChakraborty May 30, 2021
825e7c7
Set default duration to 500
RitamChakraborty May 30, 2021
69f8e93
Fix wrong StatefulBuilder deletion
RitamChakraborty May 30, 2021
2f5524c
Fix insertion sort
RitamChakraborty May 31, 2021
941b708
Change maximum duration
RitamChakraborty May 31, 2021
57de494
Fix color change
RitamChakraborty May 31, 2021
4bd9d1a
Recommit due to ide bug
RitamChakraborty May 31, 2021
c96dad2
Disable sorting when sorting in progress
RitamChakraborty May 31, 2021
7de9fd6
Change slider ui
RitamChakraborty May 31, 2021
748e17b
Shuffle when sorting type is changed
RitamChakraborty May 31, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
60 changes: 30 additions & 30 deletions .packages
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,34 @@
#
# For more info see: https://dart.dev/go/dot-packages-deprecation
#
# Generated by pub on 2021-05-26 10:15:57.093396.
ansicolor:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/ansicolor-1.1.1/lib/
args:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/args-2.1.0/lib/
async:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.6.1/lib/
boolean_selector:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/boolean_selector-2.1.0/lib/
characters:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/characters-1.1.0/lib/
charcode:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/charcode-1.2.0/lib/
clock:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/clock-1.1.0/lib/
collection:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/collection-1.15.0/lib/
cupertino_icons:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/
fake_async:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/fake_async-1.2.0/lib/
flutter:file:///C:/src/flutter/packages/flutter/lib/
flutter_rename_app:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_rename_app-1.0.0/lib/
flutter_test:file:///C:/src/flutter/packages/flutter_test/lib/
io:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/io-1.0.0/lib/
matcher:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.10/lib/
meta:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0/lib/
path:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/path-1.8.0/lib/
process_run:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/process_run-0.10.12+3/lib/
pub_semver:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/pub_semver-2.0.0/lib/
sky_engine:file:///C:/src/flutter/bin/cache/pkg/sky_engine/lib/
source_span:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/source_span-1.8.1/lib/
stack_trace:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.10.0/lib/
stream_channel:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/stream_channel-2.1.0/lib/
string_scanner:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.1.0/lib/
term_glyph:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.2.0/lib/
test_api:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/test_api-0.3.0/lib/
typed_data:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/typed_data-1.3.0/lib/
vector_math:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/vector_math-2.1.0/lib/
yaml:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/yaml-2.2.1/lib/
# Generated by pub on 2021-05-30 21:22:36.224817.
ansicolor:file:///home/ritam/.pub-cache/hosted/pub.dartlang.org/ansicolor-1.1.1/lib/
args:file:///home/ritam/.pub-cache/hosted/pub.dartlang.org/args-2.1.0/lib/
async:file:///home/ritam/.pub-cache/hosted/pub.dartlang.org/async-2.6.1/lib/
boolean_selector:file:///home/ritam/.pub-cache/hosted/pub.dartlang.org/boolean_selector-2.1.0/lib/
characters:file:///home/ritam/.pub-cache/hosted/pub.dartlang.org/characters-1.1.0/lib/
charcode:file:///home/ritam/.pub-cache/hosted/pub.dartlang.org/charcode-1.2.0/lib/
clock:file:///home/ritam/.pub-cache/hosted/pub.dartlang.org/clock-1.1.0/lib/
collection:file:///home/ritam/.pub-cache/hosted/pub.dartlang.org/collection-1.15.0/lib/
cupertino_icons:file:///home/ritam/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/
fake_async:file:///home/ritam/.pub-cache/hosted/pub.dartlang.org/fake_async-1.2.0/lib/
flutter:file:///home/ritam/Tools/flutter/packages/flutter/lib/
flutter_rename_app:file:///home/ritam/.pub-cache/hosted/pub.dartlang.org/flutter_rename_app-1.0.0/lib/
flutter_test:file:///home/ritam/Tools/flutter/packages/flutter_test/lib/
io:file:///home/ritam/.pub-cache/hosted/pub.dartlang.org/io-1.0.0/lib/
matcher:file:///home/ritam/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.10/lib/
meta:file:///home/ritam/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0/lib/
path:file:///home/ritam/.pub-cache/hosted/pub.dartlang.org/path-1.8.0/lib/
process_run:file:///home/ritam/.pub-cache/hosted/pub.dartlang.org/process_run-0.10.12+3/lib/
pub_semver:file:///home/ritam/.pub-cache/hosted/pub.dartlang.org/pub_semver-2.0.0/lib/
sky_engine:file:///home/ritam/Tools/flutter/bin/cache/pkg/sky_engine/lib/
source_span:file:///home/ritam/.pub-cache/hosted/pub.dartlang.org/source_span-1.8.1/lib/
stack_trace:file:///home/ritam/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.10.0/lib/
stream_channel:file:///home/ritam/.pub-cache/hosted/pub.dartlang.org/stream_channel-2.1.0/lib/
string_scanner:file:///home/ritam/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.1.0/lib/
term_glyph:file:///home/ritam/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.2.0/lib/
test_api:file:///home/ritam/.pub-cache/hosted/pub.dartlang.org/test_api-0.3.0/lib/
typed_data:file:///home/ritam/.pub-cache/hosted/pub.dartlang.org/typed_data-1.3.0/lib/
vector_math:file:///home/ritam/.pub-cache/hosted/pub.dartlang.org/vector_math-2.1.0/lib/
yaml:file:///home/ritam/.pub-cache/hosted/pub.dartlang.org/yaml-2.2.1/lib/
sortviz:lib/
50 changes: 50 additions & 0 deletions lib/components/bar.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import 'package:flutter/material.dart';
import 'package:sortviz/components/barPainter.dart';
import 'package:sortviz/util/color_picker.dart';

class Bar extends StatelessWidget {
final Color _color;
final int _height;
final double _width;
final int _index;
final ColorPicker _colorPicker;

Bar(
{@required Color color,
@required int height,
@required double width,
@required int index,
Key key})
: this._color = color,
this._height = height,
this._width = width,
this._index = index,
_colorPicker = ColorPicker(sortColor: color, height: height),
assert(color != null),
assert(height != null),
assert(width != null),
assert(index != null),
super(key: key);

@override
Widget build(BuildContext context) {
Widget bar = Container(
height: _height.toDouble(),
width: _width,
color: _colorPicker.color,
);

return bar;

// Todo: Although I had fixed it, I really liked your approach. So I'd like if you fix it by yourself

return CustomPaint(
painter: ArrayBar(
sortColor: _color,
width: _width,
height: _height,
index: _index,
),
);
}
}
2 changes: 2 additions & 0 deletions lib/components/barPainter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ class ArrayBar extends CustomPainter {
final int height;
final int index;
final Color sortColor;

ArrayBar({this.width, this.height, this.index, this.sortColor});

@override
void paint(Canvas canvas, Size size) {
Paint paint = Paint();
Expand Down
20 changes: 0 additions & 20 deletions lib/components/cardView.dart

This file was deleted.

98 changes: 98 additions & 0 deletions lib/components/value_slider.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import 'package:flutter/material.dart';

class ValueSlider extends StatelessWidget {
final String _title;
final String _param;
final double _value;
final double _max;
final double _min;
final ValueChanged<double> _onChanged;
final Color _backgroundColor;

const ValueSlider({
@required String title,
String param,
@required double value,
@required double max,
@required double min,
@required ValueChanged<double> onChanged,
@required Color backgroundColor,
Key key,
}) : this._title = title,
this._param = param,
this._value = value,
this._max = max,
this._min = min,
this._onChanged = onChanged,
this._backgroundColor = backgroundColor,
assert(title != null),
assert(value != null),
assert(max != null),
assert(min != null),
assert(onChanged != null),
assert(backgroundColor != null),
super(key: key);

@override
Widget build(BuildContext context) {
return Expanded(
child: Padding(
padding: const EdgeInsets.all(16),
child: Material(
color: _backgroundColor,
borderRadius: BorderRadius.circular(8),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Expanded(
child: Text(
_title,
style: TextStyle(
fontSize: 18,
color: Colors.white,
),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
textBaseline: TextBaseline.alphabetic,
children: <Widget>[
Text(
_value.toString(),
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
_param != null
? Text(
" " + _param,
style: TextStyle(
fontSize: 25.0,
color: Colors.white,
fontWeight: FontWeight.bold,
),
)
: Container(),
],
),
Expanded(
child: Slider(
max: _max,
min: _min,
value: _value,
inactiveColor: Colors.white,
onChanged: _onChanged,
),
)
],
),
),
),
),
);
}
}