Skip to content

Commit d0b8deb

Browse files
committed
added windows support
1 parent f09dec1 commit d0b8deb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+3087
-129
lines changed

.metadata

+20-11
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,38 @@
11
# This file tracks properties of this Flutter project.
22
# Used by Flutter tool to assess capabilities and perform upgrades etc.
33
#
4-
# This file should be version controlled.
4+
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: f92f44110e87bad5ff168335c36da6f6053036e6
8-
channel: stable
7+
revision: "5dcb86f68f239346676ceb1ed1ea385bd215fba1"
8+
channel: "stable"
99

1010
project_type: app
1111

1212
# Tracks metadata for the flutter migrate command
1313
migration:
1414
platforms:
1515
- platform: root
16-
create_revision: f92f44110e87bad5ff168335c36da6f6053036e6
17-
base_revision: f92f44110e87bad5ff168335c36da6f6053036e6
16+
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
17+
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
1818
- platform: android
19-
create_revision: f92f44110e87bad5ff168335c36da6f6053036e6
20-
base_revision: f92f44110e87bad5ff168335c36da6f6053036e6
19+
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
20+
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
2121
- platform: ios
22-
create_revision: f92f44110e87bad5ff168335c36da6f6053036e6
23-
base_revision: f92f44110e87bad5ff168335c36da6f6053036e6
22+
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
23+
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
24+
- platform: linux
25+
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
26+
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
27+
- platform: macos
28+
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
29+
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
2430
- platform: web
25-
create_revision: f92f44110e87bad5ff168335c36da6f6053036e6
26-
base_revision: f92f44110e87bad5ff168335c36da6f6053036e6
31+
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
32+
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
33+
- platform: windows
34+
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
35+
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
2736

2837
# User provided section
2938

lib/main.dart

+20-12
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import 'package:fluttertoast/fluttertoast.dart';
1212
import 'package:battery_indicator/battery_indicator.dart';
1313
import 'package:parallax_rain/parallax_rain.dart';
1414
import 'package:shared_preferences/shared_preferences.dart';
15+
import 'package:flutter/foundation.dart' show defaultTargetPlatform, TargetPlatform;
1516

1617

