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