Merge pull request #2199 from fufesou/fix_peer_card_view

Fix peer card view
This commit is contained in:
RustDesk 2022-11-18 10:25:32 +08:00 committed by GitHub
commit 0a2627f06a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 19 deletions

View File

@ -28,14 +28,16 @@ class _PeerTabPageState extends State<PeerTabPage>
setPeer() { setPeer() {
final index = bind.getLocalFlutterConfig(k: 'peer-tab-index'); final index = bind.getLocalFlutterConfig(k: 'peer-tab-index');
if (index == '') return; if (index != '') {
_tabIndex.value = int.parse(index); _tabIndex.value = int.parse(index);
}
final uiType = bind.getLocalFlutterConfig(k: 'peer-card-ui-type'); final uiType = bind.getLocalFlutterConfig(k: 'peer-card-ui-type');
if (uiType == '') return; if (uiType != '') {
peerCardUiType.value = int.parse(uiType) == PeerUiType.list.index peerCardUiType.value = int.parse(uiType) == PeerUiType.list.index
? PeerUiType.list ? PeerUiType.list
: PeerUiType.grid; : PeerUiType.grid;
}
} }
// hard code for now // hard code for now

View File

@ -321,12 +321,10 @@ class _ImagePaintState extends State<ImagePaint> {
if (c.scrollStyle == ScrollStyle.scrollbar) { if (c.scrollStyle == ScrollStyle.scrollbar) {
final imageWidth = c.getDisplayWidth() * s; final imageWidth = c.getDisplayWidth() * s;
final imageHeight = c.getDisplayHeight() * s; final imageHeight = c.getDisplayHeight() * s;
final imageWidget = SizedBox( final imageWidget = CustomPaint(
width: imageWidth, size: Size(imageWidth, imageHeight),
height: imageHeight, painter: ImagePainter(image: m.image, x: 0, y: 0, scale: s),
child: CustomPaint( );
painter: ImagePainter(image: m.image, x: 0, y: 0, scale: s),
));
return NotificationListener<ScrollNotification>( return NotificationListener<ScrollNotification>(
onNotification: (notification) { onNotification: (notification) {
@ -350,13 +348,10 @@ class _ImagePaintState extends State<ImagePaint> {
Size(imageWidth, imageHeight))), Size(imageWidth, imageHeight))),
); );
} else { } else {
final imageWidget = SizedBox( final imageWidget = CustomPaint(
width: c.size.width, size: Size(c.size.width, c.size.height),
height: c.size.height, painter: ImagePainter(image: m.image, x: c.x / s, y: c.y / s, scale: s),
child: CustomPaint( );
painter:
ImagePainter(image: m.image, x: c.x / s, y: c.y / s, scale: s),
));
return mouseRegion(child: _buildListener(imageWidget)); return mouseRegion(child: _buildListener(imageWidget));
} }
} }