Skip to content

Commit

Permalink
fix-jakebonk#23: some more null exceptions - needs rework
Browse files Browse the repository at this point in the history
  • Loading branch information
BenPoell committed May 22, 2023
1 parent e5c182c commit 8559403
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions lib/boardview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ class BoardViewState extends State<BoardView> with AutomaticKeepAliveClientMixin
moveRight();
}

if (dy! < topListY! + 70) {
if (dy != null && topListY != null && dy! < topListY! + 70) {
//scroll up
if (listStates[draggedListIndex!].boardListController.hasClients && !isScrolling) {
isScrolling = true;
Expand All @@ -522,11 +522,13 @@ class BoardViewState extends State<BoardView> with AutomaticKeepAliveClientMixin
duration: new Duration(milliseconds: 10), curve: Curves.ease)
.whenComplete(() {
pos -= listStates[draggedListIndex!].boardListController.position.pixels;
if (initialY == null) initialY = 0;
// if(widget.boardViewController != null) {
// initialY -= pos;
// }

if (initialY == null) {
initialY = 0;
}

isScrolling = false;

if (topItemY != null) {
topItemY = topItemY! + pos;
}
Expand All @@ -539,18 +541,22 @@ class BoardViewState extends State<BoardView> with AutomaticKeepAliveClientMixin
});
}
}

if (0 <= draggedItemIndex! - 1 && dy! < topItemY! - listStates[draggedListIndex!].itemStates[draggedItemIndex! - 1].height / 2) {
//move up
moveUp();
}

double? tempBottom = bottomListY;

if (widget.middleWidget != null) {
if (_middleWidgetKey.currentContext != null) {
RenderBox _box = _middleWidgetKey.currentContext!.findRenderObject() as RenderBox;
tempBottom = _box.size.height;
}
}
if (dy! > tempBottom! - 70) {

if (dy != null && tempBottom != null && dy! > tempBottom - 70) {
//scroll down

if (listStates[draggedListIndex!].boardListController.hasClients) {
Expand All @@ -566,9 +572,6 @@ class BoardViewState extends State<BoardView> with AutomaticKeepAliveClientMixin
if (initialY == null) {
initialY = 0;
}
// if(widget.boardViewController != null) {
// initialY -= pos;
// }

isScrolling = false;

Expand Down

0 comments on commit 8559403

Please # to comment.