Skip to content

Commit e543f93

Browse files
committed
Update boring_to_beautiful
1 parent 24cc08e commit e543f93

File tree

37 files changed

+1069
-928
lines changed

37 files changed

+1069
-928
lines changed

boring_to_beautiful/codelab_rebuild.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,21 @@ steps:
1515
include: ../../analysis_options.yaml
1616
- name: Remove README
1717
rm: myartist/README.md
18+
- name: Add .gemini directory
19+
mkdir: adaptive_app/.gemini
20+
- name: Add .gemini/settings.json
21+
path: adaptive_app/.gemini/settings.json
22+
replace-contents: |
23+
{
24+
"mcpServers": {
25+
"dart": {
26+
"command": "dart",
27+
"args": [
28+
"mcp-server"
29+
]
30+
}
31+
}
32+
}
1833
- name: Add .vscode directory
1934
mkdir: myartist/.vscode
2035
- name: Add .vscode/launch.json
@@ -45,7 +60,7 @@ steps:
4560
--- b/boring_to_beautiful/step_01/pubspec.yaml
4661
+++ a/boring_to_beautiful/step_01/pubspec.yaml
4762
@@ -31,3 +31,9 @@ dev_dependencies:
48-
63+
4964
flutter:
5065
uses-material-design: true
5166
+ assets:

boring_to_beautiful/step_01/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 55 additions & 55 deletions
Large diffs are not rendered by default.

boring_to_beautiful/step_01/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));

boring_to_beautiful/step_01/macos/Runner.xcodeproj/project.pbxproj

Lines changed: 45 additions & 45 deletions
Large diffs are not rendered by default.

boring_to_beautiful/step_01/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ dev_dependencies:
2626
flutter_test:
2727
sdk: flutter
2828
flutter_lints: ^6.0.0
29-
build_runner: ^2.5.4
30-
freezed: ^3.1.0
29+
build_runner: ^2.6.0
30+
freezed: ^3.2.0
3131

3232
flutter:
3333
uses-material-design: true

boring_to_beautiful/step_02/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 55 additions & 55 deletions
Large diffs are not rendered by default.

boring_to_beautiful/step_02/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));

boring_to_beautiful/step_02/macos/Runner.xcodeproj/project.pbxproj

Lines changed: 45 additions & 45 deletions
Large diffs are not rendered by default.

boring_to_beautiful/step_02/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ dev_dependencies:
2727
flutter_test:
2828
sdk: flutter
2929
flutter_lints: ^6.0.0
30-
build_runner: ^2.5.4
31-
freezed: ^3.1.0
30+
build_runner: ^2.6.0
31+
freezed: ^3.2.0
3232

3333
flutter:
3434
uses-material-design: true

boring_to_beautiful/step_03/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 55 additions & 55 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)