Skip to content

Updated time pickers to use the new TextButton in place of FlatButton. - #61492

Merged
darrenaustin merged 1 commit into
flutter:masterfrom
darrenaustin:time_picker_buttons
Jul 16, 2020
Merged

darrenaustin merged 1 commit into
flutter:masterfrom
darrenaustin:time_picker_buttons

Conversation

@darrenaustin

Copy link
Copy Markdown
Contributor

Updated the Material Time Picker to use TextButton instead of FlatButton as part of the transition to the new button universe (#59702).

@fluttergithubbot fluttergithubbot added p: material_ui material_ui package in flutter/packages framework flutter/packages/flutter repository. See also f: labels. labels Jul 14, 2020
@fluttergithubbot

Copy link
Copy Markdown
Contributor

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@darrenaustin
darrenaustin requested review from HansMuller and rami-a and removed request for rami-a July 14, 2020 22:27
@@ -1831,11 +1831,11 @@ class _TimePickerDialogState extends State<_TimePickerDialog> {
child: ButtonBar(

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.

Could we eliminate the ButtonBar here?

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.

We can, but then we would lose some of the padding around the buttons that the ButtonBar provides. Might trip up some golden tests.

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.

I think you can get the same effect with

Container(
  alignment: Alignment.center,
  padding: EdgeInsets.symmetric(horizontal: 8),
  constraints: const BoxConstraints(minHeight: 52.0),
  child: Row(
    mainAxisAlignment: MainAxisAlignment.end,
    children: <Widget>[
      TextButton(
        onPressed: _handleCancel,
        child: Text(widget.cancelText ?? localizations.cancelButtonLabel),
      ),
      const SizedBox(width: 8),
      TextButton(
        onPressed: _handleOk,
        child: Text(widget.confirmText ?? localizations.okButtonLabel),
      ),
    ],
  ),
)

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.

There's special behavior in ButtonBar that puts the buttons in a column if they don't fit in a row (good for i18n cases or custom button text), so I'd say we keep the button bar until we have a good replacement for that

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.

Is that really an issue with the time picker? Can the picker become narrow enough to require making a column out of the OK/Cancel buttons while otherwise remaining usable?

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.

I think it may be possible in other locales (german perhaps?)

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.

OK, with me to leave this as-is for the moment. I'm going to write a row-unless-theres-no-room-then-a-column that we can replace ButtonBar with. Until then, this is good.

@@ -1831,11 +1831,11 @@ class _TimePickerDialogState extends State<_TimePickerDialog> {
child: ButtonBar(

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.

There's special behavior in ButtonBar that puts the buttons in a column if they don't fit in a row (good for i18n cases or custom button text), so I'd say we keep the button bar until we have a good replacement for that

@darrenaustin
darrenaustin merged commit 681395e into flutter:master Jul 16, 2020
@darrenaustin
darrenaustin deleted the time_picker_buttons branch July 16, 2020 16:43
Pragya007 pushed a commit to Pragya007/flutter that referenced this pull request Aug 11, 2020
mingwandroid pushed a commit to mingwandroid/flutter that referenced this pull request Sep 6, 2020
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jul 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants