Showing
32 changed files
with
0 additions
and
631 deletions
example/android/.gitignore
deleted
100644 → 0
example/android/app/build.gradle
deleted
100644 → 0
1 | -def localProperties = new Properties() | ||
2 | -def localPropertiesFile = rootProject.file('local.properties') | ||
3 | -if (localPropertiesFile.exists()) { | ||
4 | - localPropertiesFile.withReader('UTF-8') { reader -> | ||
5 | - localProperties.load(reader) | ||
6 | - } | ||
7 | -} | ||
8 | - | ||
9 | -def flutterRoot = localProperties.getProperty('flutter.sdk') | ||
10 | -if (flutterRoot == null) { | ||
11 | - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") | ||
12 | -} | ||
13 | - | ||
14 | -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') | ||
15 | -if (flutterVersionCode == null) { | ||
16 | - flutterVersionCode = '1' | ||
17 | -} | ||
18 | - | ||
19 | -def flutterVersionName = localProperties.getProperty('flutter.versionName') | ||
20 | -if (flutterVersionName == null) { | ||
21 | - flutterVersionName = '1.0' | ||
22 | -} | ||
23 | - | ||
24 | -apply plugin: 'com.android.application' | ||
25 | -apply plugin: 'kotlin-android' | ||
26 | -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" | ||
27 | - | ||
28 | -android { | ||
29 | - compileSdkVersion 29 | ||
30 | - | ||
31 | - sourceSets { | ||
32 | - main.java.srcDirs += 'src/main/kotlin' | ||
33 | - } | ||
34 | - | ||
35 | - lintOptions { | ||
36 | - disable 'InvalidPackage' | ||
37 | - } | ||
38 | - | ||
39 | - defaultConfig { | ||
40 | - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). | ||
41 | - applicationId "com.example.example" | ||
42 | - minSdkVersion 16 | ||
43 | - targetSdkVersion 29 | ||
44 | - versionCode flutterVersionCode.toInteger() | ||
45 | - versionName flutterVersionName | ||
46 | - } | ||
47 | - | ||
48 | - buildTypes { | ||
49 | - release { | ||
50 | - // TODO: Add your own signing config for the release build. | ||
51 | - // Signing with the debug keys for now, so `flutter run --release` works. | ||
52 | - signingConfig signingConfigs.debug | ||
53 | - } | ||
54 | - } | ||
55 | -} | ||
56 | - | ||
57 | -flutter { | ||
58 | - source '../..' | ||
59 | -} | ||
60 | - | ||
61 | -dependencies { | ||
62 | - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" | ||
63 | -} |
1 | -<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
2 | - package="com.example.example"> | ||
3 | - <!-- Flutter needs it to communicate with the running application | ||
4 | - to allow setting breakpoints, to provide hot reload, etc. | ||
5 | - --> | ||
6 | - <uses-permission android:name="android.permission.INTERNET"/> | ||
7 | -</manifest> |
1 | -<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
2 | - package="com.example.example"> | ||
3 | - <application | ||
4 | - android:label="example" | ||
5 | - android:icon="@mipmap/ic_launcher"> | ||
6 | - <activity | ||
7 | - android:name=".MainActivity" | ||
8 | - android:launchMode="singleTop" | ||
9 | - android:theme="@style/LaunchTheme" | ||
10 | - android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" | ||
11 | - android:hardwareAccelerated="true" | ||
12 | - android:windowSoftInputMode="adjustResize"> | ||
13 | - <!-- Specifies an Android theme to apply to this Activity as soon as | ||
14 | - the Android process has started. This theme is visible to the user | ||
15 | - while the Flutter UI initializes. After that, this theme continues | ||
16 | - to determine the Window background behind the Flutter UI. --> | ||
17 | - <meta-data | ||
18 | - android:name="io.flutter.embedding.android.NormalTheme" | ||
19 | - android:resource="@style/NormalTheme" | ||
20 | - /> | ||
21 | - <!-- Displays an Android View that continues showing the launch screen | ||
22 | - Drawable until Flutter paints its first frame, then this splash | ||
23 | - screen fades out. A splash screen is useful to avoid any visual | ||
24 | - gap between the end of Android's launch screen and the painting of | ||
25 | - Flutter's first frame. --> | ||
26 | - <meta-data | ||
27 | - android:name="io.flutter.embedding.android.SplashScreenDrawable" | ||
28 | - android:resource="@drawable/launch_background" | ||
29 | - /> | ||
30 | - <intent-filter> | ||
31 | - <action android:name="android.intent.action.MAIN"/> | ||
32 | - <category android:name="android.intent.category.LAUNCHER"/> | ||
33 | - </intent-filter> | ||
34 | - </activity> | ||
35 | - <!-- Don't delete the meta-data below. | ||
36 | - This is used by the Flutter tool to generate GeneratedPluginRegistrant.java --> | ||
37 | - <meta-data | ||
38 | - android:name="flutterEmbedding" | ||
39 | - android:value="2" /> | ||
40 | - </application> | ||
41 | -</manifest> |
1 | -<?xml version="1.0" encoding="utf-8"?> | ||
2 | -<!-- Modify this file to customize your launch splash screen --> | ||
3 | -<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | ||
4 | - <item android:drawable="?android:colorBackground" /> | ||
5 | - | ||
6 | - <!-- You can insert your own image assets here --> | ||
7 | - <!-- <item> | ||
8 | - <bitmap | ||
9 | - android:gravity="center" | ||
10 | - android:src="@mipmap/launch_image" /> | ||
11 | - </item> --> | ||
12 | -</layer-list> |

