Skip to content

Commit

Permalink
[gui] remove undeeded stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-toterman committed Dec 16, 2024
1 parent 8055fc1 commit 7f40ac9
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 28 deletions.
16 changes: 0 additions & 16 deletions src/client/gui/lib/extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,3 @@ extension NullableMap<T> on T? {
}
}
}

// needed because in release mode Flutter does not emit the actual code for toString for some classes
// instead the returned strings are of type "Instance of '<Type>'"
// this is done to reduce binary size, and it cannot be turned off :face-with-rolling-eyes:
// see https://api.flutter.dev/flutter/dart-ui/keepToString-constant.html for more info
extension SizeActualString on Size {
String s() {
return 'Size(${width.toStringAsFixed(1)}, ${height.toStringAsFixed(1)})';
}
}

extension RectActualString on Rect {
String s() {
return 'Rect.fromLTRB(${left.toStringAsFixed(1)}, ${top.toStringAsFixed(1)}, ${right.toStringAsFixed(1)}, ${bottom.toStringAsFixed(1)})';
}
}
3 changes: 0 additions & 3 deletions src/client/gui/lib/platform/linux.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ class LinuxPlatform extends MpPlatform {
String? get homeDirectory => Platform.environment['SNAP'] == null
? Platform.environment['HOME']
: Platform.environment['SNAP_REAL_HOME'];

@override
bool get multiplyScreenScaleFactor => true;
}

class LinuxAutostartNotifier extends AutostartNotifier {
Expand Down
3 changes: 0 additions & 3 deletions src/client/gui/lib/platform/macos.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ class MacOSPlatform extends MpPlatform {

@override
String? get homeDirectory => Platform.environment['HOME'];

@override
bool get multiplyScreenScaleFactor => false;
}

class MacOSAutostartNotifier extends AutostartNotifier {
Expand Down
2 changes: 0 additions & 2 deletions src/client/gui/lib/platform/platform.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ abstract class MpPlatform {
String get metaKey => 'Meta';

String? get homeDirectory;

bool get multiplyScreenScaleFactor;
}

MpPlatform _getPlatform() {
Expand Down
3 changes: 0 additions & 3 deletions src/client/gui/lib/platform/windows.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ class WindowsPlatform extends MpPlatform {

@override
String? get homeDirectory => Platform.environment['USERPROFILE'];

@override
bool get multiplyScreenScaleFactor => true;
}

class WindowsAutostartNotifier extends AutostartNotifier {
Expand Down
17 changes: 16 additions & 1 deletion src/client/gui/lib/window_size.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'package:window_manager/window_manager.dart';
import 'package:window_size/window_size.dart';

import 'extensions.dart';
import 'logger.dart';

const windowWidthKey = 'windowWidth';
Expand Down Expand Up @@ -79,3 +78,19 @@ Size computeDefaultWindowSize(Size? screenSize) {
logger.d('Computed default window size: ${size.s()}');
return size;
}

// needed because in release mode Flutter does not emit the actual code for toString for some classes
// instead the returned strings are of type "Instance of '<Type>'"
// this is done to reduce binary size, and it cannot be turned off :face-with-rolling-eyes:
// see https://api.flutter.dev/flutter/dart-ui/keepToString-constant.html for more info
extension on Size {
String s() {
return 'Size(${width.toStringAsFixed(1)}, ${height.toStringAsFixed(1)})';
}
}

extension on Rect {
String s() {
return 'Rect.fromLTRB(${left.toStringAsFixed(1)}, ${top.toStringAsFixed(1)}, ${right.toStringAsFixed(1)}, ${bottom.toStringAsFixed(1)})';
}
}

0 comments on commit 7f40ac9

Please sign in to comment.