Skip to content

This PR should close issue #22 and add spacing property - #27

Merged
MarcelGarus merged 5 commits into
Rahiche:masterfrom
0xdecade:master
Apr 27, 2021
Merged

MarcelGarus merged 5 commits into
Rahiche:masterfrom
0xdecade:master

Conversation

@0xdecade

Copy link
Copy Markdown
Contributor

No description provided.

@MarcelGarus MarcelGarus left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I reviewed your code, but I'm not even sure padding is the most intuitive API for this. I believe when developers want to add padding, what they really want to do is add some space between the characters, not necessarily space on the outside. Intentions like "I want to add 16px of spacing between the characters" are much more common than "I want to put 8px of padding around each character".

So, I think it would be more intuitive if instead of the padding parameter you could specify a spacing parameter, which is just a double telling how much spacing to add between the characters:

image

We could for example implement this by adding something like this in the List.generate call:

var characterEntity = widget.builder(hasFocus, char);
if (i > 0) {
  characterEntity = Padding(
    padding: EdgeInsets.only(left: widget.spacing),
    child: characterEntity,
  );
}

That's why I would instead

Comment thread example/main.dart Resolved
Comment thread lib/code_input.dart Resolved
Comment thread lib/code_input.dart Resolved
Comment thread lib/code_input.dart Resolved
0xdecade and others added 2 commits April 26, 2021 21:44
Comment thread lib/code_input.dart Resolved
Comment thread lib/code_input.dart Resolved
0xdecade and others added 2 commits April 27, 2021 10:22
Co-authored-by: Marcel Garus <marcel.garus@gmail.com>
Renamed characterEntity variable to characterWidget;
Adjusted docstrings according to the change above;
@MarcelGarus

Copy link
Copy Markdown
Collaborator

Looks good to me!

@MarcelGarus
MarcelGarus merged commit b9dbf22 into Rahiche:master Apr 27, 2021
@MarcelGarus

Copy link
Copy Markdown
Collaborator

@Rahiche Next, we should update the version in the pubspec.yaml, add a changelog, and publish it on pub.dev.

@Rahiche

Rahiche commented Apr 28, 2021

Copy link
Copy Markdown
Owner

Done @MarcelGarus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants