flutter_mathjax_latex 0.0.3 copy "flutter_mathjax_latex: ^0.0.3" to clipboard
flutter_mathjax_latex: ^0.0.3 copied to clipboard

A Flutter Package to render Mathematics / Maths, Physics and Chemistry, Statistics Equations and expressions based on LaTeX, TeX, and MathML with HTML and JavaScript support.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_mathjax_latex/flutter_mathjax_latex.dart';
import 'package:flutter_mathjax_latex_example/tex_view_document_example.dart';
import 'package:flutter_mathjax_latex_example/tex_view_quiz_example.dart';

main() {
  runApp(const FlutterTeXExample());
}

class FlutterTeXExample extends StatelessWidget {
  const FlutterTeXExample({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: TeXViewFullExample(),
    );
  }
}

class TeXViewFullExample extends StatefulWidget {
  const TeXViewFullExample({Key key}) : super(key: key);

  @override
  _TeXViewFullExampleState createState() => _TeXViewFullExampleState();
}

class _TeXViewFullExampleState extends State<TeXViewFullExample> {
  // int radVal = 0;

  TeXViewRenderingEngine renderingEngine;

  @override
  Widget build(BuildContext context) {
    renderingEngine = const TeXViewRenderingEngine.mathjax();
    return Scaffold(
      backgroundColor: Colors.white,
      appBar: AppBar(
        title: const Text("Flutter TeX (Demo)"),
      ),
      body: ListView(
        shrinkWrap: true,
        children: <Widget>[
          Padding(
            padding: const EdgeInsets.all(20),
            child: Image.asset(
              "assets/flutter_mathjax_latex_banner.png",
              fit: BoxFit.contain,
              height: 200,
            ),
          ),
          const Divider(
            height: 30,
            color: Colors.transparent,
          ),
          getExampleButton(
            context,
            'Quiz Example',
            TeXViewQuizExample(
              renderingEngine: renderingEngine,
            )),
          getExampleButton(
            context,
            'TeX Examples',
            TeXViewDocumentExamples(
              renderingEngine: renderingEngine,
            )),
        ],
      ),
    );
  }

  getExampleButton(BuildContext context, String title, Widget widget) {
    return Padding(
      padding: const EdgeInsets.all(10.0),
      child: ElevatedButton(
        style: ButtonStyle(
            elevation: MaterialStateProperty.all(5),
            backgroundColor: MaterialStateProperty.all(Colors.white)),
        onPressed: () {
          Navigator.push(
              context, MaterialPageRoute(builder: (context) => widget));
        },
        child: Padding(
          padding: const EdgeInsets.all(15.0),
          child: Text(
            title,
            style: const TextStyle(fontSize: 15, color: Colors.black),
          ),
        ),
      ),
    );
  }
}
0
likes
30
points
12
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter Package to render Mathematics / Maths, Physics and Chemistry, Statistics Equations and expressions based on LaTeX, TeX, and MathML with HTML and JavaScript support.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, markdown, webview_flutter_plus

More

Packages that depend on flutter_mathjax_latex