0

hi how can i add search and paginated in my Datatable2 in flutter this is my code and data come from server and i have one request for search for exmaple when typing the name of person and send to server response is returned ..how can i This Response(details of person) show in my data table

class TableSamleNew extends StatefulWidget {
  const TableSamleNew({Key? key}) : super(key: key);

  @override
  State<TableSamleNew> createState() => _TableSamleNewState();
}

class _TableSamleNewState extends State<TableSamleNew> {
  final getListController = Get.put(GetListController());

  late List<ListItem>? listItem =
      getListController.getList!.data!.listItem;
  @override
  Widget build(BuildContext context) {
    var input = Get.rootDelegate.arguments();
    final List my_list_2 = [];
    List mylist_3 = input["headers"];
    azadlist_3.forEach((element) => my_list_2.add(element.name));

    return Scaffold(
      body: Directionality(
        textDirection: TextDirection.rtl,
        child: GetBuilder<GetListController>(
          init: GetListController(),
          initState: (_) {},
          builder: (_) => getListController.isLoading
              ? const Padding(
                  padding: EdgeInsets.only(top: 50),
                  child: Center(child: CircularProgressIndicator()),
                )
              : DataTable2(
                  columnSpacing: 12,
                  horizontalMargin: 12,
                  minWidth: 600,
                  columns: my_list_2
                      .map<DataColumn>((el) => DataColumn(label: Text(el!)))
                      .toList(),
                  rows: listItem!
                      .map<DataRow>((e) => DataRow(cells: [
                            DataCell(Text('${e.itemInfo?.name}'
                                '${e.itemInfo?.paymentDate}')),
                            DataCell(Text('${e.itemInfo!.helpType}')),
                            DataCell(Text('${e.itemInfo!.helpType}')),
                            DataCell(Text('${e.itemInfo!.helpType}')),
                            // DataCell(Text('${e.itemInfo?.clientStoreAddress}')),
                          ]))
                      .toList()),
        ),
      ),
    );
  }
}

And Thank You For Your Response

0 Answers0