Skip to content

Commit

Permalink
Moving the attribute [id] from [DockingItem] to [DockingArea]. #1
Browse files Browse the repository at this point in the history
  • Loading branch information
caduandrade committed Oct 7, 2023
1 parent 2fefce5 commit 40cb9c1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.14.0

# The [id] attribute has been moved from the [DockingItem] to the [DockingArea].

## 1.13.0

* Allow `DockingTabs` to be initialized with only 1 child.
Expand Down
33 changes: 23 additions & 10 deletions lib/src/layout/docking_layout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ mixin DropArea {}
/// Represents any area of the layout.
abstract class DockingArea extends Area {
DockingArea(
{double? size,
{this.id,
double? size,
double? weight,
double? minimalWeight,
double? minimalSize})
Expand All @@ -25,6 +26,8 @@ abstract class DockingArea extends Area {
minimalWeight: minimalWeight,
minimalSize: minimalSize);

final dynamic id;

int _layoutId = -1;

int get layoutId => _layoutId;
Expand Down Expand Up @@ -141,12 +144,14 @@ abstract class DockingArea extends Area {
/// Represents an abstract area for a collection of widgets.
abstract class DockingParentArea extends DockingArea {
DockingParentArea(List<DockingArea> children,
{double? size,
{dynamic id,
double? size,
double? weight,
double? minimalWeight,
double? minimalSize})
: this._children = children,
super(
id: id,
size: size,
weight: weight,
minimalWeight: minimalWeight,
Expand Down Expand Up @@ -244,7 +249,7 @@ abstract class DockingParentArea extends DockingArea {
class DockingItem extends DockingArea with DropArea {
/// Builds a [DockingItem].
DockingItem(
{this.id,
{dynamic id,
this.name,
required this.widget,
this.value,
Expand All @@ -262,12 +267,12 @@ class DockingItem extends DockingArea with DropArea {
this.globalKey = keepAlive ? GlobalKey() : null,
this._maximized = maximized,
super(
id: id,
size: size,
weight: weight,
minimalWeight: minimalWeight,
minimalSize: minimalSize);

final dynamic id;
String? name;
Widget widget;
dynamic value;
Expand Down Expand Up @@ -314,12 +319,13 @@ class DockingItem extends DockingArea with DropArea {
/// Children will be arranged horizontally.
class DockingRow extends DockingParentArea {
/// Builds a [DockingRow].
DockingRow._(List<DockingArea> children,
DockingRow._(List<DockingArea> children, dynamic id,
{double? size,
double? weight,
double? minimalWeight,
double? minimalSize})
: super(children,
id: id,
size: size,
weight: weight,
minimalWeight: minimalWeight,
Expand All @@ -332,7 +338,8 @@ class DockingRow extends DockingParentArea {

/// Builds a [DockingRow].
factory DockingRow(List<DockingArea> children,
{double? size,
{dynamic id,
double? size,
double? weight,
double? minimalWeight,
double? minimalSize}) {
Expand All @@ -344,7 +351,7 @@ class DockingRow extends DockingParentArea {
newChildren.add(child);
}
}
return DockingRow._(newChildren,
return DockingRow._(newChildren, id,
size: size,
weight: weight,
minimalWeight: minimalWeight,
Expand All @@ -365,11 +372,13 @@ class DockingRow extends DockingParentArea {
class DockingColumn extends DockingParentArea {
/// Builds a [DockingColumn].
DockingColumn._(List<DockingArea> children,
{double? size,
{dynamic id,
double? size,
double? weight,
double? minimalWeight,
double? minimalSize})
: super(children,
id: id,
size: size,
weight: weight,
minimalWeight: minimalWeight,
Expand All @@ -382,7 +391,8 @@ class DockingColumn extends DockingParentArea {

/// Builds a [DockingColumn].
factory DockingColumn(List<DockingArea> children,
{double? size,
{dynamic id,
double? size,
double? weight,
double? minimalWeight,
double? minimalSize}) {
Expand All @@ -395,6 +405,7 @@ class DockingColumn extends DockingParentArea {
}
}
return DockingColumn._(newChildren,
id: id,
size: size,
weight: weight,
minimalWeight: minimalWeight,
Expand All @@ -415,14 +426,16 @@ class DockingColumn extends DockingParentArea {
class DockingTabs extends DockingParentArea with DropArea {
/// Builds a [DockingTabs].
DockingTabs(List<DockingItem> children,
{bool maximized = false,
{dynamic id,
bool maximized = false,
this.maximizable,
double? size,
double? weight,
double? minimalWeight,
double? minimalSize})
: this._maximized = maximized,
super(children,
id: id,
size: size,
weight: weight,
minimalWeight: minimalWeight,
Expand Down

0 comments on commit 40cb9c1

Please sign in to comment.