mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-11-04 00:33:12 +00:00
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.
This commit is contained in:
1 parent
037b8787fe
commit
a85ad89ffc
89 files changed
+1110
-152
No files matched your search
@@ -18,6 +18,7 @@ import '../../common.dart';
|
||||
import '../../common/formatter/id_formatter.dart';
|
||||
import '../../common/widgets/peer_tab_page.dart';
|
||||
import '../../common/widgets/autocomplete.dart';
|
||||
import '../../common/widgets/request_approval_menu.dart';
|
||||
import '../../models/platform_model.dart';
|
||||
import '../../desktop/widgets/material_mod_popup_menu.dart' as mod_menu;
|
||||
|
||||
@@ -340,6 +341,38 @@ class _ConnectionPageState extends State<ConnectionPage>
|
||||
isTcpTunneling: isTcpTunneling);
|
||||
}
|
||||
|
||||
RequestApprovalMenu _requestApprovalMenu(BuildContext context) {
|
||||
MenuEntryButton<String> action(String title,
|
||||
{bool isFileTransfer = false,
|
||||
bool isViewCamera = false,
|
||||
bool isTerminal = false,
|
||||
bool isTcpTunneling = false}) =>
|
||||
MenuEntryButton<String>(
|
||||
childBuilder: (style) => Text(translate(title), style: style),
|
||||
proc: () => connect(context, _idController.id,
|
||||
loginMethod: 'request-approval',
|
||||
isFileTransfer: isFileTransfer,
|
||||
isViewCamera: isViewCamera,
|
||||
isTerminal: isTerminal,
|
||||
isTcpTunneling: isTcpTunneling),
|
||||
padding: EdgeInsets.symmetric(horizontal: kDesktopMenuPadding.left),
|
||||
dismissOnClicked: true,
|
||||
);
|
||||
|
||||
return RequestApprovalMenu(
|
||||
title: translate('Request approval'),
|
||||
padding: EdgeInsets.symmetric(horizontal: kDesktopMenuPadding.left),
|
||||
arrowScale: MenuConfig.iconScale,
|
||||
entries: [
|
||||
action('Connect'),
|
||||
action('Transfer file', isFileTransfer: true),
|
||||
action('View camera', isViewCamera: true),
|
||||
action('${translate('Terminal')} (beta)', isTerminal: true),
|
||||
if (isDesktop) action('TCP tunneling', isTcpTunneling: true),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/// UI for the remote ID TextField.
|
||||
/// Search for a peer.
|
||||
Widget _buildRemoteIDTextField(BuildContext context) {
|
||||
@@ -579,7 +612,8 @@ class _ConnectionPageState extends State<ConnectionPage>
|
||||
() => onConnect(isTcpTunneling: true)
|
||||
),
|
||||
]
|
||||
.map((e) => MenuEntryButton<String>(
|
||||
.map<MenuEntryBase<String>>(
|
||||
(e) => MenuEntryButton<String>(
|
||||
childBuilder: (TextStyle? style) =>
|
||||
Text(
|
||||
translate(e.$1),
|
||||
@@ -591,6 +625,10 @@ class _ConnectionPageState extends State<ConnectionPage>
|
||||
kDesktopMenuPadding.left),
|
||||
dismissOnClicked: true,
|
||||
))
|
||||
.followedBy([
|
||||
MenuEntryDivider<String>(),
|
||||
_requestApprovalMenu(context),
|
||||
])
|
||||
.map((e) => e.build(
|
||||
context,
|
||||
const MenuConfig(
|
||||
|
||||
@@ -804,6 +804,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
|
||||
password: call.arguments['password'],
|
||||
forceRelay: call.arguments['forceRelay'],
|
||||
connToken: call.arguments['connToken'],
|
||||
loginMethod: call.arguments['loginMethod'] ?? '',
|
||||
);
|
||||
} else if (call.method == kWindowBumpMouse) {
|
||||
return RdPlatformChannel.instance.bumpMouse(
|
||||
|
||||
@@ -56,6 +56,7 @@ class FileManagerPage extends StatefulWidget {
|
||||
{Key? key,
|
||||
required this.id,
|
||||
required this.password,
|
||||
this.loginMethod = '',
|
||||
required this.isSharedPassword,
|
||||
this.tabController,
|
||||
this.connToken,
|
||||
@@ -63,6 +64,7 @@ class FileManagerPage extends StatefulWidget {
|
||||
: super(key: key);
|
||||
final String id;
|
||||
final String? password;
|
||||
final String loginMethod;
|
||||
final bool? isSharedPassword;
|
||||
final bool? forceRelay;
|
||||
final String? connToken;
|
||||
@@ -99,6 +101,7 @@ class _FileManagerPageState extends State<FileManagerPage>
|
||||
_ffi.start(widget.id,
|
||||
isFileTransfer: true,
|
||||
password: widget.password,
|
||||
loginMethod: widget.loginMethod,
|
||||
isSharedPassword: widget.isSharedPassword,
|
||||
connToken: widget.connToken,
|
||||
forceRelay: widget.forceRelay);
|
||||
|
||||
@@ -54,6 +54,7 @@ class _FileManagerTabPageState extends State<FileManagerTabPage> {
|
||||
key: ValueKey(params['id']),
|
||||
id: params['id'],
|
||||
password: params['password'],
|
||||
loginMethod: params['loginMethod'] ?? '',
|
||||
isSharedPassword: params['isSharedPassword'],
|
||||
tabController: tabController,
|
||||
forceRelay: params['forceRelay'],
|
||||
@@ -91,6 +92,7 @@ class _FileManagerTabPageState extends State<FileManagerTabPage> {
|
||||
key: ValueKey(id),
|
||||
id: id,
|
||||
password: args['password'],
|
||||
loginMethod: args['loginMethod'] ?? '',
|
||||
isSharedPassword: args['isSharedPassword'],
|
||||
tabController: tabController,
|
||||
forceRelay: args['forceRelay'],
|
||||
|
||||
@@ -29,6 +29,7 @@ class PortForwardPage extends StatefulWidget {
|
||||
Key? key,
|
||||
required this.id,
|
||||
required this.password,
|
||||
this.loginMethod = '',
|
||||
required this.tabController,
|
||||
required this.isRDP,
|
||||
required this.isSharedPassword,
|
||||
@@ -37,6 +38,7 @@ class PortForwardPage extends StatefulWidget {
|
||||
}) : super(key: key);
|
||||
final String id;
|
||||
final String? password;
|
||||
final String loginMethod;
|
||||
final DesktopTabController tabController;
|
||||
final bool isRDP;
|
||||
final bool? forceRelay;
|
||||
@@ -69,6 +71,7 @@ class _PortForwardPageState extends State<PortForwardPage>
|
||||
_ffi.start(widget.id,
|
||||
isPortForward: true,
|
||||
password: widget.password,
|
||||
loginMethod: widget.loginMethod,
|
||||
isSharedPassword: widget.isSharedPassword,
|
||||
forceRelay: widget.forceRelay,
|
||||
connToken: widget.connToken,
|
||||
|
||||
@@ -44,6 +44,7 @@ class _PortForwardTabPageState extends State<PortForwardTabPage> {
|
||||
key: ValueKey(params['id']),
|
||||
id: params['id'],
|
||||
password: params['password'],
|
||||
loginMethod: params['loginMethod'] ?? '',
|
||||
isSharedPassword: params['isSharedPassword'],
|
||||
tabController: tabController,
|
||||
isRDP: isRDP,
|
||||
@@ -79,6 +80,7 @@ class _PortForwardTabPageState extends State<PortForwardTabPage> {
|
||||
key: ValueKey(args['id']),
|
||||
id: id,
|
||||
password: args['password'],
|
||||
loginMethod: args['loginMethod'] ?? '',
|
||||
isSharedPassword: args['isSharedPassword'],
|
||||
isRDP: isRDP,
|
||||
tabController: tabController,
|
||||
|
||||
@@ -41,6 +41,7 @@ class RemotePage extends StatefulWidget {
|
||||
this.sessionId,
|
||||
this.tabWindowId,
|
||||
this.password,
|
||||
this.loginMethod = '',
|
||||
this.display,
|
||||
this.displays,
|
||||
this.tabController,
|
||||
@@ -57,6 +58,7 @@ class RemotePage extends StatefulWidget {
|
||||
final int? display;
|
||||
final List<int>? displays;
|
||||
final String? password;
|
||||
final String loginMethod;
|
||||
final ToolbarState toolbarState;
|
||||
final String? switchUuid;
|
||||
final bool? forceRelay;
|
||||
@@ -180,6 +182,7 @@ class _RemotePageState extends State<RemotePage>
|
||||
_ffi.start(
|
||||
widget.id,
|
||||
password: widget.password,
|
||||
loginMethod: widget.loginMethod,
|
||||
isSharedPassword: widget.isSharedPassword,
|
||||
switchUuid: widget.switchUuid,
|
||||
forceRelay: widget.forceRelay,
|
||||
|
||||
@@ -97,6 +97,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
||||
display: display,
|
||||
displays: displays?.cast<int>(),
|
||||
password: params['password'],
|
||||
loginMethod: params['loginMethod'] ?? '',
|
||||
toolbarState: ToolbarState(),
|
||||
tabController: tabController,
|
||||
switchUuid: params['switch_uuid'],
|
||||
@@ -470,6 +471,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
||||
display: display,
|
||||
displays: displays?.cast<int>(),
|
||||
password: args['password'],
|
||||
loginMethod: args['loginMethod'] ?? '',
|
||||
toolbarState: ToolbarState(),
|
||||
tabController: tabController,
|
||||
switchUuid: switchUuid,
|
||||
|
||||
@@ -14,6 +14,7 @@ class TerminalConnectionManager {
|
||||
static FFI getConnection({
|
||||
required String peerId,
|
||||
required String? password,
|
||||
String loginMethod = '',
|
||||
required bool? isSharedPassword,
|
||||
required bool? forceRelay,
|
||||
required String? connToken,
|
||||
@@ -32,6 +33,7 @@ class TerminalConnectionManager {
|
||||
ffi.start(
|
||||
peerId,
|
||||
password: password,
|
||||
loginMethod: loginMethod,
|
||||
isSharedPassword: isSharedPassword,
|
||||
forceRelay: forceRelay,
|
||||
connToken: connToken,
|
||||
|
||||
@@ -13,6 +13,7 @@ class TerminalPage extends StatefulWidget {
|
||||
Key? key,
|
||||
required this.id,
|
||||
required this.password,
|
||||
this.loginMethod = '',
|
||||
required this.tabController,
|
||||
required this.isSharedPassword,
|
||||
required this.terminalId,
|
||||
@@ -24,6 +25,7 @@ class TerminalPage extends StatefulWidget {
|
||||
}) : super(key: key);
|
||||
final String id;
|
||||
final String? password;
|
||||
final String loginMethod;
|
||||
final DesktopTabController tabController;
|
||||
final bool? forceRelay;
|
||||
final bool? isSharedPassword;
|
||||
@@ -68,6 +70,7 @@ class _TerminalPageState extends State<TerminalPage>
|
||||
_ffi = TerminalConnectionManager.getConnection(
|
||||
peerId: widget.id,
|
||||
password: widget.password,
|
||||
loginMethod: widget.loginMethod,
|
||||
isSharedPassword: widget.isSharedPassword,
|
||||
forceRelay: widget.forceRelay,
|
||||
connToken: widget.connToken,
|
||||
|
||||
@@ -79,6 +79,7 @@ class _TerminalTabPageState extends State<TerminalTabPage> {
|
||||
peerId: params['id'],
|
||||
terminalId: terminalId,
|
||||
password: params['password'],
|
||||
loginMethod: params['loginMethod'] ?? '',
|
||||
isSharedPassword: params['isSharedPassword'],
|
||||
forceRelay: params['forceRelay'],
|
||||
connToken: params['connToken'],
|
||||
@@ -89,6 +90,7 @@ class _TerminalTabPageState extends State<TerminalTabPage> {
|
||||
required String peerId,
|
||||
required int terminalId,
|
||||
String? password,
|
||||
String loginMethod = '',
|
||||
bool? isSharedPassword,
|
||||
bool? forceRelay,
|
||||
String? connToken,
|
||||
@@ -114,6 +116,7 @@ class _TerminalTabPageState extends State<TerminalTabPage> {
|
||||
terminalId: terminalId,
|
||||
tabKey: tabKey,
|
||||
password: password,
|
||||
loginMethod: loginMethod,
|
||||
isSharedPassword: isSharedPassword,
|
||||
tabController: tabController,
|
||||
forceRelay: forceRelay,
|
||||
@@ -514,6 +517,7 @@ class _TerminalTabPageState extends State<TerminalTabPage> {
|
||||
peerId: id,
|
||||
terminalId: terminalId,
|
||||
password: args['password'],
|
||||
loginMethod: args['loginMethod'] ?? '',
|
||||
isSharedPassword: args['isSharedPassword'],
|
||||
forceRelay: args['forceRelay'],
|
||||
connToken: args['connToken'],
|
||||
@@ -713,6 +717,7 @@ class _TerminalTabPageState extends State<TerminalTabPage> {
|
||||
peerId: peerId,
|
||||
terminalId: newTerminalId,
|
||||
password: page.password,
|
||||
loginMethod: page.loginMethod,
|
||||
isSharedPassword: page.isSharedPassword,
|
||||
forceRelay: page.forceRelay,
|
||||
connToken: page.connToken,
|
||||
|
||||
@@ -37,6 +37,7 @@ class ViewCameraPage extends StatefulWidget {
|
||||
this.sessionId,
|
||||
this.tabWindowId,
|
||||
this.password,
|
||||
this.loginMethod = '',
|
||||
this.display,
|
||||
this.displays,
|
||||
this.tabController,
|
||||
@@ -53,6 +54,7 @@ class ViewCameraPage extends StatefulWidget {
|
||||
final int? display;
|
||||
final List<int>? displays;
|
||||
final String? password;
|
||||
final String loginMethod;
|
||||
final ToolbarState toolbarState;
|
||||
final bool? forceRelay;
|
||||
final bool? isSharedPassword;
|
||||
@@ -112,6 +114,7 @@ class _ViewCameraPageState extends State<ViewCameraPage>
|
||||
widget.id,
|
||||
isViewCamera: true,
|
||||
password: widget.password,
|
||||
loginMethod: widget.loginMethod,
|
||||
isSharedPassword: widget.isSharedPassword,
|
||||
forceRelay: widget.forceRelay,
|
||||
tabWindowId: widget.tabWindowId,
|
||||
|
||||
@@ -97,6 +97,7 @@ class _ViewCameraTabPageState extends State<ViewCameraTabPage> {
|
||||
display: display,
|
||||
displays: displays?.cast<int>(),
|
||||
password: params['password'],
|
||||
loginMethod: params['loginMethod'] ?? '',
|
||||
toolbarState: ToolbarState(),
|
||||
tabController: tabController,
|
||||
connToken: params['connToken'],
|
||||
@@ -433,6 +434,7 @@ class _ViewCameraTabPageState extends State<ViewCameraTabPage> {
|
||||
display: display,
|
||||
displays: displays?.cast<int>(),
|
||||
password: args['password'],
|
||||
loginMethod: args['loginMethod'] ?? '',
|
||||
toolbarState: ToolbarState(),
|
||||
tabController: tabController,
|
||||
connToken: args['connToken'],
|
||||
|
||||
@@ -656,11 +656,13 @@ class _PopupMenuRouteLayout extends SingleChildLayoutDelegate {
|
||||
this.selectedItemIndex,
|
||||
this.textDirection,
|
||||
this.padding,
|
||||
this.avoidBounds,
|
||||
);
|
||||
this.avoidBounds, {
|
||||
this.submenuAnchor,
|
||||
});
|
||||
|
||||
// Rectangle of underlying button, relative to the overlay's dimensions.
|
||||
final RelativeRect position;
|
||||
final Rect? submenuAnchor;
|
||||
|
||||
// The sizes of each item are computed when the menu is laid out, and before
|
||||
// the route is laid out.
|
||||
@@ -735,6 +737,14 @@ class _PopupMenuRouteLayout extends SingleChildLayoutDelegate {
|
||||
DisplayFeatureSubScreen.subScreensInBounds(
|
||||
Offset.zero & size, avoidBounds);
|
||||
final Rect subScreen = _closestScreen(subScreens, originCenter);
|
||||
final anchor = submenuAnchor;
|
||||
if (anchor != null) {
|
||||
final left = anchor.left - childSize.width;
|
||||
if (wantedPosition.dx + childSize.width >
|
||||
subScreen.right - _kMenuScreenPadding - padding.right) {
|
||||
return _fitInsideScreen(subScreen, childSize, Offset(left, y));
|
||||
}
|
||||
}
|
||||
return _fitInsideScreen(subScreen, childSize, wantedPosition);
|
||||
}
|
||||
|
||||
@@ -781,6 +791,7 @@ class _PopupMenuRouteLayout extends SingleChildLayoutDelegate {
|
||||
assert(itemSizes.length == oldDelegate.itemSizes.length);
|
||||
|
||||
return position != oldDelegate.position ||
|
||||
submenuAnchor != oldDelegate.submenuAnchor ||
|
||||
selectedItemIndex != oldDelegate.selectedItemIndex ||
|
||||
textDirection != oldDelegate.textDirection ||
|
||||
!listEquals(itemSizes, oldDelegate.itemSizes) ||
|
||||
@@ -792,6 +803,7 @@ class _PopupMenuRouteLayout extends SingleChildLayoutDelegate {
|
||||
class _PopupMenuRoute<T> extends PopupRoute<T> {
|
||||
_PopupMenuRoute({
|
||||
required this.position,
|
||||
this.submenuAnchor,
|
||||
required this.items,
|
||||
this.menuWrapper,
|
||||
this.initialValue,
|
||||
@@ -805,6 +817,7 @@ class _PopupMenuRoute<T> extends PopupRoute<T> {
|
||||
}) : itemSizes = List<Size?>.filled(items.length, null);
|
||||
|
||||
final RelativeRect position;
|
||||
final Rect? submenuAnchor;
|
||||
final List<PopupMenuEntry<T>> items;
|
||||
final MenuWrapper? menuWrapper;
|
||||
final List<Size?> itemSizes;
|
||||
@@ -874,6 +887,7 @@ class _PopupMenuRoute<T> extends PopupRoute<T> {
|
||||
Directionality.of(context),
|
||||
mediaQuery.padding,
|
||||
_avoidBounds(mediaQuery),
|
||||
submenuAnchor: submenuAnchor,
|
||||
),
|
||||
child: capturedThemes.wrap(menu),
|
||||
);
|
||||
@@ -1042,6 +1056,7 @@ class PopupMenu<T> extends StatelessWidget {
|
||||
Future<T?> showMenu<T>({
|
||||
required BuildContext context,
|
||||
required RelativeRect position,
|
||||
Rect? submenuAnchor,
|
||||
required List<PopupMenuEntry<T>> items,
|
||||
MenuWrapper? menuWrapper,
|
||||
T? initialValue,
|
||||
@@ -1070,6 +1085,7 @@ Future<T?> showMenu<T>({
|
||||
Navigator.of(context, rootNavigator: useRootNavigator);
|
||||
return navigator.push(_PopupMenuRoute<T>(
|
||||
position: position,
|
||||
submenuAnchor: submenuAnchor,
|
||||
items: items,
|
||||
menuWrapper: menuWrapper,
|
||||
initialValue: initialValue,
|
||||
@@ -1352,6 +1368,9 @@ class PopupMenuButtonState<T> extends State<PopupMenuButton<T>> {
|
||||
menuWrapper: widget.menuWrapper,
|
||||
initialValue: widget.initialValue,
|
||||
position: position,
|
||||
submenuAnchor: widget.position == PopupMenuPosition.overSide
|
||||
? button.localToGlobal(Offset.zero, ancestor: overlay) & button.size
|
||||
: null,
|
||||
shape: widget.shape ?? popupMenuTheme.shape,
|
||||
color: widget.color ?? popupMenuTheme.color,
|
||||
constraints: widget.constraints,
|
||||
|
||||
@@ -15,6 +15,8 @@ class PopupMenuChildrenItem<T> extends mod_menu.PopupMenuEntry<T> {
|
||||
this.enabled,
|
||||
this.textStyle,
|
||||
this.onTap,
|
||||
this.dismissParentOnCanceled = false,
|
||||
this.useButtonLayout = false,
|
||||
this.position = mod_menu.PopupMenuPosition.overSide,
|
||||
this.offset = Offset.zero,
|
||||
required this.itemBuilder,
|
||||
@@ -27,6 +29,8 @@ class PopupMenuChildrenItem<T> extends mod_menu.PopupMenuEntry<T> {
|
||||
final EdgeInsets? padding;
|
||||
final RxBool? enabled;
|
||||
final void Function()? onTap;
|
||||
final bool dismissParentOnCanceled;
|
||||
final bool useButtonLayout;
|
||||
final List<mod_menu.PopupMenuEntry<T>> Function(BuildContext) itemBuilder;
|
||||
final Widget child;
|
||||
|
||||
@@ -69,20 +73,42 @@ class MyPopupMenuItemState<T, W extends PopupMenuChildrenItem<T>>
|
||||
position: widget.position,
|
||||
offset: widget.offset,
|
||||
onSelected: handleTap,
|
||||
onCanceled: widget.dismissParentOnCanceled
|
||||
? () {
|
||||
if (ModalRoute.of(context)?.isCurrent == true) {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
}
|
||||
: null,
|
||||
itemBuilder: widget.itemBuilder,
|
||||
padding: EdgeInsets.zero,
|
||||
child: AnimatedDefaultTextStyle(
|
||||
style: style,
|
||||
duration: kThemeChangeDuration,
|
||||
child: Container(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: widget.height, maxHeight: widget.height),
|
||||
padding:
|
||||
widget.padding ?? const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: widget.child,
|
||||
),
|
||||
),
|
||||
child: Builder(builder: (context) {
|
||||
final child = AnimatedDefaultTextStyle(
|
||||
style: style,
|
||||
duration: kThemeChangeDuration,
|
||||
child: Container(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: widget.height, maxHeight: widget.height),
|
||||
padding: widget.padding ??
|
||||
const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: widget.child,
|
||||
),
|
||||
);
|
||||
if (!widget.useButtonLayout) return child;
|
||||
final onPressed = enabled.value
|
||||
? () => context
|
||||
.findAncestorStateOfType<mod_menu.PopupMenuButtonState<T>>()
|
||||
?.showButtonMenu()
|
||||
: null;
|
||||
// The popup trigger owns keyboard focus; retain the menu button sizing.
|
||||
return ExcludeFocus(
|
||||
child: TextButton(
|
||||
onPressed: onPressed,
|
||||
child: TextButton(onPressed: onPressed, child: child),
|
||||
),
|
||||
);
|
||||
}),
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -645,11 +671,15 @@ class MenuEntrySubMenu<T> extends MenuEntryBase<T> {
|
||||
final String text;
|
||||
final List<MenuEntryBase<T>> entries;
|
||||
final EdgeInsets? padding;
|
||||
final bool dismissParentOnCanceled;
|
||||
final double arrowScale;
|
||||
|
||||
MenuEntrySubMenu({
|
||||
required this.text,
|
||||
required this.entries,
|
||||
this.padding,
|
||||
this.dismissParentOnCanceled = false,
|
||||
this.arrowScale = MenuConfig.iconScale,
|
||||
RxBool? enabled,
|
||||
}) : super(enabled: enabled);
|
||||
|
||||
@@ -662,13 +692,14 @@ class MenuEntrySubMenu<T> extends MenuEntryBase<T> {
|
||||
enabled: super.enabled,
|
||||
height: conf.height,
|
||||
padding: padding,
|
||||
dismissParentOnCanceled: dismissParentOnCanceled,
|
||||
useButtonLayout: true,
|
||||
position: mod_menu.PopupMenuPosition.overSide,
|
||||
itemBuilder: (BuildContext context) => entries
|
||||
.map((entry) => entry.build(context, conf))
|
||||
.expand((i) => i)
|
||||
.toList(),
|
||||
child: Row(children: [
|
||||
const SizedBox(width: MenuConfig.midPadding),
|
||||
Obx(() => Text(
|
||||
text,
|
||||
style: super.enabled!.value
|
||||
@@ -678,10 +709,15 @@ class MenuEntrySubMenu<T> extends MenuEntryBase<T> {
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Obx(() => Icon(
|
||||
Icons.keyboard_arrow_right,
|
||||
color: super.enabled!.value ? conf.commonColor : Colors.grey,
|
||||
)),
|
||||
child: Transform.scale(
|
||||
scale: arrowScale,
|
||||
child: Obx(() => Icon(
|
||||
Icons.keyboard_arrow_right,
|
||||
color: super.enabled!.value
|
||||
? Theme.of(context).unselectedWidgetColor
|
||||
: disabledStyle().color,
|
||||
)),
|
||||
),
|
||||
))
|
||||
]),
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user