|
@@ -458,21 +458,25 @@ class _CalculatorPageState extends State<CalculatorPage> {
|
|
|
return LayoutBuilder(
|
|
return LayoutBuilder(
|
|
|
builder: (context, box) {
|
|
builder: (context, box) {
|
|
|
final rows = <List<_Key>>[
|
|
final rows = <List<_Key>>[
|
|
|
- // 1 大运算符
|
|
|
|
|
|
|
+ // 1 大运算符。∫ 收在 d/dx 的 shift 里 —— 求和/求积一层、求导/求积分一层,
|
|
|
|
|
+ // 同族的放一起,比原来"∫ 自己一个键、shift 却是 ∏"顺。
|
|
|
[
|
|
[
|
|
|
- _Key('∫', _Act.bigOp, payload: 'Integrate', prefill: ['x'],
|
|
|
|
|
|
|
+ _Key('Σ', _Act.bigOp,
|
|
|
|
|
+ payload: 'Sum', prefill: ['n', '1', 'Infinity'],
|
|
|
shifted: _Key('∏', _Act.bigOp,
|
|
shifted: _Key('∏', _Act.bigOp,
|
|
|
payload: 'Product', prefill: ['n', '1', 'Infinity'])),
|
|
payload: 'Product', prefill: ['n', '1', 'Infinity'])),
|
|
|
- _Key('Σ', _Act.bigOp,
|
|
|
|
|
- payload: 'Sum', prefill: ['n', '1', 'Infinity']),
|
|
|
|
|
- _Key('d/dx', _Act.fnPrefixed, payload: 'D', prefill: ['', 'x']),
|
|
|
|
|
|
|
+ _Key('d/dx', _Act.fnPrefixed, payload: 'D', prefill: ['', 'x'],
|
|
|
|
|
+ shifted: _Key('∫', _Act.bigOp,
|
|
|
|
|
+ payload: 'Integrate', prefill: ['x'])),
|
|
|
_Key('lim', _Act.bigOp, payload: 'Limit', prefill: ['x', '0']),
|
|
_Key('lim', _Act.bigOp, payload: 'Limit', prefill: ['x', '0']),
|
|
|
_Key('solve', _Act.fnPrefixed, payload: 'Solve',
|
|
_Key('solve', _Act.fnPrefixed, payload: 'Solve',
|
|
|
prefill: ['', 'x'],
|
|
prefill: ['', 'x'],
|
|
|
shifted: _Key('nsolve', _Act.fnPrefixed, payload: 'NSolve',
|
|
shifted: _Key('nsolve', _Act.fnPrefixed, payload: 'NSolve',
|
|
|
prefill: ['', 'x'])),
|
|
prefill: ['', 'x'])),
|
|
|
|
|
+ _Key('√', _Act.sqrt,
|
|
|
|
|
+ shifted: _Key('|x|', _Act.fn, payload: 'Abs')),
|
|
|
],
|
|
],
|
|
|
- // 2 常用函数
|
|
|
|
|
|
|
+ // 2 函数。! 也放这排(它本来就是个函数),shift 是组合数
|
|
|
[
|
|
[
|
|
|
_Key('sin', _Act.fn, payload: 'Sin',
|
|
_Key('sin', _Act.fn, payload: 'Sin',
|
|
|
shifted: _Key('asin', _Act.fn, payload: 'ArcSin')),
|
|
shifted: _Key('asin', _Act.fn, payload: 'ArcSin')),
|
|
@@ -482,29 +486,25 @@ class _CalculatorPageState extends State<CalculatorPage> {
|
|
|
shifted: _Key('atan', _Act.fn, payload: 'ArcTan')),
|
|
shifted: _Key('atan', _Act.fn, payload: 'ArcTan')),
|
|
|
_Key('ln', _Act.fn, payload: 'Log',
|
|
_Key('ln', _Act.fn, payload: 'Log',
|
|
|
shifted: _Key('lg', _Act.fn, payload: 'Log10')),
|
|
shifted: _Key('lg', _Act.fn, payload: 'Log10')),
|
|
|
- _Key('√', _Act.sqrt,
|
|
|
|
|
- shifted: _Key('|x|', _Act.fn, payload: 'Abs')),
|
|
|
|
|
- ],
|
|
|
|
|
- // 3 变量
|
|
|
|
|
- [
|
|
|
|
|
- _Key('x', _Act.char, payload: 'x', mathVar: true),
|
|
|
|
|
- _Key('y', _Act.char, payload: 'y', mathVar: true),
|
|
|
|
|
- _Key('a', _Act.char, payload: 'a', mathVar: true),
|
|
|
|
|
- _Key('t', _Act.char, payload: 't', mathVar: true),
|
|
|
|
|
- _Key('n', _Act.char, payload: 'n', mathVar: true),
|
|
|
|
|
|
|
+ _Key('!', _Act.postfix,
|
|
|
|
|
+ shifted: _Key('C', _Act.fnPrefixed,
|
|
|
|
|
+ payload: 'Binomial', prefill: ['', ''])),
|
|
|
],
|
|
],
|
|
|
- // 4 运算符:解方程、赋值、代入、定义函数全靠它们。
|
|
|
|
|
- // 都是"运算符"不是"函数",所以放键盘上而不是函数面板里。
|
|
|
|
|
|
|
+ // 3 变量。原来那排运算符(赋值、等号、代入、逗号、矩阵)收进它们的 shift,
|
|
|
|
|
+ // 于是整排省掉一个 —— 键盘从 9 排压到 8 排,键也更高。
|
|
|
[
|
|
[
|
|
|
- _Key('=', _Act.char, payload: '=', tint: true),
|
|
|
|
|
- _Key('==', _Act.char, payload: '==', tint: true),
|
|
|
|
|
- // /. 和 -> 永远成对出现(代入就是 `式子 /. x -> 值`),
|
|
|
|
|
- // 合成一个键直接给出骨架,省一个位置给逗号(矩阵行分隔)
|
|
|
|
|
- _Key('/.→', _Act.subst, tint: true),
|
|
|
|
|
- _Key(',', _Act.comma),
|
|
|
|
|
- _Key('{', _Act.brace, tint: true),
|
|
|
|
|
|
|
+ _Key('x', _Act.char, payload: 'x', mathVar: true,
|
|
|
|
|
+ shifted: _Key('=', _Act.char, payload: '=', tint: true)),
|
|
|
|
|
+ _Key('y', _Act.char, payload: 'y', mathVar: true,
|
|
|
|
|
+ shifted: _Key('==', _Act.char, payload: '==', tint: true)),
|
|
|
|
|
+ _Key('a', _Act.char, payload: 'a', mathVar: true,
|
|
|
|
|
+ shifted: _Key('/.→', _Act.subst, tint: true)),
|
|
|
|
|
+ _Key('t', _Act.char, payload: 't', mathVar: true,
|
|
|
|
|
+ shifted: _Key(',', _Act.comma)),
|
|
|
|
|
+ _Key('n', _Act.char, payload: 'n', mathVar: true,
|
|
|
|
|
+ shifted: _Key('{', _Act.brace, tint: true)),
|
|
|
],
|
|
],
|
|
|
- // 5 数字与括号
|
|
|
|
|
|
|
+ // 4 数字与括号
|
|
|
[
|
|
[
|
|
|
_Key('7', _Act.char, payload: '7', mergeDigit: true),
|
|
_Key('7', _Act.char, payload: '7', mergeDigit: true),
|
|
|
_Key('8', _Act.char, payload: '8', mergeDigit: true),
|
|
_Key('8', _Act.char, payload: '8', mergeDigit: true),
|
|
@@ -512,9 +512,7 @@ class _CalculatorPageState extends State<CalculatorPage> {
|
|
|
_Key('(', _Act.group,
|
|
_Key('(', _Act.group,
|
|
|
shifted: _Key('P', _Act.fnPrefixed,
|
|
shifted: _Key('P', _Act.fnPrefixed,
|
|
|
payload: 'FactorialPower', prefill: ['', ''])),
|
|
payload: 'FactorialPower', prefill: ['', ''])),
|
|
|
- _Key('!', _Act.postfix,
|
|
|
|
|
- shifted: _Key('C', _Act.fnPrefixed,
|
|
|
|
|
- payload: 'Binomial', prefill: ['', ''])),
|
|
|
|
|
|
|
+ _Key('π', _Act.char, payload: 'Pi', tint: true, display: 'π'),
|
|
|
],
|
|
],
|
|
|
[
|
|
[
|
|
|
_Key('4', _Act.char, payload: '4', mergeDigit: true),
|
|
_Key('4', _Act.char, payload: '4', mergeDigit: true),
|
|
@@ -530,22 +528,20 @@ class _CalculatorPageState extends State<CalculatorPage> {
|
|
|
_Key('+', _Act.char, payload: '+'),
|
|
_Key('+', _Act.char, payload: '+'),
|
|
|
_Key('−', _Act.char, payload: '-'),
|
|
_Key('−', _Act.char, payload: '-'),
|
|
|
],
|
|
],
|
|
|
- // 7 花括号:矩阵用
|
|
|
|
|
[
|
|
[
|
|
|
_Key('0', _Act.char, payload: '0', mergeDigit: true),
|
|
_Key('0', _Act.char, payload: '0', mergeDigit: true),
|
|
|
_Key('.', _Act.char, payload: '.', mergeDigit: true),
|
|
_Key('.', _Act.char, payload: '.', mergeDigit: true),
|
|
|
_Key('^', _Act.power),
|
|
_Key('^', _Act.power),
|
|
|
// 常量。编辑框显示 π / e,送进引擎的是 Pi / E(和 ANS 同一套机制)
|
|
// 常量。编辑框显示 π / e,送进引擎的是 Pi / E(和 ANS 同一套机制)
|
|
|
- _Key('π', _Act.char, payload: 'Pi', tint: true, display: 'π'),
|
|
|
|
|
_Key('e', _Act.char, payload: 'E', tint: true, display: 'e'),
|
|
_Key('e', _Act.char, payload: 'E', tint: true, display: 'e'),
|
|
|
|
|
+ // 虚数单位。送进 Symja 的是 I,编辑框里显示小写 i
|
|
|
|
|
+ _Key('i', _Act.char, payload: 'I', tint: true, display: 'i'),
|
|
|
],
|
|
],
|
|
|
[
|
|
[
|
|
|
// ⇧ 开着的时候这个键是深色的 —— 一眼能看出"现在是 shift 层"
|
|
// ⇧ 开着的时候这个键是深色的 —— 一眼能看出"现在是 shift 层"
|
|
|
_Key('⇧', _Act.shift, tint: true, primary: _shift),
|
|
_Key('⇧', _Act.shift, tint: true, primary: _shift),
|
|
|
_Key('⌫', _Act.back, tint: true),
|
|
_Key('⌫', _Act.back, tint: true),
|
|
|
_Key('CLR', _Act.clear, tint: true),
|
|
_Key('CLR', _Act.clear, tint: true),
|
|
|
- // 虚数单位。送进 Symja 的是 I,编辑框里显示小写 i
|
|
|
|
|
- _Key('i', _Act.char, payload: 'I', tint: true, display: 'i'),
|
|
|
|
|
_Key('ANS', _Act.char, payload: '%', tint: true, display: 'ANS'),
|
|
_Key('ANS', _Act.char, payload: '%', tint: true, display: 'ANS'),
|
|
|
// 键盘负责"敲字符",✓ 负责"执行"。两者都叫 = 会撞车。
|
|
// 键盘负责"敲字符",✓ 负责"执行"。两者都叫 = 会撞车。
|
|
|
_Key('✓', _Act.commit, primary: true),
|
|
_Key('✓', _Act.commit, primary: true),
|