simpleclub / math_keyboard

Math expression editing using an on-screen software keyboard or physical keyboard input in a typeset input field in Flutter.
https://simpleclub.github.io/math_keyboard
BSD 3-Clause "New" or "Revised" License
134 stars 50 forks source link

Support for equal sign (for inputting equations) #22

Open ghost opened 3 years ago

github-actions[bot] commented 3 years ago

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

You can expect triage from us soon 🙂 In the meantime, you can try to search for similar issues in our issue database.

creativecreatorormaybenot commented 3 years ago

Hi @gabcodedev - thanks for opening the issue and using the package 😃

Can you elaborate on what you would expect the button to do? (if that is what you are referring to)
If you look at the source code, you will notice that it is actually very easy for you to add your own keyboard layouts (and contribute them). However, how would you expect to interact with the button?

ghost commented 3 years ago

Woah, that was fast, thanks for the quick response. I need the equal sign for inputing quadratic equations. Anyway, I am going to try to implement it myself as you suggested. And also I wanted to thank all the team working in this package because it really saves a lot of time to have an already made and fully functional math keyboard. Good job! 👍

creativecreatorormaybenot commented 3 years ago

Now I see what you mean. So you want to have the equal sign not for evaluating an expression but rather for inputting equations - that makes sense.

When implementing it, you will find one flaw in the current implementation that I want to point out: because of the way we use the keyboard internally, we have only provided the option to prefill the AST from a math_expression. This means that you will not be able to manually set initial values for the math field easily with the current implementation.

I am talking about this line in particular:

https://github.com/simpleclub/math_keyboard/blob/491120508a9b665182dcc7e674323ae26bcc3f2e/math_keyboard/lib/src/widgets/math_field.dart#L659

It is definitely on our todos to adjust the way the package interacts with the AST once we add new features, but we simply have not tackled it yet since we have not needed it.
It should be an easy change to accept the package-specific AST for that - so you can change that if you want. In the future, we should offer a way to input TeX programmatically 👍

creativecreatorormaybenot commented 3 years ago

Anyway, I am going to try to implement it myself as you suggested.

So my conclusion: you should be able to do it with minimal changes - I can guide you if you need any help 🙂
The solution will not be optimal, but we can optimize that in the future 🚀

SSebigo commented 2 years ago

@creativecreatorormaybenot Is this feature still WIP or is it abandoned? I did some changes to add the equal sign but my employer refuses to use it if it isn't officially supported...

creativecreatorormaybenot commented 2 years ago

@SSebigo Would you be able to open a PR with your changes? Potentially (I cannot guarantee so), we could review it and make it part of the package if we find time and it does not break the simpleclub code base.

cc @edhom