This file contains hidden or 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 _ColourSliderState extends State<ColourSlider> { | |
| var fraction = 0.0; | |
| @override | |
| Widget build(BuildContext context) { | |
| debugPaintPointersEnabled = true; | |
| return GestureDetector( | |
| onPanUpdate: (DragUpdateDetails details) { | |
| RenderBox box = context.findRenderObject(); | |
| Offset localOffset = box.globalToLocal(details.globalPosition); |
This file contains hidden or 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
| void performLayout(Size size) { | |
| var trackSize = layoutChild(ColourSlider.track, BoxConstraints.loose(size)); | |
| var thumbSize = layoutChild(ColourSlider.thumb, BoxConstraints.loose(size)); | |
| positionChild(ColourSlider.track, Offset(0, thumbSize.height/2 - trackSize.height/2)); | |
| positionChild(ColourSlider.thumb, Offset(-thumbSize.width/2, 0)); | |
| } |
This file contains hidden or 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 _ColourSliderDelegate extends MultiChildLayoutDelegate { | |
| @override | |
| void performLayout(Size size) { | |
| layoutChild(ColourSlider.track, BoxConstraints.loose(size)); | |
| positionChild(ColourSlider.track, Offset(0, 0)); | |
| layoutChild(ColourSlider.thumb, BoxConstraints.loose(size)); | |
| positionChild(ColourSlider.thumb, Offset(0, 0)); | |
| } | |
| @override |
This file contains hidden or 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 ColourSlider extends StatefulWidget { | |
| static final track = "track"; | |
| static final thumb = "thumb"; | |
| @override | |
| _ColourSliderState createState() => _ColourSliderState(); | |
| } | |
| class _ColourSliderState extends State<ColourSlider> { | |
| @override |
This file contains hidden or 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
| body: Center( | |
| child: ColourSlider(), | |
| ), |
This file contains hidden or 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
| package uk.co.jatra.recorder | |
| import android.os.Bundle | |
| import android.support.v7.app.AppCompatActivity | |
| import android.support.v7.widget.LinearLayoutManager | |
| import android.support.v7.widget.RecyclerView | |
| import android.support.v7.widget.helper.ItemTouchHelper | |
| import android.support.v7.widget.helper.ItemTouchHelper.DOWN | |
| import android.support.v7.widget.helper.ItemTouchHelper.UP | |
| import android.view.LayoutInflater |