- Created CMakeLists.txt for Flutter and runner components. - Implemented resource script (Runner.rc) for application metadata. - Developed main entry point (main.cpp) for the Windows application. - Added FlutterWindow class to manage the Flutter view within a Win32 window. - Implemented utility functions for console management and command line argument parsing. - Established Win32Window class for high DPI-aware window handling. - Included application icon and manifest for proper Windows integration. - Set up build configurations and dependencies for the Flutter application on Windows.
75 lines
2.0 KiB
Dart
75 lines
2.0 KiB
Dart
|
|
|
|
import 'package:marco/helpers/widgets/my_display_type.dart';
|
|
import 'package:marco/helpers/widgets/my_screen_media_type.dart';
|
|
|
|
class MyScreenMedia {
|
|
static int flexColumns = 12;
|
|
static double flexSpacing = 24;
|
|
|
|
static MyScreenMediaType getTypeFromWidth(double width) {
|
|
for (var i in MyScreenMediaType.values) {
|
|
if (width < i.width) {
|
|
return i;
|
|
}
|
|
}
|
|
return MyScreenMediaType.xxl;
|
|
}
|
|
|
|
static Map<MyScreenMediaType, T> getFilledMedia<T>(
|
|
Map<MyScreenMediaType, T>? map, T defaultValue,
|
|
[bool reversed = false]) {
|
|
Map<MyScreenMediaType, T> d = {};
|
|
map ??= {};
|
|
List list = MyScreenMediaType.list;
|
|
if (reversed) {
|
|
list = list.reversed.toList();
|
|
}
|
|
for (var i = 0; i < list.length; i++) {
|
|
d[list[i]] =
|
|
map[list[i]] ?? (i > 0 ? d[list[i - 1]] : null) ?? defaultValue;
|
|
}
|
|
return d;
|
|
}
|
|
|
|
static Map<MyScreenMediaType, double> getFlexedDataFromString(String? string) {
|
|
string ??= "";
|
|
Map<MyScreenMediaType, double> d = {};
|
|
|
|
List<String> data = string.split(" ");
|
|
for (String item in data) {
|
|
for (var type in MyScreenMediaType.values) {
|
|
if (item.contains(type.className)) {
|
|
double? flex = double.tryParse(item.replaceAll("${type.className}-", ""));
|
|
if (flex != null) {
|
|
d[type] = flex;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return getFilledMedia<double>(d, MyScreenMedia.flexColumns.toDouble());
|
|
}
|
|
|
|
static Map<MyScreenMediaType, MyDisplayType> getDisplayDataFromString(
|
|
String? string) {
|
|
string ??= "";
|
|
Map<MyScreenMediaType, MyDisplayType> d = {};
|
|
|
|
List<String> data = string.split(" ");
|
|
for (String item in data) {
|
|
for (var type in MyScreenMediaType.values) {
|
|
if (item.contains(type.className)) {
|
|
MyDisplayType displayType = MyDisplayType.fromString(
|
|
item.replaceAll("${type.className}-", ""));
|
|
d[type] = displayType;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
return getFilledMedia(d, MyDisplayType.block);
|
|
}
|
|
}
|