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

TeXView Widget takes more space than needed at the bottom in ListView.builder #154

Open
aeaevo opened this issue Jul 12, 2023 · 0 comments

Comments

@aeaevo
Copy link

aeaevo commented Jul 12, 2023

Situation:
I am building a maximum of 6 TeXView instances in a ListView.builder.

Expected behaviour:
One TeXView below the next one in a vertically scrollable ListView.

Actual behaviour:
A List is created with TeXView instances, but in some cases the TeXView takes more space after the actually rendered content than needed. It seems like being approx. double the space needed (in this example the TeXView is wrapped with a teal-colored Container). This issue occurs irregularly with the exact same LaTeX code. I also feel the issue happens when scrolling slowly rather than fast

ListView.builder(
  itemCount: answers.length,
  itemBuilder: (context, index) {

  String parsedText = parseTeX(answers[index]);

  return Container(
    color: Colors.teal,
    child: TeXView(
        fonts: const [
          TeXViewFont(
              fontFamily: 'Poppins',
              src: 'fonts/Poppins-Regular.ttf'),
        ],
        child: TeXViewColumn(
          children: [
            for (var text in parsedText) ...[
              if (text.trim().isNotEmpty) ...[
                TeXViewDocument(text.trim(),
                    style: TeXViewStyle(
                      padding: const TeXViewPadding.only(
                          top: 5, bottom: 5),
                      backgroundColor: Colors.transparent,
                      contentColor: colorWhite,
                      fontStyle: TeXViewFontStyle(
                          fontSize: 12,
                          fontFamily: 'Poppins'),
                      textAlign:
                          containsTextNotEnclosedInMath(
                                  text)
                              ? TeXViewTextAlign.left
                              : TeXViewTextAlign.center,
                    )),
              ]
            ]
          ],
        )),
    )
  });
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

1 participant