flame-engine / flame

A Flutter based game engine.
https://flame-engine.org
MIT License
8.98k stars 879 forks source link

CircleComponent doesn't accept `key` parameter. #3169

Closed jpwoodbu closed 1 month ago

jpwoodbu commented 1 month ago

What happened?

I get a build error when trying to pass a key parameter to the constructor of a CircleComponent:

No associated named super constructor parameter. Try changing the name to the name of an existing named super constructor parameter, or creating such named parameter.

What do you expect?

From https://docs.flame-engine.org/latest/flame/components.html#component-keys, I would expect that all components accept a key parameter.

How can we reproduce this?

final key = ComponentKey.named('player'); final foo = CircleComponent(key: key);

What steps should take to fix this?

Likely adding super.key to the constructor parameters of CircleComponent will fix it.

Do have an example of where the bug occurs?

No response

Relevant log output

No response

Execute in a terminal and put output into the code block below

Output of: flutter doctor -v

Affected platforms

All

Other information

$ flutter doctor -v [✓] Flutter (Channel stable, 3.22.1, on Ubuntu 22.04.4 LTS 6.5.0-35-generic, locale en_US.UTF-8) • Flutter version 3.22.1 on channel stable at /home/jpwoodbu/fvm/versions/3.22.1 • Upstream repository https://github.com/flutter/flutter.git • Framework revision a14f74ff3a (3 days ago), 2024-05-22 11:08:21 -0500 • Engine revision 55eae6864b • Dart version 3.4.1 • DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /home/jpwoodbu/Android/Sdk/ • Platform android-34, build-tools 34.0.0 • Java binary at: /home/jpwoodbu/android/android-studio/jbr/bin/java • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160) • All Android licenses accepted.

[✓] Chrome - develop for the web • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop • Ubuntu clang version 14.0.0-1ubuntu1.1 • cmake version 3.22.1 • ninja version 1.10.1 • pkg-config version 0.29.2

[✓] Android Studio (version 2023.3) • Android Studio at /home/jpwoodbu/android/android-studio • Flutter plugin version 79.0.2 • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)

[✓] VS Code (version 1.89.1) • VS Code at /usr/share/code • Flutter extension version 3.88.0

[✓] Connected device (2 available) • Linux (desktop) • linux • linux-x64 • Ubuntu 22.04.4 LTS 6.5.0-35-generic • Chrome (web) • chrome • web-javascript • Google Chrome 125.0.6422.112

[✓] Network resources • All expected network resources are available.

• No issues found!

Are you interested in working on a PR for this?

RutvikPanchal246 commented 1 month ago

Hi @jpwoodbu @spydon , I want to work on this bug

ufrshubham commented 1 month ago

Assigned this to you @RutvikPanchal246. If it is not too much work, can you also fix this for all the components? If I am not wrong, it is missing from following component:

RutvikPanchal246 commented 1 month ago

Sure @ufrshubham , I'll add key param in all components that you mention.