server_table 1.0.0 copy "server_table: ^1.0.0" to clipboard
server_table: ^1.0.0 copied to clipboard

Enterprise server-side data table for Flutter with pagination, sorting, filtering, and configurable backend response parsing.

example/lib/main.dart

import 'package:example/api/api_client.dart';
import 'package:example/customer/customer_datasource.dart';
import 'package:example/model/customer.dart';
import 'package:flutter/material.dart';
import 'package:server_table/server_table.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();

  configureAuth();
  runApp(const MyApp());
}

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // TRY THIS: Try running your application with "flutter run". You'll see
        // the application has a purple toolbar. Then, without quitting the app,
        // try changing the seedColor in the colorScheme below to Colors.green
        // and then invoke "hot reload" (save your changes or press the "hot
        // reload" button in a Flutter-supported IDE, or press "r" if you used
        // the command line to start the app).
        //
        // Notice that the counter didn't reset back to zero; the application
        // state is not lost during the reload. To reset the state, use hot
        // restart instead.
        //
        // This works for code too, not just values: Most code changes can be
        // tested with just a hot reload.
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
      ),
      home: CustomerPage(),
    );
  }
}

class CustomerPage extends StatelessWidget {
  CustomerPage({super.key});

  final columns = [
    ServerColumn<Customer>(
      title: 'ID',
      field: 'id',
      sortable: true,
      width: 100,
      cellBuilder: (context, customer) {
        return Text(customer.id.toString());
      },
    ),

    ServerColumn<Customer>(
      title: 'Name',
      field: 'name',
      sortable: true,
      filterable: true,
      width: 200,
      cellBuilder: (context, customer) {
        return Text(customer.name);
      },
    ),

    ServerColumn<Customer>(
      title: 'Email',
      field: 'emailAddress',
      sortable: true,
      filterable: true,
      width: 250,
      cellBuilder: (context, customer) {
        return Text(customer.email ?? "");
      },
    ),
  ];
  final customerController = ServerTableController<Customer>(
    dataSource: customerSource,
  );
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: ServerTable<Customer>(
        controller: customerController,
        columns: columns,
      ),
    );
  }
}
5
likes
150
points
88
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Enterprise server-side data table for Flutter with pagination, sorting, filtering, and configurable backend response parsing.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

collection, dio, flutter

More

Packages that depend on server_table