Skip to content

Commit ce627ae

Browse files
committed
Update brick_breaker
1 parent 4ee5c4d commit ce627ae

File tree

41 files changed

+1143
-1016
lines changed

Some content is hidden

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

41 files changed

+1143
-1016
lines changed

brick_breaker/codelab_rebuild.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,21 @@ steps:
3232
flutter: pub upgrade --major-versions
3333
- name: Remove README
3434
rm: brick_breaker/README.md
35+
- name: Add .gemini directory
36+
mkdir: brick_breaker/.gemini
37+
- name: Add .gemini/settings.json
38+
path: brick_breaker/.gemini/settings.json
39+
replace-contents: |
40+
{
41+
"mcpServers": {
42+
"dart": {
43+
"command": "dart",
44+
"args": [
45+
"mcp-server"
46+
]
47+
}
48+
}
49+
}
3550
- name: Add .vscode directory
3651
mkdir: brick_breaker/.vscode
3752
- name: Add .vscode/launch.json

brick_breaker/step_03/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ migrate_working_dir/
2727
**/doc/api/
2828
**/ios/Flutter/.last_build_id
2929
.dart_tool/
30-
.flutter-plugins
3130
.flutter-plugins-dependencies
3231
.pub-cache/
3332
.pub/
3433
/build/
34+
/coverage/
3535

3636
# Symbolication related
3737
app.*.symbols

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

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

brick_breaker/step_03/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));

brick_breaker/step_03/macos/Runner.xcodeproj/project.pbxproj

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

brick_breaker/step_03/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ environment:
99
dependencies:
1010
flutter:
1111
sdk: flutter
12-
flame: ^1.29.0
12+
flame: ^1.30.1
1313
flutter_animate: ^4.5.2
1414
google_fonts: ^6.2.1
1515

1616
dev_dependencies:
1717
flutter_test:
1818
sdk: flutter
19-
flutter_lints: ^5.0.0
19+
flutter_lints: ^6.0.0
2020

2121
flutter:
2222
uses-material-design: true

brick_breaker/step_04/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ migrate_working_dir/
2727
**/doc/api/
2828
**/ios/Flutter/.last_build_id
2929
.dart_tool/
30-
.flutter-plugins
3130
.flutter-plugins-dependencies
3231
.pub-cache/
3332
.pub/
3433
/build/
34+
/coverage/
3535

3636
# Symbolication related
3737
app.*.symbols

brick_breaker/step_04/ios/Runner.xcodeproj/project.pbxproj

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

brick_breaker/step_04/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));

brick_breaker/step_04/macos/Runner.xcodeproj/project.pbxproj

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

0 commit comments

Comments
 (0)