Merge pull request #1918 from fufesou/fix_remote_min_
flutter_desktop: fix layout size computation
This commit is contained in:
commit
4a1a5f668f
@ -443,11 +443,14 @@ class ImagePaint extends StatelessWidget {
|
|||||||
|
|
||||||
Widget _buildCrossScrollbar(BuildContext context, Widget child, Size size) {
|
Widget _buildCrossScrollbar(BuildContext context, Widget child, Size size) {
|
||||||
var layoutSize = MediaQuery.of(context).size;
|
var layoutSize = MediaQuery.of(context).size;
|
||||||
|
// If minimized, w or h may be negative here.
|
||||||
|
final w = layoutSize.width - kWindowBorderWidth * 2;
|
||||||
|
final h =
|
||||||
|
layoutSize.height - kWindowBorderWidth * 2 - kDesktopRemoteTabBarHeight;
|
||||||
layoutSize = Size(
|
layoutSize = Size(
|
||||||
layoutSize.width - kWindowBorderWidth * 2,
|
w < 0 ? 0 : w,
|
||||||
layoutSize.height -
|
h < 0 ? 0 : h,
|
||||||
kWindowBorderWidth * 2 -
|
);
|
||||||
kDesktopRemoteTabBarHeight);
|
|
||||||
bool overflow =
|
bool overflow =
|
||||||
layoutSize.width < size.width || layoutSize.height < size.height;
|
layoutSize.width < size.width || layoutSize.height < size.height;
|
||||||
return overflow
|
return overflow
|
||||||
|
@ -577,8 +577,10 @@ class CanvasModel with ChangeNotifier {
|
|||||||
|
|
||||||
Size get size {
|
Size get size {
|
||||||
final size = MediaQueryData.fromWindow(ui.window).size;
|
final size = MediaQueryData.fromWindow(ui.window).size;
|
||||||
return Size(size.width - windowBorderWidth * 2,
|
// If minimized, w or h may be negative here.
|
||||||
size.height - tabBarHeight - windowBorderWidth * 2);
|
double w = size.width - windowBorderWidth * 2;
|
||||||
|
double h = size.height - tabBarHeight - windowBorderWidth * 2;
|
||||||
|
return Size(w < 0 ? 0 : w, h < 0 ? 0 : h);
|
||||||
}
|
}
|
||||||
|
|
||||||
moveDesktopMouse(double x, double y) {
|
moveDesktopMouse(double x, double y) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user