Skip to content

Commit a922f3d

Browse files
SaadArdatiBirjuVachhani
authored andcommitted
Cloud UI #40
1 parent abaf4d6 commit a922f3d

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

lib/src/model/sdk_publish_model.dart

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ class SDKPublishModel extends PrivacyBase {
167167
/// a custom id. This map will modify that usage without being destructive.
168168
final Map<String, String> layoutIDMap;
169169

170+
/// A list of layout ids that are explicitly disabled from the server's side.
171+
final List<String> disabledLayouts;
172+
170173
static Map<String, dynamic> serializeLookupMapFonts(
171174
LookupMap<SDKPublishFont> map) =>
172175
map.dataMap.map((key, value) => MapEntry(key, value.toJson()));
@@ -260,6 +263,7 @@ class SDKPublishModel extends PrivacyBase {
260263
this.entryPageId,
261264
this.entryCanvasId,
262265
DateTime? lastUpdated,
266+
List<String>? disabledLayouts,
263267

264268
// Privacy
265269
required super.teams,
@@ -286,7 +290,8 @@ class SDKPublishModel extends PrivacyBase {
286290
(lookupMap: layoutIDMap ?? {}, dataMap: {}),
287291
),
288292
apis = apis ?? {},
289-
lastUpdated = lastUpdated ?? DateTime.now();
293+
lastUpdated = lastUpdated ?? DateTime.now(),
294+
disabledLayouts = disabledLayouts ?? [];
290295

291296
/// Creates a new instance of [SDKPublishModel] with privacy inherited from
292297
/// another [PrivacyBase].
@@ -306,6 +311,7 @@ class SDKPublishModel extends PrivacyBase {
306311
this.entryPageId,
307312
this.entryCanvasId,
308313
DateTime? lastUpdated,
314+
List<String>? disabledLayouts,
309315

310316
// Privacy
311317
required super.privacy,
@@ -326,6 +332,7 @@ class SDKPublishModel extends PrivacyBase {
326332
),
327333
lastUpdated = lastUpdated ?? DateTime.now(),
328334
apis = apis ?? {},
335+
disabledLayouts = disabledLayouts ?? [],
329336
super.private();
330337

331338
/// Creates a new instance of [SDKPublishModel] from a JSON map.
@@ -360,6 +367,7 @@ class SDKPublishModel extends PrivacyBase {
360367
String? entryPageId,
361368
String? entryCanvasId,
362369
DateTime? lastUpdated,
370+
List<String>? disabledLayouts,
363371

364372
// Privacy
365373
PrivacyBase? privacy,
@@ -378,6 +386,7 @@ class SDKPublishModel extends PrivacyBase {
378386
entryPageId: entryPageId ?? this.entryPageId,
379387
entryCanvasId: entryCanvasId ?? this.entryCanvasId,
380388
lastUpdated: lastUpdated ?? this.lastUpdated,
389+
disabledLayouts: disabledLayouts ?? this.disabledLayouts,
381390

382391
// Privacy
383392
privacy: privacy ?? this,
@@ -400,6 +409,7 @@ class SDKPublishModel extends PrivacyBase {
400409
entryPageId,
401410
entryCanvasId,
402411
lastUpdated,
412+
disabledLayouts,
403413
];
404414
}
405415

lib/src/model/sdk_publish_model.g.dart

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/ui/codelessly_widget.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,10 @@ class _CodelesslyWidgetState extends State<CodelesslyWidget> {
504504
const CodelesslyLoadingScreen();
505505
}
506506

507+
if (model.disabledLayouts.contains(effectiveLayoutID)) {
508+
return const SizedBox.shrink();
509+
}
510+
507511
// Set the canvas ID if it is not already set. (This is for the first
508512
// time the layout is loaded. For subsequent loads, the canvas ID is
509513
// set in the didChangeDependencies method.) e.g. when media query

0 commit comments

Comments
 (0)