Procházet zdrojové kódy

去掉计算器页的绘图按钮

绘图只保留在工具页(函数图像绘制 / 参数方程绘图)和控制台的 plot 命令。
计算器顶栏现在只剩:精确/近似 和 函数面板。

Co-Authored-By: Claude Code <noreply@anthropic.com>
nonvioce před 4 týdny
rodič
revize
9c5afa2262
1 změnil soubory, kde provedl 0 přidání a 45 odebrání
  1. 0 45
      lib/calculator_page.dart

+ 0 - 45
lib/calculator_page.dart

@@ -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),