create method

Future<void> create({
  1. int rows = 50,
  2. int cols = 10,
  3. int viewportWidth = 800,
  4. int viewportHeight = 600,
  5. double scale = 1.0,
})

Create a new native grid instance.

rows and cols include the data body plus any true frozen panes. Column headers live in the top column-indicator band by default. viewportWidth and viewportHeight set the initial pixel dimensions.

Implementation

Future<void> create({
  int rows = 50,
  int cols = 10,
  int viewportWidth = 800,
  int viewportHeight = 600,
  double scale = 1.0,
}) async {
  final req = CreateRequest()
    ..viewportWidth = viewportWidth
    ..viewportHeight = viewportHeight
    ..scale = scale
    ..config = (GridConfig()
      ..layout = (LayoutConfig()
        ..rows = rows
        ..cols = cols
        ..extendLastCol = true)
      ..scrolling = (ScrollConfig()
        ..scrollbars = ScrollBarsMode.SCROLLBAR_BOTH
        ..fastScroll = true
        ..flingImpulseGain = _defaultFlingImpulseGain
        ..flingFriction = _defaultFlingFriction)
      ..editing =
          (EditConfig()..defaultEditor = _defaultEngineTextEditorSpec())
      ..span = (SpanConfig()..cellSpan = CellSpanMode.CELL_SPAN_ADJACENT)
      ..interaction = (InteractionConfig()
        ..resize = (ResizePolicy()
          ..columns = true
          ..rows = true
          ..uniform = false)
        ..headerFeatures = (HeaderFeatures()
          ..sort = true
          ..reorder = true
          ..chooser = false))
      ..indicators = _defaultIndicatorsConfig());
  final response = await VolvoxGridService.Create(req);
  _gridId = response.gridId;
  notifyListeners();
}