|
|
@@ -5,7 +5,6 @@ import 'package:flutter/services.dart';
|
|
|
import 'package:flutter_math_fork/flutter_math.dart';
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
-import 'curve_plot.dart';
|
|
|
import 'expr_editor.dart';
|
|
|
import 'expr_node.dart';
|
|
|
import 'expr_parse.dart';
|
|
|
@@ -208,45 +207,6 @@ class _CalculatorPageState extends State<CalculatorPage> {
|
|
|
await session.refreshVariables();
|
|
|
}
|
|
|
|
|
|
- Future<void> _plotCurrent() async {
|
|
|
- final expr = _source;
|
|
|
- if (expr.isEmpty || expr == 'Null') return;
|
|
|
- final session = context.read<SymjaSession>();
|
|
|
- final messenger = ScaffoldMessenger.of(context);
|
|
|
- try {
|
|
|
- final s = await session.sample(expr, from: -6.3, to: 6.3, count: 240);
|
|
|
- if (!mounted) return;
|
|
|
- await showDialog<void>(
|
|
|
- context: context,
|
|
|
- builder: (_) => AlertDialog(
|
|
|
- title: Text('$expr (${s.ys.length} 点,${s.elapsedMs} ms)'),
|
|
|
- content: SizedBox(
|
|
|
- width: 360,
|
|
|
- height: 420,
|
|
|
- child: CurvePlot(series: [
|
|
|
- CurveSeries(
|
|
|
- label: expr,
|
|
|
- color: const Color(0xFF3F51B5),
|
|
|
- points: [
|
|
|
- for (var i = 0; i < s.ys.length; i++)
|
|
|
- Offset(s.xAt(i), s.ys[i]),
|
|
|
- ],
|
|
|
- ),
|
|
|
- ]),
|
|
|
- ),
|
|
|
- actions: [
|
|
|
- TextButton(
|
|
|
- onPressed: () => Navigator.pop(context),
|
|
|
- child: const Text('关闭'),
|
|
|
- ),
|
|
|
- ],
|
|
|
- ),
|
|
|
- );
|
|
|
- } on SymjaException catch (e) {
|
|
|
- messenger.showSnackBar(SnackBar(content: Text('$e')));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
// ------------------------------------------------------------------ 按键
|
|
|
|
|
|
void _press(_Key k) {
|
|
|
@@ -345,11 +305,6 @@ class _CalculatorPageState extends State<CalculatorPage> {
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
- IconButton(
|
|
|
- tooltip: '画图(x ∈ [-6.3, 6.3])',
|
|
|
- icon: const Icon(Icons.show_chart),
|
|
|
- onPressed: _plotCurrent,
|
|
|
- ),
|
|
|
IconButton(
|
|
|
tooltip: '函数面板',
|
|
|
icon: const Icon(Icons.functions),
|