show<T, R> static method
Future<R?>
show<T, R>({
- required BuildContext context,
- required List<
ModDataHeader> headers, - required List<
T> data, - required DataTableSource source,
- required dynamic onPageChanged(
- int page
- required int totalRecords,
- required int currentPage,
- required int rowsPerPage,
- BorderStyle borderStyle = BorderStyle.none,
- Color? oddRowColor,
- Color? evenRowColor,
- Color? headerBackgroundColor,
- Color? hoverColor,
- String paginationText = 'of',
- String rowsPerPageText = 'Rows per page',
- dynamic onSort(
- String field,
- SortDirection direction
- dynamic onRowsPerPageChanged(
- int rowsPerPage
- List<
int> availableRowsPerPage = const [5, 10, 15, 20, 50, 100, 200], - double? paginationBorderRadius = 5,
- String? currentSortField,
- SortDirection currentSortDirection = SortDirection.none,
- double rowHeight = 35.0,
- bool fixedHeader = false,
- bool enableSimplePagination = false,
- dynamic onColumnWidthChanged()?,
- bool enableColumnResize = false,
- bool showHorizontalScrollbar = true,
- ModDataTableActionBarConfig? actionBarConfig,
- List<
String> ? columnsShow, - Widget? emptyViewWidget,
- required Widget header,
- Color? modalHeaderColor,
- Color? modalBodyColor,
- ModModalPosition position = ModModalPosition.center,
- ModModalSize size = ModModalSize.lg,
- ModModalHeight height = ModModalHeight.auto,
- bool fullScreen = false,
- double borderRadius = 8.0,
- bool barrierDismissible = true,
- VoidCallback? onClose,
- double? maxWidth,
- double? minWidth,
- double? maxHeight,
- double? minHeight,
- EdgeInsets? bodyPadding,
Shows the DataTableModal as a dialog
Implementation
static Future<R?> show<T, R>({
required BuildContext context,
// DataTable required properties
required List<ModDataHeader> headers,
required List<T> data,
required DataTableSource source,
required Function(int page) onPageChanged,
required int totalRecords,
required int currentPage,
required int rowsPerPage,
// DataTable optional properties
BorderStyle borderStyle = BorderStyle.none,
Color? oddRowColor,
Color? evenRowColor,
Color? headerBackgroundColor,
Color? footerBackgroundColor,
Color? hoverColor,
String paginationText = 'of',
String rowsPerPageText = 'Rows per page',
Function(String field, SortDirection direction)? onSort,
Function(int rowsPerPage)? onRowsPerPageChanged,
List<int> availableRowsPerPage = const [5, 10, 15, 20, 50, 100, 200],
double? paginationBorderRadius = 5,
String? currentSortField,
SortDirection currentSortDirection = SortDirection.none,
double rowHeight = 35.0,
bool fixedHeader = false,
bool enableSimplePagination = false,
Function(String field, double newWidth)? onColumnWidthChanged,
bool enableColumnResize = false,
bool showHorizontalScrollbar = true,
ModDataTableActionBarConfig? actionBarConfig,
List<String>? columnsShow,
Widget? emptyViewWidget,
// Modal required properties
required Widget header,
// Modal optional properties
Color? modalHeaderColor,
Color? modalBodyColor,
Color? modalFooterColor,
ModModalPosition position = ModModalPosition.center,
ModModalSize size = ModModalSize.lg,
ModModalHeight height = ModModalHeight.auto,
bool fullScreen = false,
double borderRadius = 8.0,
bool barrierDismissible = true,
VoidCallback? onClose,
double? maxWidth,
double? minWidth,
double? maxHeight,
double? minHeight,
EdgeInsets? bodyPadding,
ModDataTableModalFooterConfig footerConfig =
const ModDataTableModalFooterConfig(),
}) {
final modalAlignment = position == ModModalPosition.top
? Alignment.topCenter
: position == ModModalPosition.bottom
? Alignment.bottomCenter
: Alignment.center;
return showDialog<R>(
context: context,
barrierDismissible: barrierDismissible,
builder: (context) => Align(
alignment: modalAlignment,
child: ModDataTableModal<T>(
// DataTable properties
headers: headers,
data: data,
source: source,
onPageChanged: onPageChanged,
totalRecords: totalRecords,
currentPage: currentPage,
rowsPerPage: rowsPerPage,
borderStyle: borderStyle,
oddRowColor: oddRowColor,
evenRowColor: evenRowColor,
headerBackgroundColor: headerBackgroundColor,
footerBackgroundColor: footerBackgroundColor,
hoverColor: hoverColor,
paginationText: paginationText,
rowsPerPageText: rowsPerPageText,
onSort: onSort,
onRowsPerPageChanged: onRowsPerPageChanged,
availableRowsPerPage: availableRowsPerPage,
paginationBorderRadius: paginationBorderRadius,
currentSortField: currentSortField,
currentSortDirection: currentSortDirection,
rowHeight: rowHeight,
fixedHeader: fixedHeader,
enableSimplePagination: enableSimplePagination,
onColumnWidthChanged: onColumnWidthChanged,
enableColumnResize: enableColumnResize,
showHorizontalScrollbar: showHorizontalScrollbar,
actionBarConfig: actionBarConfig,
columnsShow: columnsShow,
emptyViewWidget: emptyViewWidget,
// Modal properties
header: header,
modalHeaderColor: modalHeaderColor,
modalBodyColor: modalBodyColor,
modalFooterColor: modalFooterColor,
position: position,
size: size,
height: height,
fullScreen: fullScreen,
borderRadius: borderRadius,
barrierDismissible: barrierDismissible,
onClose: onClose,
maxWidth: maxWidth,
minWidth: minWidth,
maxHeight: maxHeight,
minHeight: minHeight,
bodyPadding: bodyPadding,
footerConfig: footerConfig,
),
),
);
}