Skip to content

Commit

Permalink
Fixed list layout label position property not showing
Browse files Browse the repository at this point in the history
  • Loading branch information
Gold872 committed Nov 8, 2023
1 parent 32ef712 commit e60f470
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions lib/widgets/draggable_containers/draggable_list_layout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ class DraggableListLayout extends DraggableLayoutContainer {

String labelPosition = 'TOP';

List<String> labelPositions = const [
'Top',
'Left',
'Right',
'Bottom',
'Hidden',
];

DraggableListLayout({
super.key,
required super.dashboardGrid,
Expand Down Expand Up @@ -74,20 +82,20 @@ class DraggableListLayout extends DraggableLayoutContainer {
return;
}

if (!labelPositions.contains(value)) {
return;
}

setState(() {
labelPosition = value.toUpperCase();

refresh();
});
},
choices: const [
'Top',
'Left',
'Right',
'Bottom',
'Hidden',
],
initialValue: labelPosition,
choices: labelPositions,
initialValue:
labelPosition.substring(0, 1).toUpperCase() +
labelPosition.substring(1).toLowerCase(),
),
const Divider(),
if (children.isNotEmpty)
Expand Down Expand Up @@ -224,6 +232,10 @@ class DraggableListLayout extends DraggableLayoutContainer {
labelPosition = tryCast(jsonData['properties']['label_position']) ??
tryCast(jsonData['properties']['Label position']) ??
'TOP';

if (!labelPositions.contains(labelPosition)) {
labelPosition = 'TOP';
}
}

for (Map<String, dynamic>? childData in jsonData['children']) {
Expand Down

0 comments on commit e60f470

Please sign in to comment.