1718
void main() async {
@@ -324,7 +325,8 @@ class _ClockPageState extends State<ClockPage> with SingleTickerProviderStateMix
324325
decoration: BoxDecoration(
325326
borderRadius: BorderRadius.circular(10),
326327
),
327-
child: BatteryIndicator(
328+
child : defaultTargetPlatform == TargetPlatform.android
329+
? BatteryIndicator(
328330
style: BatteryIndicatorStyle.values[1],
329331
colorful: false,
330332
showPercentNum: false,
@@ -333,7 +335,18 @@ class _ClockPageState extends State<ClockPage> with SingleTickerProviderStateMix
333335
ratio: 1.5,
334336
showPercentSlide: true,
335337
percentNumSize: 50,
336-
),
338+
)
339+
: Container(),
340+
// child: BatteryIndicator(
341+
// style: BatteryIndicatorStyle.values[1],
342+
// colorful: false,
343+
// showPercentNum: false,
344+
// mainColor: _currentBackgroundGradient.colors.last,
345+
// size: 44,
346+
// ratio: 1.5,
347+
// showPercentSlide: true,
348+
// percentNumSize: 50,
349+
// ),
337350
),
338351
),
339352
],
@@ -389,7 +402,7 @@ class _ClockPageState extends State<ClockPage> with SingleTickerProviderStateMix
389402
child: Text(
390403
timezone,
391404
style: const TextStyle(
392-
color: Colors.white, // Set the text color of the DropdownMenuItem
405+
color: Colors.white,
393406
),
394407
),
395408
);
@@ -428,7 +441,7 @@ class _ClockPageState extends State<ClockPage> with SingleTickerProviderStateMix
428441
child: Text(
429442
timezone,
430443
style: const TextStyle(
431-
color: Colors.white, // Set the text color of the DropdownMenuItem
444+
color: Colors.white,
432445
),
433446
),
434447
);
@@ -473,12 +486,9 @@ class _ClockPageState extends State<ClockPage> with SingleTickerProviderStateMix
473486
);
474487
},
475488
).then((value) {
476-
// Handle the selected option
477489
if (value != null) {
478-
// Perform actions based on the selected option
479490
}
480491
}).whenComplete(() {
481-
// Call setState to refresh the widget after the menu is closed
482492
setState(() {});
483493
});
484494
}
@@ -548,7 +558,6 @@ class _ClockPageState extends State<ClockPage> with SingleTickerProviderStateMix
548558
textColor: Colors.white,
549559
fontSize: 40.0,
550560
);
551-
// Add your logic or navigate to a different screen
552561
},
553562
child: Text(
554563
workDays.replaceAll('|', ''),
@@ -643,7 +652,6 @@ class _ClockPageState extends State<ClockPage> with SingleTickerProviderStateMix
643652
return Scaffold(
644653
floatingActionButton: FloatingActionButton(
645654
onPressed: () {
646-
// Perform your desired action here
647655
toggleParallaxRainVisibility();
648656
if(isParallaxRainVisible){
649657
_writeSharedPreferences(parallaxVisible: true);
@@ -652,10 +660,10 @@ class _ClockPageState extends State<ClockPage> with SingleTickerProviderStateMix
652660
}
653661

654662
},
655-
backgroundColor: _currentBackgroundGradient.colors.last.withOpacity(0.3), // Set the icon color
656-
elevation: 0.0, // Set the elevation of the button
663+
backgroundColor: _currentBackgroundGradient.colors.last.withOpacity(0.3),
664+
elevation: 0.0,
657665
shape: RoundedRectangleBorder(
658-
borderRadius: BorderRadius.circular(100.0), // Set a circular border radius
666+
borderRadius: BorderRadius.circular(100.0),
659667
),
660668
child: Icon(
661669
Icons.landscape,

linux/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
flutter/ephemeral

linux/CMakeLists.txt

+145
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
# Project-level configuration.
2+
cmake_minimum_required(VERSION 3.10)
3+
project(runner LANGUAGES CXX)
4+
5+
# The name of the executable created for the application. Change this to change
6+
# the on-disk name of your application.
7+
set(BINARY_NAME "standby_screen")
8+
# The unique GTK application identifier for this application. See:
9+
# https://wiki.gnome.org/HowDoI/ChooseApplicationID
10+
set(APPLICATION_ID "standby.stillkonfuzed.com.standby_screen")
11+
12+
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
13+
# versions of CMake.
14+
cmake_policy(SET CMP0063 NEW)
15+
16+
# Load bundled libraries from the lib/ directory relative to the binary.
17+
set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
18+
19+
# Root filesystem for cross-building.
20+
if(FLUTTER_TARGET_PLATFORM_SYSROOT)
21+
set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT})
22+
set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT})
23+
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
24+
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
25+
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
26+
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
27+
endif()
28+
29+
# Define build configuration options.
30+
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
31+
set(CMAKE_BUILD_TYPE "Debug" CACHE
32+
STRING "Flutter build mode" FORCE)
33+
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
34+
"Debug" "Profile" "Release")
35+
endif()
36+
37+
# Compilation settings that should be applied to most targets.
38+
#
39+
# Be cautious about adding new options here, as plugins use this function by
40+
# default. In most cases, you should add new options to specific targets instead
41+
# of modifying this function.
42+
function(APPLY_STANDARD_SETTINGS TARGET)
43+
target_compile_features(${TARGET} PUBLIC cxx_std_14)
44+
target_compile_options(${TARGET} PRIVATE -Wall -Werror)
45+
target_compile_options(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O3>")
46+
target_compile_definitions(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:NDEBUG>")
47+
endfunction()
48+
49+
# Flutter library and tool build rules.
50+
set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
51+
add_subdirectory(${FLUTTER_MANAGED_DIR})
52+
53+
# System-level dependencies.
54+
find_package(PkgConfig REQUIRED)
55+
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
56+
57+
add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
58+
59+
# Define the application target. To change its name, change BINARY_NAME above,
60+
# not the value here, or `flutter run` will no longer work.
61+
#
62+
# Any new source files that you add to the application should be added here.
63+
add_executable(${BINARY_NAME}
64+
"main.cc"
65+
"my_application.cc"
66+
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
67+
)
68+
69+
# Apply the standard set of build settings. This can be removed for applications
70+
# that need different build settings.
71+
apply_standard_settings(${BINARY_NAME})
72+
73+
# Add dependency libraries. Add any application-specific dependencies here.
74+
target_link_libraries(${BINARY_NAME} PRIVATE flutter)
75+
target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
76+
77+
# Run the Flutter tool portions of the build. This must not be removed.
78+
add_dependencies(${BINARY_NAME} flutter_assemble)
79+
80+
# Only the install-generated bundle's copy of the executable will launch
81+
# correctly, since the resources must in the right relative locations. To avoid
82+
# people trying to run the unbundled copy, put it in a subdirectory instead of
83+
# the default top-level location.
84+
set_target_properties(${BINARY_NAME}
85+
PROPERTIES
86+
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run"
87+
)
88+
89+
90+
# Generated plugin build rules, which manage building the plugins and adding
91+
# them to the application.
92+
include(flutter/generated_plugins.cmake)
93+
94+
95+
# === Installation ===
96+
# By default, "installing" just makes a relocatable bundle in the build
97+
# directory.
98+
set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
99+
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
100+
set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
101+
endif()
102+
103+
# Start with a clean build bundle directory every time.
104+
install(CODE "
105+
file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\")
106+
" COMPONENT Runtime)
107+
108+
set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
109+
set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
110+
111+
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
112+
COMPONENT Runtime)
113+
114+
install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
115+
COMPONENT Runtime)
116+
117+
install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
118+
COMPONENT Runtime)
119+
120+
foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES})
121+
install(FILES "${bundled_library}"
122+
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
123+
COMPONENT Runtime)
124+
endforeach(bundled_library)
125+
126+
# Copy the native assets provided by the build.dart from all packages.
127+
set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/")
128+
install(DIRECTORY "${NATIVE_ASSETS_DIR}"
129+
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
130+
COMPONENT Runtime)
131+
132+
# Fully re-copy the assets directory on each build to avoid having stale files
133+
# from a previous install.
134+
set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
135+
install(CODE "
136+
file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
137+
" COMPONENT Runtime)
138+
install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
139+
DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
140+
141+
# Install the AOT library on non-Debug builds only.
142+
if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
143+
install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
144+
COMPONENT Runtime)
145+
endif()

