Skip to content

Commit

Permalink
Updated dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
atreeon committed Feb 8, 2024
1 parent 712629a commit 63f9f27
Show file tree
Hide file tree
Showing 8 changed files with 184 additions and 102 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [0.1.0]
updated dependencies

## [0.0.3]
overflow problem on resize fixed

## [0.0.2]
√show a dropdown for the different filter types (add greater than, less than, between & equals)
√have an option to add a scrollable to my rows
Expand Down
34 changes: 18 additions & 16 deletions lib/ReusableDataGridW.dart
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ class _ResusableDatagridW<T> extends State<ResusableDatagridW<T>> {
setState(() {
//to do: add tests here as is complicated
if (maxHeight == null) {
rowsPerPage = (size.height - (hasFilter ? 140 : 110)) ~/ (rowHeight);
rowsPerPage = (size.height - (hasFilter ? 145 : 110)) ~/ (rowHeight);
widgetSize = size;
} else {
rowsPerPage = (widget.maxHeight! - (hasFilter ? 140 : 110)) ~/ (rowHeight);
rowsPerPage = (widget.maxHeight! - (hasFilter ? 145 : 110)) ~/ (rowHeight);

if (data.length <= rowsPerPage) {
rowsPerPage = data.length;

maxHeight = rowsPerPage * rowHeight + (hasFilter ? 80 : 50);
maxHeight = rowsPerPage * rowHeight + (hasFilter ? 85 : 50);
}
}
});
Expand Down Expand Up @@ -185,7 +185,7 @@ class _ResusableDatagridW<T> extends State<ResusableDatagridW<T>> {

double headingRowHeight = hasFilter ? 77 : 45;

return FlexibleFixedW(
return FlexibleFixedHeightW(
height: maxHeight,
child: GetChildSize(
onChange: (size) {
Expand All @@ -204,15 +204,17 @@ class _ResusableDatagridW<T> extends State<ResusableDatagridW<T>> {
columns: columns,
)
else
AtreeonPaginatedDataTable(
columnSpacing: 20,
showCheckboxColumn: false,
showFirstLastButtons: true,
dataRowHeight: rowHeight,
source: dts,
headingRowHeight: headingRowHeight,
columns: columns,
rowsPerPage: rowsPerPage,
SingleChildScrollView(
child: AtreeonPaginatedDataTable(
columnSpacing: 20,
showCheckboxColumn: false,
showFirstLastButtons: true,
dataRowHeight: rowHeight,
source: dts,
headingRowHeight: headingRowHeight,
columns: columns,
rowsPerPage: rowsPerPage,
),
),
widget.onCreateClick == null
? Container()
Expand Down Expand Up @@ -302,12 +304,12 @@ class DTS<T> extends DataTableSource {

///If a height is passed it is a fixed height widget
///
///If height is null it is flexible
class FlexibleFixedW extends StatelessWidget {
///If height is null it is flexible (column(expanded))
class FlexibleFixedHeightW extends StatelessWidget {
final Widget child;
final double? height;

const FlexibleFixedW({
const FlexibleFixedHeightW({
Key? key,
required this.child,
this.height,
Expand Down
148 changes: 72 additions & 76 deletions lib/atreeon_paginated_data_table.dart
Original file line number Diff line number Diff line change
Expand Up @@ -467,93 +467,89 @@ class AtreeonPaginatedDataTableState extends State<AtreeonPaginatedDataTable> {
Container(width: 14.0),
]);

// CARD
return Card(
semanticContainer: false,
child: LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
if (headerWidgets.isNotEmpty)
Semantics(
container: true,
child: DefaultTextStyle(
// These typographic styles aren't quite the regular ones. We pick the closest ones from the regular
// list and then tweak them appropriately.
// See https://material.io/design/components/data-tables.html#tables-within-cards
style: _selectedRowCount > 0 ? 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: Ink(
height: 64.0,
color: _selectedRowCount > 0 ? themeData.secondaryHeaderColor : null,
child: Padding(
padding: const EdgeInsetsDirectional.only(start: 24, end: 14.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: headerWidgets,
),
return LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
if (headerWidgets.isNotEmpty)
Semantics(
container: true,
child: DefaultTextStyle(
// These typographic styles aren't quite the regular ones. We pick the closest ones from the regular
// list and then tweak them appropriately.
// See https://material.io/design/components/data-tables.html#tables-within-cards
style: _selectedRowCount > 0 ? 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: Ink(
height: 64.0,
color: _selectedRowCount > 0 ? themeData.secondaryHeaderColor : null,
child: Padding(
padding: const EdgeInsetsDirectional.only(start: 24, end: 14.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: headerWidgets,
),
),
),
),
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
primary: widget.primary,
controller: widget.controller,
dragStartBehavior: widget.dragStartBehavior,
child: ConstrainedBox(
constraints: BoxConstraints(minWidth: constraints.minWidth, maxWidth: constraints.maxWidth),
child: DataTable(
key: _tableKey,
columns: widget.columns,
sortColumnIndex: widget.sortColumnIndex,
sortAscending: widget.sortAscending,
onSelectAll: widget.onSelectAll,
// Make sure no decoration is set on the DataTable
// from the theme, as its already wrapped in a Card.
decoration: const BoxDecoration(),
dataRowHeight: widget.dataRowHeight,
headingRowHeight: widget.headingRowHeight,
horizontalMargin: widget.horizontalMargin,
checkboxHorizontalMargin: widget.checkboxHorizontalMargin,
columnSpacing: widget.columnSpacing,
showCheckboxColumn: widget.showCheckboxColumn,
showBottomBorder: true,
rows: _getRows(_firstRowIndex, widget.rowsPerPage),
),
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
primary: widget.primary,
controller: widget.controller,
dragStartBehavior: widget.dragStartBehavior,
child: ConstrainedBox(
constraints: BoxConstraints(minWidth: constraints.minWidth, maxWidth: constraints.maxWidth),
child: DataTable(
key: _tableKey,
columns: widget.columns,
sortColumnIndex: widget.sortColumnIndex,
sortAscending: widget.sortAscending,
onSelectAll: widget.onSelectAll,
// Make sure no decoration is set on the DataTable
// from the theme, as its already wrapped in a Card.
decoration: const BoxDecoration(),
dataRowHeight: widget.dataRowHeight,
headingRowHeight: widget.headingRowHeight,
horizontalMargin: widget.horizontalMargin,
checkboxHorizontalMargin: widget.checkboxHorizontalMargin,
columnSpacing: widget.columnSpacing,
showCheckboxColumn: widget.showCheckboxColumn,
showBottomBorder: true,
rows: _getRows(_firstRowIndex, widget.rowsPerPage),
),
),
DefaultTextStyle(
style: footerTextStyle!,
child: IconTheme.merge(
data: const IconThemeData(
opacity: 0.54,
),
child: SizedBox(
// TODO(bkonyi): this won't handle text zoom correctly,
// https://github.com/flutter/flutter/issues/48522
height: 56.0,
child: SingleChildScrollView(
dragStartBehavior: widget.dragStartBehavior,
scrollDirection: Axis.horizontal,
reverse: true,
child: Row(
children: footerWidgets,
),
),
DefaultTextStyle(
style: footerTextStyle!,
child: IconTheme.merge(
data: const IconThemeData(
opacity: 0.54,
),
child: SizedBox(
// TODO(bkonyi): this won't handle text zoom correctly,
// https://github.com/flutter/flutter/issues/48522
height: 56.0,
child: SingleChildScrollView(
dragStartBehavior: widget.dragStartBehavior,
scrollDirection: Axis.horizontal,
reverse: true,
child: Row(
children: footerWidgets,
),
),
),
),
],
);
},
),
),
],
);
},
);
}
}
16 changes: 8 additions & 8 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
name: atreeon_datagrid_responsive
description: A datagrid with sorting and filtering capabilities. It is also responsive to screen size. Fully Typed.
version: 0.0.2+2
version: 0.1.0
homepage: https://atreeon.com
repository: https://github.com/atreeon/atreeon_datagrid_responsive

environment:
sdk: ">=2.17.0 <3.0.0"
sdk: ">=2.17.0 <4.0.0"
flutter: ">=3.0.0"

dependencies:
flutter:
sdk: flutter
dartx: ^0.6.0
font_awesome_flutter: ^9.0.0
optional: ^6.1.0+1
diacritic: ^0.1.3
intl: ^0.17.0
atreeon_get_child_size: ^0.1.1
dartx: ">=0.6.0 <2.0.0"
font_awesome_flutter: ">=9.0.0 <11.0.0"
optional: ">=6.1.0+1 <7.0.0"
diacritic: ">=0.1.3 <1.0.0"
intl: ">=0.18.0 <1.0.0"
atreeon_get_child_size: ">=0.1.1 <0.2.0"

dev_dependencies:
test: ^1.18.2
Expand Down
43 changes: 43 additions & 0 deletions terminalCommands/1_dry_run_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#run in root like this: ./terminalCommands/1_dry_run_release.sh

cd terminalCommands

versionRaw=$(flutter pub add atreeon_datagrid_responsive --dry-run)
versionPub=$(echo "$versionRaw" | grep -o '+ atreeon_datagrid_responsive [0-9.]*' | awk '{print $3}')
versionLocal=$(grep 'version:' "../pubspec.yaml" | awk '{print $2}')

cd ../

echo "Ready to upload atreeon_datagrid_responsive version $versionLocal updating $versionPub"

read -p "Is this correct? (y/n): " choice

if [ "$choice" = "y" ]; then
clear
echo "Continuing..."
else
exit 0
fi

flutter pub get
flutter pub run test

read -p "Did the tests pass? (y/n): " choice
if [ "$choice" = "y" ]; then
clear
echo "Continuing..."
else
exit 0
fi

flutter pub publish --dry-run

read -p "Ready? (y/n): " choice
if [ "$choice" = "y" ]; then
clear
echo "All ready to upload..."
else
exit 0
fi


28 changes: 28 additions & 0 deletions terminalCommands/2_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#run in root like this: ./terminalCommands/2_release.sh

echo blah

#cd terminalCommands || exit
#./1_dry_run_release.sh
#cd ../
#
#read -p "Do you want to publish atreeon_datagrid_responsive? (y/n): " choice
#if [ "$choice" = "y" ]; then
# clear
# flutter pub publish
#else
# exit 0
#fi


versionLocal=$(grep 'version:' "pubspec.yaml" | awk '{print $2}')

read -p "Do you want to tag atreeon_datagrid_responsive as $versionLocal? (use 'i' to insert, 'esc' to finish editing, ':' for console, 'wq' to save (y/n): " choice
if [ "$choice" = "y" ]; then
clear
git tag "$versionLocal" -a
else
exit 0
fi

echo "now please commit and push"
2 changes: 0 additions & 2 deletions terminalCommands/publish.txt

This file was deleted.

9 changes: 9 additions & 0 deletions terminalCommands/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: dummy

environment:
sdk: ">=2.17.0 <4.0.0"
flutter: ">=3.0.0"

dependencies:
flutter:
sdk: flutter

0 comments on commit 63f9f27

Please sign in to comment.