nrb 4.0.6 copy "nrb: ^4.0.6" to clipboard
nrb: ^4.0.6 copied to clipboard

A highly responsive Flutter table and report builder for complex nested headers, editable data grids, and premium Excel/PDF exports.

example/lib/main.dart

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

void main() {
  runApp(
    const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: NRBQuickStartDemo(),
    ),
  );
}

/// A simplified, copy-pasteable example of the Nexora Report Builder.
/// This demo shows how to implement a professional report with a data grid.
class NRBQuickStartDemo extends StatefulWidget {
  const NRBQuickStartDemo({super.key});

  @override
  State<NRBQuickStartDemo> createState() => _NRBQuickStartDemoState();
}

class _NRBQuickStartDemoState extends State<NRBQuickStartDemo> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('NRB Quick Start'),
        backgroundColor: Colors.blueGrey.shade900,
        foregroundColor: Colors.white,
      ),
      body: Column(
        children: [
          // -------------------------------------------------------------------
          // TOP SECTION: Analytics (Optional Charts)
          // -------------------------------------------------------------------
          const Padding(
            padding: EdgeInsets.all(16.0),
            child: Text(
              "Revenue Overview",
              style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
            ),
          ),
          const SizedBox(
            height: 150,
            child: NrbBarChart(
              data: [120, 150, 180, 220, 300, 280],
              labels: ["Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
              barColor: Colors.teal,
            ),
          ),

          const Divider(height: 40),

          // -------------------------------------------------------------------
          // MAIN SECTION: The Data Grid (NrbTableEngine)
          // -------------------------------------------------------------------
          Expanded(
            child: NrbTableEngine(
              reportName: "Quick_Start_Report",
              frozenColumnsCount: 1, // Freeze the first column
              isSortingEnable: true,
              primaryUiColor: Colors.teal,

              // 1. Define Headers (Supports ColSpan/RowSpan)
              headers: [
                [
                  const NrbHeaderCell(text: "Category", colSpan: 1, rowSpan: 2, backgroundColor: Colors.teal),
                  const NrbHeaderCell(text: "Financial Performance", colSpan: 2, backgroundColor: Colors.teal),
                  const NrbHeaderCell(text: "Stats", colSpan: 1, rowSpan: 2, backgroundColor: Colors.teal),
                ],
                [
                  NrbHeaderCell(text: "Income", backgroundColor: Colors.teal.shade700),
                  NrbHeaderCell(text: "Outcome", backgroundColor: Colors.teal.shade700),
                ]
              ],

              // 2. Pass Table Data
              tableData: [
                [
                  const TextCell(itemContent: "Electronics"),
                  const TextCell(itemContent: "45000", isAmount: true),
                  const TextCell(itemContent: "12000", isAmount: true),
                  const TextCell(itemContent: "88%"),
                ],
                [
                  const TextCell(itemContent: "Fashion"),
                  const TextCell(itemContent: "32000", isAmount: true),
                  const TextCell(itemContent: "15000", isAmount: true),
                  const TextCell(itemContent: "92%"),
                ],
                [
                  const TextCell(itemContent: "Groceries", isBold: true),
                  const TextCell(itemContent: "78000", isAmount: true, isBold: true),
                  const TextCell(itemContent: "45000", isAmount: true, isBold: true),
                  const TextCell(itemContent: "95%", isBold: true),
                ],
              ],

              // 3. Export Configuration
              enableDownload: true,
              showDownloadFloatingButton: true,

              // FOR FREE NATIVE PDF: Leave apiKey as empty string
              apiKey: "",
              companyName: "Innovate Nest Labs",
              companyAddress: "Uttar Mawna, Sreepur, Gazipur, Bangladesh",
              companyLogoAsset: "assets/logo.png", // Ensure this is in your assets
              
              // FOR PREMIUM EXCEL/WORD: Use your credentials
              // packageName: "your.package.name",
              // apiKey: "YOUR_PRO_API_KEY",
            ),
          ),
        ],
      ),
    );
  }
}
10
likes
120
points
347
downloads

Documentation

API reference

Publisher

verified publisherinnovatenestlabs.com

Weekly Downloads

A highly responsive Flutter table and report builder for complex nested headers, editable data grids, and premium Excel/PDF exports.

License

unknown (license)

Dependencies

cross_file, flutter, path_provider, share_plus, web

More

Packages that depend on nrb