mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-04-20 22:13:48 +00:00
- Introduced a new extension for localization in Flutter with `LocalizationExtension` in `l10n.dart`. - Added a Python script `translate.py` for translating ARB/JSON localization files using a local Ollama model, preserving keys and placeholders, and handling ICU format rules.
35 lines
999 B
Dart
35 lines
999 B
Dart
import 'package:flutter/material.dart';
|
|
import '../connector/meshcore_connector.dart';
|
|
import '../l10n/l10n.dart';
|
|
|
|
/// Shows a confirmation dialog before disconnecting from the device.
|
|
/// Returns true if user confirmed and disconnect completed, false otherwise.
|
|
Future<bool> showDisconnectDialog(
|
|
BuildContext context,
|
|
MeshCoreConnector connector,
|
|
) async {
|
|
final l10n = context.l10n;
|
|
final confirmed = await showDialog<bool>(
|
|
context: context,
|
|
builder: (context) => AlertDialog(
|
|
title: Text(l10n.dialog_disconnect),
|
|
content: Text(l10n.dialog_disconnectConfirm),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(context, false),
|
|
child: Text(l10n.common_cancel),
|
|
),
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(context, true),
|
|
child: Text(l10n.common_disconnect),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
|
|
if (confirmed == true) {
|
|
await connector.disconnect();
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|