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

Unexpected size of chessboard in squares simple and complex examples #21

Open
VladimirMishka opened this issue Dec 20, 2023 · 5 comments

Comments

@VladimirMishka
Copy link

I am interested in creating an app for teaching the 3-check variant of chess and I have been looking for an appropriate framework. Your Dart/Flutter framework is very interesting. I am an experienced Delphi developer, but brand new to Dart/Flutter. I have been reading books on both Dart and Flutter to come up to speed. I am using the Microsoft Visual Studio Code IDE at the moment.

I was able to get both example programs to build and open in Windows 11. I didn't change any code. Visual Studio suggested that a few lines needed trailing commas and I allowed it to fix that syntax. The problem is that the chessboard and pieces are way too large (please see screenshots) and therefore you can only see the black pieces. I am hoping for a chessboard about the size of a "Lichess" chessboard. On the bottom of the simple example it says "Bottom overflowed by 1134 pixels" and at the bottom of the Complex Example after creating a game (I was slightly disappointed that 3-check didn't appear in the drop-down list but I imagine it can be added), it says "Bottom overflowed by 848 pixels." Visual studio Code seemed to indicate some kind of formatting error in the complex example (see screenshot) and I took a screenshot of something similar in the simple example.

Would you be able to point out what I should do to fix this?
Squares Simple Example Visual Studio Code Screen
Squares Complex Example Visual Studio Code Screen
Squares Complex Example Create Game
Squares Complex Example Opening Screen
Squares Simple Example
Thank you.

@malaschitz
Copy link
Contributor

You can whole chessboard widget add to your own widget. For example SizedWidget, Container etc... I suggest close this issue.

@VladimirMishka
Copy link
Author

Thank you for taking the time to comment, malaschitz. I hope you know that for someone like me who is brand new to Dart/Flutter, your answer, unfortunately, is not very helpful. It doesn't explain why the chessboard is so big "out-of-the-box" and it doesn't contain enough detail for someone new to this programming paradigm to fix the source code.

@alexobviously
Copy link
Owner

Hey, so basically the board widgets are designed to be agnostic of dimensions, and determine their size from the parent widget that contains them. This was a deliberate design decision to allow flexibility with regards to all of flutter's various ways of sizing and arranging widgets.

A good start would be to put it in SizedBox or FittedBox, but there are other options. Just treat it as any other widget that inherits its size from its parent.

Admittedly though, the layout in the example projects is not optimal, and I should probably update it to something more sensible. I just made it like that as a temporary solution and it's really just optimised for mobile, but I'll see if I can get a quick update out this weekend with more robust layouts in the examples.

@alexobviously
Copy link
Owner

And if you want to add three check to the list, there's a list of variants somewhere and you want to add CommonVariants.threeCheck (I think, I'm writing this from my phone). But I will also do that myself tomorrow.

@VladimirMishka
Copy link
Author

Thank you very much for the information and any updates to the example projects while I get up to speed on learning Flutter widgets. I really appreciate it.

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

No branches or pull requests

3 participants