An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.
Rust androidanydeskdartflatpakflutterflutter-appsioslinuxmacosp2prdpremote-controlremote-desktoprustrust-langteamviewervncwaylandwindows
mobile use _buildPeerTile
21pages5a6a7e8d82c5
diff --git a/flutter/lib/common/widgets/peer_card.dart b/flutter/lib/common/widgets/peer_card.dartindex fd558c68c..8bb4fdfdb 100644--- a/flutter/lib/common/widgets/peer_card.dart+++ b/flutter/lib/common/widgets/peer_card.dart@@ -63,75 +63,29 @@ class _PeerCardState extends State<_PeerCard>Widget _buildMobile() {final peer = super.widget.peer;- final name =- '${peer.username}${peer.username.isNotEmpty && peer.hostname.isNotEmpty ? '@' : ''}${peer.hostname}';final PeerTabModel peerTabModel = Provider.of(context);- final child = Card(+ return Card(margin: EdgeInsets.symmetric(horizontal: 2),child: GestureDetector(- onTap: () {- if (peerTabModel.multiSelectionMode) {- peerTabModel.select(peer);- } else {- if (!isWebDesktop) {- connectInPeerTab(context, peer.id, widget.tab);- }- }- },- onDoubleTap: isWebDesktop- ? () => connectInPeerTab(context, peer.id, widget.tab)- : null,- onLongPress: () {+ onTap: () {+ if (peerTabModel.multiSelectionMode) {peerTabModel.select(peer);- },- child: Container(+ } else {+ if (!isWebDesktop) {+ connectInPeerTab(context, peer.id, widget.tab);+ }+ }+ },+ onDoubleTap: isWebDesktop+ ? () => connectInPeerTab(context, peer.id, widget.tab)+ : null,+ onLongPress: () {+ peerTabModel.select(peer);+ },+ child: Container(padding: EdgeInsets.only(left: 12, top: 8, bottom: 8),- child: Row(- children: [- Container(- width: 50,- height: 50,- decoration: BoxDecoration(- color: str2color('${peer.id}${peer.platform}', 0x7f),- borderRadius: BorderRadius.circular(4),- ),- padding: const EdgeInsets.all(6),- child: getPlatformImage(peer.platform)),- Expanded(- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Row(children: [- getOnline(4, peer.online),- Text(peer.alias.isEmpty- ? formatID(peer.id)- : peer.alias)- ]),- Text(name)- ],- ).paddingOnly(left: 8.0),- ),- checkBoxOrActionMoreMobile(peer),- ],- ),- )));- final colors = _frontN(peer.tags, 25).map((e) => str2color2(e)).toList();- return Tooltip(- message: peer.tags.isNotEmpty- ? '${translate('Tags')}: ${peer.tags.join(', ')}'- : '',- child: Stack(children: [- child,- if (colors.isNotEmpty)- Positioned(- top: 2,- right: 10,- child: CustomPaint(- painter: TagPainter(radius: 3, colors: colors),- ),- )- ]),- );+ child: _buildPeerTile(context, peer, null)),+ ));}Widget _buildDesktop() {@@ -178,87 +132,95 @@ class _PeerCardState extends State<_PeerCard>}Widget _buildPeerTile(- BuildContext context, Peer peer, Rx<BoxDecoration?> deco) {+ BuildContext context, Peer peer, Rx<BoxDecoration?>? deco) {final name ='${peer.username}${peer.username.isNotEmpty && peer.hostname.isNotEmpty ? '@' : ''}${peer.hostname}';final greyStyle = TextStyle(fontSize: 11,color: Theme.of(context).textTheme.titleLarge?.color?.withOpacity(0.6));- final child = Obx(- () => Container(- foregroundDecoration: deco.value,- child: Row(- mainAxisSize: MainAxisSize.max,- children: [- Container(- decoration: BoxDecoration(- color: str2color('${peer.id}${peer.platform}', 0x7f),- borderRadius: BorderRadius.only(- topLeft: Radius.circular(_tileRadius),- bottomLeft: Radius.circular(_tileRadius),- ),+ final child = Row(+ mainAxisSize: MainAxisSize.max,+ children: [+ Container(+ decoration: BoxDecoration(+ color: str2color('${peer.id}${peer.platform}', 0x7f),+ borderRadius: isMobile+ ? BorderRadius.circular(_tileRadius)+ : BorderRadius.only(+ topLeft: Radius.circular(_tileRadius),+ bottomLeft: Radius.circular(_tileRadius),+ ),+ ),+ alignment: Alignment.center,+ width: isMobile ? 50 : 42,+ height: isMobile ? 50 : null,+ child: getPlatformImage(peer.platform, size: isMobile ? 38 : 30)+ .paddingAll(6),+ ),+ Expanded(+ child: Container(+ decoration: BoxDecoration(+ color: Theme.of(context).colorScheme.background,+ borderRadius: BorderRadius.only(+ topRight: Radius.circular(_tileRadius),+ bottomRight: Radius.circular(_tileRadius),),- alignment: Alignment.center,- width: 42,- child: getPlatformImage(peer.platform, size: 30).paddingAll(6),),- Expanded(- child: Container(- decoration: BoxDecoration(- color: Theme.of(context).colorScheme.background,- borderRadius: BorderRadius.only(- topRight: Radius.circular(_tileRadius),- bottomRight: Radius.circular(_tileRadius),- ),- ),- child: Row(- children: [- Expanded(- child: Column(- children: [- Row(children: [- getOnline(8, peer.online),- Expanded(- child: Text(- peer.alias.isEmpty- ? formatID(peer.id)- : peer.alias,- overflow: TextOverflow.ellipsis,- style: Theme.of(context).textTheme.titleSmall,- )),- ]).marginOnly(bottom: 0, top: 2),- Align(- alignment: Alignment.centerLeft,+ child: Row(+ children: [+ Expanded(+ child: Column(+ children: [+ Row(children: [+ getOnline(isMobile ? 4 : 8, peer.online),+ Expanded(child: Text(- name,- style: greyStyle,- textAlign: TextAlign.start,- overflow: TextOverflow.ellipsis,- ),- ),- ],- ).marginOnly(top: 2),- ),- checkBoxOrActionMoreDesktop(peer, isTile: true),- ],- ).paddingOnly(left: 10.0, top: 3.0),- ),- )- ],- ),- ),+ peer.alias.isEmpty ? formatID(peer.id) : peer.alias,+ overflow: TextOverflow.ellipsis,+ style: Theme.of(context).textTheme.titleSmall,+ )),+ ]).marginOnly(top: isMobile ? 0 : 2),+ Align(+ alignment: Alignment.centerLeft,+ child: Text(+ name,+ style: isMobile ? null : greyStyle,+ textAlign: TextAlign.start,+ overflow: TextOverflow.ellipsis,+ ),+ ),+ ],+ ).marginOnly(top: 2),+ ),+ isMobile+ ? checkBoxOrActionMoreMobile(peer)+ : checkBoxOrActionMoreDesktop(peer, isTile: true),+ ],+ ).paddingOnly(left: 10.0, top: 3.0),+ ),+ )+ ],);final colors = _frontN(peer.tags, 25).map((e) => str2color2(e)).toList();return Tooltip(- message: peer.tags.isNotEmpty- ? '${translate('Tags')}: ${peer.tags.join(', ')}'- : '',+ message: isMobile+ ? ''+ : peer.tags.isNotEmpty+ ? '${translate('Tags')}: ${peer.tags.join(', ')}'+ : '',child: Stack(children: [- child,+ deco == null+ ? child+ : Obx(+ () => Container(+ foregroundDecoration: deco.value,+ child: child,+ ),+ ),if (colors.isNotEmpty)Positioned(top: 2,- right: 10,+ right: isMobile ? 20 : 10,child: CustomPaint(painter: TagPainter(radius: 3, colors: colors),),