-
Notifications
You must be signed in to change notification settings - Fork 294
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
Edit-message (2/n): Implement variant of content input without a typing notifier #1431
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the refactor! This will be helpful for implementing saved snippets as well; left a comment bringing that into the discussion.
lib/widgets/compose_box.dart
Outdated
// ignore: unused_element | ||
factory _ContentInput.noTypingNotifier({ | ||
required Narrow narrow, | ||
required SendableNarrow destination, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think ideally destination
shouldn't be needed for this variant, but I can't think of a better alternative without making destination
nullable in the base class _ContentInput
and having null-checks in the mixin. (I think this—having a default constructor that allows all combinations, and factories with set values and assertions—is how some Flutter upstream widgets (e.g.: SwitchListTile
) handle this.)
For editing messages, providing a reasonable value for destination
might still be convenient for the caller (and will become a requirement when we get to supporting typing notifications for editing).
Saved snippets might need a variant that does not have typing notifier or autocompletion; in that case neither narrow
nor destination
should be needed from the caller, as there are no reasonable values other than null
for them anyway:
factory _ContentInput.savedSnippet({
required ComposeBoxController controller,
required String hintText,
}) => _ContentInputNoTypingNotifier._(
narrow: null,
destination: null,
controller: controller,
hintText: hintText,
);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another approach would be dropping the mixin
, moving the typing notifier logic to _ContentInputStateWithTypingNotifier
, and moving the destination
field to _ContentInputWithTypingNotifier
. However, that won't help if we need the mixin in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another approach would be dropping the
mixin
, moving the typing notifier logic to_ContentInputStateWithTypingNotifier
, and moving thedestination
field to_ContentInputWithTypingNotifier
. However, that won't help if we need the mixin in the future.
Interesting! I'll push some wip commits trying this out.
We'll use this for the edit-message compose box.
…tNoTypingNotifier`
479cf37
to
e67a478
Compare
Thanks for the review! I've pushed some NOMERGE commits with a way to have |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This change LGTM. I guess destination
might need dartdoc highlighting its relationship with typing notifications.
@@ -486,6 +533,10 @@ class _ContentInputState extends State<_ContentInput> with WidgetsBindingObserve | |||
} | |||
} | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove extra newline
The edit-message compose box (#126) shouldn't send typing notifications like the regular compose box does.
(There's actually a different kind of typing notification that we'll want to implement eventually; that's #1350. But that's not for us to do now.)
This PR implements
_ContentInput.noTypingNotifier
, as prep for implementing the edit-message compose box.Related: #126