Skip to content

Added callbacks for backdrop events #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jun 4, 2020
Merged

Conversation

vlytvyne
Copy link
Contributor

@vlytvyne vlytvyne commented Jun 3, 2020

I find it very useful to know when the front layer expands or collapses. It might come in handy if you want to change or do smt reactively. In my case, I needed to change toolbar title when state of frontLayer changes, so I added this feature.

Copy link
Member

@daadu daadu left a comment

Choose a reason for hiding this comment

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

There are some changes to be done:

  • rename the callbacks
  • proper indentations
  • callback only when the event happens (put inside the if condition)

Copy link
Member

@daadu daadu left a comment

Choose a reason for hiding this comment

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

add trailing comma

@daadu daadu self-requested a review June 3, 2020 10:22
Copy link
Member

@daadu daadu left a comment

Choose a reason for hiding this comment

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

refactor it

@daadu
Copy link
Member

daadu commented Jun 3, 2020

@WieFel Please review this? I think this feature is useful.

@daadu daadu requested a review from WieFel June 3, 2020 10:29
Co-authored-by: Harsh Bhikadia <harsh.bhikadiya@gmail.com>
Copy link
Member

@daadu daadu left a comment

Choose a reason for hiding this comment

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

@vlytvyne refactor properly

@vlytvyne
Copy link
Contributor Author

vlytvyne commented Jun 3, 2020

I doubt if onFrontLayerVisible is an appropriate variable name. onExpanded in my opinion is way more familiar and intuitive, also it's unclear what onFrontLayerVisible means as front layer is always visible at least partly. I'll rename variables, but write if u changed ur mind.

@daadu
Copy link
Member

daadu commented Jun 3, 2020

@vlytvyne We already expose showFrontLayer and showBackLayer helper methods with Backdrop.of(context), then nomenclature is to keep consistency with that.

Yes it is not the most appropriate. But if we are planning to change the names then it should be everywhere - keeping backward compatibility in mind

I would say following names would be most appropriate.

  • showFrontLayer -> backdropClose
  • showBackLayer -> backdropOpen
  • onFrontLayerVisible -> onBackdropClose
  • onBackLayerVisible -> onBackdropOpen

@WieFel What do you think about it?

@daadu daadu mentioned this pull request Jun 3, 2020
@daadu daadu changed the title Added onExpand onCollapse callbacks Added callbacks for backdrop events Jun 3, 2020
@vlytvyne
Copy link
Contributor Author

vlytvyne commented Jun 3, 2020

Please note that "backdrop" it's a composition of both front and back layers so backdropOpen and similar variants are puzzling.

From https://material.io/components/backdrop#usage :

"A backdrop is composed of two surfaces: a back layer and a front layer. The back layer displays actions and context, and these control and inform the front layer's content."

@daadu
Copy link
Member

daadu commented Jun 3, 2020

@vlytvyne

MDG uses following terms for this - "Revealing the back layer" and "Concealing the back layer".

Keeping that in mind, the name should be as following:

  • showFrontLayer -> concealBackLayer
  • showBackLayer -> revealBackLayer
  • onFrontLayerVisible -> onBackLayerConcealed
  • onBackLayerVisible -> onBackLayerRevealed

@vlytvyne
Copy link
Contributor Author

vlytvyne commented Jun 3, 2020

I definitely like it better this way.

@daadu
Copy link
Member

daadu commented Jun 3, 2020

@WieFel Let us know your views.

- `showFrontLayer` -> `concealBackLayer`
- `showBackLayer` -> `revealBackLayer`
- `onFrontLayerVisible` -> `onBackLayerConcealed`
- `onBackLayerVisible` -> `onBackLayerRevealed`

fluttercommunity#30
@daadu
Copy link
Member

daadu commented Jun 3, 2020

@vlytvyne @WieFel I have done the changes. Please check.

@daadu daadu self-requested a review June 3, 2020 11:29
Copy link
Collaborator

@WieFel WieFel left a comment

Choose a reason for hiding this comment

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

I think this is a good improvement! :)

There is only one slight change I'd make:
I would change the occurrences of

  @Deprecated("..."
      "This feature was deprecated after v1.0.0.")

to "deprecated after v0.3.3", because this should indicate from which version on the feature was deprecated, or did I get that wrong?

@daadu
Copy link
Member

daadu commented Jun 4, 2020

@WieFel Yeah, you are right.

@daadu
Copy link
Member

daadu commented Jun 4, 2020

@WieFel Done requested changes.

@daadu daadu merged commit c9e7c18 into fluttercommunity:master Jun 4, 2020
@daadu
Copy link
Member

daadu commented Jun 4, 2020

This feature have landed in pub.dev with v0.3.3.

@vlytvyne Check yourself out in Contributors Section in README.md!!

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

Successfully merging this pull request may close these issues.

3 participants