Skip to content

Add CheckedPopupMenuitem, update the Stocks demo - #2216

Merged
HansMuller merged 2 commits into
flutter:masterfrom
HansMuller:stocks_demo
Feb 26, 2016
Merged

HansMuller merged 2 commits into
flutter:masterfrom
HansMuller:stocks_demo

Conversation

@HansMuller

Copy link
Copy Markdown
Contributor

Using PopupMenuButton and CheckedPopupMenuItem in the stocks demo.

Fixes #2200

Also:

  • Render disabled menu item icons correctly
  • Rename the disabled property to enabled (and etc)
  • Add an enabled property to ListItem
  • Don't call PopupMenuItem.onSelected unless an item was actually selected

),
new PopupMenuItem(
disabled: true,
isDisabled: true,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we change this to "enabled: false"? The Web has had a number of issues due to having booleans that are negative adjectives.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's a pity we can't use the onPressed != null approach.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maybe value != null?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Can we change this to "enabled: false"? The Web has had a number of issues due to having booleans that are negative adjectives.

Sure. I've been using isFoo for boolean properties, so isEnabled?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

maybe value != null?

I have mixed feelings about this kind of overloading since developers are unlikely to guess that it's how one disables an item. But if you really think it's a good idea, OK.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

let's stick with the boolean.

As far as isFoo vs foo, for widget constructor arguments, we don't generally do the is prefix. isFoo is usually reserved for getters that examine state.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

OK. I'll de-prefix ListItem's isThreeLine, isDisabled, and isDense as well.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"isThreeLine" is probably better than "threeLine" since the latter isn't an adjective. Generally I think my intuition is that arguments that are booleans should be adjective, and arguments that take other types should be nouns. (length:3 -> "the length is 3" vs dense:true -> "this is dense")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've changed isDense to dense. Sadly, I've just noticed that Input also supports dense layout. It's property is called isDense. Sigh.

@Hixie

Hixie commented Feb 26, 2016

Copy link
Copy Markdown
Contributor

LGTM. Sorry about not catching the isFoo thing in earlier patches.

HansMuller pushed a commit that referenced this pull request Feb 26, 2016
Add CheckedPopupMenuitem, update the Stocks demo
@HansMuller
HansMuller merged commit 8edeecb into flutter:master Feb 26, 2016
@HansMuller
HansMuller deleted the stocks_demo branch February 26, 2016 22:04
TahaTesser pushed a commit to NevercodeHQ/flutter that referenced this pull request Aug 13, 2020
Android: Use android.arch.lifecycle instead of androidx.lifecycle:lifecycle in build.gradle to support apps that has not been migrated to AndroidX.
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 16, 2021
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.

Add CheckedPopupMenuItem

2 participants