Skip to content

Added CupertinoFormSection, CupertinoSplitFormRow, and CupertinoTextFormField - #70676

Merged
fluttergithubbot merged 21 commits into
flutter:masterfrom
DanielEdrisian:cupertino-form
Dec 1, 2020
Merged

fluttergithubbot merged 21 commits into
flutter:masterfrom
DanielEdrisian:cupertino-form

Conversation

@DanielEdrisian

@DanielEdrisian DanielEdrisian commented Nov 17, 2020 •

Copy link
Copy Markdown
Contributor

Description

Added CupertinoFormSection, CupertinoSplitFormRow, and CupertinoTextFormField.

Screen Shot 2020-11-17 at 8 10 46 PM

Demo:
https://github.com/DanielEdrisian/SharedStorage/blob/main/demo%20forms.mov

Related Issues

#69916
#26745

Tests

No tests.

Replace this with a list of the tests that you added as part of this PR. A change in behavior with no test covering it
will likely get reverted accidentally sooner or later. PRs must include tests for all changed/updated/fixed behaviors. See Test Coverage.

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.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Did any tests fail when you ran them? Please read Handling breaking changes.

@flutter-dashboard flutter-dashboard Bot added the framework flutter/packages/flutter repository. See also f: labels. label Nov 17, 2020
@google-cla google-cla Bot added the cla: yes label Nov 17, 2020
@flutter-dashboard flutter-dashboard Bot added the p: cupertino_ui cupertino_ui package in flutter/packages label Nov 18, 2020
@DanielEdrisian DanielEdrisian changed the title Added cupertino form section, split row, and text form field. Added CupertinoFormSection, CupertinoSplitFormRow, and CupertinoTextFormField Nov 18, 2020
@DanielEdrisian
DanielEdrisian marked this pull request as ready for review November 18, 2020 04:14
@flutter-dashboard

Copy link
Copy Markdown

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.

@xster xster left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry I have to finish later tonight. Some notes on the first file.

Comment thread packages/flutter/lib/src/cupertino/form_section.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/form_section.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/form_section.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/form_section.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/form_section.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/form_section.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/form_section.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/split_form_row.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/split_form_row.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/split_form_row.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/form_section.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/form_section.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/form_section.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/form_section.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/form_section.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/form_section.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/split_form_row.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/text_form_field.dart Outdated

@xster xster left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ok, one more file

Comment thread packages/flutter/lib/src/cupertino/split_form_row.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/split_form_row.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/split_form_row.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/split_form_row.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/split_form_row.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/split_form_row.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/split_form_row.dart Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's a bit of a hidden feature. But if there's verbatim doc in various places, you can search for usages of {@macro ... in various places

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.

Keeping this comment to see if my use of macro was correct. Will close once the documentation tool passes here.

Comment thread packages/flutter/lib/src/cupertino/text_form_field.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/split_form_row.dart Outdated

@xster xster left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Cool, overall approach looks good. I think we're ready for tests.

Comment thread packages/flutter/lib/src/cupertino/text_field.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/text_field.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/text_form_field.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/text_form_field.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/text_form_field.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/text_form_field.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/text_form_field.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/text_form_field.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/text_form_field.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/form_row.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/form_row.dart Outdated

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.

nit: is there a reason for making margins nullable, instead of using _kDefaultMargins as its default in the constructor?

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.

Here's my thought process:

CupertinoTextFormFieldRow also has a margins property that is passed onto CupertinoFormRow upon its composition. I would have to have the same private constant defined in two files if I wanted to have a non-nullable margins property, so i thought it was better to leave the default behavior as optional chaining instead. The alternative would be to create some class specifically to hold that default value, and then use that in both the text field row and the normal row. Is there a better way to go about this?

Comment thread packages/flutter/lib/src/cupertino/form_row.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/form_row.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/form_section.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/text_form_field_row.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/text_form_field_row.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/text_form_field_row.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/text_form_field_row.dart Outdated
@xster

xster commented Nov 23, 2020

Copy link
Copy Markdown
Member

you should be able to run dart dev/bots/analyze-sample-code.dart locally to check whether the sample code is right instead of waiting for CI to build it

@xster xster left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Great work! LGTM

Comment thread packages/flutter/lib/src/cupertino/form_row.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/form_row.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/form_row.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/form_row.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/form_row.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/form_section.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/form_section.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/form_section.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/text_form_field_row.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/text_form_field_row.dart Outdated

@LongCatIsLooong LongCatIsLooong left a comment

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.

LGTM!

Comment thread packages/flutter/lib/src/cupertino/form_section.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/form_section.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/form_section.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/form_section.dart Outdated
@DanielEdrisian

Copy link
Copy Markdown
Contributor Author

I made some changes to the CupertinoFormSection API @LongCatIsLooong @xster

  • Change decoration to groupDecoration and only affects the row group.
  • Gutted borderRadius because now it's settable in groupDecoration.
  • Add a clipBehavior for the row group. Defaults to Clip.none.
  • Add a backgroundColor to the entire form.
  • Change color scheme such that it switches between secondary and primary system background color upon theme changes.

Comment thread packages/flutter/lib/src/cupertino/form_section.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/form_section.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/form_section.dart Outdated

@xster xster left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Section and row still need tests but otherwise still LGTM

Comment thread packages/flutter/lib/src/cupertino/form_section.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/form_section.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/form_section.dart Outdated
@DanielEdrisian

Copy link
Copy Markdown
Contributor Author

Rebased on top of master

@fluttergithubbot

Copy link
Copy Markdown
Contributor

This pull request is not suitable for automatic merging in its current state.

  • The status or check suite Mac build_gallery has failed. Please fix the issues identified (or deflake) before re-applying this label.

@fluttergithubbot
fluttergithubbot merged commit e244724 into flutter:master Dec 1, 2020
jonahwilliams pushed a commit that referenced this pull request Dec 1, 2020
jonahwilliams pushed a commit that referenced this pull request Dec 1, 2020
DanielEdrisian added a commit to DanielEdrisian/flutter that referenced this pull request Dec 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants