18 Commits

Author SHA1 Message Date
b79fee0ae2 chore: Update min Dart constraint to 3.8 (#3676)
Update min Dart constraint to 3.8, which will enable us to use the
fancier collection literals.

This requires bumping the min Flutter version as well:

<img width="1892" height="1122" alt="image"
src="https://github.com/user-attachments/assets/7c7b07fc-4d96-4987-824d-9a7133ecfb85"
/>
2025-08-10 12:42:31 -04:00
e27818d872 fix: Set margins of JoystickComponent properly (#3019)
The margins of the `JoystickComponent` weren't set properly, this PR
fixes that.
2024-02-05 11:02:02 +00:00
152fbb61db docs: Fix examples for v1.9.0 (#2757)
Fixed up some examples that needed fixing before releasing v1.9.0
2023-09-21 19:24:40 +00:00
7c2f400076 feat!: Add CameraComponent to FlameGame (#2740)
This PR adds the `CameraComponent` and a `World` by default to the
FlameGame.
2023-09-18 21:06:37 +02:00
e852064e49 fix: Viewport should recieve events before the world (#2630)
The viewport should receive events before the world, otherwise all huds will get the events after the world components, if there are any world components underneath them.
2023-08-07 11:57:21 +00:00
2d45d2be39 chore: Remove 1.8.0 deprecations (#2538)
Removes all the deprecated methods before 1.8.0 release.
2023-05-22 19:01:55 +02:00
dbda37b81a refactor: Add new lint rules (#2477)
This PR adds the following lint rules to our list:

```
always_put_required_named_parameters_first
avoid_multiple_declarations_per_line
avoid_positional_boolean_parameters
avoid_returning_null_for_void
avoid_returning_this
avoid_unnecessary_containers
enable_null_safety
library_private_types_in_public_api
no_leading_underscores_for_library_prefixes
no_leading_underscores_for_local_identifiers
prefer_null_aware_method_calls
tighten_type_of_initializing_formals
unnecessary_late
use_setters_to_change_properties
```

And these rules were considered, and some changes were made according to
them as a clean-up, but in many places they didn't make sense
(`prefer_asserts_with_message` I would have included, but there were too
many places that needed to be changes):

```
collection_methods_unrelated_type
prefer_asserts_with_message
avoid_renaming_method_parameters
```
2023-04-13 19:42:00 +00:00
b5bdf4ec17 feat!: The HasTappableComponents mixin is no longer needed (#2450)
This PR is the second in a series of refactors that aim to simplify event handling in Flame. The approach is as follows:

    Added the MultiTapDispatcher component, which contains the logic that used to be within the HasTappableComponents mixin. This component is internal; it mounts to a FlameGame directly, and ensures that it is a singleton.
    Whenever any TapCallbacks component is added to a game, it automatically adds the MultiTapDispatcher component (unless there is already one), which in turn registers a tap gesture detector with GestureDetectorBuilder and rebuilds the game widget.

The end result is that now in order to make a component tappable you only need to add the TapCallbacks mixin to that component, everything else will be handled by the framework.

Consequently, the HasTappableComponents mixin is now empty and marked as deprecated.
2023-04-02 16:52:57 +00:00
843ddc3624 refactor: Move to package imports (#1625)
* refactor: Move to package imports

* Fix local imports

* Removed unused imports
2022-05-15 15:04:35 +00:00
295468f03c feat: Add Transform2D.setFrom and Transform2D.clone (#1495) 2022-03-27 21:48:26 +00:00
05f7a4c3d6 refactor: Remove Loadable, optional onLoads (#1333) 2022-01-24 23:23:12 +01:00
5c47d7f6d7 chore: analyze issues introduced from new dart version (#1196)
* Added Component.childrenFactory

* fix some of the lint warnings

* more lint warnings

* remove changelog entry

* more analyzer warnings

* one more warning

* one more warning

* remove more unused imports

* fix more warnings

* another warning

* one more warning

* a lot more warnings

* some more warnings

* fix warnings in flame_svg

* fix warnings in flame_bloc

* Remove OrderedSet override feature

* Remove testRandom change

* Remove unnecessary type checks

* Re-remove deprecated argument in random_test

Co-authored-by: Pasha Stetsenko <stpasha@google.com>
2021-12-09 15:40:43 +01:00
07ab8ce9c9 respectCamera and respectViewport proposal: coordinate system enum (#1167)
* Coordinate system

* Fixess

* .

* .

* Fix tests

* Rename CoordinateSystem to PositioningType

* Update docs for PositioningType

* Use switch instead of if-else

* PositioningType -> PositionType

* Don't do unnecessary transforms

* Added tests for PositionType.widget

* Update doc/components.md

Co-authored-by: Luan Nico <luanpotter27@gmail.com>

* Added PositionType tests

Co-authored-by: Lukas Klingsbo <me@lukas.fyi>
Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com>
2021-12-08 09:07:36 +00:00
bfcda073bb Effect controllers restructuring (#1134)
* Update effectController

* move effect controllers into the controllers/ directory

* Add .forward property to EffectController

* SimpleEffectController supports reverse time

* Fixing some compile errors

* rename SimpleEffectController -> LinearEffectController

* minor cleanup

* DurationEffectController and PauseEffectController

* ReverseLinearEffectController

* CurvedEffectController and its reverse

* InfiniteEffectController

* Added EffectController.recede()

* Add EffectController.update()

* Add InfiniteEffectController'

* RepeatedEffectController

* SequenceEffectController

* DelayedEffectController

* Restore the [EffectController.started] property

* minor

* Rename reset() -> setToStart()

* time direction is now managed from the Effect class

* StandardEffectController replaced with function standardController()

* update some doc-comments

* flutter analyze

* flutter format

* fix some tests

* more test fixes

* fix remaining tests

* format

* rename local variable

* minor simplification

* Expand docs in PauseEffectController

* added tests

* Curved controller test

* fix errors

* formatting

* added more tests

* format

* fix RepeatedEffectController

* more tests

* format

* changelog

* increase tolerance

* Replaced standardController with factory EffectController constructor

* Added parameter EffectController({alternate=false})

* Added default for curve= parameter

* rename

* rename tests

* added more exports

* rename tests

* rename src/effects2

Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com>
2021-12-04 15:58:42 +00:00
4b40479563 Rename isHud to respectCamera (#1159)
* Camera as an internal component

* Correct respectCamera

* Added changelog entry

* Add super call that will later be removed

* Rename callRender -> callOwnRender

* Don't call render when root

* Remove callOwnRender

* Skip CameraWrapper in own renderTree

* Too complex to have camera as component

* Revert test

* Update docs for respectCamera

* Move down field

* Fix changelog
2021-12-04 13:41:51 +00:00
790b8f73dd Remove old effects system (#1157)
* Remove old effects system

* Add changelog entry
2021-12-03 15:02:25 +01:00
ca8f8d3632 Added a ButtonComponent (#1146)
* Added a ButtonComponent

* Don't import VoidCallback

* Change epsilon since test is flaky

* Added SpriteButtonComponent

* Add changelog entry

* Add docs
2021-11-29 21:01:05 +01:00
8b132d7c0b Unify examples structure (#1118)
* Animations, CameraAndViewport, CollisionDetection and Components unified

* Added descriptions to effects

* Rename input games

* Unify input stories

* Add info to parallax section

* Added descriptions to the rendering examples

* Add descriptions to the sprites directory

* Fix utils and rendering section

* Add descriptions to the widgets section

* Delete directory that rebase brought back

* Unify game names

* Added some styleguide docs for examples

* Fix analyze issues

* All files should have _example as suffix

* Made the FollowComponentExample a bit easier to understand

* Change priority of ember
2021-11-19 14:28:04 +01:00