Giter Site home page Giter Site logo

quasar-pankaj / flow_board Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zuhabul/flow_board

0.0 0.0 0.0 633 KB

License: MIT License

Shell 0.56% Ruby 0.73% C++ 11.58% C 1.11% Objective-C 0.35% Java 0.30% Kotlin 0.07% Dart 72.90% Swift 0.71% HTML 0.99% CMake 10.70%

flow_board's Introduction

flow_board

Flow Board

A customizable and draggable Kanban Board widget for Flutter

Intro

flow_board is a customizable and draggable Kanban Board widget for Flutter. You can use it to create a Kanban Board tool like those in Trello.

Check out flow_board to see to build a BoardView database.

Getting Started

Add the FlowBoard Flutter package to your environment.

With Flutter:

flutter pub add flow_board
flutter pub get

This will add a line like this to your package's pubspec.yaml:

dependencies:
  flow_board: ^0.0.1

Create your first board

Initialize an FlowBoardController for the board. It contains the data used by the board. You can register callbacks to receive the changes of the board.

final FlowBoardController controller = FlowBoardController(
  onMoveGroup: (fromGroupId, fromIndex, toGroupId, toIndex) {
    debugPrint('Move item from $fromIndex to $toIndex');
  },
  onMoveGroupItem: (groupId, fromIndex, toIndex) {
    debugPrint('Move $groupId:$fromIndex to $groupId:$toIndex');
  },
  onMoveGroupItemToGroup: (fromGroupId, fromIndex, toGroupId, toIndex) {
    debugPrint('Move $fromGroupId:$fromIndex to $toGroupId:$toIndex');
  },
);

Provide an initial value of the board by initializing the FlowBoardGroupData. It represents a group data and contains list of items. Each item displayed in the group requires to implement the FlowBoardGroupItem class.

void initState() {
  final group1 = FlowBoardGroupData(id: "To Do", items: [
    TextItem("Card 1"),
    TextItem("Card 2"),
  ]);
  final group2 = FlowBoardGroupData(id: "In Progress", items: [
    TextItem("Card 3"),
    TextItem("Card 4"),
  ]);

  final group3 = FlowBoardGroupData(id: "Done", items: []);

  controller.addGroup(group1);
  controller.addGroup(group2);
  controller.addGroup(group3);
  super.initState();
}

class TextItem extends FlowBoardGroupItem {
  final String s;
  TextItem(this.s);

  @override
  String get id => s;
}

Finally, return a FlowBoard widget in the build method.

@override
Widget build(BuildContext context) {
  return FlowBoard(
    controller: controller,
    cardBuilder: (context, group, groupItem) {
      final textItem = groupItem as TextItem;
      return FlowBoardGroupCard(
        key: ObjectKey(textItem),
        child: Text(textItem.s),
      );
    },
    groupConstraints: const BoxConstraints.tightFor(width: 240),
  );
}

Usage Example

To quickly grasp how it can be used, look at the /example/lib folder. First, run main.dart to play with the demo.

Second, let's delve into multi_board_list_example.dart to understand a few key components:

  • A Board widget is created via instantiating an FlowBoard object.
  • In the FlowBoard object, you can find the FlowBoardController, which is defined in board_data.dart, is fed with pre-populated mock data. It also contains callback functions to materialize future user data.
  • Three builders: FlowBoardHeaderBuilder, FlowBoardFooterBuilder, FlowBoardCardBuilder. See below image for what they are used for.

Glossary

Please refer to the API documentation.

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

Acknowledgements

This package is a modified version of the appflowy-board. You can find the original package's license here.

License

This package is distributed under the terms of the MIT License. See the LICENSE file for details.

flow_board's People

Contributors

zuhabul avatar

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.