Files
Client/lib/widget/demo_restricted.dart
T

22 lines
617 B
Dart

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;
}