544 Bytes

442 Bytes

721 Bytes

1.01 KB

1.41 KB
1 | -<?xml version="1.0" encoding="utf-8"?> | ||
2 | -<resources> | ||
3 | - <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on --> | ||
4 | - <style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar"> | ||
5 | - <!-- Show a splash screen on the activity. Automatically removed when | ||
6 | - Flutter draws its first frame --> | ||
7 | - <item name="android:windowBackground">@drawable/launch_background</item> | ||
8 | - </style> | ||
9 | - <!-- Theme applied to the Android Window as soon as the process has started. | ||
10 | - This theme determines the color of the Android Window while your | ||
11 | - Flutter UI initializes, as well as behind your Flutter UI while its | ||
12 | - running. | ||
13 | - | ||
14 | - This Theme is only used starting with V2 of Flutter's Android embedding. --> | ||
15 | - <style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar"> | ||
16 | - <item name="android:windowBackground">?android:colorBackground</item> | ||
17 | - </style> | ||
18 | -</resources> |
1 | -<?xml version="1.0" encoding="utf-8"?> | ||
2 | -<resources> | ||
3 | - <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off --> | ||
4 | - <style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar"> | ||
5 | - <!-- Show a splash screen on the activity. Automatically removed when | ||
6 | - Flutter draws its first frame --> | ||
7 | - <item name="android:windowBackground">@drawable/launch_background</item> | ||
8 | - </style> | ||
9 | - <!-- Theme applied to the Android Window as soon as the process has started. | ||
10 | - This theme determines the color of the Android Window while your | ||
11 | - Flutter UI initializes, as well as behind your Flutter UI while its | ||
12 | - running. | ||
13 | - | ||
14 | - This Theme is only used starting with V2 of Flutter's Android embedding. --> | ||
15 | - <style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar"> | ||
16 | - <item name="android:windowBackground">?android:colorBackground</item> | ||
17 | - </style> | ||
18 | -</resources> |
1 | -<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
2 | - package="com.example.example"> | ||
3 | - <!-- Flutter needs it to communicate with the running application | ||
4 | - to allow setting breakpoints, to provide hot reload, etc. | ||
5 | - --> | ||
6 | - <uses-permission android:name="android.permission.INTERNET"/> | ||
7 | -</manifest> |
example/android/build.gradle
deleted
100644 → 0
1 | -buildscript { | ||
2 | - ext.kotlin_version = '1.3.50' | ||
3 | - repositories { | ||
4 | - google() | ||
5 | - jcenter() | ||
6 | - } | ||
7 | - | ||
8 | - dependencies { | ||
9 | - classpath 'com.android.tools.build:gradle:3.5.0' | ||
10 | - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | ||
11 | - } | ||
12 | -} | ||
13 | - | ||
14 | -allprojects { | ||
15 | - repositories { | ||
16 | - google() | ||
17 | - jcenter() | ||
18 | - } | ||
19 | -} | ||
20 | - | ||
21 | -rootProject.buildDir = '../build' | ||
22 | -subprojects { | ||
23 | - project.buildDir = "${rootProject.buildDir}/${project.name}" | ||
24 | -} | ||
25 | -subprojects { | ||
26 | - project.evaluationDependsOn(':app') | ||
27 | -} | ||
28 | - | ||
29 | -task clean(type: Delete) { | ||
30 | - delete rootProject.buildDir | ||
31 | -} |
example/android/gradle.properties
deleted
100644 → 0
example/android/settings.gradle
deleted
100644 → 0
1 | -include ':app' | ||
2 | - | ||
3 | -def localPropertiesFile = new File(rootProject.projectDir, "local.properties") | ||
4 | -def properties = new Properties() | ||
5 | - | ||
6 | -assert localPropertiesFile.exists() | ||
7 | -localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } | ||
8 | - | ||
9 | -def flutterSdkPath = properties.getProperty("flutter.sdk") | ||
10 | -assert flutterSdkPath != null, "flutter.sdk not set in local.properties" | ||
11 | -apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" |
example/linux/.gitignore
deleted
100644 → 0
1 | -flutter/ephemeral |
example/linux/CMakeLists.txt
deleted
100644 → 0
1 | -cmake_minimum_required(VERSION 3.10) | ||
2 | -project(runner LANGUAGES CXX) | ||
3 | - | ||
4 | -set(BINARY_NAME "example") | ||
5 | -set(APPLICATION_ID "com.example.example") | ||
6 | - | ||
7 | -cmake_policy(SET CMP0063 NEW) | ||
8 | - | ||
9 | -set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") | ||
10 | - | ||
11 | -# Configure build options. | ||
12 | -if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) | ||
13 | - set(CMAKE_BUILD_TYPE "Debug" CACHE | ||
14 | - STRING "Flutter build mode" FORCE) | ||
15 | - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS | ||
16 | - "Debug" "Profile" "Release") | ||
17 | -endif() | ||
18 | - | ||
19 | -# Compilation settings that should be applied to most targets. | ||
20 | -function(APPLY_STANDARD_SETTINGS TARGET) | ||
21 | - target_compile_features(${TARGET} PUBLIC cxx_std_14) | ||
22 | - target_compile_options(${TARGET} PRIVATE -Wall -Werror) | ||
23 | - target_compile_options(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O3>") | ||
24 | - target_compile_definitions(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:NDEBUG>") | ||
25 | -endfunction() | ||
26 | - | ||
27 | -set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") | ||
28 | - | ||
29 | -# Flutter library and tool build rules. | ||
30 | -add_subdirectory(${FLUTTER_MANAGED_DIR}) | ||
31 | - | ||
32 | -# System-level dependencies. | ||
33 | -find_package(PkgConfig REQUIRED) | ||
34 | -pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) | ||
35 | - | ||
36 | -add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") | ||
37 | - | ||
38 | -# Application build | ||
39 | -add_executable(${BINARY_NAME} | ||
40 | - "main.cc" | ||
41 | - "my_application.cc" | ||
42 | - "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" | ||
43 | -) | ||
44 | -apply_standard_settings(${BINARY_NAME}) | ||
45 | -target_link_libraries(${BINARY_NAME} PRIVATE flutter) | ||
46 | -target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) | ||
47 | -add_dependencies(${BINARY_NAME} flutter_assemble) | ||
48 | -# Only the install-generated bundle's copy of the executable will launch | ||
49 | -# correctly, since the resources must in the right relative locations. To avoid | ||
50 | -# people trying to run the unbundled copy, put it in a subdirectory instead of | ||
51 | -# the default top-level location. | ||
52 | -set_target_properties(${BINARY_NAME} | ||
53 | - PROPERTIES | ||
54 | - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" | ||
55 | -) | ||
56 | - | ||
57 | -# Generated plugin build rules, which manage building the plugins and adding | ||
58 | -# them to the application. | ||
59 | -include(flutter/generated_plugins.cmake) | ||
60 | - | ||
61 | - | ||
62 | -# === Installation === | ||
63 | -# By default, "installing" just makes a relocatable bundle in the build | ||
64 | -# directory. | ||
65 | -set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") | ||
66 | -if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) | ||
67 | - set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) | ||
68 | -endif() | ||
69 | - | ||
70 | -# Start with a clean build bundle directory every time. | ||
71 | -install(CODE " | ||
72 | - file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") | ||
73 | - " COMPONENT Runtime) | ||
74 | - | ||
75 | -set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") | ||
76 | -set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") | ||
77 | - | ||
78 | -install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" | ||
79 | - COMPONENT Runtime) | ||
80 | - | ||
81 | -install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" | ||
82 | - COMPONENT Runtime) | ||
83 | - | ||
84 | -install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" | ||
85 | - COMPONENT Runtime) | ||
86 | - | ||
87 | -if(PLUGIN_BUNDLED_LIBRARIES) | ||
88 | - install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" | ||
89 | - DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" | ||
90 | - COMPONENT Runtime) | ||
91 | -endif() | ||
92 | - | ||
93 | -# Fully re-copy the assets directory on each build to avoid having stale files | ||
94 | -# from a previous install. | ||
95 | -set(FLUTTER_ASSET_DIR_NAME "flutter_assets") | ||
96 | -install(CODE " | ||
97 | - file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") | ||
98 | - " COMPONENT Runtime) | ||
99 | -install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" | ||
100 | - DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) | ||
101 | - | ||
102 | -# Install the AOT library on non-Debug builds only. | ||
103 | -if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") | ||
104 | - install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" | ||
105 | - COMPONENT Runtime) | ||
106 | -endif() |
example/linux/flutter/CMakeLists.txt
deleted
100644 → 0
1 | -cmake_minimum_required(VERSION 3.10) | ||
2 | - | ||
3 | -set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") | ||
4 | - | ||
5 | -# Configuration provided via flutter tool. | ||
6 | -include(${EPHEMERAL_DIR}/generated_config.cmake) | ||
7 | - | ||
8 | -# TODO: Move the rest of this into files in ephemeral. See | ||
9 | -# https://github.com/flutter/flutter/issues/57146. | ||
10 | - | ||
11 | -# Serves the same purpose as list(TRANSFORM ... PREPEND ...), | ||
12 | -# which isn't available in 3.10. | ||
13 | -function(list_prepend LIST_NAME PREFIX) | ||
14 | - set(NEW_LIST "") | ||
15 | - foreach(element ${${LIST_NAME}}) | ||
16 | - list(APPEND NEW_LIST "${PREFIX}${element}") | ||
17 | - endforeach(element) | ||
18 | - set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) | ||
19 | -endfunction() | ||
20 | - | ||
21 | -# === Flutter Library === | ||
22 | -# System-level dependencies. | ||
23 | -find_package(PkgConfig REQUIRED) | ||
24 | -pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) | ||
25 | -pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) | ||
26 | -pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) | ||
27 | -pkg_check_modules(BLKID REQUIRED IMPORTED_TARGET blkid) | ||
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 | - PkgConfig::BLKID | ||
70 | -) | ||
71 | -add_dependencies(flutter flutter_assemble) | ||
72 | - | ||
73 | -# === Flutter tool backend === | ||
74 | -# _phony_ is a non-existent file to force this command to run every time, | ||
75 | -# since currently there's no way to get a full input/output list from the | ||
76 | -# flutter tool. | ||
77 | -add_custom_command( | ||
78 | - OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} | ||
79 | - ${CMAKE_CURRENT_BINARY_DIR}/_phony_ | ||
80 | - COMMAND ${CMAKE_COMMAND} -E env | ||
81 | - ${FLUTTER_TOOL_ENVIRONMENT} | ||
82 | - "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" | ||
83 | - linux-x64 ${CMAKE_BUILD_TYPE} | ||
84 | -) | ||
85 | -add_custom_target(flutter_assemble DEPENDS | ||
86 | - "${FLUTTER_LIBRARY}" | ||
87 | - ${FLUTTER_LIBRARY_HEADERS} | ||
88 | -) |
1 | -// | ||
2 | -// Generated file. Do not edit. | ||
3 | -// | ||
4 | - | ||
5 | -#ifndef GENERATED_PLUGIN_REGISTRANT_ | ||
6 | -#define GENERATED_PLUGIN_REGISTRANT_ | ||
7 | - | ||
8 | -#include <flutter_linux/flutter_linux.h> | ||
9 | - | ||
10 | -// Registers Flutter plugins. | ||
11 | -void fl_register_plugins(FlPluginRegistry* registry); | ||
12 | - | ||
13 | -#endif // GENERATED_PLUGIN_REGISTRANT_ |
1 | -# | ||
2 | -# Generated file, do not edit. | ||
3 | -# | ||
4 | - | ||
5 | -list(APPEND FLUTTER_PLUGIN_LIST | ||
6 | -) | ||
7 | - | ||
8 | -set(PLUGIN_BUNDLED_LIBRARIES) | ||
9 | - | ||
10 | -foreach(plugin ${FLUTTER_PLUGIN_LIST}) | ||
11 | - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) | ||
12 | - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) | ||
13 | - list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>) | ||
14 | - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) | ||
15 | -endforeach(plugin) |
example/linux/main.cc
deleted
100644 → 0
example/linux/my_application.cc
deleted
100644 → 0
1 | -#include "my_application.h" | ||
2 | - | ||
3 | -#include <flutter_linux/flutter_linux.h> | ||
4 | -#ifdef GDK_WINDOWING_X11 | ||
5 | -#include <gdk/gdkx.h> | ||
6 | -#endif | ||
7 | - | ||
8 | -#include "flutter/generated_plugin_registrant.h" | ||
9 | - | ||
10 | -struct _MyApplication { | ||
11 | - GtkApplication parent_instance; | ||
12 | -}; | ||
13 | - | ||
14 | -G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) | ||
15 | - | ||
16 | -// Implements GApplication::activate. | ||
17 | -static void my_application_activate(GApplication* application) { | ||
18 | - GtkWindow* window = | ||
19 | - GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); | ||
20 | - | ||
21 | - // Use a header bar when running in GNOME as this is the common style used | ||
22 | - // by applications and is the setup most users will be using (e.g. Ubuntu | ||
23 | - // desktop). | ||
24 | - // If running on X and not using GNOME then just use a traditional title bar | ||
25 | - // in case the window manager does more exotic layout, e.g. tiling. | ||
26 | - // If running on Wayland assume the header bar will work (may need changing | ||
27 | - // if future cases occur). | ||
28 | - gboolean use_header_bar = TRUE; | ||
29 | -#ifdef GDK_WINDOWING_X11 | ||
30 | - GdkScreen *screen = gtk_window_get_screen(window); | ||
31 | - if (GDK_IS_X11_SCREEN(screen)) { | ||
32 | - const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); | ||
33 | - if (g_strcmp0(wm_name, "GNOME Shell") != 0) { | ||
34 | - use_header_bar = FALSE; | ||
35 | - } | ||
36 | - } | ||
37 | -#endif | ||
38 | - if (use_header_bar) { | ||
39 | - GtkHeaderBar *header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); | ||
40 | - gtk_widget_show(GTK_WIDGET(header_bar)); | ||
41 | - gtk_header_bar_set_title(header_bar, "example"); | ||
42 | - gtk_header_bar_set_show_close_button(header_bar, TRUE); | ||
43 | - gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); | ||
44 | - } | ||
45 | - else { | ||
46 | - gtk_window_set_title(window, "example"); | ||
47 | - } | ||
48 | - | ||
49 | - gtk_window_set_default_size(window, 1280, 720); | ||
50 | - gtk_widget_show(GTK_WIDGET(window)); | ||
51 | - | ||
52 | - g_autoptr(FlDartProject) project = fl_dart_project_new(); | ||
53 | - | ||
54 | - FlView* view = fl_view_new(project); | ||
55 | - gtk_widget_show(GTK_WIDGET(view)); | ||
56 | - gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); | ||
57 | - | ||
58 | - fl_register_plugins(FL_PLUGIN_REGISTRY(view)); | ||
59 | - | ||
60 | - gtk_widget_grab_focus(GTK_WIDGET(view)); | ||
61 | -} | ||
62 | - | ||
63 | -static void my_application_class_init(MyApplicationClass* klass) { | ||
64 | - G_APPLICATION_CLASS(klass)->activate = my_application_activate; | ||
65 | -} | ||
66 | - | ||
67 | -static void my_application_init(MyApplication* self) {} | ||
68 | - | ||
69 | -MyApplication* my_application_new() { | ||
70 | - return MY_APPLICATION(g_object_new(my_application_get_type(), | ||
71 | - "application-id", APPLICATION_ID, | ||
72 | - nullptr)); | ||
73 | -} |
example/linux/my_application.h
deleted
100644 → 0
1 | -#ifndef FLUTTER_MY_APPLICATION_H_ | ||
2 | -#define FLUTTER_MY_APPLICATION_H_ | ||
3 | - | ||
4 | -#include <gtk/gtk.h> | ||
5 | - | ||
6 | -G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, | ||
7 | - GtkApplication) | ||
8 | - | ||
9 | -/** | ||
10 | - * my_application_new: | ||
11 | - * | ||
12 | - * Creates a new Flutter-based application. | ||
13 | - * | ||
14 | - * Returns: a new #MyApplication. | ||
15 | - */ | ||
16 | -MyApplication* my_application_new(); | ||
17 | - | ||
18 | -#endif // FLUTTER_MY_APPLICATION_H_ |
example/web/favicon.png
deleted
100644 → 0

