-
-
Save MarcinusX/b9103fe68b5f8f95029bade06e196029 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class _HeightPickerState extends State<HeightPicker> { | |
double get _pixelsPerUnit { | |
return _drawingHeight / widget.totalUnits; | |
} | |
double get _sliderPosition { | |
double halfOfBottomLabel = labelsFontSize / 2; | |
int unitsFromBottom = widget.height - widget.minHeight; | |
return halfOfBottomLabel + unitsFromBottom * _pixelsPerUnit; | |
} | |
///returns actual height of slider to be able to slide | |
double get _drawingHeight { | |
double totalHeight = widget.widgetHeight; | |
double marginBottom = marginBottomAdapted(context); | |
double marginTop = marginTopAdapted(context); | |
return totalHeight - (marginBottom + marginTop + labelsFontSize); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return Stack( | |
children: <Widget>[ | |
_drawSlider(), | |
_drawLabels(), | |
], | |
); | |
} | |
Widget _drawSlider() { | |
return Positioned( | |
child: HeightSlider(height: widget.height), | |
left: 0.0, | |
right: 0.0, | |
bottom: _sliderPosition, | |
); | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment