💄 Optimize and bug fixes
This commit is contained in:
@@ -97,7 +97,6 @@
|
||||
EA2DD3AF98ED146A30B33E80 /* Pods-RunnerTests.release.xcconfig */,
|
||||
BAC0E182EE058A579F8BAF8B /* Pods-RunnerTests.profile.xcconfig */,
|
||||
);
|
||||
name = Pods;
|
||||
path = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
@@ -474,6 +473,7 @@
|
||||
DEVELOPMENT_TEAM = W7HPZ53V6B;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
INFOPLIST_KEY_CFBundleDisplayName = SimpleMathCalc;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
@@ -657,6 +657,7 @@
|
||||
DEVELOPMENT_TEAM = W7HPZ53V6B;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
INFOPLIST_KEY_CFBundleDisplayName = SimpleMathCalc;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
@@ -680,6 +681,7 @@
|
||||
DEVELOPMENT_TEAM = W7HPZ53V6B;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
INFOPLIST_KEY_CFBundleDisplayName = SimpleMathCalc;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
|
@@ -104,6 +104,7 @@ class _CalculatorHomePageState extends State<CalculatorHomePage> {
|
||||
floatingLabelAlignment: FloatingLabelAlignment.center,
|
||||
hintText: '例如: 2x^2 - 8x + 6 = 0',
|
||||
),
|
||||
keyboardType: TextInputType.number,
|
||||
onSubmitted: (_) => _solveEquation(),
|
||||
),
|
||||
),
|
||||
@@ -159,7 +160,18 @@ class _CalculatorHomePageState extends State<CalculatorHomePage> {
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
SelectableText(step.explanation),
|
||||
if (!step.explanation.contains(r'$'))
|
||||
SelectableText(
|
||||
step.explanation,
|
||||
textAlign: TextAlign.center,
|
||||
)
|
||||
else
|
||||
LaTexT(
|
||||
laTeXCode: Text(
|
||||
step.explanation,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
Center(
|
||||
child: LaTexT(
|
||||
laTeXCode: Text(
|
||||
@@ -182,6 +194,7 @@ class _CalculatorHomePageState extends State<CalculatorHomePage> {
|
||||
backgroundColor: Theme.of(
|
||||
context,
|
||||
).colorScheme.primary,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||
label: Text(
|
||||
step.stepNumber.toString(),
|
||||
style: TextStyle(fontSize: 32),
|
||||
@@ -229,27 +242,132 @@ class _CalculatorHomePageState extends State<CalculatorHomePage> {
|
||||
elevation: 8,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
spacing: 16,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
onPressed: () => _insertSymbol('('),
|
||||
child: Text('(', style: GoogleFonts.robotoMono()),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
spacing: 16,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Tooltip(
|
||||
message: '左括号',
|
||||
child: FilledButton.tonal(
|
||||
onPressed: () => _insertSymbol('('),
|
||||
child: Text('(', style: GoogleFonts.robotoMono()),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Tooltip(
|
||||
message: '右括号',
|
||||
child: FilledButton.tonal(
|
||||
onPressed: () => _insertSymbol(')'),
|
||||
child: Text(')', style: GoogleFonts.robotoMono()),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Tooltip(
|
||||
message: '幂符号',
|
||||
child: FilledButton.tonal(
|
||||
onPressed: () => _insertSymbol('^'),
|
||||
child: Text('^', style: GoogleFonts.robotoMono()),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Tooltip(
|
||||
message: '平方',
|
||||
child: FilledButton.tonal(
|
||||
onPressed: () => _insertSymbol('^2'),
|
||||
child: Text('^2', style: GoogleFonts.robotoMono()),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Tooltip(
|
||||
message: '未知数',
|
||||
child: FilledButton.tonal(
|
||||
onPressed: () => _insertSymbol('x'),
|
||||
child: Text('x', style: GoogleFonts.robotoMono()),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
onPressed: () => _insertSymbol(')'),
|
||||
child: Text(')', style: GoogleFonts.robotoMono()),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
spacing: 16,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Tooltip(
|
||||
message: '加法',
|
||||
child: FilledButton.tonal(
|
||||
onPressed: () => _insertSymbol('+'),
|
||||
child: Text('+', style: GoogleFonts.robotoMono()),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Tooltip(
|
||||
message: '减法',
|
||||
child: FilledButton.tonal(
|
||||
onPressed: () => _insertSymbol('-'),
|
||||
child: Text('-', style: GoogleFonts.robotoMono()),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Tooltip(
|
||||
message: '乘法',
|
||||
child: FilledButton.tonal(
|
||||
onPressed: () => _insertSymbol('*'),
|
||||
child: Text('*', style: GoogleFonts.robotoMono()),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Tooltip(
|
||||
message: '除法',
|
||||
child: FilledButton.tonal(
|
||||
onPressed: () => _insertSymbol('/'),
|
||||
child: Text('/', style: GoogleFonts.robotoMono()),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Tooltip(
|
||||
message: '小数点',
|
||||
child: FilledButton.tonal(
|
||||
onPressed: () => _insertSymbol('.'),
|
||||
child: Text('.', style: GoogleFonts.robotoMono()),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Tooltip(
|
||||
message: '等于号',
|
||||
child: FilledButton.tonal(
|
||||
onPressed: () => _insertSymbol('='),
|
||||
child: Text('=', style: GoogleFonts.robotoMono()),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
onPressed: () => _insertSymbol('^'),
|
||||
child: Text('^', style: GoogleFonts.robotoMono()),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: FilledButton.icon(
|
||||
icon: const Icon(Icons.keyboard_hide),
|
||||
onPressed: () => _focusNode.unfocus(),
|
||||
label: Text('收起键盘'),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@@ -149,7 +149,7 @@ class SolverService {
|
||||
CalculationStep(
|
||||
stepNumber: 1,
|
||||
title: '整理方程',
|
||||
explanation: r'将方程整理成标准形式 ax^2+bx+c=0。',
|
||||
explanation: r'将方程整理成标准形式 $ax^2+bx+c=0$。',
|
||||
formula:
|
||||
'\$\$${a}x^2 ${b >= 0 ? '+' : ''} ${b}x ${c >= 0 ? '+' : ''} $c = 0\$\$',
|
||||
),
|
||||
|
Reference in New Issue
Block a user