common_data_table 0.0.1 copy "common_data_table: ^0.0.1" to clipboard
common_data_table: ^0.0.1 copied to clipboard

A Common Data Table same like data table with search filter, set limits, export excel / pdf and also edit, delete option and add more actions

example/lib/main.dart

import 'package:common_data_table/common_data_table.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:url_launcher/url_launcher.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Common Data Table Example',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        useMaterial3: true,
      ),
      home: MyHomePage(),
    );
  }
}

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

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: CommonDataTable(
        isSearchAble: true,
        heading: [
          'S.NO',
          'Title',
        ],
        rowActionButtons: [
          RowActionButton(
            tooltip: "View Image",
            icon: Icons.remove_red_eye,
            isDisabled: (index) {
              if (index == 3) {
                return true;
              }
              return null;
            },
            onTap: (index) {},
            color: Colors.blue,
          )
        ],
        tableActionButtons: [
          TableActionButton(
            child: Text("Add Highlight"),
            onTap: () {},
            icon: Icon(
              FontAwesomeIcons.addressBook,
              size: 20,
            ),
          )
        ],
        data: [
          for (int i = 1; i <= 50; i++) ...[
            [
              '$i.',
              'Title of $i',
            ],
          ]
        ],
        headingAlign: {
          0: TblAlign.center,
          1: TblAlign.center,
        },
        dataAlign: {
          0: TblAlign.center,
        },
        onEdit: (index) {},
        onDelete: (index) {},
        disabledDeleteButtons: [1, 3, 5],
        disabledEditButtons: [0, 2, 4],
        dataTextStyle: (row) {
          if (row[0] == '4.') {
            return {
              1: TextStyle(
                color: Colors.red,
                fontSize: 20,
              )
            };
          }
          return null;
        },
        onExportExcel: (file) async {
          await launchUrl(Uri.file(file.path));
        },
        onExportPDF: (file) async {
          await launchUrl(Uri.file(file.path));
        },
      ),
    );
  }
}
10
likes
140
points
120
downloads

Publisher

verified publishersolusibejo.com

Weekly Downloads

A Common Data Table same like data table with search filter, set limits, export excel / pdf and also edit, delete option and add more actions

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, font_awesome_flutter, path_provider, syncfusion_flutter_pdf, syncfusion_flutter_xlsio

More

Packages that depend on common_data_table