Add isDismissible configuration for showModalBottomSheet#42404
Conversation
…sible by tapping on the scrim
|
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
|
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
mehmetf
left a comment
There was a problem hiding this comment.
These look good to me too but I would like to get Hans' approval.
caae18f to
96c55ba
Compare
|
I do not think "isDismissible" is a good variable name. I do not know whether Flutter project has any naming convention for boolean variables but "is" is a verb, and verbs are inappropriate to represent an object's state. Therefore "isDismissible" should simply become "dismissible". You should only use verbs for accessor (getter / setter) methods where it makes more sense when boolean variable is an adjective. |
|
|
There was a problem hiding this comment.
Using square brackets creates a hyperlink to the parameter in question in the API documentation.
| /// The `isDismissible` parameter specifies whether the bottom sheet will be | |
| /// The [isDismissible] parameter specifies whether the bottom sheet will be |
There was a problem hiding this comment.
Still has 4 spaces instead of 2
|
@johnsonmh Interesting, thanks for the reference. But if you look further, you find this - https://dart.dev/guides/language/effective-dart/design#consider-omitting-the-verb-for-a-named-boolean-parameter
Example: Isolate.spawn(entryPoint, message, paused: false);
var copy = List.from(elements, growable: true);
var regExp = RegExp(pattern, caseSensitive: false);Which is succinct as verb doesn't give any new information as stated in the documentation. Compare to: Isolate.spawn(entryPoint, message, isPaused: false);
var copy = List.from(elements, isGrowable: true);
var regExp = RegExp(pattern, isCaseSensitive: false);Since "isDismissable" is named parameter, then this rule should apply. |
|
@genert I do agree that the parameter name |
96c55ba to
236652e
Compare
* Allow showModalBottomSheet to present bottom sheet that is not dismissible by tapping on the scrim * Add guards, improve styling and tests for BottomSheet
Description
Currently showBottomSheet does not allow BottomSheet that is non-dismissible.
This change will allow an extra configuration that allows user to create a non-dismissible BottomSheet while keeping the original behaviour as the default.
Related Issues
Fixes #42395
Tests
I added the following tests:
Updated the existing test by adding details about default behaviour.
Created test to make sure bottom sheet is not dismissed when isDismissible is set to false.
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?