✨ Latex steps
This commit is contained in:
		
							
								
								
									
										43
									
								
								ios/Podfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								ios/Podfile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,43 @@ | ||||
| # Uncomment this line to define a global platform for your project | ||||
| # platform :ios, '13.0' | ||||
|  | ||||
| # CocoaPods analytics sends network stats synchronously affecting flutter build latency. | ||||
| ENV['COCOAPODS_DISABLE_STATS'] = 'true' | ||||
|  | ||||
| project 'Runner', { | ||||
|   'Debug' => :debug, | ||||
|   'Profile' => :release, | ||||
|   'Release' => :release, | ||||
| } | ||||
|  | ||||
| def flutter_root | ||||
|   generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) | ||||
|   unless File.exist?(generated_xcode_build_settings_path) | ||||
|     raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" | ||||
|   end | ||||
|  | ||||
|   File.foreach(generated_xcode_build_settings_path) do |line| | ||||
|     matches = line.match(/FLUTTER_ROOT\=(.*)/) | ||||
|     return matches[1].strip if matches | ||||
|   end | ||||
|   raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" | ||||
| end | ||||
|  | ||||
| require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) | ||||
|  | ||||
| flutter_ios_podfile_setup | ||||
|  | ||||
| target 'Runner' do | ||||
|   use_frameworks! | ||||
|  | ||||
|   flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) | ||||
|   target 'RunnerTests' do | ||||
|     inherit! :search_paths | ||||
|   end | ||||
| end | ||||
|  | ||||
| post_install do |installer| | ||||
|   installer.pods_project.targets.each do |target| | ||||
|     flutter_additional_ios_build_settings(target) | ||||
|   end | ||||
| end | ||||
| @@ -1,10 +1,9 @@ | ||||
| import 'package:flutter/material.dart'; | ||||
| // 稍后我们会创建这个 SolverService | ||||
| import 'solver_service.dart'; | ||||
| // 引入我们的数据模型 | ||||
| import 'models/calculation_step.dart'; | ||||
| import 'package:latext/latext.dart'; | ||||
| import 'package:simple_math_calc/models/calculation_step.dart'; | ||||
| import 'package:simple_math_calc/solver_service.dart'; | ||||
|  | ||||
| void main() { | ||||
| void main() async { | ||||
|   runApp(const MyApp()); | ||||
| } | ||||
|  | ||||
| @@ -116,17 +115,9 @@ class _CalculatorHomePageState extends State<CalculatorHomePage> { | ||||
|                     style: Theme.of(context).textTheme.titleMedium, | ||||
|                   ), | ||||
|                   const SizedBox(height: 4), | ||||
|                   Text(step.explanation), | ||||
|                   SelectableText(step.explanation), | ||||
|                   const SizedBox(height: 8), | ||||
|                   Center( | ||||
|                     child: Text( | ||||
|                       step.formula, | ||||
|                       style: const TextStyle( | ||||
|                         fontSize: 16, | ||||
|                         fontWeight: FontWeight.bold, | ||||
|                       ), | ||||
|                     ), | ||||
|                   ), | ||||
|                   Center(child: LaTexT(laTeXCode: Text(step.formula))), | ||||
|                 ], | ||||
|               ), | ||||
|             ), | ||||
| @@ -137,12 +128,17 @@ class _CalculatorHomePageState extends State<CalculatorHomePage> { | ||||
|           color: Theme.of(context).colorScheme.primaryContainer, | ||||
|           child: Padding( | ||||
|             padding: const EdgeInsets.all(16.0), | ||||
|             child: Text( | ||||
|               "最终答案: ${result.finalAnswer}", | ||||
|             child: Column( | ||||
|               children: [ | ||||
|                 Text( | ||||
|                   "最终答案:", | ||||
|                   style: Theme.of(context).textTheme.titleLarge?.copyWith( | ||||
|                     color: Theme.of(context).colorScheme.onPrimaryContainer, | ||||
|                   ), | ||||
|               textAlign: TextAlign.center, | ||||
|                 ), | ||||
|                 const SizedBox(height: 8), | ||||
|                 LaTexT(laTeXCode: Text(result.finalAnswer)), | ||||
|               ], | ||||
|             ), | ||||
|           ), | ||||
|         ), | ||||
|   | ||||
| @@ -144,7 +144,7 @@ class SolverService { | ||||
|     steps.add( | ||||
|       CalculationStep( | ||||
|         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\$\$', | ||||
|       ), | ||||
|   | ||||
| @@ -1 +1,2 @@ | ||||
| #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" | ||||
| #include "ephemeral/Flutter-Generated.xcconfig" | ||||
|   | ||||
| @@ -1 +1,2 @@ | ||||
| #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" | ||||
| #include "ephemeral/Flutter-Generated.xcconfig" | ||||
|   | ||||
							
								
								
									
										42
									
								
								macos/Podfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								macos/Podfile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,42 @@ | ||||
| platform :osx, '10.15' | ||||
|  | ||||
| # CocoaPods analytics sends network stats synchronously affecting flutter build latency. | ||||
| ENV['COCOAPODS_DISABLE_STATS'] = 'true' | ||||
|  | ||||
| project 'Runner', { | ||||
|   'Debug' => :debug, | ||||
|   'Profile' => :release, | ||||
|   'Release' => :release, | ||||
| } | ||||
|  | ||||
| def flutter_root | ||||
|   generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) | ||||
|   unless File.exist?(generated_xcode_build_settings_path) | ||||
|     raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" | ||||
|   end | ||||
|  | ||||
|   File.foreach(generated_xcode_build_settings_path) do |line| | ||||
|     matches = line.match(/FLUTTER_ROOT\=(.*)/) | ||||
|     return matches[1].strip if matches | ||||
|   end | ||||
|   raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" | ||||
| end | ||||
|  | ||||
| require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) | ||||
|  | ||||
| flutter_macos_podfile_setup | ||||
|  | ||||
| target 'Runner' do | ||||
|   use_frameworks! | ||||
|  | ||||
|   flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) | ||||
|   target 'RunnerTests' do | ||||
|     inherit! :search_paths | ||||
|   end | ||||
| end | ||||
|  | ||||
| post_install do |installer| | ||||
|   installer.pods_project.targets.each do |target| | ||||
|     flutter_additional_macos_build_settings(target) | ||||
|   end | ||||
| end | ||||
							
								
								
									
										130
									
								
								pubspec.lock
									
									
									
									
									
								
							
							
						
						
									
										130
									
								
								pubspec.lock
									
									
									
									
									
								
							| @@ -1,6 +1,14 @@ | ||||
