Skip to content

Commit 4fa886b

Browse files
authored
Merge pull request #70 from devaryakjha/chore/framework-upgrade
chore: flutter upgrade
2 parents 6dec167 + 9658521 commit 4fa886b

File tree

8 files changed

+81
-59
lines changed

8 files changed

+81
-59
lines changed

.fvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"flutter": "3.27.1"
2+
"flutter": "3.29.2"
33
}

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"dart.flutterSdkPath": ".fvm/versions/3.27.1",
2+
"dart.flutterSdkPath": ".fvm/versions/3.29.2",
33
"editor.codeActionsOnSave": {
44
"source.fixAll": "explicit",
55
"source.organizeImports": "explicit"

examples/tagflow/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ publish_to: "none"
44
version: 1.1.0
55

66
environment:
7-
sdk: ">=3.0.0 <4.0.0"
7+
sdk: ">= 3.7.0 <4.0.0"
88

99
dependencies:
1010
cupertino_icons: ^1.0.8

packages/tagflow/lib/src/widgets/selectable_adapter.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,4 +368,15 @@ class _RenderSelectableAdapter extends RenderProxyBox
368368
_geometry.dispose();
369369
super.dispose();
370370
}
371+
372+
@override
373+
int get contentLength => 1;
374+
375+
@override
376+
SelectedContentRange? getSelection() {
377+
if (!value.hasSelection) {
378+
return null;
379+
}
380+
return const SelectedContentRange(startOffset: 0, endOffset: 1);
381+
}
371382
}

packages/tagflow/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ homepage: https://docs.arya.run/tagflow
66
issue_tracker: https://github.com/devaryakjha/tagflow/issues
77

88
environment:
9-
sdk: ">=3.0.0 <4.0.0"
9+
sdk: ">= 3.7.0 <4.0.0"
1010

1111
dependencies:
1212
collection: ^1.19.0

packages/tagflow_table/lib/src/rendering/tagflow_table.dart

