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

class CustomPaginatedTable extends StatelessWidget {
  final List<DataColumn> columns;
  final List<DataRow> rows;
  final int currentPage;
  final int itemsPerPage;
  final bool isDesktop;

  const CustomPaginatedTable({
    super.key,
    required this.columns,
    required this.rows,
    required this.currentPage,
    required this.itemsPerPage,
    this.isDesktop = false,
  });

  @override
  Widget build(BuildContext context) {
    return LayoutBuilder(
      builder: (context, constraints) {
        // double minWidth = isDesktop ? MediaQuery.of(context).size.width : 1300;
        double minWidth = isDesktop ? constraints.maxWidth : 1300;
        return SingleChildScrollView(
          scrollDirection: Axis.horizontal,
          child: SingleChildScrollView(
            scrollDirection: Axis.vertical,
            child: ConstrainedBox(
              // width: MediaQuery.of(context).size.width * 0.8,
              constraints: BoxConstraints(minWidth: minWidth),

              child: DataTable(
                dividerThickness: 0.5,

                // columnSpacing: isDesktop ? 24.0 : 16.0,
                border: TableBorder(
                  horizontalInside: BorderSide(
                    width: 0.5,
                    // color: Colors.grey.shade200,
                  ),
                ),
                columns: columns,
                rows: rows,
              ),
            ),
          ),
        );
      },
    );
  }
}
