Git Product home page Git Product logo

flutterboardview's Introduction

pub package

Flutter BoardView

This is a custom widget that can create a draggable BoardView or also known as a kanban. The view can be reordered with drag and drop.

Installation

Just add boardview to the pubspec.yaml file.

Usage Example

To get started you can look inside the /example folder. This package is broken into 3 core parts

Example

BoardView

The BoardView class takes in a List of BoardLists. It can also take in a BoardViewController which is can be used to animate to positions in the BoardView

BoardViewController boardViewController = new BoardViewController();

List<BoardList> _lists = List<BoardList>();

BoardView(
  lists: _lists,
  boardViewController: boardViewController,
);

BoardList

The BoardList has several callback methods for when it is being dragged. The header item is a Row and expects a List as its object. The header item on long press will begin the drag process for the BoardList.

    BoardList(
      onStartDragList: (int listIndex) {
    
      },
      onTapList: (int listIndex) async {
    
      },
      onDropList: (int listIndex, int oldListIndex) {       
       
      },
      headerBackgroundColor: Color.fromARGB(255, 235, 236, 240),
      backgroundColor: Color.fromARGB(255, 235, 236, 240),
      header: [
        Expanded(
            child: Padding(
                padding: EdgeInsets.all(5),
                child: Text(
                  "List Item",
                  style: TextStyle(fontSize: 20),
                ))),
      ],
      items: items,
    );

BoardItem

The BoardItem view has several callback methods that get called when dragging. A long press on the item field widget will begin the drag process.

    BoardItem(
        onStartDragItem: (int listIndex, int itemIndex, BoardItemState state) {
        
        },
        onDropItem: (int listIndex, int itemIndex, int oldListIndex,
            int oldItemIndex, BoardItemState state) {
                      
        },
        onTapItem: (int listIndex, int itemIndex, BoardItemState state) async {
        
        },
        item: Card(
          child: Padding(
            padding: const EdgeInsets.all(8.0),
            child: Text("Board Item"),
          ),
        )
    );

flutterboardview's People

Contributors

jakebonk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

flutterboardview's Issues

showing this error

                                         ^^^^^^^^^^^^^

