-
Notifications
You must be signed in to change notification settings - Fork 137
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
Issue in version 4.0.10 #201
Comments
Please do |
I am getting the same issue on 4.0.12. Doing a |
Please share a minimal example that I can try. |
the quiz example didn't work in my case. i copy pasted it with no changes made, but i'll just keep it here in case i accidentally did something. import 'package:flutter/material.dart';
import 'package:flutter_tex/flutter_tex.dart';
class Quiz {
final String statement;
final List<QuizOption> options;
final String correctOptionId;
Quiz(
{required this.statement,
required this.options,
required this.correctOptionId});
}
class QuizOption {
final String id;
final String option;
QuizOption(this.id, this.option);
}
class TeXViewQuizExample extends StatefulWidget {
const TeXViewQuizExample({super.key});
@override
State<TeXViewQuizExample> createState() => _TeXViewQuizExampleState();
}
class _TeXViewQuizExampleState extends State<TeXViewQuizExample> {
int currentQuizIndex = 0;
String selectedOptionId = "";
bool isWrong = false;
List<Quiz> quizList = [
Quiz(
statement: r"""<h3>What is the correct form of quadratic formula?</h3>""",
options: [
QuizOption(
"id_1",
r""" <h2>(A) \(x = {-b \pm \sqrt{b^2+4ac} \over 2a}\)</h2>""",
),
QuizOption(
"id_2",
r""" <h2>(B) \(x = {b \pm \sqrt{b^2-4ac} \over 2a}\)</h2>""",
),
QuizOption(
"id_3",
r""" <h2>(C) \(x = {-b \pm \sqrt{b^2-4ac} \over 2a}\)</h2>""",
),
QuizOption(
"id_4",
r""" <h2>(D) \(x = {-b + \sqrt{b^2+4ac} \over 2a}\)</h2>""",
),
],
correctOptionId: "id_3",
),
Quiz(
statement:
r"""<h3>Choose the correct mathematical form of Bohr's Radius.</h3>""",
options: [
QuizOption(
"id_1",
r""" <h2>(A) \( a_0 = \frac{{\hbar ^2 }}{{m_e ke^2 }} \)</h2>""",
),
QuizOption(
"id_2",
r""" <h2>(B) \( a_0 = \frac{{\hbar ^2 }}{{m_e ke^3 }} \)</h2>""",
),
QuizOption(
"id_3",
r""" <h2>(C) \( a_0 = \frac{{\hbar ^3 }}{{m_e ke^2 }} \)</h2>""",
),
QuizOption(
"id_4",
r""" <h2>(D) \( a_0 = \frac{{\hbar }}{{m_e ke^2 }} \)</h2>""",
),
],
correctOptionId: "id_1",
),
Quiz(
statement: r"""<h3>Select the correct Chemical Balanced Equation.</h3>""",
options: [
QuizOption(
"id_1",
r""" <h2>(A) \( \ce{CO + C -> 2 CO} \)</h2>""",
),
QuizOption(
"id_2",
r""" <h2>(B) \( \ce{CO2 + C -> CO} \)</h2>""",
),
QuizOption(
"id_3",
r""" <h2>(C) \( \ce{CO + C -> CO} \)</h2>""",
),
QuizOption(
"id_4",
r""" <h2>(D) \( \ce{CO2 + C -> 2 CO} \)</h2>""",
),
],
correctOptionId: "id_4",
),
];
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
title: const Text("TeXView Quiz"),
),
body: ListView(
physics: const ScrollPhysics(),
children: <Widget>[
Text(
'Quiz ${currentQuizIndex + 1}/${quizList.length}',
style: const TextStyle(fontSize: 20),
textAlign: TextAlign.center,
),
TeXView(
child: TeXViewColumn(children: [
TeXViewDocument(quizList[currentQuizIndex].statement,
style:
const TeXViewStyle(textAlign: TeXViewTextAlign.center)),
TeXViewGroup(
children: quizList[currentQuizIndex]
.options
.map((QuizOption option) {
return TeXViewGroupItem(
rippleEffect: false,
id: option.id,
child: TeXViewDocument(option.option,
style: const TeXViewStyle(
padding: TeXViewPadding.all(10))));
}).toList(),
selectedItemStyle: TeXViewStyle(
borderRadius: const TeXViewBorderRadius.all(10),
border: TeXViewBorder.all(TeXViewBorderDecoration(
borderWidth: 3, borderColor: Colors.green[900])),
margin: const TeXViewMargin.all(10)),
normalItemStyle:
const TeXViewStyle(margin: TeXViewMargin.all(10)),
onTap: (id) {
selectedOptionId = id;
setState(() {
isWrong = false;
});
})
]),
style: const TeXViewStyle(
margin: TeXViewMargin.all(5),
padding: TeXViewPadding.all(10),
borderRadius: TeXViewBorderRadius.all(10),
border: TeXViewBorder.all(
TeXViewBorderDecoration(
borderColor: Colors.blue,
borderStyle: TeXViewBorderStyle.solid,
borderWidth: 5),
),
backgroundColor: Colors.white,
),
// loadingWidgetBuilder: (context) {
// return const Center(
// child: CircularProgressIndicator(),
// );
// },
),
if (isWrong)
const Padding(
padding: EdgeInsets.all(20),
child: Text(
"Wrong answer!!! Please choose a correct option.",
textAlign: TextAlign.center,
style: TextStyle(fontSize: 18, color: Colors.red),
),
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
ElevatedButton(
onPressed: () {
setState(() {
if (currentQuizIndex > 0) {
selectedOptionId = "";
currentQuizIndex--;
}
});
},
child: const Text("Previous"),
),
ElevatedButton(
onPressed: () {
setState(() {
if (selectedOptionId ==
quizList[currentQuizIndex].correctOptionId) {
selectedOptionId = "";
if (currentQuizIndex != quizList.length - 1) {
currentQuizIndex++;
}
} else {
isWrong = true;
}
});
},
child: const Text("Next"),
),
],
)
],
),
);
}
} error:
|
Any solutions here? |
Please update your Flutter SDK to at least |
I had the same issue, fixed by updating flutter, thanks |
Not sure if you your problem only happens on ios If so please see Readme>How to use?>ios |
@RyanChan548
Is it working for you? if yes, which platform? |
I work on android |
@RyanChan548 But there is anotther crash which i was getting in older version as well because of which i updated the package.
This is inside the package, if i change the function to runJavascript as suggested in the error log, the error goes away. If you have any idea on this, it will be really helpful. Otherwise i will have to mute this in crashlytics. Any suggestions are appreciated. |
@deepakjoshi17 I don't see this issue on my side but I just updated it as mentioned, please update your package to PS: I assume you're facing this issue on iOS and I don't have a MAC machine so I can't verify it. |
../.pub-cache/hosted/pub.dev/flutter_tex-4.0.10/lib/src/utils/tex_rendering_server.dart:19:11: Error: Undefined name 'LocalHostServer'.
await LocalHostServer.start(port: port);
^^^^^^^^^^^^^^^
../.pub-cache/hosted/pub.dev/flutter_tex-4.0.10/lib/src/utils/tex_rendering_server.dart:20:14: Error: Undefined name 'LocalHostServer'.
server = LocalHostServer.server;
^^^^^^^^^^^^^^^
../.pub-cache/hosted/pub.dev/flutter_tex-4.0.10/lib/src/utils/tex_rendering_server.dart:65:11: Error: Undefined name 'LocalHostServer'.
await LocalHostServer.close();
^^^^^^^^^^^^^^^
../.pub-cache/hosted/pub.dev/flutter_tex-4.0.10/lib/src/utils/style_utils.dart:8:27: Error: The getter 'r' isn't defined for the class 'Color'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'r'.
return "rgba(${((color?.r ?? 0) * 255).toInt()}, ${((color?.g ?? 0) * 255).toInt()}, ${((color?.b ?? 0) * 255).toInt()}, ${((color?.a ?? 0) * 255).toInt()})";
^
../.pub-cache/hosted/pub.dev/flutter_tex-4.0.10/lib/src/utils/style_utils.dart:8:63: Error: The getter 'g' isn't defined for the class 'Color'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'g'.
return "rgba(${((color?.r ?? 0) * 255).toInt()}, ${((color?.g ?? 0) * 255).toInt()}, ${((color?.b ?? 0) * 255).toInt()}, ${((color?.a ?? 0) * 255).toInt()})";
^
../.pub-cache/hosted/pub.dev/flutter_tex-4.0.10/lib/src/utils/style_utils.dart:8:99: Error: The getter 'b' isn't defined for the class 'Color'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'b'.
return "rgba(${((color?.r ?? 0) * 255).toInt()}, ${((color?.g ?? 0) * 255).toInt()}, ${((color?.b ?? 0) * 255).toInt()}, ${((color?.a ?? 0) * 255).toInt()})";
^
../.pub-cache/hosted/pub.dev/flutter_tex-4.0.10/lib/src/utils/style_utils.dart:8:135: Error: The getter 'a' isn't defined for the class 'Color'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'a'.
return "rgba(${((color?.r ?? 0) * 255).toInt()}, ${((color?.g ?? 0) * 255).toInt()}, ${((color?.b ?? 0) * 255).toInt()}, ${((color?.a ?? 0) * 255).toInt()})";
^
Target kernel_snapshot_program failed: Exception
The text was updated successfully, but these errors were encountered: