Skip to content

Commit f9fb4bd

Browse files
Merge pull request #292 from Yuvaraj-Gajaraj/master
Flutter widget source update with latest source.
2 parents f6bee24 + becda5f commit f9fb4bd

File tree

1,937 files changed

+109306
-39370
lines changed

Some content is hidden

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

1,937 files changed

+109306
-39370
lines changed

Diff for: packages/syncfusion_flutter_barcodes/analysis_options.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ analyzer:
55
include_file_not_found: ignore
66
lines_longer_than_80_chars: ignore
77
avoid_as: false
8+
use_raw_strings: ignore
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
flutter/ephemeral
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
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()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
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+
pkg_check_modules(LZMA REQUIRED IMPORTED_TARGET liblzma)
29+
30+
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so")
31+
32+
# Published to parent scope for install step.
33+
set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
34+
set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
35+
set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
36+
set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE)
37+
38+
list(APPEND FLUTTER_LIBRARY_HEADERS
39+
"fl_basic_message_channel.h"
40+
"fl_binary_codec.h"
41+
"fl_binary_messenger.h"
42+
"fl_dart_project.h"
43+
"fl_engine.h"
44+
"fl_json_message_codec.h"
45+
"fl_json_method_codec.h"
46+
"fl_message_codec.h"
47+
"fl_method_call.h"
48+
"fl_method_channel.h"
49+
"fl_method_codec.h"
50+
"fl_method_response.h"
51+
"fl_plugin_registrar.h"
52+
"fl_plugin_registry.h"
53+
"fl_standard_message_codec.h"
54+
"fl_standard_method_codec.h"
55+
"fl_string_codec.h"
56+
"fl_value.h"
57+
"fl_view.h"
58+
"flutter_linux.h"
59+
)
60+
list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/")
61+
add_library(flutter INTERFACE)
62+
target_include_directories(flutter INTERFACE
63+
"${EPHEMERAL_DIR}"
64+
)
65+
target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}")
66+
target_link_libraries(flutter INTERFACE
67+
PkgConfig::GTK
68+
PkgConfig::GLIB
69+
PkgConfig::GIO
70+
PkgConfig::BLKID
71+
PkgConfig::LZMA
72+
)
73+
add_dependencies(flutter flutter_assemble)
74+
75+
# === Flutter tool backend ===
76+
# _phony_ is a non-existent file to force this command to run every time,
77+
# since currently there's no way to get a full input/output list from the
78+
# flutter tool.
79+
add_custom_command(
80+
OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
81+
${CMAKE_CURRENT_BINARY_DIR}/_phony_
82+
COMMAND ${CMAKE_COMMAND} -E env
83+
${FLUTTER_TOOL_ENVIRONMENT}
84+
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh"
85+
linux-x64 ${CMAKE_BUILD_TYPE}
86+
VERBATIM
87+
)
88+
add_custom_target(flutter_assemble DEPENDS
89+
"${FLUTTER_LIBRARY}"
90+
${FLUTTER_LIBRARY_HEADERS}
91+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//
2+
// Generated file. Do not edit.
3+
//
4+
5+
#include "generated_plugin_registrant.h"
6+
7+
8+
void fl_register_plugins(FlPluginRegistry* registry) {
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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_
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include "my_application.h"
2+
3+
int main(int argc, char** argv) {
4+
g_autoptr(MyApplication) app = my_application_new();
5+
return g_application_run(G_APPLICATION(app), argc, argv);
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
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+
char** dart_entrypoint_arguments;
13+
};
14+
15+
G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
16+
17+
// Implements GApplication::activate.
18+
static void my_application_activate(GApplication* application) {
19+
MyApplication* self = MY_APPLICATION(application);
20+
GtkWindow* window =
21+
GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));
22+
23+
// Use a header bar when running in GNOME as this is the common style used
24+
// by applications and is the setup most users will be using (e.g. Ubuntu
25+
// desktop).
26+
// If running on X and not using GNOME then just use a traditional title bar
27+
// in case the window manager does more exotic layout, e.g. tiling.
28+
// If running on Wayland assume the header bar will work (may need changing
29+
// if future cases occur).
30+
gboolean use_header_bar = TRUE;
31+
#ifdef GDK_WINDOWING_X11
32+
GdkScreen *screen = gtk_window_get_screen(window);
33+
if (GDK_IS_X11_SCREEN(screen)) {
34+
const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen);
35+
if (g_strcmp0(wm_name, "GNOME Shell") != 0) {
36+
use_header_bar = FALSE;
37+
}
38+
}
39+
#endif
40+
if (use_header_bar) {
41+
GtkHeaderBar *header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
42+
gtk_widget_show(GTK_WIDGET(header_bar));
43+
gtk_header_bar_set_title(header_bar, "example");
44+
gtk_header_bar_set_show_close_button(header_bar, TRUE);
45+
gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
46+
}
47+
else {
48+
gtk_window_set_title(window, "example");
49+
}
50+
51+
gtk_window_set_default_size(window, 1280, 720);
52+
gtk_widget_show(GTK_WIDGET(window));
53+
54+
g_autoptr(FlDartProject) project = fl_dart_project_new();
55+
fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);
56+
57+
FlView* view = fl_view_new(project);
58+
gtk_widget_show(GTK_WIDGET(view));
59+
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
60+
61+
fl_register_plugins(FL_PLUGIN_REGISTRY(view));
62+
63+
gtk_widget_grab_focus(GTK_WIDGET(view));
64+
}
65+
66+
// Implements GApplication::local_command_line.
67+
static gboolean my_application_local_command_line(GApplication* application, gchar ***arguments, int *exit_status) {
68+
MyApplication* self = MY_APPLICATION(application);
69+
// Strip out the first argument as it is the binary name.
70+
self->dart_entrypoint_arguments = g_strdupv(*arguments + 1);
71+
72+
g_autoptr(GError) error = nullptr;
73+
if (!g_application_register(application, nullptr, &error)) {
74+
g_warning("Failed to register: %s", error->message);
75+
*exit_status = 1;
76+
return TRUE;
77+
}
78+
79+
g_application_activate(application);
80+
*exit_status = 0;
81+
82+
return TRUE;
83+
}
84+
85+
// Implements GObject::dispose.
86+
static void my_application_dispose(GObject *object) {
87+
MyApplication* self = MY_APPLICATION(object);
88+
g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev);
89+
G_OBJECT_CLASS(my_application_parent_class)->dispose(object);
90+
}
91+
92+
static void my_application_class_init(MyApplicationClass* klass) {
93+
G_APPLICATION_CLASS(klass)->activate = my_application_activate;
94+
G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line;
95+
G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
96+
}
97+
98+
static void my_application_init(MyApplication* self) {}
99+
100+
MyApplication* my_application_new() {
101+
return MY_APPLICATION(g_object_new(my_application_get_type(),
102+
"application-id", APPLICATION_ID,
103+
nullptr));
104+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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_
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Flutter-related
2+
**/Flutter/ephemeral/
3+
**/Pods/
4+
5+
# Xcode-related
6+
**/xcuserdata/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "ephemeral/Flutter-Generated.xcconfig"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "ephemeral/Flutter-Generated.xcconfig"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//
2+
// Generated file. Do not edit.
3+
//
4+
5+
import FlutterMacOS
6+
import Foundation
7+
8+
9+
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
10+
}

0 commit comments

Comments
 (0)