/C:/Users/username/AppData/Local/Pub/Cache/hosted/pub.dev/boardview-0.2.2/lib/vs_scrollbar.dart:177:50: Error: The getter 'showTrackOnHover' isn't defined for the class 'ScrollbarThemeData'.

  • 'ScrollbarThemeData' is from 'package:flutter/src/material/scrollbar_theme.dart' ('/C:/src/flutter/packages/flutter/lib/src/material/scrollbar_theme.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'showTrackOnHover'.
    widget.showTrackOnHover ?? _scrollbarTheme.showTrackOnHover ?? false;
    ^^^^^^^^^^^^^^^^

How to retain board scroll position

Thanks for creating this package!

We're connecting the board to a REST API and would like to update it after we've saved the data to the server. The challenge is the scroll position is lost when the widget is recreated.

Is it possible to track the scroll position and then set the position when the widget is rebuilt?

BoardView takes up as much space as it can.

Can we please have an option for BoardView to take up only the amount of space that the BoardItems need?

I'm getting unbounded height errors and I'm not sure how I could make it resize according to its parent because the parent also resizes itself based on its content.

Thank you for this package btw, it does exactly what I needed.

Unhandled Exception: Null check operator used on a null value

/flutter ( 4415): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Null check operator used on a null value
E/flutter ( 4415): #0 BoardViewState.build. (package:boardview/boardview.dart:570:53)
E/flutter ( 4415): #1 _RootZone.run (dart:async/zone.dart:1655:54)
E/flutter ( 4415): #2 _FutureListener.handleWhenComplete (dart:async/future_impl.dart:199:18)
E/flutter ( 4415): #3 Future._propagateToListeners.handleWhenCompleteCallback (dart:async/future_impl.dart:810:39)
E/flutter ( 4415): #4 Future._propagateToListeners (dart:async/future_impl.dart:866:11)
E/flutter ( 4415): #5 Future._completeWithValue (dart:async/future_impl.dart:641:5)
E/flutter ( 4415):
E/flutter ( 4415):

Needs animateTo BoardItem.

For now there's only animating to BoardList (unless I missed how to use it). I would really appreciate adding animating to a BoardItem.

Thank you.

isPointerOverScrollbar Error

my yaml file:
environment:
sdk: ">=2.12.0 <3.0.0"

dependencies:
flutter:
sdk: flutter

cupertino_icons: ^1.0.2
boardview: ^0.2.1

When I flutter run
../../developer/flutter/.pub-cache/hosted/pub.dartlang.org/boardview-0.2.2/lib/vs_scrollbar.dart:321:31: Error: Too many positional arguments: 1 allowed, but 2 found.
Try removing the extra positional arguments.
if (isPointerOverScrollbar(event.position,PointerDeviceKind.mouse)) {

Vertical Board

Can you also add a Vertical direction as well? It is more convenient and useful that way. It will be very helpful.
Great package btw.

draggedListIndex null when moving item in top left

Hi,

when moving an item from somewhere in the lists to the top left it occurs that the null-check of draggedListIndex fails.
image

It seems that .whenComplete((){ is somehow in the asyncronous call is called twice but I couldn't really dive deeper into the logic, maybe you have a clue.
image

Crash log:

I/flutter (13850): [2022-01-30 07:52:38.658171 | Catcher | INFO] ============================== CATCHER LOG ==============================
I/flutter (13850): [2022-01-30 07:52:38.658806 | Catcher | INFO] Crash occurred on 2022-01-30 07:52:38.657085
I/flutter (13850): [2022-01-30 07:52:38.659022 | Catcher | INFO]
I/flutter (13850): [2022-01-30 07:52:38.665425 | Catcher | INFO] ------- DEVICE INFO -------
I/flutter (13850): [2022-01-30 07:52:38.668144 | Catcher | INFO] id: RSR1.201013.001
I/flutter (13850): [2022-01-30 07:52:38.669514 | Catcher | INFO] androidId: a4eb8febffeede56
I/flutter (13850): [2022-01-30 07:52:38.671544 | Catcher | INFO] board: goldfish_x86
I/flutter (13850): [2022-01-30 07:52:38.673091 | Catcher | INFO] bootloader: unknown
I/flutter (13850): [2022-01-30 07:52:38.673414 | Catcher | INFO] brand: google
I/flutter (13850): [2022-01-30 07:52:38.673602 | Catcher | INFO] device: generic_x86_arm
I/flutter (13850): [2022-01-30 07:52:38.673771 | Catcher | INFO] display: sdk_gphone_x86_arm-userdebug 11 RSR1.201013.001 6903271 dev-keys
I/flutter (13850): [2022-01-30 07:52:38.674629 | Catcher | INFO] fingerprint: google/sdk_gphone_x86_arm/generic_x86_arm:11/RSR1.201013.001/6903271:userdebug/dev-keys
I/flutter (13850): [2022-01-30 07:52:38.675092 | Catcher | INFO] hardware: ranchu
I/flutter (13850): [2022-01-30 07:52:38.675526 | Catcher | INFO] host: abfarm-us-west1-c-0007
I/flutter (13850): [2022-01-30 07:52:38.675647 | Catcher | INFO] isPhysicalDevice: false
I/flutter (13850): [2022-01-30 07:52:38.675738 | Catcher | INFO] manufacturer: Google
I/flutter (13850): [2022-01-30 07:52:38.675944 | Catcher | INFO] model: sdk_gphone_x86_arm
I/flutter (13850): [2022-01-30 07:52:38.676414 | Catcher | INFO] product: sdk_gphone_x86_arm
I/flutter (13850): [2022-01-30 07:52:38.676522 | Catcher | INFO] tags: dev-keys
I/flutter (13850): [2022-01-30 07:52:38.676615 | Catcher | INFO] type: userdebug
I/flutter (13850): [2022-01-30 07:52:38.676703 | Catcher | INFO] versionBaseOs:
I/flutter (13850): [2022-01-30 07:52:38.676807 | Catcher | INFO] versionCodename: REL
I/flutter (13850): [2022-01-30 07:52:38.678090 | Catcher | INFO] versionIncremental: 6903271
I/flutter (13850): [2022-01-30 07:52:38.678334 | Catcher | INFO] versionPreviewSdk: 0
I/flutter (13850): [2022-01-30 07:52:38.678499 | Catcher | INFO] versionRelease: 11
I/flutter (13850): [2022-01-30 07:52:38.686513 | Catcher | INFO] versionSdk: 30
I/flutter (13850): [2022-01-30 07:52:38.686778 | Catcher | INFO] versionSecurityPatch: 2020-09-05
I/flutter (13850): [2022-01-30 07:52:38.686994 | Catcher | INFO]
I/flutter (13850): [2022-01-30 07:52:38.688534 | Catcher | INFO] ------- APP INFO -------
I/flutter (13850): [2022-01-30 07:52:38.689257 | Catcher | INFO] environment: debug
I/flutter (13850): [2022-01-30 07:52:38.689520 | Catcher | INFO] version: 0.9.1
I/flutter (13850): [2022-01-30 07:52:38.691351 | Catcher | INFO] appName: XXX
I/flutter (13850): [2022-01-30 07:52:38.691787 | Catcher | INFO] buildNumber: 202201291
I/flutter (13850): [2022-01-30 07:52:38.692339 | Catcher | INFO] packageName: XXX
I/flutter (13850): [2022-01-30 07:52:38.692592 | Catcher | INFO]
I/flutter (13850): [2022-01-30 07:52:38.692756 | Catcher | INFO] ---------- ERROR ----------
I/flutter (13850): [2022-01-30 07:52:38.692957 | Catcher | INFO] Null check operator used on a null value
I/flutter (13850): [2022-01-30 07:52:38.693181 | Catcher | INFO]
I/flutter (13850): [2022-01-30 07:52:38.693323 | Catcher | INFO] ------- STACK TRACE -------
I/flutter (13850): [2022-01-30 07:52:38.693588 | Catcher | INFO] #0      BoardViewState.build.<anonymous closure> package:boardview/boardview.dart:503
I/flutter (13850): [2022-01-30 07:52:38.694075 | Catcher | INFO] #1      _rootRun (dart:async/zone.dart:1420:47)
I/flutter (13850): [2022-01-30 07:52:38.694714 | Catcher | INFO] #2      _CustomZone.run (dart:async/zone.dart:1328:19)
I/flutter (13850): [2022-01-30 07:52:38.696102 | Catcher | INFO] #3      _FutureListener.handleWhenComplete (dart:async/future_impl.dart:203:18)
I/flutter (13850): [2022-01-30 07:52:38.696368 | Catcher | INFO] #4      Future._propagateToListeners.handleWhenCompleteCallback (dart:async/future_impl.dart:737:39)
I/flutter (13850): [2022-01-30 07:52:38.697425 | Catcher | INFO] #5      Future._propagateToListeners (dart:async/future_impl.dart:793:11)
I/flutter (13850): [2022-01-30 07:52:38.697798 | Catcher | INFO] #6      Future._completeWithValue (dart:async/future_impl.dart:602:5)
I/flutter (13850): [2022-01-30 07:52:38.698862 | Catcher | INFO] #7      _completeOnAsyncReturn (dart:async-patch/async_patch.dart:264:13)
I/flutter (13850): [2022-01-30 07:52:38.700419 | Catcher | INFO] #8      ScrollController.animateTo (package:flutter/src/widgets/scroll_controller.dart)
package:flutter/…/widgets/scroll_controller.dart:1
I/flutter (13850): [2022-01-30 07:52:38.700765 | Catcher | INFO] <asynchronous suspension>
I/flutter (13850): [2022-01-30 07:52:38.701310 | Catcher | INFO]
I/flutter (13850): [2022-01-30 07:52:38.701552 | Catcher | INFO] ------- CUSTOM INFO -------
I/flutter (13850): [2022-01-30 07:52:38.701705 | Catcher | INFO] ======================================================================

how to add/remove items to list?

i tried using this plugin to move item from one list to other. i followed example in github. but it only shows list headers for me.
i need to add some items to list. how to achieve them. can i add listtile to those list(custom widgets)?

widget.isAlwaysShown ?? _scrollbarTheme.isAlwaysShown ?? false;

../../../.pub-cache/hosted/pub.dev/boardview-0.2.2/lib/vs_scrollbar.dart:143:5: Error: No named parameter with the name 'isAlwaysShown'.
isAlwaysShown: isAlwaysShown,
^^^^^^^^^^^^^
../../../.pub-cache/hosted/pub.dev/boardview-0.2.2/lib/vs_scrollbar.dart:174:14: Error: The getter 'isAlwaysShown' isn't defined for the class '_MaterialScrollbar'.

  • '_MaterialScrollbar' is from 'package:boardview/vs_scrollbar.dart' ('../../../.pub-cache/hosted/pub.dev/boardview-0.2.2/lib/vs_scrollbar.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'isAlwaysShown'.
    widget.isAlwaysShown ?? _scrollbarTheme.isAlwaysShown ?? false;
    ^^^^^^^^^^^^^
    ../../../.pub-cache/hosted/pub.dev/boardview-0.2.2/lib/vs_scrollbar.dart:174:47: Error: The getter 'isAlwaysShown' isn't defined for the class 'ScrollbarThemeData'.
  • 'ScrollbarThemeData' is from 'package:flutter/src/material/scrollbar_theme.dart' ('../../../snap/flutter/common/flutter/packages/flutter/lib/src/material/scrollbar_theme.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'isAlwaysShown'.
    widget.isAlwaysShown ?? _scrollbarTheme.isAlwaysShown ?? false;
    ^^^^^^^^^^^^^
    Target kernel_snapshot failed: Exception

FAILURE: Build failed with an exception.

  • Where:
    Script '/home/anselm/snap/flutter/common/flutter/packages/flutter_tools/gradle/src/main/groovy/flutter.groovy' line: 1297

  • What went wrong:
    Execution failed for task ':app:compileFlutterBuildDebug'.

Process 'command '/home/anselm/snap/flutter/common/flutter/bin/flutter'' finished with non-zero exit value 1

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

Warning after Upgrade to Flutter 3

: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
../…/lib/boardview.dart:307
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../flutter/packages/flutter/lib/src/widgets/binding.dart').
package:flutter/…/widgets/binding.dart:1
      WidgetsBinding.instance!.addPostFrameCallback((Duration duration) {
                     ^

: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
../…/lib/boardview.dart:569
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../flutter/packages/flutter/lib/src/widgets/binding.dart').
package:flutter/…/widgets/binding.dart:1
      WidgetsBinding.instance!.addPostFrameCallback((timeStamp) {
                     ^

: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
../…/lib/board_item.dart:92
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../flutter/packages/flutter/lib/src/widgets/binding.dart').
package:flutter/…/widgets/binding.dart:1
    WidgetsBinding.instance!

                   ^
: Warning: Operand of null-aware operation '?.' has type 'SchedulerBinding' which excludes null.
../…/lib/table_sticky_headers.dart:115
- 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('../../flutter/packages/flutter/lib/src/scheduler/binding.dart').
package:flutter/…/scheduler/binding.dart:1
    SchedulerBinding.instance?.addPostFrameCallback((_) {

Not Scrolling automatically when drag items vertically

when a BoardList has many Items which we can see while scrolling maually . but when we move any item from one index to another in same list which has many items then moving vertically scrolling automatically not working . it should be scroll automatically upward and downward when we drag any item verticaly . suppose i am to drag and drop any BoardItem from 0th index to 20th index then i can not move it in one Drag becasue of not auto scrolling . pls solve this issue in package .

Run Isssue

How Can I Run This Code Using The GitHub URL.

Can't get the example working

I can't get the code to works. I'm able to draw a list, but it's not dragging items...
Here's my code:

import 'package:boardview/board_item.dart';
import 'package:boardview/board_list.dart';
import 'package:boardview/boardview.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class MyView extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return MyViewState();
  }
}

class MyViewState extends State<MyView> {
  @override
  Widget build(BuildContext context) {
    var boardItem0 = BoardItem(
        item: Container(
            height: 8,
            child: Text(
              'TESTE 0',
              style: TextStyle(fontSize: 12),
            )));
    var boardItem1 = BoardItem(
        item: Container(
            width: double.maxFinite,
            height: 10,
            child: Text(
              '  TESTE 1   ',
              style: TextStyle(fontSize: 12),
            )));

    var listBoardItems = List<BoardItem>();
    listBoardItems.add(boardItem0);
    listBoardItems.add(boardItem1);

    var boardList = BoardList(
        backgroundColor: Colors.yellow,
        items: listBoardItems,
        index: 0,
        footer: Container(height: 50));

    var listBoardListItems = List<BoardList>();
    listBoardListItems.add(boardList);

    var boardView0 = BoardView(lists: listBoardListItems);

    return Container(
      child: boardView0,
    );
  }
}

Add New BroadList Button At the Horizontal End .

I am using this library pls add this functionality in BoardView Library .
there should be a parameter in Board View for adding a addNewList Button View at the end of board list .. on tap of that button we can add new board list on that index . and loaded Board list should not be dragged across that addNew button

Error when moving items from one list to another untill is empty and then adding back

My two lists are initialized with 2 itens.
I move all from the first list to second one.
Then, I try to add an item of the second list to the first list.

Throws the exception:
RangeError (index): Invalid value: Valid value range is empty: 1

Edit: I've made a small overloading on constructor of BoardView to support a custom width instead the default value.

My full code:

import 'package:boardview/board_item.dart';
import 'package:boardview/board_list.dart';
import 'package:boardview/boardview.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class MyExample extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return MyExampleState();
  }
}

class MyExampleState extends State<MyExample> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(),
      body: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          mainAxisAlignment: MainAxisAlignment.start,
          children: <Widget>[
            Expanded(
                child: BoardView(
              lists: _get() + _get(), width: 150,
            )),
          ]),
    );
  }

  List<BoardList> _get() {
    var boardItem0 = BoardItem(
        item: Container(
            height: 20,
            color: Colors.indigo[100],
            child: Text(
              'ABC',
              style: TextStyle(fontSize: 12),
            )));
    var boardItem1 = BoardItem(
        item: Container(
            height: 20,
            color: Colors.purple[100],
            child: Text(
              '123',
              style: TextStyle(fontSize: 12),
            )));

    var listBoardItems = List<BoardItem>();
    listBoardItems.add(boardItem0);
    listBoardItems.add(boardItem1);

    var boardList = BoardList(
        headerBackgroundColor: Colors.green,
        header: Container(
          height: 50,
          color: Colors.blue,
        ),
        items: listBoardItems,
        footer: Container(
          height: 50,
          color: Colors.red,
        ));

    var listBoardListItems = List<BoardList>();
    listBoardListItems.add(boardList);

    return (listBoardListItems);
  }
}

Gif attached:

untitled

Error: No named parameter with the name 'isAlwaysShown'.

Launching lib/main.dart on RMX1801 in debug mode...
/home/amar/.pub-cache/hosted/pub.dev/vs_scrollbar-0.2.1/lib/vs_scrollbar.dart:143:11: Error: No named parameter with the name 'isAlwaysShown'.
isAlwaysShown: isAlwaysShown,
^^^^^^^^^^^^^
/home/amar/.pub-cache/hosted/pub.dev/vs_scrollbar-0.2.1/lib/vs_scrollbar.dart:174:14: Error: The getter 'isAlwaysShown' isn't defined for the class '_MaterialScrollbar'.

  • '_MaterialScrollbar' is from 'package:vs_scrollbar/vs_scrollbar.dart' ('/home/amar/.pub-cache/hosted/pub.dev/vs_scrollbar-0.2.1/lib/vs_scrollbar.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'isAlwaysShown'.
    widget.isAlwaysShown ?? _scrollbarTheme.isAlwaysShown ?? false;
    ^^^^^^^^^^^^^
    /home/amar/.pub-cache/hosted/pub.dev/vs_scrollbar-0.2.1/lib/vs_scrollbar.dart:174:47: Error: The getter 'isAlwaysShown' isn't defined for the class 'ScrollbarThemeData'.
  • 'ScrollbarThemeData' is from 'package:flutter/src/material/scrollbar_theme.dart' ('/home/amar/snap/flutter/common/flutter/packages/flutter/lib/src/material/scrollbar_theme.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'isAlwaysShown'.
    widget.isAlwaysShown ?? _scrollbarTheme.isAlwaysShown ?? false;
    ^^^^^^^^^^^^^
    Target kernel_snapshot failed: Exception

FAILURE: Build failed with an exception.

  • Where:
    Script '/home/amar/snap/flutter/common/flutter/packages/flutter_tools/gradle/src/main/groovy/flutter.groovy' line: 1297

  • What went wrong:
    Execution failed for task ':app:compileFlutterBuildDebug'.

Process 'command '/home/amar/snap/flutter/common/flutter/bin/flutter'' finished with non-zero exit value 1

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

BUILD FAILED in 23s

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.