Lines changed: 64 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,11 @@ class TagflowTableBorder extends Equatable {
111111
right: BorderSide.lerp(a.right, b.right, t),
112112
top: BorderSide.lerp(a.top, b.top, t),
113113
bottom: BorderSide.lerp(a.bottom, b.bottom, t),
114-
horizontalInside:
115-
BorderSide.lerp(a.horizontalInside, b.horizontalInside, t),
114+
horizontalInside: BorderSide.lerp(
115+
a.horizontalInside,
116+
b.horizontalInside,
117+
t,
118+
),
116119
verticalInside: BorderSide.lerp(a.verticalInside, b.verticalInside, t),
117120
);
118121
}
@@ -169,16 +172,8 @@ class TagflowTableBorder extends Equatable {
169172
if (treatFirstRowAsHeader && headerBackgroundColor != null && rows > 0) {
170173
// extending beyond the padding
171174
// TODO(devaryakjha): make this configurable
172-
final headerRect = Rect.fromLTWH(
173-
0,
174-
0,
175-
rect.width,
176-
rowHeights[0],
177-
);
178-
canvas.drawRect(
179-
headerRect,
180-
Paint()..color = headerBackgroundColor,
181-
);
175+
final headerRect = Rect.fromLTWH(0, 0, rect.width, rowHeights[0]);
176+
canvas.drawRect(headerRect, Paint()..color = headerBackgroundColor);
182177
}
183178

184179
// Paint outer borders
@@ -216,8 +211,10 @@ class TagflowTableBorder extends Equatable {
216211

217212
// Paint inner borders
218213
if (horizontalInside != BorderSide.none && rows > 1) {
219-
_horizontalInsidePaint =
220-
_getPaint(horizontalInside, _horizontalInsidePaint);
214+
_horizontalInsidePaint = _getPaint(
215+
horizontalInside,
216+
_horizontalInsidePaint,
217+
);
221218
var y = rowHeights[0];
222219
for (var i = 1; i < rows; i++) {
223220
// Find segments where we should draw the horizontal line
@@ -314,13 +311,13 @@ class TagflowTableBorder extends Equatable {
314311
@override
315312
// coverage:ignore-line
316313
List<Object?> get props => [
317-
left,
318-
right,
319-
top,
320-
bottom,
321-
horizontalInside,
322-
verticalInside,
323-
];
314+
left,
315+
right,
316+
top,
317+
bottom,
318+
horizontalInside,
319+
verticalInside,
320+
];
324321
}
325322

326323
class RenderTagflowTable extends RenderBox
@@ -410,9 +407,11 @@ class RenderTagflowTable extends RenderBox
410407

411408
// Calculate total spacing needed between columns
412409
final totalColumnSpacing = (_columnCount - 1) * _columnSpacing;
413-
414-
// Calculate available width for columns after accounting for spacing and padding
415-
final availableWidth = constraints.maxWidth - totalColumnSpacing - _padding.horizontal;
410+
411+
// Calculate available width for columns after accounting for
412+
// spacing and padding
413+
final availableWidth =
414+
constraints.maxWidth - totalColumnSpacing - _padding.horizontal;
416415

417416
// First pass: Calculate minimum and preferred column widths
418417
_columnWidths = List<double>.filled(_columnCount, 0);
@@ -429,23 +428,29 @@ class RenderTagflowTable extends RenderBox
429428
// Update minimum widths
430429
for (var i = 0; i < childParentData.colSpan; i++) {
431430
final colIndex = childParentData.column + i;
432-
_columnWidths[colIndex] = math.max(_columnWidths[colIndex], widthPerColumn);
433-
431+
_columnWidths[colIndex] = math.max(
432+
_columnWidths[colIndex],
433+
widthPerColumn,
434+
);
435+
434436
// Track how flexible each column is based on content
435437
final flexibility = (maxWidth - minWidth) / childParentData.colSpan;
436-
columnFlexibility[colIndex] = math.max(columnFlexibility[colIndex], flexibility);
438+
columnFlexibility[colIndex] = math.max(
439+
columnFlexibility[colIndex],
440+
flexibility,
441+
);
437442
}
438443
}
439444
child = childParentData.nextSibling;
440445
}
441446

442447
// Calculate total current width and adjust if needed
443448
final totalColumnWidth = _columnWidths.reduce((a, b) => a + b);
444-
449+
445450
if (totalColumnWidth > availableWidth) {
446451
// Need to shrink columns - distribute reduction proportionally
447452
final reduction = totalColumnWidth - availableWidth;
448-
453+
449454
// Calculate shrink factors based on current widths
450455
final totalWidth = _columnWidths.reduce((a, b) => a + b);
451456
for (var i = 0; i < _columnCount; i++) {
@@ -490,9 +495,11 @@ class RenderTagflowTable extends RenderBox
490495
final childHeight =
491496
child.getMinIntrinsicHeight(cellWidth) / childParentData.rowSpan;
492497
for (var i = 0; i < childParentData.rowSpan; i++) {
493-
_rowHeights[childParentData.row + i] =
494-
_rowHeights[childParentData.row + i]
495-
.clamp(childHeight, double.infinity);
498+
_rowHeights[childParentData.row +
499+
i] = _rowHeights[childParentData.row + i].clamp(
500+
childHeight,
501+
double.infinity,
502+
);
496503
}
497504
}
498505
child = childParentData.nextSibling;
@@ -556,11 +563,13 @@ class RenderTagflowTable extends RenderBox
556563
}
557564

558565
// Update final table size to include spacing
559-
final tableWidth = _columnWidths.reduce((a, b) => a + b) +
560-
(_columnCount - 1) * _columnSpacing +
566+
final tableWidth =
567+
_columnWidths.reduce((a, b) => a + b) +
568+
(_columnCount - 1) * _columnSpacing +
561569
_padding.horizontal;
562-
final tableHeight = _rowHeights.reduce((a, b) => a + b) +
563-
(_rowCount - 1) * _rowSpacing +
570+
final tableHeight =
571+
_rowHeights.reduce((a, b) => a + b) +
572+
(_rowCount - 1) * _rowSpacing +
564573
_padding.vertical;
565574

566575
size = constraints.constrain(Size(tableWidth, tableHeight));
@@ -571,12 +580,7 @@ class RenderTagflowTable extends RenderBox
571580
// First paint the table background and borders
572581
_border.paint(
573582
context.canvas,
574-
Rect.fromLTWH(
575-
offset.dx,
576-
offset.dy,
577-
size.width,
578-
size.height,
579-
),
583+
Rect.fromLTWH(offset.dx, offset.dy, size.width, size.height),
580584
rows: _rowCount,
581585
columns: _columnCount,
582586
cellData: _buildCellDataGrid(),
@@ -732,13 +736,17 @@ class RenderTagflowTable extends RenderBox
732736
// Update minimum widths
733737
for (var i = 0; i < childParentData.colSpan; i++) {
734738
final colIndex = childParentData.column + i;
735-
_columnWidths[colIndex] =
736-
_columnWidths[colIndex].clamp(widthPerColumn, double.infinity);
739+
_columnWidths[colIndex] = _columnWidths[colIndex].clamp(
740+
widthPerColumn,
741+
double.infinity,
742+
);
737743

738744
// Track how flexible each column is based on content
739745
final flexibility = (maxWidth - minWidth) / childParentData.colSpan;
740-
columnFlexibility[colIndex] =
741-
math.max(columnFlexibility[colIndex], flexibility);
746+
columnFlexibility[colIndex] = math.max(
747+
columnFlexibility[colIndex],
748+
flexibility,
749+
);
742750
}
743751
}
744752
child = childParentData.nextSibling;
@@ -747,8 +755,10 @@ class RenderTagflowTable extends RenderBox
747755
// Calculate total minimum width and distribute extra space
748756
final totalMinWidth =
749757
_columnWidths.reduce((a, b) => a + b) + _padding.horizontal;
750-
final extraWidth =
751-
(constraints.maxWidth - totalMinWidth).clamp(0.0, double.infinity);
758+
final extraWidth = (constraints.maxWidth - totalMinWidth).clamp(
759+
0.0,
760+
double.infinity,
761+
);
752762

753763
if (extraWidth > 0) {
754764
// Calculate total flexibility
@@ -782,16 +792,17 @@ class RenderTagflowTable extends RenderBox
782792
}
783793

784794
// Get the height needed for this width
785-
final childHeight = child
795+
final childHeight =
796+
child
786797
.getDryLayout(BoxConstraints.tightFor(width: cellWidth))
787798
.height /
788799
childParentData.rowSpan;
789800
for (var i = 0; i < childParentData.rowSpan; i++) {
790-
rowHeights[childParentData.row + i] =
791-
rowHeights[childParentData.row + i]
792-
.clamp(childHeight, double.infinity);
801+
rowHeights[childParentData.row + i] = rowHeights[childParentData.row +
802+
i]
803+
.clamp(childHeight, double.infinity);
793804
}
794-
child = childParentData.nextSibling;
805+
child = childParentData.nextSibling;
795806
}
796807
child = childParentData.nextSibling;
797808
}

packages/tagflow_table/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ homepage: https://docs.arya.run/tagflow
66
issue_tracker: https://github.com/devaryakjha/tagflow/issues
77

88
environment:
9-
sdk: ">=3.0.0 <4.0.0"
9+
sdk: ">= 3.7.0 <4.0.0"
1010

1111
dependencies:
1212
equatable: ^2.0.7

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: tagflow_workspace
22

33
environment:
4-
sdk: ">=3.0.0 <4.0.0"
4+
sdk: ">= 3.7.0 <4.0.0"
55

66
dev_dependencies:
77
melos: ^6.2.0

0 commit comments

Comments
 (0)