bcell 1.1.0 copy "bcell: ^1.1.0" to clipboard
bcell: ^1.1.0 copied to clipboard

A Flutter data-grid widget with a pluto_grid-shaped API and spreadsheet features: a formula engine, multi-sheet workbooks, charts, pivot tables, and CSV/XLSX/PDF import-export.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:bcell/bcell.dart';

void main() {
  runApp(const BCellExampleApp());
}

class BCellExampleApp extends StatelessWidget {
  const BCellExampleApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: 'BCell Example',
      home: BCellGridExamplePage(),
    );
  }
}

class BCellGridExamplePage extends StatefulWidget {
  const BCellGridExamplePage({super.key});

  @override
  State<BCellGridExamplePage> createState() => _BCellGridExamplePageState();
}

class _BCellGridExamplePageState extends State<BCellGridExamplePage> {
  late BCellGridStateManager stateManager;

  final List<BCellColumn> columns = [
    BCellColumn(
      title: 'Id',
      field: 'id',
      type: BCellColumnType.number(),
      width: 80,
    ),
    BCellColumn(title: 'Name', field: 'name', type: BCellColumnType.text()),
    BCellColumn(title: 'Role', field: 'role', type: BCellColumnType.text()),
  ];

  final List<BCellRow> rows = [
    BCellRow(
      cells: {
        'id': BCellValue(value: 1),
        'name': BCellValue(value: 'Ada Lovelace'),
        'role': BCellValue(value: 'Engineer'),
      },
    ),
    BCellRow(
      cells: {
        'id': BCellValue(value: 2),
        'name': BCellValue(value: 'Grace Hopper'),
        'role': BCellValue(value: 'Admiral'),
      },
    ),
    BCellRow(
      cells: {
        'id': BCellValue(value: 3),
        'name': BCellValue(value: 'Alan Turing'),
        'role': BCellValue(value: 'Mathematician'),
      },
    ),
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('BCell Grid Example')),
      body: Padding(
        padding: const EdgeInsets.all(16),
        child: BCellGrid(
          columns: columns,
          rows: rows,
          onLoaded: (BCellGridOnLoadedEvent event) {
            stateManager = event.stateManager;
          },
          // Demo only: don't log real cell values in production apps —
          // grid data often contains user PII and device logs are readable.
          onSelected: (BCellGridOnSelectedEvent event) {
            debugPrint('Selected row ${event.rowIdx}: ${event.cell?.value}');
          },
          onSorted: (BCellGridOnSortedEvent event) {
            debugPrint(
              'Sorted by ${event.column.field}: '
              '${event.oldSort.name} -> ${event.column.sort.name}',
            );
          },
          onChanged: (BCellGridOnChangedEvent event) {
            debugPrint(
              'Cell changed at row ${event.rowIdx}, '
              'column ${event.column.field}: '
              '${event.oldValue} -> ${event.value}',
            );
          },
        ),
      ),
    );
  }
}
0
likes
160
points
98
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A Flutter data-grid widget with a pluto_grid-shaped API and spreadsheet features: a formula engine, multi-sheet workbooks, charts, pivot tables, and CSV/XLSX/PDF import-export.

Homepage
Repository (GitHub)
View/report issues

Topics

#grid #spreadsheet #table #widget #formula

License

MIT (license)

Dependencies

crypto, excel, fl_chart, flutter, pdf, pointycastle

More

Packages that depend on bcell