flutter_tex icon indicating copy to clipboard operation
flutter_tex copied to clipboard

Content getting cut off width wise and height wise. Also not being scrollable.

Open Roopaish opened this issue 2 years ago • 3 comments

The content is getting cut off at the bottom. Screenshot_2022-03-21-23-26-00-883_com clamphook clamphook

The table is not fully visible width wise and is not scrollable. Screenshot_2022-03-21-23-26-21-262_com clamphook clamphook

Roopaish avatar Mar 22 '22 01:03 Roopaish

The table is not fully visible width wise and is not scrollable.

Fixed it by wrapping the table in a div with style overflow:scroll; Don't know about the height issue.

Roopaish avatar Mar 23 '22 16:03 Roopaish

Hi...Thanks for sharing that info. I'm using Dart/Flutter and I'm facing the same issue with content getting cut off (width). Did you use Dart and how did you create the div, using the TeXView widget?

syngetprog avatar Feb 22 '23 20:02 syngetprog

@syngetprog I think I am late here. It's not a good way but I found that it rendered correctly when I hot reloaded. So I called setState 😂. And it's fixed lol.

Here's the code snippet (I would not recommend it though it worked)

class ContentRenderer extends StatefulWidget {
  final List<String>? texts;
  const ContentRenderer({Key? key, this.texts}) : super(key: key);

  @override
  State<ContentRenderer> createState() => _ContentRendererState();
}

class _ContentRendererState extends State<ContentRenderer> {
  String newContent = '';
  bool placeholder = true;
  @override
  Widget build(BuildContext context) {
    return Column(
      mainAxisSize: MainAxisSize.min,
      children: [
        if (placeholder) SizedBox(height: Get.height),
        TeXView(
          renderingEngine: const TeXViewRenderingEngine.katex(),
          child: TeXViewColumn(
            style: TeXViewStyle(
              contentColor: Colors.black,
              fontStyle: TeXViewFontStyle(
                fontSize: 18,
                fontFamily: GoogleFonts.inter().fontFamily,
                fontWeight: TeXViewFontWeight.w400,
              ),
            ),
            children: [
              ...widget.texts!.map((text) {
                return TeXViewDocument("${formatText(text)} $newContent");
              }),
            ],
          ),
          onRenderFinished: (_) {
            setState(() {
              newContent = '<br/><br/>';
              placeholder = false;
            });
          },
        ),
      ],
    );
  }
}

Roopaish avatar Apr 07 '23 15:04 Roopaish