mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-06-08 02:12:49 +08:00
mobile: limited height scroll tags/users, and scrollable peers
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
5236dcfe52
commit
167bf70cd6
@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:dynamic_layouts/dynamic_layouts.dart';
|
import 'package:dynamic_layouts/dynamic_layouts.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_hbb/common/formatter/id_formatter.dart';
|
import 'package:flutter_hbb/common/formatter/id_formatter.dart';
|
||||||
@ -170,16 +172,18 @@ class _AddressBookState extends State<AddressBook> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final gridView = DynamicGridView.builder(
|
||||||
|
shrinkWrap: isMobile,
|
||||||
|
gridDelegate: SliverGridDelegateWithWrapping(),
|
||||||
|
itemCount: tags.length,
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
final e = tags[index];
|
||||||
|
return tagBuilder(e);
|
||||||
|
});
|
||||||
|
final maxHeight = max(MediaQuery.of(context).size.height / 6, 100.0);
|
||||||
return isDesktop
|
return isDesktop
|
||||||
? DynamicGridView.builder(
|
? gridView
|
||||||
gridDelegate: SliverGridDelegateWithWrapping(
|
: LimitedBox(maxHeight: maxHeight, child: gridView);
|
||||||
mainAxisSpacing: 0, crossAxisSpacing: 0),
|
|
||||||
itemCount: tags.length,
|
|
||||||
itemBuilder: (BuildContext context, int index) {
|
|
||||||
final e = tags[index];
|
|
||||||
return tagBuilder(e);
|
|
||||||
})
|
|
||||||
: Wrap(children: tags.map((e) => tagBuilder(e)).toList());
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_hbb/common/hbbs/hbbs.dart';
|
import 'package:flutter_hbb/common/hbbs/hbbs.dart';
|
||||||
import 'package:flutter_hbb/common/widgets/login.dart';
|
import 'package:flutter_hbb/common/widgets/login.dart';
|
||||||
@ -157,11 +159,14 @@ class _MyGroupState extends State<MyGroup> {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}).toList();
|
}).toList();
|
||||||
|
final listView = ListView.builder(
|
||||||
|
shrinkWrap: isMobile,
|
||||||
|
itemCount: items.length,
|
||||||
|
itemBuilder: (context, index) => _buildUserItem(items[index]));
|
||||||
|
var maxHeight = max(MediaQuery.of(context).size.height / 6, 100.0);
|
||||||
return isDesktop
|
return isDesktop
|
||||||
? ListView.builder(
|
? listView
|
||||||
itemCount: items.length,
|
: LimitedBox(maxHeight: maxHeight, child: listView);
|
||||||
itemBuilder: (context, index) => _buildUserItem(items[index]))
|
|
||||||
: Column(children: items.map((e) => _buildUserItem(e)).toList());
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,23 +197,14 @@ class _PeersViewState extends State<_PeersView> with WindowListener {
|
|||||||
: SizedBox(width: mobileWidth, child: visibilityChild);
|
: SizedBox(width: mobileWidth, child: visibilityChild);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Widget child;
|
final child = DynamicGridView.builder(
|
||||||
if (isDesktop) {
|
gridDelegate: SliverGridDelegateWithWrapping(
|
||||||
child = DynamicGridView.builder(
|
mainAxisSpacing: space / 2, crossAxisSpacing: space),
|
||||||
gridDelegate: SliverGridDelegateWithWrapping(
|
itemCount: peers.length,
|
||||||
mainAxisSpacing: space / 2, crossAxisSpacing: space),
|
itemBuilder: (BuildContext context, int index) {
|
||||||
itemCount: peers.length,
|
return buildOnePeer(peers[index]);
|
||||||
itemBuilder: (BuildContext context, int index) {
|
},
|
||||||
return buildOnePeer(peers[index]);
|
);
|
||||||
},
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
child = Wrap(
|
|
||||||
spacing: space,
|
|
||||||
runSpacing: space,
|
|
||||||
children: peers.map((e) => buildOnePeer(e)).toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (updateEvent == UpdateEvent.load) {
|
if (updateEvent == UpdateEvent.load) {
|
||||||
_curPeers.clear();
|
_curPeers.clear();
|
||||||
_curPeers.addAll(peers.map((e) => e.id));
|
_curPeers.addAll(peers.map((e) => e.id));
|
||||||
|
@ -80,7 +80,7 @@ class _ConnectionPageState extends State<ConnectionPage> {
|
|||||||
_buildRemoteIDTextField(),
|
_buildRemoteIDTextField(),
|
||||||
])),
|
])),
|
||||||
SliverFillRemaining(
|
SliverFillRemaining(
|
||||||
hasScrollBody: false,
|
hasScrollBody: true,
|
||||||
child: PeerTabPage(),
|
child: PeerTabPage(),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
@ -400,11 +400,11 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
path: "packages/dynamic_layouts"
|
path: "packages/dynamic_layouts"
|
||||||
ref: "0023d01996576e494094793a6552463f01c5627a"
|
ref: "74cc4b495dcf3a4cb8df38d9ecc89f53f074a2c6"
|
||||||
resolved-ref: "0023d01996576e494094793a6552463f01c5627a"
|
resolved-ref: "74cc4b495dcf3a4cb8df38d9ecc89f53f074a2c6"
|
||||||
url: "https://github.com/flutter/packages.git"
|
url: "https://github.com/21pages/packages.git"
|
||||||
source: git
|
source: git
|
||||||
version: "0.0.1+1"
|
version: "0.0.1+2"
|
||||||
event_bus:
|
event_bus:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -102,9 +102,9 @@ dependencies:
|
|||||||
flex_color_picker: ^3.3.0
|
flex_color_picker: ^3.3.0
|
||||||
dynamic_layouts:
|
dynamic_layouts:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/flutter/packages.git
|
url: https://github.com/21pages/packages.git
|
||||||
path: packages/dynamic_layouts
|
path: packages/dynamic_layouts
|
||||||
ref: 0023d01996576e494094793a6552463f01c5627a
|
ref: 74cc4b495dcf3a4cb8df38d9ecc89f53f074a2c6
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
icons_launcher: ^2.0.4
|
icons_launcher: ^2.0.4
|
||||||
|
Loading…
Reference in New Issue
Block a user