running formatter

This commit is contained in:
2026-01-15 17:34:56 -08:00
parent a962b1f3cf
commit 6634ebaf81
1180 changed files with 16714 additions and 16640 deletions
@@ -68,11 +68,13 @@ class _NativePagedListViewState extends State<PagedListView> {
}
void _scrollListener() {
if (_controller!.offset >= _controller!.position.maxScrollExtent && !_controller!.position.outOfRange) {
if (_controller!.offset >= _controller!.position.maxScrollExtent &&
!_controller!.position.outOfRange) {
// Bottom of List
widget.loadNext!();
}
if (_controller!.offset <= _controller!.position.minScrollExtent && !_controller!.position.outOfRange) {
if (_controller!.offset <= _controller!.position.minScrollExtent &&
!_controller!.position.outOfRange) {
// Top of List
}
}
@@ -86,7 +88,11 @@ class _NativePagedListViewState extends State<PagedListView> {
controller: _controller,
slivers: <Widget>[
...?widget.slivers,
if (widget.onRefresh == null) SliverToBoxAdapter(child: Container()) else cupertino.CupertinoSliverRefreshControl(onRefresh: widget.onRefresh),
if (widget.onRefresh == null)
SliverToBoxAdapter(child: Container())
else
cupertino.CupertinoSliverRefreshControl(
onRefresh: widget.onRefresh),
if (widget.isLoading != null && widget.rows.isEmpty)
Center(child: widget.isLoading)
else
@@ -102,7 +108,8 @@ class _NativePagedListViewState extends State<PagedListView> {
value: widget.rows[index].selected,
onChanged: (bool? value) {
setState(() {
widget.rows[index].onSelectChanged!(value);
widget.rows[index]
.onSelectChanged!(value);
});
},
)
@@ -157,13 +164,18 @@ class _NativePagedListViewState extends State<PagedListView> {
}
_sortController = Scaffold.of(context).showBottomSheet((context) {
final List<DataColumn> _cols = widget.columns.where((c) => c.onSort != null).toList();
final List<DataColumn> _cols =
widget.columns.where((c) => c.onSort != null).toList();
final bool? _sortAsc = widget.sortAscending;
final int? selectedIndex = widget.sortColumnIndex;
return Container(
decoration: BoxDecoration(
color: Theme.of(context).brightness == Brightness.dark ? Colors.black38 : Colors.grey[200],
borderRadius: const BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20))),
color: Theme.of(context).brightness == Brightness.dark
? Colors.black38
: Colors.grey[200],
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(20),
topRight: Radius.circular(20))),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
@@ -173,7 +185,9 @@ class _NativePagedListViewState extends State<PagedListView> {
dense: true,
selected: selectedIndex == i,
title: _cols[i].label,
subtitle: Text(widget.sortAscending! ? 'Ascending' : 'Descending'),
subtitle: Text(widget.sortAscending!
? 'Ascending'
: 'Descending'),
leading: Radio<int>(
groupValue: selectedIndex,
onChanged: (value) {
@@ -184,7 +198,9 @@ class _NativePagedListViewState extends State<PagedListView> {
value: i,
),
trailing: IconButton(
icon: Icon(_sortAsc! ? Icons.arrow_upward : Icons.arrow_downward),
icon: Icon(_sortAsc!
? Icons.arrow_upward
: Icons.arrow_downward),
onPressed: () {
_sortController!.setState!(() {
_cols[i].onSort!(i, !_sortAsc);
@@ -254,7 +270,8 @@ class _NativePagedListViewState extends State<PagedListView> {
bool get rowsSelected => _selectedRowCount != 0;
int get _selectedRowCount => widget.rows.where((d) => d.selected).toSet().toList().length;
int get _selectedRowCount =>
widget.rows.where((d) => d.selected).toSet().toList().length;
List<Widget> _buildMobileChildren(int index) {
List<Widget> _children = [];
@@ -25,11 +25,17 @@ class StatelessDataTable extends StatelessWidget {
this.rowsPerPage = defaultRowsPerPage,
this.handlePrevious,
this.handleNext,
this.availableRowsPerPage = const <int>[defaultRowsPerPage, defaultRowsPerPage * 2, defaultRowsPerPage * 5, defaultRowsPerPage * 10],
this.availableRowsPerPage = const <int>[
defaultRowsPerPage,
defaultRowsPerPage * 2,
defaultRowsPerPage * 5,
defaultRowsPerPage * 10
],
this.onRowsPerPageChanged,
this.dragStartBehavior = DragStartBehavior.down,
}) : assert(columns.isNotEmpty),
assert(sortColumnIndex == null || (sortColumnIndex >= 0 && sortColumnIndex < columns.length)),
assert(sortColumnIndex == null ||
(sortColumnIndex >= 0 && sortColumnIndex < columns.length)),
assert(rowsPerPage > 0),
assert(() {
if (onRowsPerPageChanged != null) {
@@ -60,7 +66,11 @@ class StatelessDataTable extends StatelessWidget {
final bool rowCountApproximate;
final Map<int, DataRow> _rows = <int, DataRow>{};
DataRow _getBlankRowFor(int index) => DataRow.byIndex(index: index, cells: columns.map<DataCell>((DataColumn column) => DataCell.empty).toList());
DataRow _getBlankRowFor(int index) => DataRow.byIndex(
index: index,
cells: columns
.map<DataCell>((DataColumn column) => DataCell.empty)
.toList());
DataRow _getProgressIndicatorRowFor(int index) {
bool haveProgressIndicator = false;
@@ -100,7 +110,8 @@ class StatelessDataTable extends StatelessWidget {
}
//show no data
if (result.isEmpty) {
var cells = columns.map<DataCell>((DataColumn column) => DataCell.empty).toList();
var cells =
columns.map<DataCell>((DataColumn column) => DataCell.empty).toList();
cells[cells.length ~/ 2] = const DataCell(Text('no data'));
result.add(DataRow.byIndex(index: 0, cells: cells));
}
@@ -110,13 +121,15 @@ class StatelessDataTable extends StatelessWidget {
final GlobalKey _tableKey = GlobalKey();
int get _selectedRowCount => rows.where((d) => d.selected).toSet().toList().length;
int get _selectedRowCount =>
rows.where((d) => d.selected).toSet().toList().length;
@override
Widget build(BuildContext context) {
assert(debugCheckHasMaterialLocalizations(context));
final ThemeData themeData = Theme.of(context);
final MaterialLocalizations localizations = MaterialLocalizations.of(context);
final MaterialLocalizations localizations =
MaterialLocalizations.of(context);
final List<Widget> headerWidgets = <Widget>[];
double startPadding = 24;
@@ -152,8 +165,9 @@ class StatelessDataTable extends StatelessWidget {
final TextStyle? footerTextStyle = themeData.textTheme.caption;
final List<Widget> footerWidgets = <Widget>[];
if (onRowsPerPageChanged != null) {
final List<Widget> _footerChildren =
availableRowsPerPage.where((int value) => value <= rows.length || value == rowsPerPage).map<DropdownMenuItem<int>>((int value) {
final List<Widget> _footerChildren = availableRowsPerPage
.where((int value) => value <= rows.length || value == rowsPerPage)
.map<DropdownMenuItem<int>>((int value) {
return DropdownMenuItem<int>(value: value, child: Text('$value'));
}).toList();
footerWidgets.addAll(<Widget>[
@@ -177,7 +191,11 @@ class StatelessDataTable extends StatelessWidget {
}
footerWidgets.addAll(<Widget>[
Container(width: 32),
Text(localizations.pageRowsInfoTitle(firstRowIndex + 1, firstRowIndex + rowsPerPage, totalItems ?? rows.length, rowCountApproximate)),
Text(localizations.pageRowsInfoTitle(
firstRowIndex + 1,
firstRowIndex + rowsPerPage,
totalItems ?? rows.length,
rowCountApproximate)),
Container(width: 32),
IconButton(
icon: const Icon(Icons.chevron_left),
@@ -189,7 +207,10 @@ class StatelessDataTable extends StatelessWidget {
icon: const Icon(Icons.chevron_right),
padding: EdgeInsets.zero,
tooltip: localizations.nextPageTooltip,
onPressed: (!rowCountApproximate && (firstRowIndex + rowsPerPage >= (totalItems ?? rows.length))) ? null : handleNext),
onPressed: (!rowCountApproximate &&
(firstRowIndex + rowsPerPage >= (totalItems ?? rows.length)))
? null
: handleNext),
Container(width: 14),
]);
@@ -203,17 +224,24 @@ class StatelessDataTable extends StatelessWidget {
container: true,
child: DefaultTextStyle(
style: _selectedRowCount > 0
? themeData.textTheme.subtitle1!.copyWith(color: themeData.colorScheme.secondary)
: themeData.textTheme.headline6!.copyWith(fontWeight: FontWeight.w400),
? themeData.textTheme.subtitle1!
.copyWith(color: themeData.colorScheme.secondary)
: themeData.textTheme.headline6!
.copyWith(fontWeight: FontWeight.w400),
child: IconTheme.merge(
data: const IconThemeData(opacity: 0.54),
child: ButtonTheme(
child: Ink(
height: 64,
color: _selectedRowCount > 0 ? themeData.secondaryHeaderColor : null,
color: _selectedRowCount > 0
? themeData.secondaryHeaderColor
: null,
child: Padding(
padding: EdgeInsetsDirectional.only(start: startPadding, end: 14),
child: Row(mainAxisAlignment: MainAxisAlignment.end, children: headerWidgets),
padding: EdgeInsetsDirectional.only(
start: startPadding, end: 14),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: headerWidgets),
),
),
),
@@ -269,17 +297,24 @@ class StatelessDataTable extends StatelessWidget {
container: true,
child: DefaultTextStyle(
style: _selectedRowCount > 0
? themeData.textTheme.subtitle1!.copyWith(color: themeData.colorScheme.secondary)
: themeData.textTheme.headline6!.copyWith(fontWeight: FontWeight.w400),
? themeData.textTheme.subtitle1!
.copyWith(color: themeData.colorScheme.secondary)
: themeData.textTheme.headline6!
.copyWith(fontWeight: FontWeight.w400),
child: IconTheme.merge(
data: const IconThemeData(opacity: 0.54),
child: ButtonTheme(
child: Ink(
height: 64,
color: _selectedRowCount > 0 ? themeData.secondaryHeaderColor : null,
color: _selectedRowCount > 0
? themeData.secondaryHeaderColor
: null,
child: Padding(
padding: EdgeInsetsDirectional.only(start: startPadding, end: 14),
child: Row(mainAxisAlignment: MainAxisAlignment.end, children: headerWidgets),
padding: EdgeInsetsDirectional.only(
start: startPadding, end: 14),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: headerWidgets),
),
),
),
@@ -287,23 +322,23 @@ class StatelessDataTable extends StatelessWidget {
),
),
Expanded(
flex: 8,
child: ScrollConfiguration(
behavior: CustomScrollBehavior(),
flex: 8,
child: ScrollConfiguration(
behavior: CustomScrollBehavior(),
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable(
key: _tableKey,
columns: columns,
sortColumnIndex: sortColumnIndex,
sortAscending: sortAscending,
onSelectAll: onSelectAll,
rows: _getRows(firstRowIndex, rowsPerPage)),
),
scrollDirection: Axis.horizontal,
child: DataTable(
key: _tableKey,
columns: columns,
sortColumnIndex: sortColumnIndex,
sortAscending: sortAscending,
onSelectAll: onSelectAll,
rows: _getRows(firstRowIndex, rowsPerPage)),
),
),
),
),
DefaultTextStyle(
style: footerTextStyle!,