| # Generated by pub | ||||
| # See https://dart.dev/tools/pub/glossary#lockfile | ||||
| packages: | ||||
|   args: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: args | ||||
|       sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "2.7.0" | ||||
|   async: | ||||
|     dependency: transitive | ||||
|     description: | ||||
| @@ -70,11 +78,51 @@ packages: | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "5.0.0" | ||||
|   flutter_math_fork: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: flutter_math_fork | ||||
|       sha256: "6d5f2f1aa57ae539ffb0a04bb39d2da67af74601d685a161aff7ce5bda5fa407" | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "0.7.4" | ||||
|   flutter_svg: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: flutter_svg | ||||
|       sha256: b9c2ad5872518a27507ab432d1fb97e8813b05f0fc693f9d40fad06d073e0678 | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "2.2.1" | ||||
|   flutter_test: | ||||
|     dependency: "direct dev" | ||||
|     description: flutter | ||||
|     source: sdk | ||||
|     version: "0.0.0" | ||||
|   http: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: http | ||||
|       sha256: bb2ce4590bc2667c96f318d68cac1b5a7987ec819351d32b1c987239a815e007 | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "1.5.0" | ||||
|   http_parser: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: http_parser | ||||
|       sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "4.1.2" | ||||
|   latext: | ||||
|     dependency: "direct main" | ||||
|     description: | ||||
|       name: latext | ||||
|       sha256: "4dc2e3b8436cf8bce2d74b3af53055d56b9dc83c816fec5cf1c8f2789bf89a64" | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "0.5.1" | ||||
|   leak_tracker: | ||||
|     dependency: transitive | ||||
|     description: | ||||
| @@ -139,6 +187,14 @@ packages: | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "1.16.0" | ||||
|   nested: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: nested | ||||
|       sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "1.0.0" | ||||
|   path: | ||||
|     dependency: transitive | ||||
|     description: | ||||
| @@ -147,6 +203,14 @@ packages: | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "1.9.1" | ||||
|   path_parsing: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: path_parsing | ||||
|       sha256: "883402936929eac138ee0a45da5b0f2c80f89913e6dc3bf77eb65b84b409c6ca" | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "1.1.0" | ||||
|   petitparser: | ||||
|     dependency: transitive | ||||
|     description: | ||||
| @@ -155,6 +219,14 @@ packages: | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "6.1.0" | ||||
|   provider: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: provider | ||||
|       sha256: "4e82183fa20e5ca25703ead7e05de9e4cceed1fbd1eadc1ac3cb6f565a09f272" | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "6.1.5+1" | ||||
|   sky_engine: | ||||
|     dependency: transitive | ||||
|     description: flutter | ||||
| @@ -208,6 +280,46 @@ packages: | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "0.7.6" | ||||
|   tuple: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: tuple | ||||
|       sha256: a97ce2013f240b2f3807bcbaf218765b6f301c3eff91092bcfa23a039e7dd151 | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "2.0.2" | ||||
|   typed_data: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: typed_data | ||||
|       sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "1.4.0" | ||||
|   vector_graphics: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: vector_graphics | ||||
|       sha256: a4f059dc26fc8295b5921376600a194c4ec7d55e72f2fe4c7d2831e103d461e6 | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "1.1.19" | ||||
|   vector_graphics_codec: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: vector_graphics_codec | ||||
|       sha256: "99fd9fbd34d9f9a32efd7b6a6aae14125d8237b10403b422a6a6dfeac2806146" | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "1.1.13" | ||||
|   vector_graphics_compiler: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: vector_graphics_compiler | ||||
|       sha256: d354a7ec6931e6047785f4db12a1f61ec3d43b207fc0790f863818543f8ff0dc | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "1.1.19" | ||||
|   vector_math: | ||||
|     dependency: transitive | ||||
|     description: | ||||
| @@ -224,6 +336,22 @@ packages: | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "15.0.2" | ||||
|   web: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: web | ||||
|       sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "1.1.1" | ||||
|   xml: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: xml | ||||
|       sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "6.5.0" | ||||
| sdks: | ||||
|   dart: ">=3.9.2 <4.0.0" | ||||
|   flutter: ">=3.18.0-18.0.pre.54" | ||||
|   flutter: ">=3.29.0" | ||||
|   | ||||
| @@ -35,6 +35,7 @@ dependencies: | ||||
|   # Use with the CupertinoIcons class for iOS style icons. | ||||
|   cupertino_icons: ^1.0.8 | ||||
|   math_expressions: ^3.0.0 | ||||
|   latext: ^0.5.1 | ||||
|  | ||||
| dev_dependencies: | ||||
|   flutter_test: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user