rodydavis/golden_layout

Tries to call null method 'this.widget.onClose()' when not closeable.

Schwusch opened this issue · 1 comments

While compiling the package at 225fb1f
Code crashes in this little example:

import 'package:flutter/material.dart';
import 'package:golden_layout/golden_layout.dart';

void main() {
  runApp(Example());
}

class Example extends StatelessWidget {
  @override
  Widget build(BuildContext context) => MaterialApp(
        home: Foo(),
      );
}

class Foo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    final controller = WindowController();
    (controller.base as WindowColumn).children.add(WindowRow([
          WindowGroup(
            WindowTab(
                id: 'bar', title: (_, __) => Text('bar'), canClose: false),
            false,
          ),
          WindowGroup(
            WindowTab(
                id: 'baz', title: (_, __) => Text('baz'), canClose: false),
            false,
          ),
        ]));
    return Scaffold(
      body: GoldenLayout(controller: controller),
    );
  }
}

While dragging a tab:
image

The error message is:

══╡ EXCEPTION CAUGHT BY GESTURE ╞══
The following JSNoSuchMethodError was thrown while handling a gesture:
NoSuchMethodError: tried to call a non-function, such as null: 'this.widget.onClose'

When the exception was thrown, this was the stack:
packages/golden_layout/src/window_group.dart 67:76                       <fn>
packages/flutter/src/widgets/drag_target.dart 418:29                     [_startDrag]
packages/flutter/src/widgets/drag_target.dart 324:36                     <fn>
packages/flutter/src/gestures/multidrag.dart 269:59                      <fn>
packages/flutter/src/gestures/recognizer.dart 182:24                     invokeCallback
packages/flutter/src/gestures/multidrag.dart 269:14                      [_startDrag]
packages/flutter/src/gestures/multidrag.dart 259:48                      <fn>
packages/flutter/src/gestures/multidrag.dart 488:14                      accepted
packages/flutter/src/gestures/multidrag.dart 259:10                      acceptGesture
packages/flutter/src/gestures/arena.dart 263:11                          [_resolveInFavorOf]
packages/flutter/src/gestures/arena.dart 222:9                           [_resolve]
packages/flutter/src/gestures/arena.dart 52:12                           resolve
packages/flutter/src/gestures/multidrag.dart 62:17                       resolve
packages/flutter/src/gestures/multidrag.dart 474:7                       [_delayPassed]
dart-sdk/lib/_internal/js_dev_runtime/private/isolate_helper.dart 48:19  internalCallback

Handler: "onStart"
Recognizer:
  DelayedMultiDragGestureRecognizer#abd8b
═══════════════════════════════════════════════════

Fixed on 0.0.2