Files
rustdesk/flutter/lib/common/widgets/request_approval_menu.dart
T
21pages a85ad89ffc feat: request approval (#16784)
* feat: add connections without sending passwords

Add Without password actions and pass the selection through desktop,
mobile and Web sessions. Omit the password when constructing LoginRequest,
preserve saved credentials, and reuse the existing approval and OS login
dialogs. Keep protocol and controlled-side authentication changes separate.

* fix: preserve login method across session windows

* fix: skip password persistence for consent connections

* refactor: unify request approval menus and naming

* chore: move request approval translation key to the end

* i18n: translate request approval menu label

* fix: align request approval menu layout and icons

* fix: avoid duplicate focus stops in request approval menus

* fix: distinguish request approval submenus on mobile

* fix: open overflowing submenus to the left

* Revert "fix: distinguish request approval submenus on mobile"

This reverts commit 7f0e50d4e4.
2026-11-02 23:48:27 +08:00

53 lines
1.8 KiB
Dart

import 'package:flutter/material.dart';
import '../../desktop/widgets/material_mod_popup_menu.dart' as mod_menu;
import '../../desktop/widgets/popup_menu.dart';
class RequestApprovalMenu extends MenuEntryBase<String> {
final String title;
final List<MenuEntryButton<String>> entries;
final EdgeInsets? padding;
final double arrowScale;
RequestApprovalMenu(
{required this.title,
required this.entries,
this.padding,
this.arrowScale = 1.0});
@override
List<mod_menu.PopupMenuEntry<String>> build(
BuildContext context, MenuConfig conf) {
final theme = Theme.of(context);
final checkboxTheme = CheckboxTheme.of(context);
final checkboxWidth =
((checkboxTheme.materialTapTargetSize ?? theme.materialTapTargetSize) ==
MaterialTapTargetSize.padded
? kMinInteractiveDimension
: kMinInteractiveDimension - 8) +
(checkboxTheme.visualDensity ?? theme.visualDensity)
.baseSizeAdjustment
.dx;
final arrowInset = (checkboxWidth - (IconTheme.of(context).size ?? 24)) / 2;
return MenuEntrySubMenu<String>(
text: title,
dismissParentOnCanceled: true,
arrowScale: arrowScale,
padding: (padding ?? EdgeInsets.zero)
.copyWith(right: (padding?.right ?? 0) + arrowInset),
entries: entries
.map((entry) => MenuEntryButton<String>(
childBuilder: entry.childBuilder,
proc: entry.proc,
padding: entry.padding,
enabled: entry.enabled,
dismissOnClicked: true,
dismissCallback: () {
if (Navigator.canPop(context)) Navigator.pop(context);
},
))
.toList(),
).build(context, conf);
}
}