Skip to content
This repository has been archived by the owner on Oct 8, 2023. It is now read-only.

WIP: Initial implementation #1

Closed
wants to merge 1 commit into from
Closed

Conversation

erickzanardo
Copy link
Member

This PRs adds the first implementation of this widget, my idea here is to provide a simple, easy to use Flutter widget to function as a splash screen for Flame.

I choose to make it a separate package because this widget bundles images (the Flame logo) and although they are small, I think it would be bad if this was bundled with Flame, because since we always try to make things optional there, would be annoying to add that file size to people who don't want to add the splash screen to their games.

This is result so far (be aware that this is a GIF from a recorded screen, so it may not be as smooth as it is on the device):

flame_splash_screen

I would like here to discuss about the current api, if that is already good, if there is any suggestions and etc, when we finish the discussions here, I will finish writing the docs and README.

Future.delayed(widget.fadeInDuration).then((_) {
setState(() {
_visible = false;
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can inline this set state call

Future.delayed(widget.waitDuration).then((_) {
setState(() {
_visible = true;
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can inline this set state call

widget.fadeOutDuration
).then((_) {
Navigator.of(context).pushReplacementNamed(widget.navigateTo);
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not add this inside the callback with only the fadeOutTime or have the three as separated invocations summing the times?


void main() {
test('adds one to input values', () {
final calculator = Calculator();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is this related? haha

Copy link
Member

@luanpotter luanpotter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments, I love the idea and overall looks good (have some nits).

Two bigger issues to think are:

  1. you are missing reamds, license, TODOs there (should be easy to add)
  2. and the harder question is, this impl does not allow for it to wait for stuff to load, making it a fake splash screen, right? I'm not sure, is the idea to start loading, show this for a fixed time while loading and then if necessary show a custom loading bar? Could we provide that functionality? Or is it too much? I don't know, I'm just thinking how it would work on a real game were I actually need to load dozens of futures before starting (images, sounds, config files, system calls, network connections, play games, etc).

@erickzanardo
Copy link
Member Author

@luanpotter

you are missing reamds, license, TODOs there (should be easy to add)

This is WIP, I will add those after we finish discussing the APIs

and the harder question is, this impl does not allow for it to wait for stuff to load, making it a fake splash screen, right? I'm not sure, is the idea to start loading, show this for a fixed time while loading and then if necessary show a custom loading bar? Could we provide that functionality? Or is it too much? I don't know, I'm just thinking how it would work on a real game were I actually need to load dozens of futures before starting (images, sounds, config files, system calls, network connections, play games, etc).

Yeah, that could be a good addition, like a loadResources parameter that must return a Future, and we wait for it before fading out sounds good?

@luanpotter
Copy link
Member

Yeah, I thought of something like that. But then if we are going to control that, we need a way for the user to complement our animation with his own logos (company, game) and eventually an actual loader/spinner.

Because I assume some users would use it as a quick and working loading screen, but eventually would like to show flame for fixed time, studio for fixed time, and a loading for the remaining time for the actual load, instead of waiting on flame for all the loading and then having extra wait time for the other logos and such.

Makes sense?

@erickzanardo
Copy link
Member Author

Yeah, I thought of something like that. But then if we are going to control that, we need a way for the user to complement our animation with his own logos (company, game) and eventually an actual loader/spinner.

The custom logo I think is cool, but I think this is a plus, this is more of a way for people showing their support to Flame, by helping advertising it, it is common on games for engines to have their own splash screen, but I see no problem on letting the user add their own logo to this module.

The spinner I don't like, loading things on a Splash screen, is a way to fake loading things, so it is something more natural to the player, if we add a spinner, we totally break that feeling.

I think we should add the option to the custom logo, and a parameter that receives a function which returns a Future, and wait for it alongside the splash screen fade/wait times.

What do you think?

@luanpotter
Copy link
Member

"fake loading things" -> that is my concern, the use case I see is:

  1. I want to show flame splash screen and use this lib to support flame
  2. I also want to show my own studio/game logo
  3. I want to have these displayed while I truly load my Future

I don't want to show only flame splash screen for 5 seconds while my whole game loads and then show a fake splash screen to show my studio. Does that make sense?

@erickzanardo
Copy link
Member Author

I am confused, all the use cases you listed will be fullfilled if we do what I proposed on my previous comment.

The only thing I have disagreed was to show a spinner, or a loading indicator, because that will kill the feeling of the "not loading, just a slpash screen"

@luanpotter
Copy link
Member

Agreed, I just exemplifying the need to add a custom logo/studio. This is just one case by the way, three requirements for the same app (just making sure it's clear).

@erickzanardo
Copy link
Member Author

erickzanardo commented Oct 31, 2019 via email

@erickzanardo
Copy link
Member Author

Closing this in favor of #2

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants