open method

Future<void> open()

Implementation

Future<void> open() async {
  double rowsHeight = 6 * itemHeight;

  // itemHeight * 2 = Header Height + Column Height
  double popupHeight = (itemHeight * 2) +
      rowsHeight +
      PlutoGridSettings.totalShadowLineWidth +
      PlutoGridSettings.gridInnerSpacing;

  final popupColumns = _buildColumns();

  final defaultDate = _getDefaultDate();

  currentYear = defaultDate.year;

  currentMonth = defaultDate.month;

  final List<DateTime> days = PlutoDateTimeHelper.getDaysInBetween(
    DateTime(defaultDate.year, defaultDate.month, 1),
    DateTime(defaultDate.year, defaultDate.month + 1, 0),
  );

  final popupRows = _buildRows(days);

  PlutoGridPopup(
    context: context,
    mode: PlutoGridMode.select,
    onLoaded: _onLoaded,
    onSelected: _onSelected,
    columns: popupColumns,
    rows: popupRows,
    width: popupColumns.fold<double>(0, (previous, column) {
          return previous + column.width;
        }) +
        1,
    height: popupHeight,
    createHeader: _createHeader,
    configuration: configuration.copyWith(
      tabKeyAction: PlutoGridTabKeyAction.normal,
      style: configuration.style.copyWith(
        enableColumnBorderVertical: false,
        enableColumnBorderHorizontal: false,
        enableCellBorderVertical: false,
        enableCellBorderHorizontal: false,
        enableRowColorAnimation: false,
        oddRowColor: const PlutoOptional(null),
        evenRowColor: const PlutoOptional(null),
        activatedColor: configuration.style.gridBackgroundColor,
        gridBorderColor: configuration.style.gridBackgroundColor,
        borderColor: configuration.style.gridBackgroundColor,
        activatedBorderColor: configuration.style.gridBackgroundColor,
        inactivatedBorderColor: configuration.style.gridBackgroundColor,
        rowHeight: configuration.style.rowHeight,
        defaultColumnTitlePadding: PlutoGridSettings.columnTitlePadding,
        defaultCellPadding: const EdgeInsets.symmetric(horizontal: 3),
        gridBorderRadius: configuration.style.gridPopupBorderRadius,
      ),
      columnSize: const PlutoGridColumnSizeConfig(
        autoSizeMode: PlutoAutoSizeMode.none,
        resizeMode: PlutoResizeMode.none,
      ),
    ),
  );
}