initializeBoard method
void
initializeBoard({
- required List<
BoardListsData> data, - Color backgroundColor = Colors.white,
- TextStyle? textStyle,
- dynamic onItemTap()?,
- dynamic onItemLongPress()?,
- dynamic onListTap(
- int? listIndex
- dynamic onListLongPress(
- int? listIndex
- double? displacementX,
- double? displacementY,
- void onItemReorder()?,
- void onListReorder()?,
- void onListRename()?,
- void onNewCardInsert()?,
- Decoration? boardDecoration,
- Decoration? listDecoration,
- Widget listTransitionBuilder()?,
- Widget cardTransitionBuilder()?,
- required Duration cardTransitionDuration,
- required Duration listTransitionDuration,
- Color? cardPlaceHolderColor,
- Color? listPlaceHolderColor,
Implementation
void initializeBoard(
{required List<BoardListsData> data,
Color backgroundColor = Colors.white,
TextStyle? textStyle,
Function(int? itemIndex, int? listIndex)? onItemTap,
Function(int? cardIndex, int? listIndex)? onItemLongPress,
Function(int? listIndex)? onListTap,
Function(int? listIndex)? onListLongPress,
double? displacementX,
double? displacementY,
void Function(int? oldCardIndex, int? newCardIndex, int? oldListIndex,
int? newListIndex)?
onItemReorder,
void Function(int? oldListIndex, int? newListIndex)? onListReorder,
void Function(String? oldName, String? newName)? onListRename,
void Function(String? cardIndex, String? listIndex, String? text)?
onNewCardInsert,
Decoration? boardDecoration,
Decoration? listDecoration,
Widget Function(Widget child, Animation<double> animation)?
listTransitionBuilder,
Widget Function(Widget child, Animation<double> animation)?
cardTransitionBuilder,
required Duration cardTransitionDuration,
required Duration listTransitionDuration,
Color? cardPlaceHolderColor,
Color? listPlaceHolderColor}) {
board = BoardState(
textStyle: textStyle,
lists: [],
displacementX: displacementX,
displacementY: displacementY,
onItemTap: onItemTap,
onItemLongPress: onItemLongPress,
onListTap: onListTap,
onListLongPress: onListLongPress,
onItemReorder: onItemReorder,
onListReorder: onListReorder,
onListRename: onListRename,
onNewCardInsert: onNewCardInsert,
listTransitionBuilder: listTransitionBuilder,
cardTransitionBuilder: cardTransitionBuilder,
cardTransitionDuration: cardTransitionDuration,
listTransitionDuration: listTransitionDuration,
controller: ScrollController(),
backgroundColor: backgroundColor,
cardPlaceholderColor: cardPlaceHolderColor,
listPlaceholderColor: listPlaceHolderColor,
listDecoration: listDecoration,
boardDecoration: boardDecoration);
for (int i = 0; i < data.length; i++) {
List<ListItem> listItems = [];
for (int j = 0; j < data[i].items.length; j++) {
listItems
.add(ListItem(child: data[i].items[j], listIndex: i, index: j));
}
board.lists.add(BoardList(
headerBackgroundColor: data[i].headerBackgroundColor,
footerBackgroundColor: data[i].footerBackgroundColor,
backgroundColor: data[i].backgroundColor,
items: listItems,
width: data[i].width,
scrollController: ScrollController(),
title: data[i].title ?? 'LIST ${i + 1}'));
}
}