linux/flutter/CMakeLists.txt

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# This file controls Flutter-level build steps. It should not be edited.
2+
cmake_minimum_required(VERSION 3.10)
3+
4+
set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
5+
6+
# Configuration provided via flutter tool.
7+
include(${EPHEMERAL_DIR}/generated_config.cmake)
8+
9+
# TODO: Move the rest of this into files in ephemeral. See
10+
# https://github.com/flutter/flutter/issues/57146.
11+
12+
# Serves the same purpose as list(TRANSFORM ... PREPEND ...),
13+
# which isn't available in 3.10.
14+
function(list_prepend LIST_NAME PREFIX)
15+
set(NEW_LIST "")
16+
foreach(element ${${LIST_NAME}})
17+
list(APPEND NEW_LIST "${PREFIX}${element}")
18+
endforeach(element)
19+
set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE)
20+
endfunction()
21+
22+
# === Flutter Library ===
23+
# System-level dependencies.
24+
find_package(PkgConfig REQUIRED)
25+
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
26+
pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
27+
pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)
28+
29+
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so")
30+
31+
# Published to parent scope for install step.
32+
set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
33+
set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
34+
set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
35+
set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE)
36+
37+
list(APPEND FLUTTER_LIBRARY_HEADERS
38+
"fl_basic_message_channel.h"
39+
"fl_binary_codec.h"
40+
"fl_binary_messenger.h"
41+
"fl_dart_project.h"
42+
"fl_engine.h"
43+
"fl_json_message_codec.h"
44+
"fl_json_method_codec.h"
45+
"fl_message_codec.h"
46+
"fl_method_call.h"
47+
"fl_method_channel.h"
48+
"fl_method_codec.h"
49+
"fl_method_response.h"
50+
"fl_plugin_registrar.h"
51+
"fl_plugin_registry.h"
52+
"fl_standard_message_codec.h"
53+
"fl_standard_method_codec.h"
54+
"fl_string_codec.h"
55+
"fl_value.h"
56+
"fl_view.h"
57+
"flutter_linux.h"
58+
)
59+
list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/")
60+
add_library(flutter INTERFACE)
61+
target_include_directories(flutter INTERFACE
62+
"${EPHEMERAL_DIR}"
63+
)
64+
target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}")
65+
target_link_libraries(flutter INTERFACE
66+
PkgConfig::GTK
67+
PkgConfig::GLIB
68+
PkgConfig::GIO
69+
)
70+
add_dependencies(flutter flutter_assemble)
71+
72+
# === Flutter tool backend ===
73+
# _phony_ is a non-existent file to force this command to run every time,
74+
# since currently there's no way to get a full input/output list from the
75+
# flutter tool.
76+
add_custom_command(
77+
OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
78+
${CMAKE_CURRENT_BINARY_DIR}/_phony_
79+
COMMAND ${CMAKE_COMMAND} -E env
80+
${FLUTTER_TOOL_ENVIRONMENT}
81+
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh"
82+
${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE}
83+
VERBATIM
84+
)
85+
add_custom_target(flutter_assemble DEPENDS
86+
"${FLUTTER_LIBRARY}"
87+
${FLUTTER_LIBRARY_HEADERS}
88+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//
2+
// Generated file. Do not edit.
3+
//
4+
5+
// clang-format off
6+
7+
#include "generated_plugin_registrant.h"
8+
9+
10+
void fl_register_plugins(FlPluginRegistry* registry) {
11+
}

0 commit comments

Comments
 (0)