917 Bytes
example/web/icons/Icon-192.png
deleted
100644 → 0

5.17 KB
example/web/icons/Icon-512.png
deleted
100644 → 0

8.06 KB
example/web/index.html
deleted
100644 → 0
1 | -<!DOCTYPE html> | ||
2 | -<html> | ||
3 | -<head> | ||
4 | - <!-- | ||
5 | - If you are serving your web app in a path other than the root, change the | ||
6 | - href value below to reflect the base path you are serving from. | ||
7 | - | ||
8 | - The path provided below has to start and end with a slash "/" in order for | ||
9 | - it to work correctly. | ||
10 | - | ||
11 | - Fore more details: | ||
12 | - * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base | ||
13 | - --> | ||
14 | - <base href="/"> | ||
15 | - | ||
16 | - <meta charset="UTF-8"> | ||
17 | - <meta content="IE=Edge" http-equiv="X-UA-Compatible"> | ||
18 | - <meta name="description" content="A new Flutter project."> | ||
19 | - | ||
20 | - <!-- iOS meta tags & icons --> | ||
21 | - <meta name="apple-mobile-web-app-capable" content="yes"> | ||
22 | - <meta name="apple-mobile-web-app-status-bar-style" content="black"> | ||
23 | - <meta name="apple-mobile-web-app-title" content="example"> | ||
24 | - <link rel="apple-touch-icon" href="icons/Icon-192.png"> | ||
25 | - | ||
26 | - <!-- Favicon --> | ||
27 | - <link rel="icon" type="image/png" href="favicon.png"/> | ||
28 | - | ||
29 | - <title>example</title> | ||
30 | - <link rel="manifest" href="manifest.json"> | ||
31 | -</head> | ||
32 | -<body> | ||
33 | - <!-- This script installs service_worker.js to provide PWA functionality to | ||
34 | - application. For more information, see: | ||
35 | - https://developers.google.com/web/fundamentals/primers/service-workers --> | ||
36 | - <script> | ||
37 | - if ('serviceWorker' in navigator) { | ||
38 | - window.addEventListener('flutter-first-frame', function () { | ||
39 | - navigator.serviceWorker.register('flutter_service_worker.js'); | ||
40 | - }); | ||
41 | - } | ||
42 | - </script> | ||
43 | - <script src="main.dart.js" type="application/javascript"></script> | ||
44 | -</body> | ||
45 | -</html> |
example/web/manifest.json
deleted
100644 → 0
1 | -{ | ||
2 | - "name": "example", | ||
3 | - "short_name": "example", | ||
4 | - "start_url": ".", | ||
5 | - "display": "standalone", | ||
6 | - "background_color": "#0175C2", | ||
7 | - "theme_color": "#0175C2", | ||
8 | - "description": "A new Flutter project.", | ||
9 | - "orientation": "portrait-primary", | ||
10 | - "prefer_related_applications": false, | ||
11 | - "icons": [ | ||
12 | - { | ||
13 | - "src": "icons/Icon-192.png", | ||
14 | - "sizes": "192x192", | ||
15 | - "type": "image/png" | ||
16 | - }, | ||
17 | - { | ||
18 | - "src": "icons/Icon-512.png", | ||
19 | - "sizes": "512x512", | ||
20 | - "type": "image/png" | ||
21 | - } | ||
22 | - ] | ||
23 | -} |
-
Please register or login to post a comment