mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-05-10 18:06:01 +02:00
opt dropdown button of connection page (#11086)
* Use menu style of the peer card * Add margin between connection button and dropdown button * Use thinner icon Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
parent
b2cc9eac23
commit
e0fd698101
5 changed files with 71 additions and 37 deletions
BIN
flutter/assets/more.ttf
Normal file
BIN
flutter/assets/more.ttf
Normal file
Binary file not shown.
|
@ -108,6 +108,8 @@ class IconFont {
|
||||||
static const _family2 = 'PeerSearchbar';
|
static const _family2 = 'PeerSearchbar';
|
||||||
static const _family3 = 'AddressBook';
|
static const _family3 = 'AddressBook';
|
||||||
static const _family4 = 'DeviceGroup';
|
static const _family4 = 'DeviceGroup';
|
||||||
|
static const _family5 = 'More';
|
||||||
|
|
||||||
IconFont._();
|
IconFont._();
|
||||||
|
|
||||||
static const IconData max = IconData(0xe606, fontFamily: _family1);
|
static const IconData max = IconData(0xe606, fontFamily: _family1);
|
||||||
|
@ -123,6 +125,7 @@ class IconFont {
|
||||||
IconData(0xe623, fontFamily: _family4);
|
IconData(0xe623, fontFamily: _family4);
|
||||||
static const IconData deviceGroupFill =
|
static const IconData deviceGroupFill =
|
||||||
IconData(0xe748, fontFamily: _family4);
|
IconData(0xe748, fontFamily: _family4);
|
||||||
|
static const IconData more = IconData(0xe609, fontFamily: _family5);
|
||||||
}
|
}
|
||||||
|
|
||||||
class ColorThemeExtension extends ThemeExtension<ColorThemeExtension> {
|
class ColorThemeExtension extends ThemeExtension<ColorThemeExtension> {
|
||||||
|
|
|
@ -2,10 +2,12 @@
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_hbb/common/widgets/connection_page_title.dart';
|
import 'package:flutter_hbb/common/widgets/connection_page_title.dart';
|
||||||
import 'package:flutter_hbb/consts.dart';
|
import 'package:flutter_hbb/consts.dart';
|
||||||
|
import 'package:flutter_hbb/desktop/widgets/popup_menu.dart';
|
||||||
import 'package:flutter_hbb/models/state_model.dart';
|
import 'package:flutter_hbb/models/state_model.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:url_launcher/url_launcher_string.dart';
|
import 'package:url_launcher/url_launcher_string.dart';
|
||||||
|
@ -17,6 +19,7 @@ import '../../common/formatter/id_formatter.dart';
|
||||||
import '../../common/widgets/peer_tab_page.dart';
|
import '../../common/widgets/peer_tab_page.dart';
|
||||||
import '../../common/widgets/autocomplete.dart';
|
import '../../common/widgets/autocomplete.dart';
|
||||||
import '../../models/platform_model.dart';
|
import '../../models/platform_model.dart';
|
||||||
|
import '../../desktop/widgets/material_mod_popup_menu.dart' as mod_menu;
|
||||||
|
|
||||||
class OnlineStatusWidget extends StatefulWidget {
|
class OnlineStatusWidget extends StatefulWidget {
|
||||||
const OnlineStatusWidget({Key? key, this.onSvcStatusChanged})
|
const OnlineStatusWidget({Key? key, this.onSvcStatusChanged})
|
||||||
|
@ -211,6 +214,8 @@ class _ConnectionPageState extends State<ConnectionPage>
|
||||||
// https://github.com/flutter/flutter/issues/157244
|
// https://github.com/flutter/flutter/issues/157244
|
||||||
Iterable<Peer> _autocompleteOpts = [];
|
Iterable<Peer> _autocompleteOpts = [];
|
||||||
|
|
||||||
|
final _menuOpen = false.obs;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
@ -513,7 +518,7 @@ class _ConnectionPageState extends State<ConnectionPage>
|
||||||
child: Text(translate("Connect")),
|
child: Text(translate("Connect")),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 3),
|
const SizedBox(width: 8),
|
||||||
Container(
|
Container(
|
||||||
height: 28.0,
|
height: 28.0,
|
||||||
width: 28.0,
|
width: 28.0,
|
||||||
|
@ -522,41 +527,64 @@ class _ConnectionPageState extends State<ConnectionPage>
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
),
|
),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: MenuAnchor(
|
child: Obx(() {
|
||||||
builder: (context, controller, builder) {
|
var offset = Offset(0, 0);
|
||||||
return IconButton(
|
return InkWell(
|
||||||
padding: EdgeInsets.zero,
|
child: _menuOpen.value
|
||||||
constraints: BoxConstraints(),
|
? Transform.rotate(
|
||||||
visualDensity: VisualDensity.compact,
|
angle: pi,
|
||||||
icon: controller.isOpen
|
child: Icon(IconFont.more, size: 14),
|
||||||
? const Icon(Icons.keyboard_arrow_up)
|
)
|
||||||
: const Icon(Icons.keyboard_arrow_down),
|
: Icon(IconFont.more, size: 14),
|
||||||
onPressed: () {
|
onTapDown: (e) {
|
||||||
setState(() {
|
offset = e.globalPosition;
|
||||||
if (controller.isOpen) {
|
},
|
||||||
controller.close();
|
onTap: () async {
|
||||||
} else {
|
_menuOpen.value = true;
|
||||||
controller.open();
|
final x = offset.dx;
|
||||||
}
|
final y = offset.dy;
|
||||||
});
|
await mod_menu
|
||||||
},
|
.showMenu(
|
||||||
);
|
context: context,
|
||||||
},
|
position: RelativeRect.fromLTRB(x, y, x, y),
|
||||||
menuChildren: <Widget>[
|
items: [
|
||||||
MenuItemButton(
|
(
|
||||||
onPressed: () {
|
'Transfer file',
|
||||||
onConnect(isFileTransfer: true);
|
() => onConnect(isFileTransfer: true)
|
||||||
},
|
),
|
||||||
child: Text(translate('Transfer file')),
|
(
|
||||||
),
|
'View camera',
|
||||||
MenuItemButton(
|
() => onConnect(isViewCamera: true)
|
||||||
onPressed: () {
|
),
|
||||||
onConnect(isViewCamera: true);
|
]
|
||||||
},
|
.map((e) => MenuEntryButton<String>(
|
||||||
child: Text(translate('View camera')),
|
childBuilder: (TextStyle? style) => Text(
|
||||||
),
|
translate(e.$1),
|
||||||
],
|
style: style,
|
||||||
),
|
),
|
||||||
|
proc: () => e.$2(),
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: kDesktopMenuPadding.left),
|
||||||
|
dismissOnClicked: true,
|
||||||
|
))
|
||||||
|
.map((e) => e.build(
|
||||||
|
context,
|
||||||
|
const MenuConfig(
|
||||||
|
commonColor:
|
||||||
|
CustomPopupMenuTheme.commonColor,
|
||||||
|
height: CustomPopupMenuTheme.height,
|
||||||
|
dividerHeight: CustomPopupMenuTheme
|
||||||
|
.dividerHeight)))
|
||||||
|
.expand((i) => i)
|
||||||
|
.toList(),
|
||||||
|
elevation: 8,
|
||||||
|
)
|
||||||
|
.then((_) {
|
||||||
|
_menuOpen.value = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
|
|
|
@ -229,7 +229,7 @@ class _ViewCameraPageState extends State<ViewCameraPage>
|
||||||
|
|
||||||
// https://github.com/flutter/flutter/issues/64935
|
// https://github.com/flutter/flutter/issues/64935
|
||||||
super.dispose();
|
super.dispose();
|
||||||
debugPrint("REMOTE PAGE dispose session $sessionId ${widget.id}");
|
debugPrint("VIEW CAMERA PAGE dispose session $sessionId ${widget.id}");
|
||||||
_ffi.textureModel.onViewCameraPageDispose(closeSession);
|
_ffi.textureModel.onViewCameraPageDispose(closeSession);
|
||||||
if (closeSession) {
|
if (closeSession) {
|
||||||
// ensure we leave this session, this is a double check
|
// ensure we leave this session, this is a double check
|
||||||
|
|
|
@ -164,6 +164,9 @@ flutter:
|
||||||
- family: DeviceGroup
|
- family: DeviceGroup
|
||||||
fonts:
|
fonts:
|
||||||
- asset: assets/device_group.ttf
|
- asset: assets/device_group.ttf
|
||||||
|
- family: More
|
||||||
|
fonts:
|
||||||
|
- asset: assets/more.ttf
|
||||||
|
|
||||||
# An image asset can refer to one or more resolution-specific "variants", see
|
# An image asset can refer to one or more resolution-specific "variants", see
|
||||||
# https://flutter.dev/assets-and-images/#resolution-aware.
|
# https://flutter.dev/assets-and-images/#resolution-aware.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue