Skip to content

Commit c6f14cd

Browse files
committed
Update ffigen_codelab
1 parent a7502be commit c6f14cd

File tree

26 files changed

+1113
-87
lines changed

26 files changed

+1113
-87
lines changed

ffigen_codelab/codelab_rebuild.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,36 @@ steps:
1515
rm: ffigen_app/LICENSE
1616
- name: Remove README
1717
rm: ffigen_app/README.md
18+
- name: Add .gemini directory
19+
mkdir: ffigen_app/.gemini
20+
- name: Add .gemini/settings.json
21+
path: ffigen_app/.gemini/settings.json
22+
replace-contents: |
23+
{
24+
"mcpServers": {
25+
"dart": {
26+
"command": "dart",
27+
"args": [
28+
"mcp-server"
29+
]
30+
}
31+
}
32+
}
33+
- name: Add .gemini directory
34+
mkdir: ffigen_app/example/.gemini
35+
- name: Add .gemini/settings.json
36+
path: ffigen_app/example/.gemini/settings.json
37+
replace-contents: |
38+
{
39+
"mcpServers": {
40+
"dart": {
41+
"command": "dart",
42+
"args": [
43+
"mcp-server"
44+
]
45+
}
46+
}
47+
}
1848
- name: Add .vscode directory
1949
mkdir: ffigen_app/.vscode
2050
- name: Add .vscode/launch.json

ffigen_codelab/step_03/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,6 @@ android {
5858
}
5959

6060
defaultConfig {
61-
minSdk = 21
61+
minSdk = 24
6262
}
6363
}

ffigen_codelab/step_03/example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
1061C1C3CF975F8B0313985B /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B39F871A60C2999911FB836D /* Pods_RunnerTests.framework */; };
1011
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
1112
331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; };
1213
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
1314
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
1415
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
1516
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
1617
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
18+
F1796C86A0DAC635B6290D02 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0AB02A85A19BD8AB746FA3C6 /* Pods_Runner.framework */; };
1719
/* End PBXBuildFile section */
1820

1921
/* Begin PBXContainerItemProxy section */
@@ -40,28 +42,45 @@
4042
/* End PBXCopyFilesBuildPhase section */
4143

4244
/* Begin PBXFileReference section */
45+
0AB02A85A19BD8AB746FA3C6 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
46+
106704E7A38764C2F5CF9919 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = "<group>"; };
4347
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
4448
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
49+
2F0904A7126B261D646E11F4 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = "<group>"; };
4550
331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; };
4651
331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
4752
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
53+
44F5C23B6AE4F8F99AF7875C /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
54+
5E4F7497A8A68429AA3D5252 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
4855
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
4956
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
5057
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
58+
7C31CAE0364A1DDA5D0C95D7 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = "<group>"; };
5159
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
5260
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
5361
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
5462
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
5563
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
5664
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
5765
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
66+
B39F871A60C2999911FB836D /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
67+
C3D41E29B74DDD202CDE256C /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
5868
/* End PBXFileReference section */
5969

6070
/* Begin PBXFrameworksBuildPhase section */
71+
0D1AF455A7A884EEDABC0B74 /* Frameworks */ = {
72+
isa = PBXFrameworksBuildPhase;
73+
buildActionMask = 2147483647;
74+
files = (
75+
1061C1C3CF975F8B0313985B /* Pods_RunnerTests.framework in Frameworks */,
76+
);
77+
runOnlyForDeploymentPostprocessing = 0;
78+
};
6179
97C146EB1CF9000F007C117D /* Frameworks */ = {
6280
isa = PBXFrameworksBuildPhase;
6381
buildActionMask = 2147483647;
6482
files = (
83+
F1796C86A0DAC635B6290D02 /* Pods_Runner.framework in Frameworks */,
6584
);
6685
runOnlyForDeploymentPostprocessing = 0;
6786
};
@@ -94,6 +113,8 @@
94113
97C146F01CF9000F007C117D /* Runner */,
95114
97C146EF1CF9000F007C117D /* Products */,
96115
331C8082294A63A400263BE5 /* RunnerTests */,
116+
F83073074C6AAF89559982C4 /* Pods */,
117+
C3071D963B6A10BC32734D70 /* Frameworks */,
97118
);
98119
sourceTree = "<group>";
99120
};
@@ -121,15 +142,40 @@
121142
path = Runner;
122143
sourceTree = "<group>";
123144
};
145+
C3071D963B6A10BC32734D70 /* Frameworks */ = {
146+
isa = PBXGroup;
147+
children = (
148+
0AB02A85A19BD8AB746FA3C6 /* Pods_Runner.framework */,
149+
B39F871A60C2999911FB836D /* Pods_RunnerTests.framework */,
150+
);
151+
name = Frameworks;
152+
sourceTree = "<group>";
153+
};
154+
F83073074C6AAF89559982C4 /* Pods */ = {
155+
isa = PBXGroup;
156+
children = (
157+
44F5C23B6AE4F8F99AF7875C /* Pods-Runner.debug.xcconfig */,
158+
5E4F7497A8A68429AA3D5252 /* Pods-Runner.release.xcconfig */,
159+
C3D41E29B74DDD202CDE256C /* Pods-Runner.profile.xcconfig */,
160+
7C31CAE0364A1DDA5D0C95D7 /* Pods-RunnerTests.debug.xcconfig */,
161+
2F0904A7126B261D646E11F4 /* Pods-RunnerTests.release.xcconfig */,
162+
106704E7A38764C2F5CF9919 /* Pods-RunnerTests.profile.xcconfig */,
163+
);
164+
name = Pods;
165+
path = Pods;
166+
sourceTree = "<group>";
167+
};
124168
/* End PBXGroup section */
125169

126170
/* Begin PBXNativeTarget section */
127171
331C8080294A63A400263BE5 /* RunnerTests */ = {
128172
isa = PBXNativeTarget;
129173
buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */;
130174
buildPhases = (
175+
90C858AD7013AF35117C5BA4 /* [CP] Check Pods Manifest.lock */,
131176
331C807D294A63A400263BE5 /* Sources */,
132177
331C807F294A63A400263BE5 /* Resources */,
178+
0D1AF455A7A884EEDABC0B74 /* Frameworks */,
133179
);
134180
buildRules = (
135181
);
@@ -145,12 +191,14 @@
145191
isa = PBXNativeTarget;
146192
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
147193
buildPhases = (
194+
FA234FEAC048ABF5A4ED9DFE /* [CP] Check Pods Manifest.lock */,
148195
9740EEB61CF901F6004384FC /* Run Script */,
149196
97C146EA1CF9000F007C117D /* Sources */,
150197
97C146EB1CF9000F007C117D /* Frameworks */,
151198
97C146EC1CF9000F007C117D /* Resources */,
152199
9705A1C41CF9048500538489 /* Embed Frameworks */,
153200
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
201+
BFFC45A221A2EE5B446BF42B /* [CP] Embed Pods Frameworks */,
154202
);
155203
buildRules = (
156204
);
@@ -238,6 +286,28 @@
238286
shellPath = /bin/sh;
239287
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
240288
};
289+
90C858AD7013AF35117C5BA4 /* [CP] Check Pods Manifest.lock */ = {
290+
isa = PBXShellScriptBuildPhase;
291+
buildActionMask = 2147483647;
292+
files = (
293+
);
294+
inputFileListPaths = (
295+
);
296+
inputPaths = (
297+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
298+
"${PODS_ROOT}/Manifest.lock",
299+
);
300+
name = "[CP] Check Pods Manifest.lock";
301+
outputFileListPaths = (
302+
);
303+
outputPaths = (
304+
"$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt",
305+
);
306+
runOnlyForDeploymentPostprocessing = 0;
307+
shellPath = /bin/sh;
308+
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
309+
showEnvVarsInLog = 0;
310+
};
241311
9740EEB61CF901F6004384FC /* Run Script */ = {
242312
isa = PBXShellScriptBuildPhase;
243313
alwaysOutOfDate = 1;
@@ -253,6 +323,45 @@
253323
shellPath = /bin/sh;
254324
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
255325
};
326+
BFFC45A221A2EE5B446BF42B /* [CP] Embed Pods Frameworks */ = {
327+
isa = PBXShellScriptBuildPhase;
328+
buildActionMask = 2147483647;
329+
files = (
330+
);
331+
inputFileListPaths = (
332+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
333+
);
334+
name = "[CP] Embed Pods Frameworks";
335+
outputFileListPaths = (
336+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
337+
);
338+
runOnlyForDeploymentPostprocessing = 0;
339+
shellPath = /bin/sh;
340+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
341+
showEnvVarsInLog = 0;
342+
};
343+
FA234FEAC048ABF5A4ED9DFE /* [CP] Check Pods Manifest.lock */ = {
344+
isa = PBXShellScriptBuildPhase;
345+
buildActionMask = 2147483647;
346+
files = (
347+
);
348+
inputFileListPaths = (
349+
);
350+
inputPaths = (
351+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
352+
"${PODS_ROOT}/Manifest.lock",
353+
);
354+
name = "[CP] Check Pods Manifest.lock";
355+
outputFileListPaths = (
356+
);
357+
outputPaths = (
358+
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
359+
);
360+
runOnlyForDeploymentPostprocessing = 0;
361+
shellPath = /bin/sh;
362+
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
363+
showEnvVarsInLog = 0;
364+
};
256365
/* End PBXShellScriptBuildPhase section */
257366

258367
/* Begin PBXSourcesBuildPhase section */
@@ -378,6 +487,7 @@
378487
};
379488
331C8088294A63A400263BE5 /* Debug */ = {
380489
isa = XCBuildConfiguration;
490+
baseConfigurationReference = 7C31CAE0364A1DDA5D0C95D7 /* Pods-RunnerTests.debug.xcconfig */;
381491
buildSettings = {
382492
BUNDLE_LOADER = "$(TEST_HOST)";
383493
CODE_SIGN_STYLE = Automatic;
@@ -395,6 +505,7 @@
395505
};
396506
331C8089294A63A400263BE5 /* Release */ = {
397507
isa = XCBuildConfiguration;
508+
baseConfigurationReference = 2F0904A7126B261D646E11F4 /* Pods-RunnerTests.release.xcconfig */;
398509
buildSettings = {
399510
BUNDLE_LOADER = "$(TEST_HOST)";
400511
CODE_SIGN_STYLE = Automatic;
@@ -410,6 +521,7 @@
410521
};
411522
331C808A294A63A400263BE5 /* Profile */ = {
412523
isa = XCBuildConfiguration;
524+
baseConfigurationReference = 106704E7A38764C2F5CF9919 /* Pods-RunnerTests.profile.xcconfig */;
413525
buildSettings = {
414526
BUNDLE_LOADER = "$(TEST_HOST)";
415527
CODE_SIGN_STYLE = Automatic;

ffigen_codelab/step_03/example/linux/runner/my_application.cc

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ struct _MyApplication {
1414

1515
G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
1616

17+
// Called when first Flutter frame received.
18+
static void first_frame_cb(MyApplication* self, FlView *view)
19+
{
20+
gtk_widget_show(gtk_widget_get_toplevel(GTK_WIDGET(view)));
21+
}
22+
1723
// Implements GApplication::activate.
1824
static void my_application_activate(GApplication* application) {
1925
MyApplication* self = MY_APPLICATION(application);
@@ -48,15 +54,23 @@ static void my_application_activate(GApplication* application) {
4854
}
4955

5056
gtk_window_set_default_size(window, 1280, 720);
51-
gtk_widget_show(GTK_WIDGET(window));
5257

5358
g_autoptr(FlDartProject) project = fl_dart_project_new();
5459
fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);
5560

5661
FlView* view = fl_view_new(project);
62+
GdkRGBA background_color;
63+
// Background defaults to black, override it here if necessary, e.g. #00000000 for transparent.
64+
gdk_rgba_parse(&background_color, "#000000");
65+
fl_view_set_background_color(view, &background_color);
5766
gtk_widget_show(GTK_WIDGET(view));
5867
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
5968

69+
// Show the window when Flutter renders.
70+
// Requires the view to be realized so we can start rendering.
71+
g_signal_connect_swapped(view, "first-frame", G_CALLBACK(first_frame_cb), self);
72+
gtk_widget_realize(GTK_WIDGET(view));
73+
6074
fl_register_plugins(FL_PLUGIN_REGISTRY(view));
6175

6276
gtk_widget_grab_focus(GTK_WIDGET(view));

0 commit comments

Comments
 (0)