implemented a comprehensive client-side demo mode triggered by a "demo@" username prefix, serving curated fixture data for all app modules
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import '../api/demo/demo_mode.dart';
|
||||
import 'info_dialog.dart';
|
||||
|
||||
/// Guards an action the demo mode can't back with real data (writes, uploads,
|
||||
/// downloads, user/element lookups). Shows an info dialog and returns `true`
|
||||
/// when a demo session is active — callers abort on `true`:
|
||||
///
|
||||
/// ```dart
|
||||
/// if (guardDemoAction(context)) return;
|
||||
/// ```
|
||||
bool guardDemoAction(BuildContext context) {
|
||||
if (!DemoMode.active) return false;
|
||||
InfoDialog.show(
|
||||
context,
|
||||
'Diese Funktion steht im Demo-Modus nicht zur Verfügung.',
|
||||
title: 'Demo-Modus',
|
||||
);
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user