Skip to content
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

feat: Adds support for custom keyboard pages and other customizations #58

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Sub6Resources
Copy link

@Sub6Resources Sub6Resources commented Aug 8, 2023

Description

  • BREAKING: bool secondPage has been replaced with int page in MathFieldEditingController to allow for more than two pages.
  • Adds support for custom keyboard pages using the new customPages attribute that takes a list of CustomButtonPages.
    • Each CustomButtonPage takes a List<List<KeyboardButtonConfig>> as well as an optional label or icon to be shown using the PageButtonConfig.
    • The existing pages were wrapped in this class.
  • Adds a fontSize attribute to MathKeyboard and a keyboardButtonFontSize attribute to MathField to allow the font size of the keyboard buttons to be adjusted.
  • Adds a heightFactor attribute to KeyboardButtonConfig to allow for customization of the height of keyboard rows.
  • Adds widget tests for MathKeyboard to test the functionality of custom and default pages on the keyboard.

Related issues & PRs

None

Checklist

  • I have made myself familiar with the CaTeX
    contributing guide.
  • I added a PR description.
  • I linked all related issues and PRs I could find (no links if there are none).
  • If this PR changes anything about the main math_keyboard or example package
    (also README etc.), I created an entry in CHANGELOG.md (## UPCOMING RELEASE if the change
    on its own is not worth an update).
  • If this PR includes a notable change in the math_keyboard package, I updated the version
    according to Dart's semantic versioning.
  • If there is new functionality in code, I added tests covering all my additions.
  • All required checks pass.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Hi 👋🏽 Thank you for opening your first PR with simpleclub/math_keyboard ❤

You can expect a review from us soon ☺️
In the meantime, please check our contribution guidelines, the PR checklist, and the PR checks.

Copy link
Member

@edhom edhom left a comment

Choose a reason for hiding this comment

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

@Sub6Resources Thanks Matthew for the contribution😍 And sorry for the late review! I have just some nits but happy to merge this one then:)

/// The buttons to display.
final List<List<KeyboardButtonConfig>>? page2;
/// The configuration for all the pages on the keyboard.
final List<CustomButtonPage>? pages;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
final List<CustomButtonPage>? pages;
final List<CustomButtonPage> pages;

I think this can't be nullable anymore

Comment on lines +144 to +148
else if (type ==
MathKeyboardType.expression)
standardKeyboard,
if (type == MathKeyboardType.expression)
functionKeyboard,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
else if (type ==
MathKeyboardType.expression)
standardKeyboard,
if (type == MathKeyboardType.expression)
functionKeyboard,
if (type == MathKeyboardType.expression)
standardKeyboard,
functionKeyboard,

Comment on lines +399 to +404
...(widget.customPages.fold<List<List<KeyboardButtonConfig>>>(
[],
(previousValue, customPage) {
return previousValue..addAll(customPage.buttonLayout);
},
)),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
...(widget.customPages.fold<List<List<KeyboardButtonConfig>>>(
[],
(previousValue, customPage) {
return previousValue..addAll(customPage.buttonLayout);
},
)),
for (final page in widget.customPages)
...page.buttonLayout

Could you check if this works?🙂

@absar
Copy link

absar commented Jul 21, 2024

@Sub6Resources @edhom this is a very useful PR can it be merged

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

Successfully merging this pull request may close these issues.

3 participants