├── .gitignore ├── .metadata ├── README.md ├── android ├── .gitignore ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── flash_tron_wallet │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── values │ │ │ ├── colors.xml │ │ │ └── styles.xml │ │ │ └── xml │ │ │ └── filepaths.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── asset ├── doc │ ├── ft-wallet01.jpeg │ ├── ft-wallet02.jpeg │ └── ft-wallet03.jpeg ├── font │ ├── PingFangSC-Medium.ttf │ ├── PingFangSC-Regular.ttf │ ├── SF-Pro-Display-Medium.otf │ ├── SF-Pro-Display-Regular.otf │ └── iconfont.ttf └── image │ ├── bg01.png │ ├── bg02.png │ ├── flash-logo.png │ ├── flash.png │ ├── splash.jpg │ └── usd.png ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Podfile ├── Podfile.lock ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings └── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── icon-1024.png │ │ ├── icon-20-ipad.png │ │ ├── icon-20@2x-ipad.png │ │ ├── icon-20@2x.png │ │ ├── icon-20@3x.png │ │ ├── icon-29-ipad.png │ │ ├── icon-29.png │ │ ├── icon-29@2x-ipad.png │ │ ├── icon-29@2x.png │ │ ├── icon-29@3x.png │ │ ├── icon-40.png │ │ ├── icon-40@2x.png │ │ ├── icon-40@3x.png │ │ ├── icon-60@2x.png │ │ ├── icon-60@3x.png │ │ ├── icon-76.png │ │ ├── icon-76@2x.png │ │ └── icon-83.5@2x.png │ └── LaunchImage.imageset │ │ ├── Contents.json │ │ ├── LaunchImage.png │ │ ├── LaunchImage@2x.png │ │ ├── LaunchImage@3x.png │ │ └── README.md │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── Runner-Bridging-Header.h ├── lib ├── common │ ├── config │ │ └── common_config.dart │ ├── enum │ │ ├── detail_wallet_type.dart │ │ ├── import_wallet_type.dart │ │ ├── mine_type.dart │ │ ├── swap_type.dart │ │ └── text_type.dart │ ├── util │ │ ├── color_util.dart │ │ ├── common_util.dart │ │ ├── http_util.dart │ │ ├── icon_util.dart │ │ ├── screen_util.dart │ │ └── text_util.dart │ └── widget │ │ ├── common │ │ └── common_widget.dart │ │ ├── scaffold │ │ └── scaffold_widget.dart │ │ └── splash │ │ ├── colorize_animated_text.dart │ │ ├── scale_animated_text.dart │ │ ├── splash_screen_view.dart │ │ └── typer_animated_text.dart ├── entity │ └── tron │ │ ├── abi_entity.dart │ │ ├── asset_entity.dart │ │ └── wallet_entity.dart ├── google │ └── protobuf │ │ └── any.pb.dart ├── index │ ├── asset │ │ ├── add_wallet │ │ │ └── add_wallet_page.dart │ │ ├── asset_page.dart │ │ ├── backup_key │ │ │ └── backup_key_page.dart │ │ ├── backup_mnemonic │ │ │ └── backup_mnemonic_page.dart │ │ ├── build_wallet │ │ │ ├── build_wallet_first_page.dart │ │ │ └── build_wallet_second_page.dart │ │ ├── import_key │ │ │ └── import_key_page.dart │ │ ├── import_mnemonic │ │ │ └── import_mnemonic_page.dart │ │ ├── recevice_token │ │ │ └── receive_token_page.dart │ │ ├── send_token │ │ │ └── send_token_page.dart │ │ ├── update_pwd │ │ │ └── update_pwd_page.dart │ │ └── wallet_detail │ │ │ └── wallet_detail_page.dart │ ├── index_page.dart │ ├── mine │ │ ├── download │ │ │ └── download_page.dart │ │ ├── mine_page.dart │ │ └── wallet_manage │ │ │ └── wallet_manage_page.dart │ ├── qr │ │ └── qr_scan_page.dart │ └── trade │ │ ├── market │ │ └── market_page.dart │ │ ├── swap │ │ └── swap_page.dart │ │ ├── trade_controller.dart │ │ └── trade_page.dart ├── locale │ └── app_Locale.dart ├── main.dart ├── model │ ├── swap_model.dart │ └── tron_info_model.dart ├── provider │ ├── global_injection.dart │ └── global_service.dart ├── route │ └── app_route.dart └── tron │ ├── api │ ├── api.pb.dart │ ├── api.pbenum.dart │ ├── api.pbgrpc.dart │ └── api.pbjson.dart │ ├── core │ ├── Contract.pb.dart │ ├── Contract.pbenum.dart │ ├── Contract.pbjson.dart │ ├── Discover.pb.dart │ ├── Discover.pbenum.dart │ ├── Discover.pbjson.dart │ ├── Tron.pb.dart │ ├── Tron.pbenum.dart │ ├── Tron.pbjson.dart │ ├── TronInventoryItems.pb.dart │ ├── TronInventoryItems.pbenum.dart │ └── TronInventoryItems.pbjson.dart │ ├── grpc │ └── grpc_client.dart │ └── service │ ├── msg_signature.dart │ ├── tron_asset.dart │ ├── tron_swap.dart │ ├── tron_swap_test.dart │ ├── tron_transaction.dart │ └── tron_wallet.dart ├── pubspec.lock ├── pubspec.yaml └── test └── widget_test.dart /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 8874f21e79d7ec66d0457c7ab338348e31b17f1d 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [Flash Finance](https://flash2c.cn/) 2 | 3 | ## Flash Tron Wallet(IOS&Android) 简单、易用、安全 4 | 5 | - 1.数字钱包(创建钱包、导入助记词、导入私钥、备份助记词、备份私钥、代币余额查询、多地址切换管理、转账、收款等) 6 | - 2.聚合交易(聚合JustSwap、 行情价格、资金池、代币兑换) 7 | - 3.聚合借贷(聚合JustLend、借贷) TODO 8 | - 4.中英文切换 9 | - 5.白天和黑夜模式切换 TODO 10 | 11 | image-01image-03 12 | 13 | ## 主要开源插件选型 14 | 15 | - 1.状态和路由管理getx 16 | 17 | - 2.http请求库dio 18 | 19 | - 3.调用公链服务gRPC 20 | 21 | - 4.屏幕适配flutter_screenutil 22 | 23 | - 5.上拉加载下拉刷新flutter_easyrefresh 24 | 25 | - 6.轻提示fluttertoast 26 | 27 | - 7.数据存储shared_preferences 28 | 29 | - 8.生成二维码qr_flutter 30 | 31 | - 9.扫描二维码scan 32 | 33 | - 10.版本更新ota_update 34 | 35 | - 11.获取版本信息package_info 36 | 37 | - 12.获取app路径path_provider 38 | 39 | - 13.加载页面url_launcher 40 | 41 | ## lib目录分层 42 | >common 43 | >>config 配置
44 | >>enum 枚举
45 | >>util 工具
46 | >>widget 组件
47 | 48 | >entity 数据模型
49 | >model 数据模型
50 | 51 | >index 页面相关 52 | >>asset 资产
53 | >>trade 交易
54 | >>mine 我的
55 | 56 | >locale 中英文国际化
57 | >provider 状态管理(调用服务、数据变更)
58 | >route 路由管理
59 | >tron 公链gRPC服务
60 | 61 | >main.dart 执行入口
-------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | def keystorePropertiesFile = rootProject.file("key.properties") 29 | def keystoreProperties = new Properties() 30 | keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) 31 | 32 | android { 33 | compileSdkVersion 29 34 | 35 | sourceSets { 36 | main.java.srcDirs += 'src/main/kotlin' 37 | } 38 | 39 | lintOptions { 40 | disable 'InvalidPackage' 41 | } 42 | 43 | defaultConfig { 44 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 45 | applicationId "com.flash2c.ftwallet" 46 | minSdkVersion 19 47 | targetSdkVersion 29 48 | versionCode flutterVersionCode.toInteger() 49 | versionName flutterVersionName 50 | } 51 | 52 | signingConfigs { 53 | release { 54 | keyAlias keystoreProperties['keyAlias'] 55 | keyPassword keystoreProperties['keyPassword'] 56 | storeFile file(keystoreProperties['storeFile']) 57 | storePassword keystoreProperties['storePassword'] 58 | } 59 | } 60 | buildTypes { 61 | release { 62 | // TODO: Add your own signing config for the release build. 63 | // Signing with the debug keys for now, so `flutter run --release` works. 64 | //signingConfig signingConfigs.debug 65 | signingConfig signingConfigs.release 66 | } 67 | } 68 | } 69 | 70 | flutter { 71 | source '../..' 72 | } 73 | 74 | dependencies { 75 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 76 | } 77 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 12 | 19 | 23 | 24 | 28 | 33 | 37 | 38 | 39 | 40 | 41 | 42 | 44 | 49 | 52 | 53 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/flash_tron_wallet/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.flash_tron_wallet 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FF2676f8 4 | #00000000 5 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 16 | 19 | 20 | -------------------------------------------------------------------------------- /android/app/src/main/res/xml/filepaths.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.50' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.5.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | android.enableR8=true 5 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip 7 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /asset/doc/ft-wallet01.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/asset/doc/ft-wallet01.jpeg -------------------------------------------------------------------------------- /asset/doc/ft-wallet02.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/asset/doc/ft-wallet02.jpeg -------------------------------------------------------------------------------- /asset/doc/ft-wallet03.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/asset/doc/ft-wallet03.jpeg -------------------------------------------------------------------------------- /asset/font/PingFangSC-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/asset/font/PingFangSC-Medium.ttf -------------------------------------------------------------------------------- /asset/font/PingFangSC-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/asset/font/PingFangSC-Regular.ttf -------------------------------------------------------------------------------- /asset/font/SF-Pro-Display-Medium.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/asset/font/SF-Pro-Display-Medium.otf -------------------------------------------------------------------------------- /asset/font/SF-Pro-Display-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/asset/font/SF-Pro-Display-Regular.otf -------------------------------------------------------------------------------- /asset/font/iconfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/asset/font/iconfont.ttf -------------------------------------------------------------------------------- /asset/image/bg01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/asset/image/bg01.png -------------------------------------------------------------------------------- /asset/image/bg02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/asset/image/bg02.png -------------------------------------------------------------------------------- /asset/image/flash-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/asset/image/flash-logo.png -------------------------------------------------------------------------------- /asset/image/flash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/asset/image/flash.png -------------------------------------------------------------------------------- /asset/image/splash.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/asset/image/splash.jpg -------------------------------------------------------------------------------- /asset/image/usd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/asset/image/usd.png -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 9.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Flutter (1.0.0) 3 | - fluttertoast (0.0.2): 4 | - Flutter 5 | - Toast 6 | - FMDB (2.7.5): 7 | - FMDB/standard (= 2.7.5) 8 | - FMDB/standard (2.7.5) 9 | - open_file (0.0.1): 10 | - Flutter 11 | - package_info (0.0.1): 12 | - Flutter 13 | - path_provider (0.0.1): 14 | - Flutter 15 | - scan (0.0.1): 16 | - Flutter 17 | - shared_preferences (0.0.1): 18 | - Flutter 19 | - sqflite (0.0.2): 20 | - Flutter 21 | - FMDB (>= 2.7.5) 22 | - Toast (4.0.0) 23 | - url_launcher (0.0.1): 24 | - Flutter 25 | 26 | DEPENDENCIES: 27 | - Flutter (from `Flutter`) 28 | - fluttertoast (from `.symlinks/plugins/fluttertoast/ios`) 29 | - open_file (from `.symlinks/plugins/open_file/ios`) 30 | - package_info (from `.symlinks/plugins/package_info/ios`) 31 | - path_provider (from `.symlinks/plugins/path_provider/ios`) 32 | - scan (from `.symlinks/plugins/scan/ios`) 33 | - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) 34 | - sqflite (from `.symlinks/plugins/sqflite/ios`) 35 | - url_launcher (from `.symlinks/plugins/url_launcher/ios`) 36 | 37 | SPEC REPOS: 38 | trunk: 39 | - FMDB 40 | - Toast 41 | 42 | EXTERNAL SOURCES: 43 | Flutter: 44 | :path: Flutter 45 | fluttertoast: 46 | :path: ".symlinks/plugins/fluttertoast/ios" 47 | open_file: 48 | :path: ".symlinks/plugins/open_file/ios" 49 | package_info: 50 | :path: ".symlinks/plugins/package_info/ios" 51 | path_provider: 52 | :path: ".symlinks/plugins/path_provider/ios" 53 | scan: 54 | :path: ".symlinks/plugins/scan/ios" 55 | shared_preferences: 56 | :path: ".symlinks/plugins/shared_preferences/ios" 57 | sqflite: 58 | :path: ".symlinks/plugins/sqflite/ios" 59 | url_launcher: 60 | :path: ".symlinks/plugins/url_launcher/ios" 61 | 62 | SPEC CHECKSUMS: 63 | Flutter: 0e3d915762c693b495b44d77113d4970485de6ec 64 | fluttertoast: 6122fa75143e992b1d3470f61000f591a798cc58 65 | FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a 66 | open_file: 02eb5cb6b21264bd3a696876f5afbfb7ca4f4b7d 67 | package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62 68 | path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c 69 | scan: aea35bb4aa59ccc8839c576a18cd57c7d492cc86 70 | shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d 71 | sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 72 | Toast: 91b396c56ee72a5790816f40d3a94dd357abc196 73 | url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef 74 | 75 | PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c 76 | 77 | COCOAPODS: 1.10.1 78 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "size": "20x20", 5 | "idiom": "iphone", 6 | "filename": "icon-20@2x.png", 7 | "scale": "2x" 8 | }, 9 | { 10 | "size": "20x20", 11 | "idiom": "iphone", 12 | "filename": "icon-20@3x.png", 13 | "scale": "3x" 14 | }, 15 | { 16 | "size": "29x29", 17 | "idiom": "iphone", 18 | "filename": "icon-29.png", 19 | "scale": "1x" 20 | }, 21 | { 22 | "size": "29x29", 23 | "idiom": "iphone", 24 | "filename": "icon-29@2x.png", 25 | "scale": "2x" 26 | }, 27 | { 28 | "size": "29x29", 29 | "idiom": "iphone", 30 | "filename": "icon-29@3x.png", 31 | "scale": "3x" 32 | }, 33 | { 34 | "size": "40x40", 35 | "idiom": "iphone", 36 | "filename": "icon-40@2x.png", 37 | "scale": "2x" 38 | }, 39 | { 40 | "size": "40x40", 41 | "idiom": "iphone", 42 | "filename": "icon-40@3x.png", 43 | "scale": "3x" 44 | }, 45 | { 46 | "size": "60x60", 47 | "idiom": "iphone", 48 | "filename": "icon-60@2x.png", 49 | "scale": "2x" 50 | }, 51 | { 52 | "size": "60x60", 53 | "idiom": "iphone", 54 | "filename": "icon-60@3x.png", 55 | "scale": "3x" 56 | }, 57 | { 58 | "size": "20x20", 59 | "idiom": "ipad", 60 | "filename": "icon-20-ipad.png", 61 | "scale": "1x" 62 | }, 63 | { 64 | "size": "20x20", 65 | "idiom": "ipad", 66 | "filename": "icon-20@2x-ipad.png", 67 | "scale": "2x" 68 | }, 69 | { 70 | "size": "29x29", 71 | "idiom": "ipad", 72 | "filename": "icon-29-ipad.png", 73 | "scale": "1x" 74 | }, 75 | { 76 | "size": "29x29", 77 | "idiom": "ipad", 78 | "filename": "icon-29@2x-ipad.png", 79 | "scale": "2x" 80 | }, 81 | { 82 | "size": "40x40", 83 | "idiom": "ipad", 84 | "filename": "icon-40.png", 85 | "scale": "1x" 86 | }, 87 | { 88 | "size": "40x40", 89 | "idiom": "ipad", 90 | "filename": "icon-40@2x.png", 91 | "scale": "2x" 92 | }, 93 | { 94 | "size": "76x76", 95 | "idiom": "ipad", 96 | "filename": "icon-76.png", 97 | "scale": "1x" 98 | }, 99 | { 100 | "size": "76x76", 101 | "idiom": "ipad", 102 | "filename": "icon-76@2x.png", 103 | "scale": "2x" 104 | }, 105 | { 106 | "size": "83.5x83.5", 107 | "idiom": "ipad", 108 | "filename": "icon-83.5@2x.png", 109 | "scale": "2x" 110 | }, 111 | { 112 | "size": "1024x1024", 113 | "idiom": "ios-marketing", 114 | "filename": "icon-1024.png", 115 | "scale": "1x" 116 | } 117 | ], 118 | "info": { 119 | "version": 1, 120 | "author": "xcode" 121 | } 122 | } -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-1024.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-20-ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-20-ipad.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-20@2x-ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-20@2x-ipad.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-29-ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-29-ipad.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-29.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-29@2x-ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-29@2x-ipad.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-40.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-76.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flash-finance/flash_tron_wallet/a9e259c3c10267b381dd124e41021ce9d5ef4581/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | FT Wallet 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | NSCameraUsageDescription 26 | FT Wallet QRCode 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | UIViewControllerBasedStatusBarAppearance 45 | 46 | io.flutter.embedded_views_preview 47 | YES 48 | 49 | 50 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /lib/common/config/common_config.dart: -------------------------------------------------------------------------------- 1 | class CommonConfig { 2 | static final bool debug = true; 3 | static final String fontFamily = 'ZH-R'; 4 | 5 | static final String baseServiceUrl = 'https://flash2c.cn'; 6 | static final String tronInfoQueryUrl = 'tronInfoQueryUrl'; 7 | static final String swapQueryUrl = 'swapQueryUrl'; 8 | static final servicePath = { 9 | tronInfoQueryUrl: baseServiceUrl + '/flash/api/v1/common/tron/info/query', 10 | swapQueryUrl: baseServiceUrl + '/flash/api/v1/common/tron/swap/query', 11 | }; 12 | } 13 | -------------------------------------------------------------------------------- /lib/common/enum/detail_wallet_type.dart: -------------------------------------------------------------------------------- 1 | enum DetailWalletType { 2 | backupMnemonic, 3 | backupKey, 4 | updatePwd, 5 | delWallet, 6 | } 7 | -------------------------------------------------------------------------------- /lib/common/enum/import_wallet_type.dart: -------------------------------------------------------------------------------- 1 | enum ImportWalletType { 2 | importKey, 3 | importMnemonic, 4 | createWallet, 5 | } 6 | -------------------------------------------------------------------------------- /lib/common/enum/mine_type.dart: -------------------------------------------------------------------------------- 1 | enum MineType { 2 | walletManger, 3 | lang, 4 | version, 5 | } 6 | -------------------------------------------------------------------------------- /lib/common/enum/swap_type.dart: -------------------------------------------------------------------------------- 1 | enum SwapType { 2 | send, 3 | receive, 4 | } 5 | -------------------------------------------------------------------------------- /lib/common/enum/text_type.dart: -------------------------------------------------------------------------------- 1 | enum TextType { 2 | normal, 3 | onlyEn, 4 | onlyNum, 5 | } 6 | -------------------------------------------------------------------------------- /lib/common/util/color_util.dart: -------------------------------------------------------------------------------- 1 | import 'package:flash_tron_wallet/common/util/common_util.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class MyColorUtil { 5 | static final Color green = Color(0xFF05B791); 6 | 7 | static final Color red = Color(0xFFF6465D); 8 | 9 | static final Color theme = Color(0xFF2676f8); 10 | 11 | static final Color white = Colors.white; 12 | 13 | static final Color transparent = Colors.transparent; 14 | 15 | static final Color backgroundLight = Color(0xFFFFFFFF); 16 | static final Color backgroundDark = Color(0xFF071724); 17 | static Color background() { 18 | return MyCommonUtil.isLightTheme() ? backgroundLight : backgroundDark; 19 | } 20 | 21 | static final Color secondaryLight = Color(0xFFF5F5F5); 22 | static final Color secondaryDark = Color(0xFF131E30); 23 | static Color secondary() { 24 | return MyCommonUtil.isLightTheme() ? secondaryLight : secondaryDark; 25 | } 26 | 27 | static Color bottomAppBar() { 28 | return background(); 29 | } 30 | 31 | static final Color bizLight = Color(0xFF333333); 32 | static final Color bizDark = Colors.white; 33 | static Color biz() { 34 | return MyCommonUtil.isLightTheme() ? bizLight : bizDark; 35 | } 36 | 37 | static final Color subBizLight = Color(0xFF999999); 38 | static final Color subBizDark = Color(0xFF757575); 39 | static Color subBiz() { 40 | return MyCommonUtil.isLightTheme() ? subBizLight : subBizDark; 41 | } 42 | 43 | static final Color dividerLineLight = Color(0xFFEEEEEE); 44 | static final Color dividerLineDark = Color(0xFF757575); 45 | static Color dividerLine() { 46 | return MyCommonUtil.isLightTheme() ? dividerLineLight : dividerLineDark; 47 | } 48 | 49 | static dividerBg() { 50 | return secondary(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /lib/common/util/common_util.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:flash_tron_wallet/common/enum/text_type.dart'; 4 | import 'package:flash_tron_wallet/common/util/color_util.dart'; 5 | import 'package:flash_tron_wallet/common/util/screen_util.dart'; 6 | import 'package:flash_tron_wallet/common/util/text_util.dart'; 7 | import 'package:flash_tron_wallet/provider/global_service.dart'; 8 | import 'package:flutter/cupertino.dart'; 9 | import 'package:flutter/material.dart'; 10 | import 'package:flutter/services.dart'; 11 | import 'package:fluttertoast/fluttertoast.dart'; 12 | 13 | class MyCommonUtil { 14 | static isLightTheme() { 15 | int themeModeValue = GlobalService.to.themeModeValue; 16 | return themeModeValue == 0; 17 | } 18 | 19 | static showToast(String msg) { 20 | Fluttertoast.showToast( 21 | msg: msg, 22 | gravity: ToastGravity.CENTER, 23 | toastLength: Toast.LENGTH_SHORT, 24 | timeInSecForIosWeb: 1, 25 | textColor: isLightTheme() ? Colors.white : MyColorUtil.biz(), 26 | fontSize: MyScreenUtil.sp(25), 27 | backgroundColor: isLightTheme() ? MyColorUtil.biz() : Colors.white, 28 | ); 29 | } 30 | 31 | static bottomBorder() { 32 | return Border( 33 | bottom: BorderSide(color: MyColorUtil.dividerLine(), width: 0.5)); 34 | } 35 | 36 | static edge({double left, double right, double top, double bottom}) { 37 | left = left ?? 0; 38 | right = right ?? 0; 39 | top = top ?? 0; 40 | bottom = bottom ?? 0; 41 | return EdgeInsets.only( 42 | left: MyScreenUtil.width(left), 43 | right: MyScreenUtil.width(right), 44 | top: MyScreenUtil.height(top), 45 | bottom: MyScreenUtil.height(bottom), 46 | ); 47 | } 48 | 49 | static sizedBox({double width, double height}) { 50 | return SizedBox( 51 | width: MyScreenUtil.width(width ?? 0), 52 | height: MyScreenUtil.height(height ?? 0), 53 | ); 54 | } 55 | 56 | static flatButton(String name, Function onPressed) { 57 | return FlatButton( 58 | child: Text( 59 | '$name', 60 | style: MyTextUtil.textStyle(2, 61 | color: MyColorUtil.theme, spacing: 0.5, size: 30), 62 | ), 63 | onPressed: onPressed, 64 | ); 65 | } 66 | 67 | static arrowForward() { 68 | return Container( 69 | child: Icon( 70 | Icons.arrow_forward_ios, 71 | size: MyScreenUtil.sp(27), 72 | color: MyColorUtil.subBiz(), 73 | ), 74 | ); 75 | } 76 | 77 | static defaultLoading({double top, double bottom}) { 78 | return Container( 79 | margin: MyCommonUtil.edge(top: top ?? 0, bottom: bottom ?? 0), 80 | child: Center( 81 | child: CupertinoActivityIndicator(), 82 | ), 83 | ); 84 | } 85 | 86 | static submit( 87 | BuildContext context, double width, String name, Function onPressed) { 88 | return Container( 89 | child: Align( 90 | child: SizedBox( 91 | width: MyScreenUtil.width(width ?? 320), 92 | child: RaisedButton( 93 | child: Container( 94 | padding: 95 | MyCommonUtil.edge(left: 10, right: 10, top: 18, bottom: 18), 96 | child: Text( 97 | '$name', 98 | style: MyTextUtil.textStyle(1, 99 | color: MyColorUtil.white, spacing: 0.6, size: 31), 100 | ), 101 | ), 102 | color: MyColorUtil.theme, 103 | onPressed: onPressed, 104 | shape: StadiumBorder(side: BorderSide(color: MyColorUtil.theme)), 105 | ), 106 | ), 107 | ), 108 | ); 109 | } 110 | 111 | static interval({double value}) { 112 | return Container( 113 | height: MyScreenUtil.height(value ?? 20), 114 | color: MyColorUtil.secondary(), 115 | ); 116 | } 117 | 118 | static icon(IconData iconData, {double size, color}) { 119 | return Icon( 120 | iconData, 121 | size: MyScreenUtil.sp(size ?? 32), 122 | color: color ?? MyColorUtil.subBiz(), 123 | ); 124 | } 125 | 126 | static textFormField({ 127 | bool readOnly, 128 | bool obscureText, 129 | Widget suffixIcon, 130 | Function onSaved, 131 | int maxLine, 132 | int maxLength, 133 | List inputFormatter, 134 | TextInputType keyboardType, 135 | String labelText, 136 | TextType textType = TextType.normal, 137 | Function validator, 138 | }) { 139 | return TextFormField( 140 | keyboardAppearance: Brightness.light, 141 | readOnly: readOnly ?? false, 142 | obscureText: obscureText ?? false, 143 | onSaved: onSaved, 144 | maxLines: maxLine ?? 1, 145 | maxLength: maxLength ?? 0, 146 | inputFormatters: inputFormatter ?? [], 147 | keyboardType: keyboardType, 148 | cursorColor: MyColorUtil.theme, 149 | decoration: InputDecoration( 150 | labelText: '$labelText', 151 | labelStyle: MyTextUtil.textStyle( 152 | 2, 153 | color: MyColorUtil.biz(), 154 | spacing: 0.1, 155 | size: 26, 156 | ), 157 | suffixIcon: suffixIcon, 158 | ), 159 | style: textType == TextType.normal 160 | ? MyTextUtil.textStyle(2, 161 | color: MyColorUtil.biz(), spacing: 0.2, size: 30) 162 | : textType == TextType.onlyEn 163 | ? MyTextUtil.textStyle4En(2, 164 | color: MyColorUtil.biz(), spacing: 0.0, size: 28) 165 | : MyTextUtil.textStyle4Num( 166 | color: MyColorUtil.biz(), 167 | spacing: 0.2, 168 | size: 32, 169 | //fontWeight: FontWeight.w500, 170 | ), 171 | validator: validator, 172 | ); 173 | } 174 | 175 | static bottomSheet(BuildContext context, Widget child) { 176 | return showModalBottomSheet( 177 | context: context, 178 | isScrollControlled: true, 179 | enableDrag: false, 180 | shape: RoundedRectangleBorder( 181 | borderRadius: BorderRadius.only( 182 | topLeft: Radius.circular(15.0), 183 | topRight: Radius.circular(15.0), 184 | ), 185 | ), 186 | builder: (BuildContext context) { 187 | return child; 188 | }); 189 | } 190 | 191 | static tabBar({ 192 | List tabs, 193 | TabController controller, 194 | Color indicatorColor, 195 | Color labelColor, 196 | Color unselectedLabelColor, 197 | Function onTap, 198 | }) { 199 | return TabBar( 200 | controller: controller, 201 | indicatorPadding: MyCommonUtil.edge(bottom: 15), 202 | indicatorColor: indicatorColor, 203 | indicatorSize: TabBarIndicatorSize.label, 204 | labelStyle: MyTextUtil.textStyle(2, spacing: 0.2, size: 32), 205 | labelColor: labelColor, 206 | unselectedLabelColor: unselectedLabelColor, 207 | indicatorWeight: 2.0, 208 | tabs: tabs, 209 | onTap: onTap, 210 | ); 211 | } 212 | 213 | static String formatNum(double num, int position) { 214 | if ((num.toString().length - num.toString().lastIndexOf(".") - 1) < 215 | position) { 216 | return num.toStringAsFixed(position) 217 | .substring(0, num.toString().lastIndexOf(".") + position + 1) 218 | .toString(); 219 | } else { 220 | return num.toString() 221 | .substring(0, num.toString().lastIndexOf(".") + position + 1) 222 | .toString(); 223 | } 224 | } 225 | 226 | static double getPrecision(int precision) { 227 | double result = 1; 228 | double baseValue = 10; 229 | for (int i = 0; i < precision; i++) { 230 | result = result * baseValue; 231 | } 232 | return result; 233 | } 234 | } 235 | 236 | class DoubleFormat extends TextInputFormatter { 237 | DoubleFormat({this.decimalRange = 6}); 238 | 239 | final int decimalRange; 240 | 241 | @override 242 | TextEditingValue formatEditUpdate( 243 | TextEditingValue oldValue, TextEditingValue newValue) { 244 | String nValue = newValue.text; 245 | TextSelection nSelection = newValue.selection; 246 | 247 | Pattern p = RegExp(r'(\d+\.?)|(\.?\d+)|(\.?)'); 248 | nValue = p 249 | .allMatches(nValue) 250 | .map((Match match) => match.group(0)) 251 | .join(); 252 | 253 | if (nValue.startsWith('.')) { 254 | nValue = '0.'; 255 | } else if (nValue.contains('.')) { 256 | if (nValue.substring(nValue.indexOf('.') + 1).length > decimalRange) { 257 | nValue = oldValue.text; 258 | } else { 259 | if (nValue.split('.').length > 2) { 260 | List split = nValue.split('.'); 261 | nValue = split[0] + '.' + split[1]; 262 | } 263 | } 264 | } 265 | 266 | nSelection = newValue.selection.copyWith( 267 | baseOffset: min(nValue.length, nValue.length + 1), 268 | extentOffset: min(nValue.length, nValue.length + 1), 269 | ); 270 | 271 | return TextEditingValue( 272 | text: nValue, selection: nSelection, composing: TextRange.empty); 273 | } 274 | } 275 | -------------------------------------------------------------------------------- /lib/common/util/http_util.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | 3 | class HttpUtil { 4 | static get(String url) async { 5 | try { 6 | Response response; 7 | Dio dio = Dio(); 8 | dio.options.contentType = 'application/json;charset=UTF-8'; 9 | response = await dio.get(url); 10 | if (response.statusCode == 200) { 11 | return response.data; 12 | } else { 13 | throw Exception('service error'); 14 | } 15 | } catch (e) { 16 | return print('error: ${e.toString()}'); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /lib/common/util/icon_util.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class MyIconUtil { 5 | static const IconData arrowBack = Icons.arrow_back; 6 | 7 | static const IconData arrowForwardIos = Icons.arrow_forward_ios; 8 | 9 | static const IconData transit = Icons.transit_enterexit_sharp; 10 | 11 | static const IconData download = Icons.download_sharp; 12 | 13 | static const IconData sync = Icons.sync_rounded; 14 | 15 | static const IconData done = Icons.done_rounded; 16 | 17 | static const IconData arrowDropDown = Icons.arrow_drop_down; 18 | 19 | static const copyExt = IconData(0xe618, fontFamily: 'ICON'); 20 | 21 | static const plusExt = IconData(0xe7b8, fontFamily: 'ICON'); 22 | 23 | static const scanExt = IconData(0xe606, fontFamily: 'ICON'); 24 | 25 | static const noteExt = IconData(0xe635, fontFamily: 'ICON'); 26 | 27 | static const walletExt = IconData(0xe6e0, fontFamily: 'ICON'); 28 | 29 | static const globalExt = IconData(0xe676, fontFamily: 'ICON'); 30 | 31 | static const manageExt = IconData(0xe6db, fontFamily: 'ICON'); 32 | } 33 | -------------------------------------------------------------------------------- /lib/common/util/screen_util.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_screenutil/screenutil.dart'; 2 | 3 | class MyScreenUtil { 4 | static width(double value) { 5 | return ScreenUtil().setWidth(value); 6 | } 7 | 8 | static height(double value) { 9 | return ScreenUtil().setHeight(value); 10 | } 11 | 12 | static sp(double value) { 13 | return ScreenUtil().setSp(value); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /lib/common/util/text_util.dart: -------------------------------------------------------------------------------- 1 | import 'package:flash_tron_wallet/common/util/screen_util.dart'; 2 | import 'package:flash_tron_wallet/provider/global_service.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:google_fonts/google_fonts.dart'; 5 | 6 | class MyTextUtil { 7 | static String textRegular4Zh = 'ZH-R'; 8 | static String textMedium4Zh = 'ZH-M'; 9 | 10 | static String textRegular4En = 'EN-R'; 11 | static String textMedium4En = 'EN-M'; 12 | 13 | static TextStyle textStyle(int type, 14 | {Color color, double spacing, double size}) { 15 | double letterSpacing = spacing != null ? spacing : 0.0; 16 | double fontSize = size != null ? size : 20.0; 17 | bool langType = GlobalService.to.langType; 18 | return langType 19 | ? TextStyle( 20 | fontFamily: type == 1 ? textRegular4Zh : textMedium4Zh, 21 | letterSpacing: letterSpacing, 22 | color: color, 23 | fontSize: MyScreenUtil.sp(fontSize + 4), 24 | ) 25 | : TextStyle( 26 | fontFamily: type == 1 ? textRegular4En : textMedium4En, 27 | letterSpacing: 0.0, 28 | color: color, 29 | fontSize: MyScreenUtil.sp(fontSize + 1), 30 | ); 31 | } 32 | 33 | static TextStyle textStyle4En(int type, 34 | {Color color, double spacing, double size}) { 35 | return TextStyle( 36 | fontFamily: type == 1 ? textRegular4En : textMedium4En, 37 | letterSpacing: 0.0, 38 | color: color, 39 | fontSize: MyScreenUtil.sp(size ?? 20.0 + 1), 40 | ); 41 | } 42 | 43 | static TextStyle textStyle4Zh(int type, 44 | {Color color, double spacing, double size}) { 45 | return TextStyle( 46 | fontFamily: type == 1 ? textRegular4Zh : textMedium4Zh, 47 | letterSpacing: spacing ?? 0.0, 48 | color: color, 49 | fontSize: MyScreenUtil.sp(size ?? 23.0 + 4), 50 | ); 51 | } 52 | 53 | static TextStyle textStyle4Num( 54 | {Color color, double spacing, double size, FontWeight fontWeight}) { 55 | return GoogleFonts.roboto( 56 | letterSpacing: spacing ?? 0.0, 57 | color: color, 58 | fontWeight: fontWeight, 59 | fontSize: MyScreenUtil.sp(size ?? 23.0), 60 | ); 61 | } 62 | 63 | static TextStyle textStyle4Index(int type, {Color color, double spacing}) { 64 | bool langType = GlobalService.to.langType; 65 | return langType 66 | ? TextStyle( 67 | fontFamily: type == 1 ? textRegular4Zh : textMedium4Zh, 68 | letterSpacing: spacing ?? 0.0, 69 | color: color, 70 | ) 71 | : TextStyle( 72 | fontFamily: type == 1 ? textRegular4En : textMedium4En, 73 | letterSpacing: 0.0, 74 | color: color, 75 | ); 76 | } 77 | 78 | static TextStyle textStyle4Update(int type, 79 | {Color color, double spacing, double size}) { 80 | double letterSpacing = spacing != null ? spacing : 0.0; 81 | double fontSize = size != null ? size : 20.0; 82 | bool langType = GlobalService.to.langType; 83 | return langType 84 | ? TextStyle( 85 | fontFamily: type == 1 ? textRegular4Zh : textMedium4Zh, 86 | letterSpacing: letterSpacing, 87 | color: color, 88 | fontSize: MyScreenUtil.sp(fontSize + 4), 89 | height: MyScreenUtil.sp(3.2), 90 | ) 91 | : TextStyle( 92 | fontFamily: type == 1 ? textRegular4En : textMedium4En, 93 | letterSpacing: 0.0, 94 | color: color, 95 | fontSize: MyScreenUtil.sp(fontSize + 1), 96 | height: MyScreenUtil.sp(3.2), 97 | ); 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /lib/common/widget/common/common_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flash_tron_wallet/common/util/color_util.dart'; 2 | import 'package:flash_tron_wallet/common/util/screen_util.dart'; 3 | import 'package:flash_tron_wallet/common/util/text_util.dart'; 4 | import 'package:flutter/material.dart'; 5 | 6 | ///title组件 7 | class TitleWidget extends StatelessWidget { 8 | final String name; 9 | 10 | TitleWidget(this.name); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return Container( 15 | child: Text( 16 | '$name', 17 | style: MyTextUtil.textStyle(2, 18 | color: MyColorUtil.biz(), spacing: 0.0, size: 32), 19 | ), 20 | ); 21 | } 22 | } 23 | 24 | ///间隔组件 25 | class IntervalWidget extends StatelessWidget { 26 | final double value; 27 | IntervalWidget(this.value); 28 | 29 | @override 30 | Widget build(BuildContext context) { 31 | return Container( 32 | height: MyScreenUtil.height(value), 33 | color: MyColorUtil.background(), 34 | ); 35 | } 36 | } 37 | 38 | ///MyPreferredSize 39 | class MyPreferredSize extends StatelessWidget implements PreferredSizeWidget { 40 | final Color backgroundColor; 41 | final Brightness brightness; 42 | @override 43 | final Size preferredSize; 44 | 45 | MyPreferredSize(this.backgroundColor, this.brightness, this.preferredSize); 46 | 47 | @override 48 | Widget build(BuildContext context) { 49 | return PreferredSize( 50 | child: AppBar( 51 | backgroundColor: backgroundColor, 52 | brightness: brightness, 53 | elevation: 0, 54 | ), 55 | preferredSize: preferredSize, 56 | ); 57 | } 58 | } 59 | 60 | ///页面跳转标示组件 61 | class ForwardWidget extends StatelessWidget { 62 | @override 63 | Widget build(BuildContext context) { 64 | return Container( 65 | child: Icon( 66 | Icons.arrow_forward_ios, 67 | size: MyScreenUtil.sp(27), 68 | color: MyColorUtil.subBiz(), 69 | ), 70 | ); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /lib/common/widget/scaffold/scaffold_widget.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:flash_tron_wallet/common/util/color_util.dart'; 4 | import 'package:flash_tron_wallet/common/util/common_util.dart'; 5 | import 'package:flash_tron_wallet/common/util/icon_util.dart'; 6 | import 'package:flash_tron_wallet/common/util/text_util.dart'; 7 | import 'package:flutter/material.dart'; 8 | import 'package:get/get.dart'; 9 | 10 | // ignore: must_be_immutable 11 | class MyScaffold extends StatelessWidget { 12 | String title; 13 | bool hasAppBar; 14 | bool hasBack; 15 | Widget body; 16 | Widget bottomNavigationBar; 17 | 18 | MyScaffold({ 19 | this.title = '', 20 | this.hasAppBar = true, 21 | this.hasBack = false, 22 | this.body, 23 | this.bottomNavigationBar, 24 | }); 25 | 26 | @override 27 | Widget build(BuildContext context) { 28 | return Obx( 29 | () => GestureDetector( 30 | onTap: () { 31 | _hideKeyboard(context); 32 | }, 33 | child: Scaffold( 34 | resizeToAvoidBottomInset: false, 35 | backgroundColor: MyColorUtil.background(), 36 | appBar: hasAppBar 37 | ? _appBarWidget(context) 38 | : _preferredSizeWidget(context), 39 | body: body, 40 | bottomNavigationBar: bottomNavigationBar, 41 | ), 42 | ), 43 | ); 44 | } 45 | 46 | Widget _appBarWidget(BuildContext context) { 47 | bool flag = MyCommonUtil.isLightTheme(); 48 | return AppBar( 49 | backgroundColor: MyColorUtil.background(), 50 | brightness: flag ? Brightness.light : Brightness.dark, 51 | title: Text( 52 | '$title', 53 | style: MyTextUtil.textStyle(2, 54 | color: MyColorUtil.biz(), spacing: 0.0, size: 32), 55 | ), 56 | centerTitle: true, 57 | elevation: 0, 58 | leading: hasBack 59 | ? InkWell( 60 | onTap: () { 61 | Get.back(); 62 | }, 63 | child: MyCommonUtil.icon( 64 | MyIconUtil.arrowBack, 65 | size: 45, 66 | color: MyColorUtil.biz(), 67 | ), 68 | ) 69 | : Container(), 70 | ); 71 | } 72 | 73 | PreferredSize _preferredSizeWidget(BuildContext context) { 74 | bool flag = MyCommonUtil.isLightTheme(); 75 | return PreferredSize( 76 | child: AppBar( 77 | backgroundColor: MyColorUtil.background(), 78 | brightness: flag ? Brightness.light : Brightness.dark, 79 | elevation: 0, 80 | ), 81 | preferredSize: Size.fromHeight(0), 82 | ); 83 | } 84 | 85 | void _hideKeyboard(BuildContext context) { 86 | FocusScopeNode currentFocus = FocusScope.of(context); 87 | if (!currentFocus.hasPrimaryFocus && currentFocus.focusedChild != null) { 88 | FocusManager.instance.primaryFocus.unfocus(); 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /lib/common/widget/splash/colorize_animated_text.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class ColorizeAnimatedText extends StatefulWidget { 4 | /// [String] that would be displayed subsequently in the animation. 5 | final String text; 6 | 7 | /// Gives [TextStyle] to the text strings. 8 | final TextStyle textStyle; 9 | 10 | /// The [Duration] of the delay between the apparition of each characters 11 | /// 12 | /// By default it is set to 500 milliseconds. 13 | final Duration speed; 14 | 15 | /// Set the colors for the gradient animation of the text. 16 | /// 17 | /// The [List] should contain at least two values of [Color] in it. 18 | final List colors; 19 | 20 | const ColorizeAnimatedText({ 21 | Key key, 22 | @required this.text, 23 | this.textStyle, 24 | @required this.colors, 25 | this.speed, 26 | }) : super(key: key); 27 | 28 | @override 29 | _ColorizeTextState createState() => _ColorizeTextState(); 30 | } 31 | 32 | class _ColorizeTextState extends State 33 | with TickerProviderStateMixin { 34 | AnimationController _controller; 35 | Animation _colorShifter, _fadeIn, _fadeOut; 36 | double _tuning; 37 | 38 | @override 39 | void initState() { 40 | super.initState(); 41 | if (mounted) setState(() {}); 42 | _controller = AnimationController( 43 | duration: widget.speed * widget.text.length, 44 | vsync: this, 45 | ); 46 | 47 | _tuning = (300.0 * widget.colors.length) * 48 | (widget.textStyle.fontSize / 24.0) * 49 | 0.75 * 50 | (widget.text.length / 15.0); 51 | 52 | _fadeIn = Tween(begin: 0.0, end: 1.0).animate( 53 | CurvedAnimation( 54 | parent: _controller, 55 | curve: const Interval(0.0, 0.1, curve: Curves.easeOut), 56 | ), 57 | ); 58 | 59 | _fadeOut = Tween(begin: 1.0, end: 1.0).animate( 60 | CurvedAnimation( 61 | parent: _controller, 62 | curve: const Interval(0.9, 1.0, curve: Curves.easeIn), 63 | ), 64 | ); 65 | 66 | _colorShifter = 67 | Tween(begin: 0.0, end: widget.colors.length * _tuning).animate( 68 | CurvedAnimation( 69 | parent: _controller, 70 | curve: const Interval(0.0, 1.0, curve: Curves.easeIn), 71 | ), 72 | ); 73 | _controller?.forward(); 74 | } 75 | 76 | @override 77 | void dispose() { 78 | _controller?.dispose(); 79 | super.dispose(); 80 | } 81 | 82 | @override 83 | Widget build(BuildContext context) { 84 | return Center( 85 | child: AnimatedBuilder( 86 | animation: _controller, 87 | builder: (BuildContext context, Widget child) { 88 | Shader linearGradient = LinearGradient(colors: widget.colors) 89 | .createShader(Rect.fromLTWH(0.0, 0.0, _colorShifter.value, 0.0)); 90 | return Opacity( 91 | opacity: _fadeIn.value != 1.0 ? _fadeIn.value : _fadeOut.value, 92 | child: Text( 93 | widget.text, 94 | style: widget.textStyle != null 95 | ? widget.textStyle.merge( 96 | TextStyle(foreground: Paint()..shader = linearGradient)) 97 | : widget.textStyle, 98 | textAlign: TextAlign.center, 99 | ), 100 | ); 101 | }, 102 | ), 103 | ); 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /lib/common/widget/splash/scale_animated_text.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class ScaleAnimatedText extends StatefulWidget { 4 | /// [String] that would be displayed subsequently in the animation. 5 | final String text; 6 | 7 | /// Gives [TextStyle] to the text strings. 8 | final TextStyle textStyle; 9 | 10 | /// Override the [Duration] of the animation by setting the duration parameter. 11 | /// 12 | /// This will set the total duration for the animated widget. 13 | /// For example, if text = ["a", "b", "c"] and if you want that each animation 14 | /// should take 3 seconds then you have to set [duration] to 3 seconds. 15 | final Duration duration; 16 | 17 | /// Set the scaling factor of the text for the animation. 18 | /// 19 | /// By default it is set to [double] value 0.5 20 | final double scalingFactor; 21 | 22 | const ScaleAnimatedText({ 23 | Key key, 24 | @required this.text, 25 | this.textStyle, 26 | this.scalingFactor = 0.2, 27 | this.duration, 28 | }) : super(key: key); 29 | 30 | @override 31 | _ScaleTextState createState() => _ScaleTextState(); 32 | } 33 | 34 | class _ScaleTextState extends State 35 | with TickerProviderStateMixin { 36 | AnimationController _controller; 37 | 38 | Animation _fadeIn, _fadeOut, _scaleIn, _scaleOut; 39 | Duration _duration; 40 | 41 | @override 42 | void initState() { 43 | super.initState(); 44 | _duration = widget.duration ?? const Duration(milliseconds: 2300); 45 | setState(() {}); 46 | _controller = AnimationController( 47 | duration: _duration, 48 | vsync: this, 49 | ); 50 | 51 | _fadeIn = Tween(begin: 0.0, end: 1.0).animate( 52 | CurvedAnimation( 53 | parent: _controller, 54 | curve: const Interval(0.0, 0.8, curve: Curves.easeOut), 55 | ), 56 | ); 57 | 58 | _fadeOut = Tween(begin: 1.0, end: 0.0).animate( 59 | CurvedAnimation( 60 | parent: _controller, 61 | curve: const Interval(0.8, 1.0, curve: Curves.easeOut), 62 | ), 63 | ); 64 | 65 | _scaleIn = Tween(begin: 0.0, end: 1.0).animate( 66 | CurvedAnimation( 67 | parent: _controller, 68 | curve: const Interval( 69 | 0.0, 70 | 1.0, 71 | curve: Curves.easeOut, 72 | ), 73 | ), 74 | ); 75 | _scaleOut = Tween(begin: 1.0, end: 0.0).animate( 76 | CurvedAnimation( 77 | parent: _controller, 78 | curve: const Interval( 79 | 1.0, 80 | 1.0, 81 | curve: Curves.easeIn, 82 | ), 83 | ), 84 | ); 85 | _controller.forward(); 86 | } 87 | 88 | @override 89 | void dispose() { 90 | _controller?.stop(); 91 | _controller?.dispose(); 92 | super.dispose(); 93 | } 94 | 95 | @override 96 | Widget build(BuildContext context) { 97 | return AnimatedBuilder( 98 | animation: _controller, 99 | child: Text( 100 | widget.text, 101 | textAlign: TextAlign.center, 102 | style: widget.textStyle, 103 | ), 104 | builder: (BuildContext context, Widget child) { 105 | return ScaleTransition( 106 | scale: _scaleIn.value != 1.0 ? _scaleIn : _scaleOut, 107 | child: Opacity( 108 | opacity: _fadeIn.value != 1.0 ? _fadeIn.value : _fadeOut.value, 109 | child: child, 110 | ), 111 | ); 112 | }, 113 | ); 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /lib/common/widget/splash/splash_screen_view.dart: -------------------------------------------------------------------------------- 1 | library splash_screen_view; 2 | 3 | import 'package:flash_tron_wallet/route/app_route.dart'; 4 | import 'package:flutter/cupertino.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:get/get.dart'; 7 | 8 | import 'colorize_animated_text.dart'; 9 | import 'scale_animated_text.dart'; 10 | import 'typer_animated_text.dart'; 11 | 12 | enum TextType { 13 | ColorizeAnimationText, 14 | TyperAnimatedText, 15 | ScaleAnimatedText, 16 | NormalText, 17 | } 18 | 19 | // ignore: must_be_immutable 20 | class SplashScreenView extends StatefulWidget { 21 | /// The [Widget] Name of target screen which you want to display after completion of splash screen milliseconds. 22 | Widget _home; 23 | 24 | /// [String] Asset path of your logo image. 25 | String _imageSrc = ""; 26 | 27 | /// [String] that would be displayed on below logo. 28 | String _text; 29 | 30 | /// Select [TextType] of your text. 31 | /// 32 | /// By default it is NormalText. 33 | TextType _textType; 34 | 35 | /// Gives [TextStyle] to the text strings. 36 | TextStyle _textStyle; 37 | 38 | /// The [Duration] of the delay between the apparition of each characters 39 | /// 40 | /// By default it is set to 3000 milliseconds. 41 | int _duration = 3000; 42 | 43 | /// [int] Size of your image logo. 44 | /// 45 | /// By default it is set to 150. 46 | int _logoSize = 150; 47 | 48 | /// [Color] Background Color of your splash screen. 49 | /// By default it is set to white. 50 | Color _backgroundColor = Colors.white; 51 | 52 | /// Set the colors for the gradient animation of the text. 53 | /// 54 | /// The [List] should contain at least two values of [Color] in it. 55 | /// By default it is set to red and black. 56 | List _colors; 57 | 58 | double _defaultTextFontSize = 20; 59 | 60 | SplashScreenView( 61 | {@required String imageSrc, 62 | @required Widget home, 63 | @required int duration, 64 | int imageSize, 65 | textStyle, 66 | colors, 67 | textType, 68 | Color backgroundColor, 69 | text}) { 70 | assert(duration != null); 71 | assert(home != null); 72 | assert(imageSrc != null); 73 | 74 | _imageSrc = imageSrc; 75 | _home = home; 76 | _duration = duration; 77 | _colors = colors; 78 | _text = text; 79 | _textStyle = textStyle; 80 | _logoSize = imageSize; 81 | _backgroundColor = backgroundColor; 82 | _textType = textType; 83 | } 84 | 85 | @override 86 | _SplashScreenViewState createState() => _SplashScreenViewState(); 87 | } 88 | 89 | class _SplashScreenViewState extends State 90 | with SingleTickerProviderStateMixin { 91 | AnimationController _animationController; 92 | Animation _animation; 93 | 94 | @override 95 | void initState() { 96 | super.initState(); 97 | if (widget._duration < 1000) widget._duration = 3000; 98 | if (widget._textType == TextType.TyperAnimatedText) { 99 | _animationController = new AnimationController( 100 | vsync: this, duration: Duration(milliseconds: 100)); 101 | _animation = Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( 102 | parent: _animationController, curve: Curves.easeInCirc)); 103 | _animationController.forward(); 104 | } else { 105 | _animationController = new AnimationController( 106 | vsync: this, duration: Duration(milliseconds: 1000)); 107 | _animation = Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( 108 | parent: _animationController, curve: Curves.easeInCirc)); 109 | _animationController.forward(); 110 | } 111 | 112 | Future.delayed(Duration(milliseconds: widget._duration)).then((value) { 113 | /*Navigator.of(context).pushReplacement( 114 | CupertinoPageRoute(builder: (BuildContext context) => widget._home));*/ 115 | Get.offNamed(AppRoute.index); 116 | }); 117 | } 118 | 119 | @override 120 | void dispose() { 121 | super.dispose(); 122 | _animationController.reset(); 123 | } 124 | 125 | @override 126 | Widget build(BuildContext context) { 127 | return Scaffold( 128 | backgroundColor: widget._backgroundColor, 129 | body: Container( 130 | width: MediaQuery.of(context).size.width, 131 | height: MediaQuery.of(context).size.height, 132 | child: FadeTransition( 133 | opacity: _animation, 134 | child: Column( 135 | mainAxisAlignment: MainAxisAlignment.center, 136 | crossAxisAlignment: CrossAxisAlignment.center, 137 | children: [ 138 | (widget._imageSrc != null) 139 | ? Image.asset( 140 | widget._imageSrc, 141 | height: (widget._logoSize != null) 142 | ? widget._logoSize.toDouble() 143 | : 150, 144 | ) 145 | : SizedBox( 146 | height: 1, 147 | ), 148 | Padding( 149 | padding: const EdgeInsets.only(right: 10, left: 10, top: 20), 150 | child: getTextWidget(), 151 | ) 152 | ], 153 | ), 154 | ), 155 | ), 156 | ); 157 | } 158 | 159 | Widget getTextWidget() { 160 | if (widget._text != null) { 161 | print("Not Blank"); 162 | switch (widget._textType) { 163 | case TextType.ColorizeAnimationText: 164 | return ColorizeAnimatedText( 165 | text: widget._text, 166 | speed: Duration(milliseconds: 1000), 167 | textStyle: (widget._textStyle != null) 168 | ? widget._textStyle 169 | : TextStyle(fontSize: widget._defaultTextFontSize), 170 | colors: (widget._colors != null) 171 | ? widget._colors 172 | : [ 173 | Colors.red, 174 | Colors.black, 175 | Colors.red, 176 | Colors.black, 177 | ], 178 | ); 179 | case TextType.NormalText: 180 | return Text( 181 | widget._text, 182 | style: (widget._textStyle != null) 183 | ? widget._textStyle 184 | : TextStyle(fontSize: widget._defaultTextFontSize), 185 | ); 186 | case TextType.TyperAnimatedText: 187 | return TyperAnimatedText( 188 | text: widget._text, 189 | speed: Duration(milliseconds: 100), 190 | textStyle: (widget._textStyle != null) 191 | ? widget._textStyle 192 | : TextStyle(fontSize: widget._defaultTextFontSize), 193 | ); 194 | case TextType.ScaleAnimatedText: 195 | return ScaleAnimatedText( 196 | text: widget._text, 197 | textStyle: (widget._textStyle != null) 198 | ? widget._textStyle 199 | : TextStyle(fontSize: widget._defaultTextFontSize), 200 | ); 201 | default: 202 | return Text( 203 | widget._text, 204 | style: (widget._textStyle != null) 205 | ? widget._textStyle 206 | : TextStyle(fontSize: widget._defaultTextFontSize), 207 | ); 208 | } 209 | } else { 210 | print("Blank"); 211 | return SizedBox( 212 | width: 1, 213 | ); 214 | } 215 | } 216 | } 217 | -------------------------------------------------------------------------------- /lib/common/widget/splash/typer_animated_text.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class TyperAnimatedText extends StatefulWidget { 4 | /// [String] that would be displayed subsequently in the animation. 5 | final String text; 6 | 7 | /// Gives [TextStyle] to the text strings. 8 | final TextStyle textStyle; 9 | 10 | /// The [Duration] of the delay between the apparition of each characters 11 | /// 12 | /// By default it is set to 40 milliseconds. 13 | final Duration speed; 14 | 15 | const TyperAnimatedText({ 16 | Key key, 17 | @required this.text, 18 | this.textStyle, 19 | this.speed, 20 | }) : super(key: key); 21 | 22 | @override 23 | _TyperState createState() => _TyperState(); 24 | } 25 | 26 | class _TyperState extends State 27 | with TickerProviderStateMixin { 28 | AnimationController _controller; 29 | Animation _typingText; 30 | 31 | @override 32 | void initState() { 33 | super.initState(); 34 | if (mounted) setState(() {}); 35 | 36 | _controller = AnimationController( 37 | duration: widget.speed * widget.text.length, 38 | vsync: this, 39 | ); 40 | 41 | _typingText = 42 | StepTween(begin: 0, end: widget.text.length).animate(_controller); 43 | 44 | _controller.forward(); 45 | } 46 | 47 | @override 48 | void dispose() { 49 | _controller?.stop(); 50 | _controller?.dispose(); 51 | super.dispose(); 52 | } 53 | 54 | @override 55 | Widget build(BuildContext context) { 56 | return AnimatedBuilder( 57 | animation: _controller, 58 | builder: (BuildContext context, Widget child) { 59 | final int offset = widget.text.length < _typingText.value 60 | ? widget.text.length 61 | : _typingText.value; 62 | 63 | return Text( 64 | widget.text.substring(0, offset), 65 | textAlign: TextAlign.center, 66 | style: widget.textStyle, 67 | ); 68 | }, 69 | ); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /lib/entity/tron/abi_entity.dart: -------------------------------------------------------------------------------- 1 | class AbiEntity { 2 | List entrys; 3 | 4 | AbiEntity({this.entrys}); 5 | 6 | AbiEntity.fromJson(Map json) { 7 | if (json['entrys'] != null) { 8 | entrys = new List(); 9 | json['entrys'].forEach((v) { 10 | entrys.add(new Entrys.fromJson(v)); 11 | }); 12 | } 13 | } 14 | 15 | Map toJson() { 16 | final Map data = new Map(); 17 | if (this.entrys != null) { 18 | data['entrys'] = this.entrys.map((v) => v.toJson()).toList(); 19 | } 20 | return data; 21 | } 22 | } 23 | 24 | class Entrys { 25 | String name; 26 | List inputs; 27 | List outputs; 28 | String type; 29 | String stateMutability; 30 | bool constant; 31 | 32 | Entrys( 33 | {this.name, 34 | this.inputs, 35 | this.outputs, 36 | this.type, 37 | this.stateMutability, 38 | this.constant}); 39 | 40 | Entrys.fromJson(Map json) { 41 | name = json['name']; 42 | if (json['inputs'] != null) { 43 | inputs = new List(); 44 | json['inputs'].forEach((v) { 45 | inputs.add(new Inputs.fromJson(v)); 46 | }); 47 | } 48 | if (json['outputs'] != null) { 49 | outputs = new List(); 50 | json['outputs'].forEach((v) { 51 | outputs.add(new Outputs.fromJson(v)); 52 | }); 53 | } 54 | type = json['type']; 55 | stateMutability = json['stateMutability']; 56 | constant = json['constant']; 57 | } 58 | 59 | Map toJson() { 60 | final Map data = new Map(); 61 | data['name'] = this.name; 62 | if (this.inputs != null) { 63 | data['inputs'] = this.inputs.map((v) => v.toJson()).toList(); 64 | } 65 | if (this.outputs != null) { 66 | data['outputs'] = this.outputs.map((v) => v.toJson()).toList(); 67 | } 68 | data['type'] = this.type; 69 | data['stateMutability'] = this.stateMutability; 70 | data['constant'] = this.constant; 71 | return data; 72 | } 73 | } 74 | 75 | class Inputs { 76 | String name; 77 | String type; 78 | bool indexed; 79 | 80 | Inputs({this.name, this.type, this.indexed}); 81 | 82 | Inputs.fromJson(Map json) { 83 | name = json['name']; 84 | type = json['type']; 85 | indexed = json['indexed']; 86 | } 87 | 88 | Map toJson() { 89 | final Map data = new Map(); 90 | data['name'] = this.name; 91 | data['type'] = this.type; 92 | data['indexed'] = this.indexed; 93 | return data; 94 | } 95 | } 96 | 97 | class Outputs { 98 | String type; 99 | 100 | Outputs({this.type}); 101 | 102 | Outputs.fromJson(Map json) { 103 | type = json['type']; 104 | } 105 | 106 | Map toJson() { 107 | final Map data = new Map(); 108 | data['type'] = this.type; 109 | return data; 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /lib/entity/tron/asset_entity.dart: -------------------------------------------------------------------------------- 1 | class AssetEntity { 2 | int type; 3 | 4 | String address; 5 | 6 | String name; 7 | 8 | int precision; 9 | 10 | double balance; 11 | 12 | double usd; 13 | 14 | String logoUrl; 15 | 16 | String originBalance; 17 | 18 | AssetEntity( 19 | {this.type, 20 | this.address, 21 | this.name, 22 | this.precision, 23 | this.balance, 24 | this.usd, 25 | this.logoUrl, 26 | this.originBalance}); 27 | 28 | AssetEntity.fromJson(Map json) { 29 | type = json['type']; 30 | address = json['address']; 31 | name = json['name']; 32 | balance = json['balance']; 33 | usd = json['usd']; 34 | logoUrl = json['logoUrl']; 35 | originBalance = json['originBalance']; 36 | } 37 | 38 | Map toJson() { 39 | final Map data = new Map(); 40 | data['type'] = this.type; 41 | data['address'] = this.address; 42 | data['name'] = this.name; 43 | data['balance'] = this.balance; 44 | data['cny'] = this.usd; 45 | data['logoUrl'] = this.logoUrl; 46 | data['originBalance'] = this.originBalance; 47 | return data; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /lib/entity/tron/wallet_entity.dart: -------------------------------------------------------------------------------- 1 | class WalletEntity { 2 | 3 | String name; 4 | 5 | String pwd; 6 | 7 | String mnemonic; 8 | 9 | String privateKey; 10 | 11 | String tronAddress; 12 | 13 | WalletEntity({this.name, this.pwd, this.mnemonic, this.privateKey, this.tronAddress}); 14 | 15 | WalletEntity.fromJson(Map json) { 16 | name = json['name']; 17 | pwd = json['pwd']; 18 | mnemonic = json['mnemonic']; 19 | privateKey = json['privateKey']; 20 | tronAddress = json['tronAddress']; 21 | } 22 | 23 | Map toJson() { 24 | final Map data = new Map(); 25 | data['name'] = this.name; 26 | data['pwd'] = this.pwd; 27 | data['mnemonic'] = this.mnemonic; 28 | data['privateKey'] = this.privateKey; 29 | data['tronAddress'] = this.tronAddress; 30 | return data; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/google/protobuf/any.pb.dart: -------------------------------------------------------------------------------- 1 | /// 2 | // Generated code. Do not modify. 3 | // source: google/protobuf/any.proto 4 | /// 5 | // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name 6 | 7 | import 'dart:core' as $core 8 | show bool, Deprecated, double, int, List, Map, override, pragma, String; 9 | 10 | import 'package:protobuf/protobuf.dart' as $pb; 11 | 12 | class Any extends $pb.GeneratedMessage { 13 | static final $pb.BuilderInfo _i = 14 | $pb.BuilderInfo('Any', package: const $pb.PackageName('google.protobuf')) 15 | ..aOS(1, 'typeUrl') 16 | ..a<$core.List<$core.int>>(2, 'value', $pb.PbFieldType.OY) 17 | ..hasRequiredFields = false; 18 | 19 | Any._() : super(); 20 | factory Any() => create(); 21 | factory Any.fromBuffer($core.List<$core.int> i, 22 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 23 | create()..mergeFromBuffer(i, r); 24 | factory Any.fromJson($core.String i, 25 | [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => 26 | create()..mergeFromJson(i, r); 27 | Any clone() => Any()..mergeFromMessage(this); 28 | Any copyWith(void Function(Any) updates) => 29 | super.copyWith((message) => updates(message as Any)); 30 | $pb.BuilderInfo get info_ => _i; 31 | @$core.pragma('dart2js:noInline') 32 | static Any create() => Any._(); 33 | Any createEmptyInstance() => create(); 34 | static $pb.PbList createRepeated() => $pb.PbList(); 35 | static Any getDefault() => _defaultInstance ??= create()..freeze(); 36 | static Any _defaultInstance; 37 | 38 | $core.String get typeUrl => $_getS(0, ''); 39 | set typeUrl($core.String v) { 40 | $_setString(0, v); 41 | } 42 | 43 | $core.bool hasTypeUrl() => $_has(0); 44 | void clearTypeUrl() => clearField(1); 45 | 46 | $core.List<$core.int> get value => $_getN(1); 47 | set value($core.List<$core.int> v) { 48 | $_setBytes(1, v); 49 | } 50 | 51 | $core.bool hasValue() => $_has(1); 52 | void clearValue() => clearField(2); 53 | 54 | /// Unpacks the message in [value] into [instance]. 55 | /// 56 | /// Throws a [InvalidProtocolBufferException] if [typeUrl] does not correspond 57 | /// to the type of [instance]. 58 | /// 59 | /// A typical usage would be `any.unpackInto(Message())`. 60 | /// 61 | /// Returns [instance]. 62 | T unpackInto(T instance, 63 | {$pb.ExtensionRegistry extensionRegistry = $pb.ExtensionRegistry.EMPTY}) { 64 | $pb.unpackIntoHelper(value, instance, typeUrl, 65 | extensionRegistry: extensionRegistry); 66 | return instance; 67 | } 68 | 69 | /// Returns `true` if the encoded message matches the type of [instance]. 70 | /// 71 | /// Can be used with a default instance: 72 | /// `any.canUnpackInto(Message.getDefault())` 73 | $core.bool canUnpackInto($pb.GeneratedMessage instance) { 74 | return $pb.canUnpackIntoHelper(instance, typeUrl); 75 | } 76 | 77 | /// Creates a new [Any] encoding [message]. 78 | /// 79 | /// The [typeUrl] will be [typeUrlPrefix]/`fullName` where `fullName` is 80 | /// the fully qualified name of the type of [message]. 81 | static Any pack($pb.GeneratedMessage message, 82 | {$core.String typeUrlPrefix = 'type.googleapis.com'}) { 83 | return Any() 84 | ..value = message.writeToBuffer() 85 | ..typeUrl = '${typeUrlPrefix}/${message.info_.qualifiedMessageName}'; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /lib/index/asset/add_wallet/add_wallet_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flash_tron_wallet/common/enum/import_wallet_type.dart'; 2 | import 'package:flash_tron_wallet/common/util/color_util.dart'; 3 | import 'package:flash_tron_wallet/common/util/common_util.dart'; 4 | import 'package:flash_tron_wallet/common/util/screen_util.dart'; 5 | import 'package:flash_tron_wallet/common/util/text_util.dart'; 6 | import 'package:flash_tron_wallet/common/widget/scaffold/scaffold_widget.dart'; 7 | import 'package:flash_tron_wallet/locale/app_Locale.dart'; 8 | import 'package:flash_tron_wallet/route/app_route.dart'; 9 | import 'package:flutter/material.dart'; 10 | import 'package:get/get.dart'; 11 | 12 | class AddWalletPage extends StatefulWidget { 13 | @override 14 | _AddWalletPageState createState() => _AddWalletPageState(); 15 | } 16 | 17 | class _AddWalletPageState extends State { 18 | @override 19 | Widget build(BuildContext context) { 20 | return MyScaffold( 21 | hasAppBar: true, 22 | hasBack: true, 23 | title: '${MyLocaleKey.assetAddWallet.tr}', 24 | body: Obx( 25 | () => _bodyWidget(context), 26 | ), 27 | ); 28 | } 29 | 30 | Widget _bodyWidget(BuildContext context) { 31 | return Container( 32 | child: ListView( 33 | children: [ 34 | MyCommonUtil.interval(value: 20), 35 | _bizWidget(context), 36 | MyCommonUtil.interval(value: 20), 37 | ], 38 | ), 39 | ); 40 | } 41 | 42 | Widget _bizWidget(BuildContext context) { 43 | return Container( 44 | margin: MyCommonUtil.edge(left: 30, right: 30), 45 | child: Column( 46 | children: [ 47 | SizedBox(height: MyScreenUtil.height(30)), 48 | _itemWidget(context, '${MyLocaleKey.assetImportPrivateKey.tr}', 49 | ImportWalletType.importKey, true), 50 | SizedBox(height: MyScreenUtil.height(30)), 51 | _itemWidget(context, '${MyLocaleKey.assetImportMnemonic.tr}', 52 | ImportWalletType.importMnemonic, true), 53 | SizedBox(height: MyScreenUtil.height(30)), 54 | _itemWidget(context, '${MyLocaleKey.assetCreateWallet.tr}', 55 | ImportWalletType.createWallet, false), 56 | ], 57 | ), 58 | ); 59 | } 60 | 61 | Widget _itemWidget( 62 | BuildContext context, String name, ImportWalletType type, bool flag) { 63 | return InkWell( 64 | onTap: () { 65 | switch (type) { 66 | case ImportWalletType.importKey: 67 | Get.toNamed(AppRoute.assetImportKey + '/2'); 68 | break; 69 | case ImportWalletType.importMnemonic: 70 | Get.toNamed(AppRoute.assetImportMnemonic + '/2'); 71 | break; 72 | case ImportWalletType.createWallet: 73 | Get.toNamed(AppRoute.assetBuildFirstWallet + '/2'); 74 | break; 75 | } 76 | }, 77 | child: Container( 78 | padding: MyCommonUtil.edge(bottom: 30), 79 | decoration: BoxDecoration( 80 | border: flag ? MyCommonUtil.bottomBorder() : null, 81 | ), 82 | child: Row( 83 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 84 | children: [ 85 | Row( 86 | children: [ 87 | MyCommonUtil.sizedBox(width: 10), 88 | Container( 89 | child: Text( 90 | '$name', 91 | style: MyTextUtil.textStyle( 92 | 2, 93 | color: MyColorUtil.biz(), 94 | spacing: 0.0, 95 | size: 30, 96 | ), 97 | ), 98 | ), 99 | ], 100 | ), 101 | Row( 102 | children: [ 103 | MyCommonUtil.arrowForward(), 104 | SizedBox(width: MyScreenUtil.width(10)), 105 | ], 106 | ), 107 | ], 108 | ), 109 | ), 110 | ); 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /lib/index/asset/backup_key/backup_key_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flash_tron_wallet/common/util/color_util.dart'; 2 | import 'package:flash_tron_wallet/common/util/common_util.dart'; 3 | import 'package:flash_tron_wallet/common/util/icon_util.dart'; 4 | import 'package:flash_tron_wallet/common/util/screen_util.dart'; 5 | import 'package:flash_tron_wallet/common/util/text_util.dart'; 6 | import 'package:flash_tron_wallet/common/widget/scaffold/scaffold_widget.dart'; 7 | import 'package:flash_tron_wallet/entity/tron/wallet_entity.dart'; 8 | import 'package:flash_tron_wallet/locale/app_Locale.dart'; 9 | import 'package:flutter/material.dart'; 10 | import 'package:flutter/services.dart'; 11 | import 'package:get/get.dart'; 12 | 13 | class BackupKeyPage extends StatefulWidget { 14 | final int index; 15 | final WalletEntity wallet; 16 | BackupKeyPage(this.index, this.wallet); 17 | 18 | @override 19 | _BackupKeyPageState createState() => _BackupKeyPageState(); 20 | } 21 | 22 | class _BackupKeyPageState extends State { 23 | @override 24 | Widget build(BuildContext context) { 25 | return MyScaffold( 26 | hasAppBar: true, 27 | hasBack: true, 28 | title: '${MyLocaleKey.assetBackupPrivateKey.tr}', 29 | body: Obx(() => _bodyWidget(context)), 30 | ); 31 | } 32 | 33 | Widget _bodyWidget(BuildContext context) { 34 | return Container( 35 | child: ListView( 36 | children: [ 37 | MyCommonUtil.sizedBox(height: 20), 38 | _descWidget(), 39 | MyCommonUtil.sizedBox(height: 40), 40 | Container( 41 | margin: MyCommonUtil.edge(left: 30, right: 30), 42 | child: Column( 43 | children: [ 44 | _dataWidget(context, widget.wallet.privateKey), 45 | MyCommonUtil.sizedBox(height: 150), 46 | _submitWidget(context), 47 | ], 48 | ), 49 | ), 50 | ], 51 | ), 52 | ); 53 | } 54 | 55 | Widget _descWidget() { 56 | return Container( 57 | margin: MyCommonUtil.edge(left: 30, right: 30), 58 | decoration: BoxDecoration( 59 | borderRadius: BorderRadius.circular(10.0), 60 | color: MyColorUtil.theme, 61 | ), 62 | child: Column( 63 | children: [ 64 | Container( 65 | padding: 66 | MyCommonUtil.edge(left: 60, right: 60, top: 30, bottom: 20), 67 | alignment: Alignment.center, 68 | child: Text( 69 | '${MyLocaleKey.backupWalletTip2.tr}', 70 | style: MyTextUtil.textStyle(1, 71 | color: MyColorUtil.white, spacing: 0.1, size: 21), 72 | maxLines: 2, 73 | overflow: TextOverflow.ellipsis, 74 | ), 75 | ), 76 | ], 77 | ), 78 | ); 79 | } 80 | 81 | Widget _dataWidget(BuildContext context, String key) { 82 | return InkWell( 83 | onTap: () { 84 | Clipboard.setData(ClipboardData(text: key)); 85 | MyCommonUtil.showToast('${MyLocaleKey.commonCopySuccess.tr}'); 86 | }, 87 | child: Container( 88 | width: MyScreenUtil.width(700), 89 | decoration: BoxDecoration( 90 | border: MyCommonUtil.bottomBorder(), 91 | ), 92 | child: Row( 93 | children: [ 94 | Container( 95 | width: MyScreenUtil.width(600), 96 | padding: MyCommonUtil.edge(left: 10, top: 25, bottom: 20), 97 | child: Text( 98 | '$key', 99 | style: MyTextUtil.textStyle4En(2, 100 | color: MyColorUtil.biz(), spacing: 0.0, size: 28), 101 | maxLines: 3, 102 | overflow: TextOverflow.ellipsis, 103 | ), 104 | ), 105 | Container( 106 | width: MyScreenUtil.width(80), 107 | alignment: Alignment.centerRight, 108 | child: MyCommonUtil.icon( 109 | MyIconUtil.copyExt, 110 | size: 30, 111 | color: MyColorUtil.biz(), 112 | ), 113 | ), 114 | ], 115 | ), 116 | ), 117 | ); 118 | } 119 | 120 | Widget _submitWidget(BuildContext context) { 121 | return MyCommonUtil.submit( 122 | context, 123 | 320, 124 | '${MyLocaleKey.commonDone.tr}', 125 | () { 126 | Navigator.pop(context); 127 | }, 128 | ); 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /lib/index/asset/backup_mnemonic/backup_mnemonic_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flash_tron_wallet/common/util/color_util.dart'; 2 | import 'package:flash_tron_wallet/common/util/common_util.dart'; 3 | import 'package:flash_tron_wallet/common/util/icon_util.dart'; 4 | import 'package:flash_tron_wallet/common/util/screen_util.dart'; 5 | import 'package:flash_tron_wallet/common/util/text_util.dart'; 6 | import 'package:flash_tron_wallet/common/widget/scaffold/scaffold_widget.dart'; 7 | import 'package:flash_tron_wallet/entity/tron/wallet_entity.dart'; 8 | import 'package:flash_tron_wallet/locale/app_Locale.dart'; 9 | import 'package:flutter/material.dart'; 10 | import 'package:flutter/services.dart'; 11 | import 'package:get/get.dart'; 12 | 13 | class BackupMnemonicPage extends StatefulWidget { 14 | final int index; 15 | final WalletEntity wallet; 16 | BackupMnemonicPage(this.index, this.wallet); 17 | 18 | @override 19 | _BackupMnemonicPageState createState() => _BackupMnemonicPageState(); 20 | } 21 | 22 | class _BackupMnemonicPageState extends State { 23 | @override 24 | Widget build(BuildContext context) { 25 | return MyScaffold( 26 | hasAppBar: true, 27 | hasBack: true, 28 | title: '${MyLocaleKey.assetBackupMnemonic.tr}', 29 | body: Obx(() => _bodyWidget(context)), 30 | ); 31 | } 32 | 33 | Widget _bodyWidget(BuildContext context) { 34 | return Container( 35 | child: ListView( 36 | children: [ 37 | MyCommonUtil.sizedBox(height: 20), 38 | _descWidget(), 39 | MyCommonUtil.sizedBox(height: 40), 40 | Container( 41 | margin: MyCommonUtil.edge(left: 30, right: 30), 42 | child: Column( 43 | children: [ 44 | _dataWidget(context, widget.wallet.mnemonic), 45 | MyCommonUtil.sizedBox(height: 150), 46 | _submitButton(context), 47 | ], 48 | ), 49 | ), 50 | ], 51 | ), 52 | ); 53 | } 54 | 55 | Widget _descWidget() { 56 | return Container( 57 | margin: MyCommonUtil.edge(left: 30, right: 30), 58 | decoration: BoxDecoration( 59 | borderRadius: BorderRadius.circular(10), 60 | color: MyColorUtil.theme, 61 | ), 62 | child: Column( 63 | children: [ 64 | Container( 65 | padding: 66 | MyCommonUtil.edge(left: 60, right: 60, top: 30, bottom: 20), 67 | alignment: Alignment.center, 68 | child: Text( 69 | '${MyLocaleKey.backupWalletTip1.tr}', 70 | style: MyTextUtil.textStyle(1, 71 | color: MyColorUtil.white, spacing: 0.1, size: 21), 72 | maxLines: 2, 73 | overflow: TextOverflow.ellipsis, 74 | ), 75 | ), 76 | ], 77 | ), 78 | ); 79 | } 80 | 81 | Widget _dataWidget(BuildContext context, String mnemonic) { 82 | return InkWell( 83 | onTap: () { 84 | Clipboard.setData(ClipboardData(text: mnemonic)); 85 | MyCommonUtil.showToast('${MyLocaleKey.commonCopySuccess.tr}'); 86 | }, 87 | child: Container( 88 | width: MyScreenUtil.width(700), 89 | decoration: BoxDecoration( 90 | border: MyCommonUtil.bottomBorder(), 91 | ), 92 | child: Row( 93 | children: [ 94 | Container( 95 | width: MyScreenUtil.width(600), 96 | padding: MyCommonUtil.edge(left: 10, top: 25, bottom: 20), 97 | child: Text( 98 | '$mnemonic', 99 | style: MyTextUtil.textStyle4En(2, 100 | color: MyColorUtil.biz(), spacing: 0.0, size: 30), 101 | maxLines: 3, 102 | overflow: TextOverflow.ellipsis, 103 | ), 104 | ), 105 | Container( 106 | width: MyScreenUtil.width(80), 107 | alignment: Alignment.centerRight, 108 | child: MyCommonUtil.icon( 109 | MyIconUtil.copyExt, 110 | size: 30, 111 | color: MyColorUtil.biz(), 112 | ), 113 | ), 114 | ], 115 | ), 116 | )); 117 | } 118 | 119 | Widget _submitButton(BuildContext context) { 120 | return MyCommonUtil.submit( 121 | context, 122 | 320, 123 | '${MyLocaleKey.commonDone.tr}', 124 | () { 125 | Navigator.pop(context); 126 | }, 127 | ); 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /lib/index/asset/build_wallet/build_wallet_second_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flash_tron_wallet/common/util/color_util.dart'; 2 | import 'package:flash_tron_wallet/common/util/common_util.dart'; 3 | import 'package:flash_tron_wallet/common/util/icon_util.dart'; 4 | import 'package:flash_tron_wallet/common/util/screen_util.dart'; 5 | import 'package:flash_tron_wallet/common/util/text_util.dart'; 6 | import 'package:flash_tron_wallet/common/widget/scaffold/scaffold_widget.dart'; 7 | import 'package:flash_tron_wallet/entity/tron/wallet_entity.dart'; 8 | import 'package:flash_tron_wallet/locale/app_Locale.dart'; 9 | import 'package:flash_tron_wallet/provider/global_service.dart'; 10 | import 'package:flutter/material.dart'; 11 | import 'package:flutter/services.dart'; 12 | import 'package:get/get.dart'; 13 | 14 | class BuildWalletSecondPage extends StatefulWidget { 15 | final String type = Get.parameters['type']; 16 | 17 | @override 18 | _BackupMnemonicSecondPageState createState() => 19 | _BackupMnemonicSecondPageState(); 20 | } 21 | 22 | class _BackupMnemonicSecondPageState extends State { 23 | @override 24 | Widget build(BuildContext context) { 25 | return MyScaffold( 26 | hasAppBar: true, 27 | hasBack: true, 28 | title: '${MyLocaleKey.assetCreateWallet.tr}', 29 | body: Obx((() => _bodyWidget(context))), 30 | ); 31 | } 32 | 33 | Widget _bodyWidget(BuildContext context) { 34 | WalletEntity wallet = GlobalService.to.selectWalletEntity; 35 | return wallet != null && wallet.mnemonic != null 36 | ? Container( 37 | width: MyScreenUtil.width(750), 38 | child: ListView( 39 | children: [ 40 | MyCommonUtil.sizedBox(height: 20), 41 | _descWidget(), 42 | MyCommonUtil.sizedBox(height: 10), 43 | Container( 44 | margin: MyCommonUtil.edge(left: 30, right: 30), 45 | child: Column( 46 | children: [ 47 | MyCommonUtil.sizedBox(height: 10), 48 | _tipsWidget(wallet.mnemonic), 49 | MyCommonUtil.sizedBox(height: 10), 50 | _dataWidget(wallet.mnemonic), 51 | MyCommonUtil.sizedBox(height: 80), 52 | _submitWidget(context), 53 | ], 54 | ), 55 | ), 56 | ], 57 | ), 58 | ) 59 | : Container(); 60 | } 61 | 62 | Widget _descWidget() { 63 | return Container( 64 | margin: MyCommonUtil.edge(left: 30, right: 30), 65 | decoration: BoxDecoration( 66 | borderRadius: BorderRadius.circular(10), 67 | color: MyColorUtil.theme, 68 | ), 69 | child: Column( 70 | children: [ 71 | Container( 72 | padding: MyCommonUtil.edge(left: 60, right: 60, top: 30, bottom: 0), 73 | alignment: Alignment.centerLeft, 74 | child: Text( 75 | '${MyLocaleKey.addWalletTip3.tr}', 76 | style: MyTextUtil.textStyle(1, 77 | color: MyColorUtil.white, spacing: 0.1, size: 21), 78 | maxLines: 2, 79 | overflow: TextOverflow.ellipsis, 80 | ), 81 | ), 82 | Container( 83 | padding: MyCommonUtil.edge(left: 60, right: 60, top: 5, bottom: 20), 84 | alignment: Alignment.centerLeft, 85 | child: Text( 86 | '${MyLocaleKey.addWalletTip4.tr}', 87 | style: MyTextUtil.textStyle(1, 88 | color: MyColorUtil.white, spacing: 0.1, size: 21), 89 | maxLines: 2, 90 | overflow: TextOverflow.ellipsis, 91 | ), 92 | ), 93 | ], 94 | ), 95 | ); 96 | } 97 | 98 | Widget _tipsWidget(String mnemonic) { 99 | return InkWell( 100 | onTap: () { 101 | Clipboard.setData(ClipboardData(text: mnemonic)); 102 | MyCommonUtil.showToast('${MyLocaleKey.commonCopySuccess.tr}'); 103 | }, 104 | child: Container( 105 | width: MyScreenUtil.width(750), 106 | margin: EdgeInsets.only(top: 10, bottom: 10), 107 | child: Row( 108 | mainAxisAlignment: MainAxisAlignment.center, 109 | children: [ 110 | Container( 111 | child: Text( 112 | '${MyLocaleKey.commonBackupMnemonic.tr}', 113 | style: MyTextUtil.textStyle(2, 114 | color: MyColorUtil.biz(), spacing: 0.4, size: 26), 115 | ), 116 | ), 117 | Container( 118 | padding: MyCommonUtil.edge(left: 30), 119 | child: MyCommonUtil.icon( 120 | MyIconUtil.copyExt, 121 | size: 30, 122 | color: MyColorUtil.biz(), 123 | ), 124 | ), 125 | ], 126 | ), 127 | ), 128 | ); 129 | } 130 | 131 | Widget _dataWidget(String mnemonic) { 132 | List _list = mnemonic.trim().split(' '); 133 | List _listWidget = []; 134 | if (_list.length > 0) { 135 | for (int i = 0; i < _list.length; i++) { 136 | _listWidget.add(_itemWidget(i + 1, _list[i])); 137 | } 138 | return Container( 139 | child: Wrap( 140 | spacing: 3, 141 | children: _listWidget, 142 | ), 143 | ); 144 | } else { 145 | return Container(); 146 | } 147 | } 148 | 149 | Widget _itemWidget(int index, String value) { 150 | return Container( 151 | width: MyScreenUtil.width(200), 152 | margin: MyCommonUtil.edge(right: 5, top: 5, bottom: 5), 153 | decoration: BoxDecoration( 154 | //color: Color(0x80EEEEEE), 155 | color: Colors.grey[50], 156 | borderRadius: BorderRadius.circular(5.0), 157 | ), 158 | child: Column( 159 | children: [ 160 | Container( 161 | alignment: Alignment.topLeft, 162 | padding: MyCommonUtil.edge(left: 15, top: 10), 163 | child: Text( 164 | '$index', 165 | style: MyTextUtil.textStyle4Num( 166 | color: MyColorUtil.subBiz(), size: 20), 167 | ), 168 | ), 169 | Container( 170 | alignment: Alignment.center, 171 | padding: MyCommonUtil.edge(bottom: 26), 172 | child: Text( 173 | '$value', 174 | style: MyTextUtil.textStyle4En(2, 175 | color: MyColorUtil.biz(), size: 27), 176 | maxLines: 1, 177 | overflow: TextOverflow.ellipsis, 178 | ), 179 | ), 180 | ], 181 | ), 182 | ); 183 | } 184 | 185 | Widget _submitWidget(BuildContext context) { 186 | return MyCommonUtil.submit(context, 320, 187 | '${MyLocaleKey.commonSavedSafely.tr}', _onPressed(context)); 188 | } 189 | 190 | Function _onPressed(BuildContext context) { 191 | return () { 192 | if (widget.type == '1') { 193 | Navigator.of(context)..pop()..pop(); 194 | } else if (widget.type == '2') { 195 | Navigator.of(context)..pop()..pop()..pop(); 196 | } 197 | }; 198 | } 199 | } 200 | -------------------------------------------------------------------------------- /lib/index/asset/recevice_token/receive_token_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flash_tron_wallet/common/util/color_util.dart'; 2 | import 'package:flash_tron_wallet/common/util/common_util.dart'; 3 | import 'package:flash_tron_wallet/common/util/screen_util.dart'; 4 | import 'package:flash_tron_wallet/common/util/text_util.dart'; 5 | import 'package:flash_tron_wallet/common/widget/scaffold/scaffold_widget.dart'; 6 | import 'package:flash_tron_wallet/entity/tron/wallet_entity.dart'; 7 | import 'package:flash_tron_wallet/locale/app_Locale.dart'; 8 | import 'package:flash_tron_wallet/provider/global_service.dart'; 9 | import 'package:flutter/material.dart'; 10 | import 'package:flutter/services.dart'; 11 | import 'package:get/get.dart'; 12 | import 'package:qr_flutter/qr_flutter.dart'; 13 | 14 | class ReceiveTokenPage extends StatefulWidget { 15 | @override 16 | _ReceiveTokenPageState createState() => _ReceiveTokenPageState(); 17 | } 18 | 19 | class _ReceiveTokenPageState extends State { 20 | @override 21 | Widget build(BuildContext context) { 22 | return MyScaffold( 23 | hasAppBar: true, 24 | hasBack: true, 25 | title: '${MyLocaleKey.assetReceivingQrCode.tr}', 26 | body: Obx(() => _bodyWidget(context)), 27 | ); 28 | } 29 | 30 | Widget _bodyWidget(BuildContext context) { 31 | WalletEntity wallet = GlobalService.to.selectWalletEntity; 32 | return Container( 33 | margin: MyCommonUtil.edge(left: 30, right: 30), 34 | child: ListView( 35 | children: [ 36 | MyCommonUtil.sizedBox(height: 30), 37 | _qrCodeWidget(context, wallet.tronAddress.trim()), 38 | MyCommonUtil.sizedBox(height: 20), 39 | _nameWidget(context, wallet.name), 40 | MyCommonUtil.sizedBox(height: 10), 41 | _addressWidget(context, wallet.tronAddress), 42 | MyCommonUtil.sizedBox(height: 80), 43 | _copyButtonWidget(context, wallet.tronAddress), 44 | ], 45 | ), 46 | ); 47 | } 48 | 49 | Widget _qrCodeWidget(BuildContext context, String address) { 50 | return Container( 51 | margin: MyCommonUtil.edge(left: 50, right: 50), 52 | child: Card( 53 | elevation: 3, 54 | shape: RoundedRectangleBorder( 55 | borderRadius: BorderRadius.all(Radius.circular(20.0))), 56 | child: Container( 57 | margin: MyCommonUtil.edge(top: 75, bottom: 75), 58 | alignment: Alignment.center, 59 | child: QrImage( 60 | data: address, 61 | size: MyScreenUtil.width(400), 62 | ), 63 | ), 64 | ), 65 | ); 66 | } 67 | 68 | Widget _nameWidget(BuildContext context, String name) { 69 | return Container( 70 | child: Column( 71 | children: [ 72 | Container( 73 | alignment: Alignment.center, 74 | child: Text( 75 | '$name', 76 | style: MyTextUtil.textStyle(2, 77 | color: MyColorUtil.biz(), spacing: 0.2, size: 30), 78 | maxLines: 1, 79 | overflow: TextOverflow.ellipsis, 80 | ), 81 | ), 82 | ], 83 | ), 84 | ); 85 | } 86 | 87 | Widget _addressWidget(BuildContext context, String address) { 88 | return Container( 89 | child: Column( 90 | children: [ 91 | Container( 92 | alignment: Alignment.center, 93 | child: Text( 94 | '$address', 95 | style: MyTextUtil.textStyle4En(2, 96 | color: MyColorUtil.biz(), spacing: 0.0, size: 27), 97 | maxLines: 1, 98 | overflow: TextOverflow.ellipsis, 99 | ), 100 | ), 101 | ], 102 | ), 103 | ); 104 | } 105 | 106 | Widget _copyButtonWidget(BuildContext context, String address) { 107 | return MyCommonUtil.submit( 108 | context, 109 | 320, 110 | '${MyLocaleKey.assetCopyAddress.tr}', 111 | onPressed(address), 112 | ); 113 | } 114 | 115 | Function onPressed(String address) { 116 | return () { 117 | Clipboard.setData(ClipboardData(text: address)); 118 | MyCommonUtil.showToast('${MyLocaleKey.commonCopySuccess.tr}'); 119 | }; 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /lib/index/asset/update_pwd/update_pwd_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flash_tron_wallet/common/enum/text_type.dart'; 2 | import 'package:flash_tron_wallet/common/util/color_util.dart'; 3 | import 'package:flash_tron_wallet/common/util/common_util.dart'; 4 | import 'package:flash_tron_wallet/common/util/screen_util.dart'; 5 | import 'package:flash_tron_wallet/common/util/text_util.dart'; 6 | import 'package:flash_tron_wallet/common/widget/scaffold/scaffold_widget.dart'; 7 | import 'package:flash_tron_wallet/entity/tron/wallet_entity.dart'; 8 | import 'package:flash_tron_wallet/locale/app_Locale.dart'; 9 | import 'package:flash_tron_wallet/provider/global_service.dart'; 10 | import 'package:flutter/material.dart'; 11 | import 'package:flutter/services.dart'; 12 | import 'package:get/get.dart'; 13 | 14 | class UpdatePwdPage extends StatefulWidget { 15 | final int index; 16 | final WalletEntity wallet; 17 | UpdatePwdPage(this.index, this.wallet); 18 | 19 | @override 20 | _UpdatePwdPageState createState() => _UpdatePwdPageState(); 21 | } 22 | 23 | class _UpdatePwdPageState extends State { 24 | final _formKey = GlobalKey(); 25 | Color _oldPwdEyeColor = MyColorUtil.subBiz(); 26 | Color _setPwdEyeColor = MyColorUtil.subBiz(); 27 | Color _confirmPwdEyeColor = MyColorUtil.subBiz(); 28 | 29 | bool _oldPwdClickEye = true; 30 | bool _setPwdClickEye = true; 31 | bool _confirmPwdClickEye = true; 32 | 33 | String _oldPwd; 34 | String _setPwd; 35 | String _confirmPwd; 36 | 37 | @override 38 | Widget build(BuildContext context) { 39 | return MyScaffold( 40 | hasAppBar: true, 41 | hasBack: true, 42 | title: '${MyLocaleKey.assetUpdatePassword.tr}', 43 | body: Obx(() => _bodyWidget(context)), 44 | ); 45 | } 46 | 47 | Widget _bodyWidget(BuildContext context) { 48 | return Container( 49 | child: Form( 50 | key: _formKey, 51 | child: ListView( 52 | children: [ 53 | MyCommonUtil.sizedBox(height: 20), 54 | _descWidget(), 55 | MyCommonUtil.sizedBox(height: 20), 56 | Container( 57 | margin: MyCommonUtil.edge(left: 30, right: 30), 58 | child: Column( 59 | children: [ 60 | _oldPwdWidget(widget.wallet.pwd), 61 | _setPwdWidget(), 62 | _confirmPwdWidget(), 63 | MyCommonUtil.sizedBox(height: 50), 64 | _submitWidget(context), 65 | ], 66 | ), 67 | ), 68 | ], 69 | ), 70 | ), 71 | ); 72 | } 73 | 74 | Widget _oldPwdWidget(String pwd) { 75 | return MyCommonUtil.textFormField( 76 | obscureText: _oldPwdClickEye, 77 | onSaved: (String value) => _oldPwd = value, 78 | maxLength: 6, 79 | inputFormatter: [FilteringTextInputFormatter.allow(RegExp("[0-9]"))], 80 | keyboardType: TextInputType.number, 81 | labelText: '${MyLocaleKey.commonEnterOldPwd.tr}', 82 | textType: TextType.onlyNum, 83 | suffixIcon: IconButton( 84 | icon: Icon( 85 | Icons.remove_red_eye, 86 | color: _oldPwdEyeColor, 87 | size: MyScreenUtil.sp(38), 88 | ), 89 | onPressed: () { 90 | setState(() { 91 | _oldPwdClickEye = !_oldPwdClickEye; 92 | _oldPwdEyeColor = 93 | _oldPwdClickEye ? MyColorUtil.subBiz() : MyColorUtil.theme; 94 | }); 95 | }, 96 | ), 97 | validator: (String value) { 98 | if (value.isEmpty) { 99 | return '${MyLocaleKey.commonCanNotBeEmpty.tr}'; 100 | } else if (value.trim().length != 6) { 101 | return '${MyLocaleKey.commonNeed6Digit.tr}'; 102 | } else if (value.trim() != pwd) { 103 | return '${MyLocaleKey.commonPwdIncorrect.tr}'; 104 | } else { 105 | return null; 106 | } 107 | }, 108 | ); 109 | } 110 | 111 | Widget _setPwdWidget() { 112 | return MyCommonUtil.textFormField( 113 | obscureText: _setPwdClickEye, 114 | onSaved: (String value) => _setPwd = value, 115 | maxLength: 6, 116 | inputFormatter: [FilteringTextInputFormatter.allow(RegExp("[0-9]"))], 117 | keyboardType: TextInputType.number, 118 | labelText: '${MyLocaleKey.assetSetPassword.tr}', 119 | textType: TextType.onlyNum, 120 | suffixIcon: IconButton( 121 | icon: Icon( 122 | Icons.remove_red_eye, 123 | color: _setPwdEyeColor, 124 | size: MyScreenUtil.sp(38), 125 | ), 126 | onPressed: () { 127 | setState(() { 128 | _setPwdClickEye = !_setPwdClickEye; 129 | _setPwdEyeColor = 130 | _setPwdClickEye ? MyColorUtil.subBiz() : MyColorUtil.theme; 131 | }); 132 | }, 133 | ), 134 | validator: (String value) { 135 | if (value.isEmpty) { 136 | return '${MyLocaleKey.commonCanNotBeEmpty.tr}'; 137 | } else if (value.trim().length != 6) { 138 | return '${MyLocaleKey.commonNeed6Digit.tr}'; 139 | } else { 140 | return null; 141 | } 142 | }, 143 | ); 144 | } 145 | 146 | Widget _confirmPwdWidget() { 147 | return MyCommonUtil.textFormField( 148 | obscureText: _confirmPwdClickEye, 149 | onSaved: (String value) => _confirmPwd = value, 150 | maxLength: 6, 151 | inputFormatter: [FilteringTextInputFormatter.allow(RegExp("[0-9]"))], 152 | keyboardType: TextInputType.number, 153 | labelText: '${MyLocaleKey.assetConfirmPassword.tr}', 154 | textType: TextType.onlyNum, 155 | suffixIcon: IconButton( 156 | icon: Icon( 157 | Icons.remove_red_eye, 158 | color: _confirmPwdEyeColor, 159 | size: MyScreenUtil.sp(38), 160 | ), 161 | onPressed: () { 162 | setState(() { 163 | _confirmPwdClickEye = !_confirmPwdClickEye; 164 | _confirmPwdEyeColor = 165 | _confirmPwdClickEye ? MyColorUtil.subBiz() : MyColorUtil.theme; 166 | }); 167 | }, 168 | ), 169 | validator: (String value) { 170 | if (value.isEmpty) { 171 | return '${MyLocaleKey.commonCanNotBeEmpty.tr}'; 172 | } else { 173 | return null; 174 | } 175 | }, 176 | ); 177 | } 178 | 179 | Widget _submitWidget(BuildContext context) { 180 | return MyCommonUtil.submit( 181 | context, 182 | 320, 183 | '${MyLocaleKey.commonSubmit.tr}', 184 | _onPressed(context), 185 | ); 186 | } 187 | 188 | Function _onPressed(BuildContext context) { 189 | return () { 190 | if (_formKey.currentState.validate()) { 191 | _formKey.currentState.save(); 192 | if (_setPwd != _confirmPwd) { 193 | MyCommonUtil.showToast('${MyLocaleKey.commonConfirmPwdError.tr}'); 194 | } else { 195 | _submit(context).then((val) { 196 | if (val == true) { 197 | MyCommonUtil.showToast('${MyLocaleKey.commonUpdateSuccess.tr}'); 198 | Navigator.pop(context); 199 | } else { 200 | MyCommonUtil.showToast('${MyLocaleKey.commonExecuteFail.tr}'); 201 | } 202 | }); 203 | } 204 | } 205 | }; 206 | } 207 | 208 | Widget _descWidget() { 209 | return Container( 210 | margin: MyCommonUtil.edge(left: 30, right: 30), 211 | decoration: BoxDecoration( 212 | borderRadius: BorderRadius.circular(10), 213 | color: MyColorUtil.theme, 214 | ), 215 | child: Column( 216 | children: [ 217 | Container( 218 | padding: MyCommonUtil.edge(left: 60, right: 60, top: 30, bottom: 0), 219 | alignment: Alignment.centerLeft, 220 | child: Text( 221 | '${MyLocaleKey.addWalletTip1.tr}', 222 | style: MyTextUtil.textStyle(1, 223 | color: MyColorUtil.white, spacing: 0.1, size: 21), 224 | maxLines: 2, 225 | overflow: TextOverflow.ellipsis, 226 | ), 227 | ), 228 | Container( 229 | padding: MyCommonUtil.edge(left: 60, right: 60, top: 5, bottom: 20), 230 | alignment: Alignment.centerLeft, 231 | child: Text( 232 | '${MyLocaleKey.addWalletTip2.tr}', 233 | style: MyTextUtil.textStyle(1, 234 | color: MyColorUtil.white, spacing: 0.1, size: 21), 235 | maxLines: 2, 236 | overflow: TextOverflow.ellipsis, 237 | ), 238 | ), 239 | ], 240 | ), 241 | ); 242 | } 243 | 244 | Future _submit(BuildContext context) async { 245 | return await GlobalService.to.updatePwd(widget.index, _setPwd); 246 | } 247 | } 248 | -------------------------------------------------------------------------------- /lib/index/index_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flash_tron_wallet/common/util/color_util.dart'; 2 | import 'package:flash_tron_wallet/common/util/screen_util.dart'; 3 | import 'package:flash_tron_wallet/common/util/text_util.dart'; 4 | import 'package:flash_tron_wallet/index/asset/asset_page.dart'; 5 | import 'package:flash_tron_wallet/index/mine/mine_page.dart'; 6 | import 'package:flash_tron_wallet/index/trade/trade_page.dart'; 7 | import 'package:flash_tron_wallet/provider/global_service.dart'; 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_screenutil/screenutil.dart'; 10 | import 'package:get/get.dart'; 11 | 12 | class IndexPage extends StatefulWidget { 13 | @override 14 | _IndexPageState createState() => _IndexPageState(); 15 | } 16 | 17 | class _IndexPageState extends State { 18 | final List tabBodies = [ 19 | AssetPage(), 20 | TradePage(), 21 | MinePage(), 22 | ]; 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | ScreenUtil.init(context, 27 | designSize: Size(750, 1624), allowFontScaling: false); 28 | return Scaffold( 29 | body: _bodyWidget(context), 30 | bottomNavigationBar: Obx( 31 | () => _bottomNavigationBarWidget(context), 32 | ), 33 | ); 34 | } 35 | 36 | Widget _bodyWidget(BuildContext context) { 37 | return PageView( 38 | physics: NeverScrollableScrollPhysics(), 39 | controller: GlobalService.to.pvController, 40 | onPageChanged: (index) { 41 | GlobalService.to.changeCurrentIndex(index); 42 | }, 43 | children: tabBodies, 44 | ); 45 | } 46 | 47 | Widget _bottomNavigationBarWidget(BuildContext context) { 48 | return BottomNavigationBar( 49 | type: BottomNavigationBarType.fixed, 50 | currentIndex: GlobalService.to.currentIndex, 51 | backgroundColor: MyColorUtil.bottomAppBar(), 52 | items: _bottomTabs(context), 53 | selectedFontSize: MyScreenUtil.sp(22), 54 | unselectedFontSize: MyScreenUtil.sp(22), 55 | onTap: (value) { 56 | GlobalService.to.changeCurrentIndex(value); 57 | }, 58 | ); 59 | } 60 | 61 | List _bottomTabs(BuildContext context) { 62 | List _bottomTabs = [ 63 | BottomNavigationBarItem( 64 | icon: Icon(Icons.donut_small), 65 | title: Text( 66 | '资产', 67 | style: MyTextUtil.textStyle4Index(2), 68 | ), 69 | ), 70 | BottomNavigationBarItem( 71 | icon: Icon(Icons.explore), 72 | title: Text( 73 | '交易', 74 | style: MyTextUtil.textStyle4Index(2), 75 | ), 76 | ), 77 | BottomNavigationBarItem( 78 | icon: Icon(Icons.account_circle), 79 | title: Text( 80 | '我的', 81 | style: MyTextUtil.textStyle4Index(2), 82 | ), 83 | ), 84 | ]; 85 | return _bottomTabs; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /lib/index/mine/download/download_page.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:flash_tron_wallet/common/util/color_util.dart'; 4 | import 'package:flash_tron_wallet/common/util/common_util.dart'; 5 | import 'package:flash_tron_wallet/common/util/text_util.dart'; 6 | import 'package:flash_tron_wallet/locale/app_Locale.dart'; 7 | import 'package:flutter/cupertino.dart'; 8 | import 'package:flutter/material.dart'; 9 | import 'package:get/get.dart'; 10 | import 'package:open_file/open_file.dart'; 11 | import 'package:ota_update/ota_update.dart'; 12 | import 'package:path_provider/path_provider.dart'; 13 | 14 | class DownloadPage extends StatefulWidget { 15 | final String url; 16 | 17 | DownloadPage(this.url); 18 | 19 | @override 20 | _DownloadPageState createState() => _DownloadPageState(); 21 | } 22 | 23 | class _DownloadPageState extends State { 24 | String progress = ''; 25 | 26 | @override 27 | void initState() { 28 | super.initState(); 29 | tryOtaUpdate(); 30 | } 31 | 32 | @override 33 | Widget build(BuildContext context) { 34 | return Obx(() => Container( 35 | child: CupertinoAlertDialog( 36 | title: Text( 37 | '${MyLocaleKey.mineAppUpdating.tr}', 38 | style: MyTextUtil.textStyle(2, 39 | color: MyColorUtil.biz(), spacing: 0.0, size: 32), 40 | ), 41 | content: Container( 42 | padding: EdgeInsets.only(top: 5), 43 | alignment: Alignment.center, 44 | child: progress != '' 45 | ? RichText( 46 | text: TextSpan( 47 | children: [ 48 | TextSpan( 49 | text: '${MyLocaleKey.mineAppDownloadProgress.tr}', 50 | style: MyTextUtil.textStyle4Update(2, 51 | color: MyColorUtil.biz(), spacing: 0.0, size: 28), 52 | ), 53 | TextSpan( 54 | text: '$progress%', 55 | style: MyTextUtil.textStyle4En( 56 | 2, 57 | size: 32, 58 | spacing: 0.0, 59 | color: MyColorUtil.biz(), 60 | ), 61 | ), 62 | ], 63 | ), 64 | ) 65 | : Text( 66 | '${MyLocaleKey.mineAppReadyToDownload.tr}', 67 | style: MyTextUtil.textStyle4Update(2, 68 | color: MyColorUtil.biz(), spacing: 0.0, size: 28), 69 | ), 70 | ), 71 | ))); 72 | } 73 | 74 | Future tryOtaUpdate() async { 75 | try { 76 | String url = widget.url; 77 | List list = url.split('/'); 78 | String fileName = list[list.length - 1]; 79 | 80 | Directory appDocDir = await getApplicationDocumentsDirectory(); 81 | String appDocPath = appDocDir.path; 82 | 83 | OtaUpdate().execute(url, destinationFilename: fileName).listen( 84 | (OtaEvent event) { 85 | switch (event.status) { 86 | case OtaStatus.DOWNLOADING: 87 | setState(() { 88 | if (event.value != null) { 89 | progress = event.value; 90 | } 91 | }); 92 | break; 93 | case OtaStatus.INSTALLING: 94 | Navigator.pop(context); 95 | OpenFile.open("$appDocPath/$fileName"); 96 | break; 97 | case OtaStatus.PERMISSION_NOT_GRANTED_ERROR: 98 | Navigator.pop(context); 99 | MyCommonUtil.showToast('${MyLocaleKey.mineAppDownloadFail.tr}'); 100 | break; 101 | default: 102 | Navigator.pop(context); 103 | MyCommonUtil.showToast('${MyLocaleKey.mineAppDownloadFail.tr}'); 104 | break; 105 | } 106 | }, 107 | ); 108 | } catch (e) { 109 | Navigator.pop(context); 110 | print('failed to make OTA update. Details: $e'); 111 | } 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /lib/index/mine/wallet_manage/wallet_manage_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flash_tron_wallet/common/util/color_util.dart'; 2 | import 'package:flash_tron_wallet/common/util/common_util.dart'; 3 | import 'package:flash_tron_wallet/common/util/icon_util.dart'; 4 | import 'package:flash_tron_wallet/common/util/screen_util.dart'; 5 | import 'package:flash_tron_wallet/common/util/text_util.dart'; 6 | import 'package:flash_tron_wallet/common/widget/scaffold/scaffold_widget.dart'; 7 | import 'package:flash_tron_wallet/entity/tron/wallet_entity.dart'; 8 | import 'package:flash_tron_wallet/index/asset/wallet_detail/wallet_detail_page.dart'; 9 | import 'package:flash_tron_wallet/locale/app_Locale.dart'; 10 | import 'package:flash_tron_wallet/provider/global_service.dart'; 11 | import 'package:flutter/material.dart'; 12 | import 'package:flutter/services.dart'; 13 | import 'package:get/get.dart'; 14 | 15 | class WalletManagePage extends StatefulWidget { 16 | @override 17 | _WalletManagePageState createState() => _WalletManagePageState(); 18 | } 19 | 20 | class _WalletManagePageState extends State { 21 | bool _langType = true; 22 | 23 | @override 24 | Widget build(BuildContext context) { 25 | return MyScaffold( 26 | hasBack: true, 27 | title: '${MyLocaleKey.mineManageWallet.tr}', 28 | body: Obx(() => _bodyWidget(context)), 29 | ); 30 | } 31 | 32 | Widget _bodyWidget(BuildContext context) { 33 | _langType = GlobalService.to.langType; 34 | List walletList = GlobalService.to.walletList; 35 | return Container( 36 | child: Column( 37 | children: [ 38 | walletList.length > 0 39 | ? Expanded(child: _walletListWidget(context, walletList)) 40 | : _notWalletWidget(context), 41 | ], 42 | ), 43 | ); 44 | } 45 | 46 | Widget _notWalletWidget(BuildContext context) { 47 | return Container( 48 | margin: MyCommonUtil.edge(left: 30, right: 30, top: 10, bottom: 20), 49 | padding: MyCommonUtil.edge(top: 50, bottom: 50), 50 | decoration: BoxDecoration( 51 | borderRadius: BorderRadius.all(Radius.circular(10.0)), 52 | image: DecorationImage( 53 | image: AssetImage('asset/image/bg02.png'), 54 | fit: BoxFit.cover, 55 | ), 56 | ), 57 | child: Container( 58 | alignment: Alignment.center, 59 | child: Text( 60 | '${MyLocaleKey.mineNoWallet.tr}', 61 | style: MyTextUtil.textStyle(2, 62 | color: MyColorUtil.white, spacing: 0.5, size: 28), 63 | ), 64 | ), 65 | ); 66 | } 67 | 68 | Widget _walletListWidget( 69 | BuildContext context, List walletList) { 70 | return Container( 71 | child: ListView.builder( 72 | shrinkWrap: true, 73 | physics: BouncingScrollPhysics(), 74 | scrollDirection: Axis.vertical, 75 | itemCount: walletList.length, 76 | itemBuilder: (context, index) { 77 | return _walletItemWidget(context, walletList[index], index); 78 | }), 79 | ); 80 | } 81 | 82 | Widget _walletItemWidget(BuildContext context, WalletEntity item, int index) { 83 | int selectIndex = GlobalService.to.selectWalletIndex; 84 | bool flag = selectIndex == index; 85 | String name = item.name; 86 | String tronAddress = item.tronAddress.substring(0, 10) + 87 | '...' + 88 | item.tronAddress 89 | .substring(item.tronAddress.length - 10, item.tronAddress.length); 90 | return Container( 91 | margin: MyCommonUtil.edge( 92 | left: 30, right: 30, top: index == 0 ? 10 : 0, bottom: 20), 93 | padding: MyCommonUtil.edge(left: 40, right: 40, top: 40, bottom: 40), 94 | decoration: BoxDecoration( 95 | borderRadius: BorderRadius.all(Radius.circular(10.0)), 96 | image: DecorationImage( 97 | image: AssetImage('asset/image/bg02.png'), 98 | fit: BoxFit.cover, 99 | ), 100 | ), 101 | child: InkWell( 102 | onTap: () { 103 | //Get.toNamed(AppRoute.assetWalletDetail + '/$index'); 104 | Get.to(WalletDetailPage(index, item)); 105 | }, 106 | child: Column( 107 | crossAxisAlignment: CrossAxisAlignment.start, 108 | children: [ 109 | Row( 110 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 111 | children: [ 112 | Container( 113 | child: Row( 114 | children: [ 115 | Container( 116 | child: Text( 117 | '$name', 118 | style: MyTextUtil.textStyle(2, 119 | color: MyColorUtil.white, spacing: 0.5, size: 28), 120 | ), 121 | ), 122 | MyCommonUtil.sizedBox(width: 50), 123 | flag 124 | ? Container( 125 | width: MyScreenUtil.width(80), 126 | padding: _langType 127 | ? MyCommonUtil.edge(top: 2, bottom: 2) 128 | : MyCommonUtil.edge(top: 5, bottom: 5), 129 | alignment: Alignment.center, 130 | decoration: BoxDecoration( 131 | borderRadius: 132 | BorderRadius.all(Radius.circular(5.0)), 133 | color: MyColorUtil.white, 134 | ), 135 | child: Text( 136 | '${MyLocaleKey.commonCurrent.tr}', 137 | style: MyTextUtil.textStyle(2, 138 | color: MyColorUtil.theme, 139 | spacing: 0.2, 140 | size: 20), 141 | ), 142 | ) 143 | : Container(), 144 | ], 145 | ), 146 | ), 147 | Container( 148 | child: MyCommonUtil.icon( 149 | MyIconUtil.arrowForwardIos, 150 | size: 28, 151 | color: MyColorUtil.white, 152 | ), 153 | ), 154 | ], 155 | ), 156 | MyCommonUtil.sizedBox(height: 20), 157 | InkWell( 158 | onTap: () { 159 | Clipboard.setData(ClipboardData(text: item.tronAddress)); 160 | MyCommonUtil.showToast('${MyLocaleKey.commonCopySuccess.tr}'); 161 | }, 162 | child: Container( 163 | child: Row( 164 | children: [ 165 | Container( 166 | child: Text( 167 | '$tronAddress', 168 | style: MyTextUtil.textStyle4En(1, 169 | color: MyColorUtil.white, spacing: 0.5, size: 26), 170 | ), 171 | ), 172 | MyCommonUtil.sizedBox(width: 50), 173 | Container( 174 | child: MyCommonUtil.icon( 175 | MyIconUtil.copyExt, 176 | size: 28, 177 | color: MyColorUtil.white, 178 | ), 179 | ), 180 | ], 181 | ), 182 | ), 183 | ), 184 | ], 185 | ), 186 | ), 187 | ); 188 | } 189 | } 190 | -------------------------------------------------------------------------------- /lib/index/qr/qr_scan_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flash_tron_wallet/common/util/color_util.dart'; 2 | import 'package:flash_tron_wallet/common/util/common_util.dart'; 3 | import 'package:flash_tron_wallet/common/util/screen_util.dart'; 4 | import 'package:flash_tron_wallet/common/util/text_util.dart'; 5 | import 'package:flash_tron_wallet/locale/app_Locale.dart'; 6 | import 'package:flash_tron_wallet/provider/global_service.dart'; 7 | import 'package:flash_tron_wallet/route/app_route.dart'; 8 | import 'package:flutter/material.dart'; 9 | import 'package:get/get.dart'; 10 | import 'package:scan/scan.dart'; 11 | 12 | class QrScanPage extends StatefulWidget { 13 | final String type = Get.parameters['type']; 14 | 15 | @override 16 | _QrScanPageState createState() => _QrScanPageState(); 17 | } 18 | 19 | class _QrScanPageState extends State { 20 | ScanController controller = ScanController(); 21 | bool _langType = true; 22 | 23 | @override 24 | void initState() { 25 | super.initState(); 26 | } 27 | 28 | @override 29 | void dispose() { 30 | controller.pause(); 31 | super.dispose(); 32 | } 33 | 34 | @override 35 | Widget build(BuildContext context) { 36 | /*double width = MediaQuery.of(context).size.width; 37 | double height = MediaQuery.of(context).size.height; 38 | return Scaffold( 39 | appBar: PreferredSize( 40 | child: Container( 41 | width: width, 42 | child: Obx(() => _qrCodeWidget(context)), 43 | ), 44 | preferredSize: Size(width, height), 45 | ), 46 | );*/ 47 | return MediaQuery.removePadding( 48 | removeTop: true, 49 | context: context, 50 | child: Scaffold( 51 | appBar: PreferredSize( 52 | child: AppBar( 53 | backgroundColor: Colors.transparent, 54 | brightness: Brightness.dark, 55 | elevation: 0, 56 | ), 57 | preferredSize: Size.fromHeight(0), 58 | ), 59 | body: Obx(() => _qrCodeWidget(context)), 60 | )); 61 | } 62 | 63 | Widget _qrCodeWidget(BuildContext context) { 64 | _langType = GlobalService.to.langType; 65 | return Container( 66 | child: Stack( 67 | children: [ 68 | Container( 69 | child: ScanView( 70 | controller: controller, 71 | scanAreaScale: 0.7, 72 | scanLineColor: MyColorUtil.theme, 73 | onCapture: (data) { 74 | if (widget.type == '1') { 75 | Navigator.of(context)..pop(); 76 | } else { 77 | Navigator.of(context)..pop()..pop(); 78 | } 79 | Get.toNamed(AppRoute.assetSendToken + '/$data'); 80 | }, 81 | ), 82 | ), 83 | Container( 84 | margin: MyCommonUtil.edge(left: 30, right: 30, top: 65), 85 | child: Row( 86 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 87 | children: [ 88 | InkWell( 89 | onTap: () { 90 | Navigator.of(context)..pop(); 91 | }, 92 | child: Container( 93 | child: Icon( 94 | Icons.arrow_back, 95 | size: MyScreenUtil.sp(45), 96 | color: MyColorUtil.white, 97 | ), 98 | ), 99 | ), 100 | Container( 101 | padding: EdgeInsets.only( 102 | left: _langType 103 | ? MyScreenUtil.width(20) 104 | : MyScreenUtil.width(130)), 105 | child: Text( 106 | '${MyLocaleKey.commonScan.tr}', 107 | style: MyTextUtil.textStyle(2, 108 | color: MyColorUtil.white, spacing: 0.2, size: 32), 109 | ), 110 | ), 111 | Container( 112 | child: Text( 113 | '${MyLocaleKey.commonPhotoAlbum.tr}', 114 | style: MyTextUtil.textStyle(2, 115 | color: MyColorUtil.white.withOpacity(0), 116 | spacing: 0.2, 117 | size: 32), 118 | ), 119 | ), 120 | ], 121 | ), 122 | ), 123 | ], 124 | ), 125 | ); 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /lib/index/trade/trade_controller.dart: -------------------------------------------------------------------------------- 1 | import 'package:get/get.dart'; 2 | 3 | class TradeController extends GetxController { 4 | @override 5 | void onInit() { 6 | super.onInit(); 7 | } 8 | 9 | @override 10 | void onClose() { 11 | super.onClose(); 12 | } 13 | 14 | var _swapLeftIndex = Rx(0); 15 | 16 | int get swapLeftIndex => _swapLeftIndex.value; 17 | 18 | changeSwapLeftIndex(int value) { 19 | _swapLeftIndex.value = value; 20 | } 21 | 22 | var _swapRightIndex = Rx(1); 23 | 24 | int get swapRightIndex => _swapRightIndex.value; 25 | 26 | changeSwapRightIndex(int value) { 27 | _swapRightIndex.value = value; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/index/trade/trade_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flash_tron_wallet/common/util/color_util.dart'; 2 | import 'package:flash_tron_wallet/common/util/common_util.dart'; 3 | import 'package:flash_tron_wallet/common/widget/scaffold/scaffold_widget.dart'; 4 | import 'package:flash_tron_wallet/index/trade/market/market_page.dart'; 5 | import 'package:flash_tron_wallet/index/trade/swap/swap_page.dart'; 6 | import 'package:flash_tron_wallet/index/trade/trade_controller.dart'; 7 | import 'package:flash_tron_wallet/locale/app_Locale.dart'; 8 | import 'package:flutter/material.dart'; 9 | import 'package:get/get.dart'; 10 | 11 | class TradePage extends StatefulWidget { 12 | @override 13 | _TradePageState createState() => _TradePageState(); 14 | } 15 | 16 | class _TradePageState extends State 17 | with SingleTickerProviderStateMixin { 18 | TabController _tabController; 19 | 20 | @override 21 | void initState() { 22 | super.initState(); 23 | _tabController = TabController(vsync: this, length: 2) 24 | ..addListener(() { 25 | FocusScope.of(context).requestFocus(FocusNode()); 26 | }); 27 | } 28 | 29 | @override 30 | Widget build(BuildContext context) { 31 | Get.lazyPut(() => TradeController()); 32 | return MyScaffold( 33 | hasAppBar: false, 34 | body: Obx(() => _bodyWidget(context)), 35 | ); 36 | } 37 | 38 | Widget _bodyWidget(BuildContext context) { 39 | return Container( 40 | child: DefaultTabController( 41 | length: 3, 42 | child: Column( 43 | children: [ 44 | Container( 45 | padding: 46 | MyCommonUtil.edge(left: 150, right: 150, top: 10, bottom: 10), 47 | decoration: BoxDecoration( 48 | color: MyColorUtil.white, 49 | ), 50 | child: MyCommonUtil.tabBar( 51 | controller: _tabController, 52 | indicatorColor: MyColorUtil.biz(), 53 | labelColor: MyColorUtil.biz(), 54 | unselectedLabelColor: MyColorUtil.subBiz(), 55 | tabs: [ 56 | Tab(text: '${MyLocaleKey.swapMarket.tr}'), 57 | Tab(text: '${MyLocaleKey.swapSwap.tr}'), 58 | ], 59 | ), 60 | ), 61 | Expanded( 62 | flex: 1, 63 | child: TabBarView( 64 | controller: _tabController, 65 | children: [ 66 | MarketPage(_tabController), 67 | SwapPage(), 68 | ], 69 | ), 70 | ), 71 | ], 72 | ), 73 | ), 74 | ); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:flash_tron_wallet/common/util/color_util.dart'; 4 | import 'package:flash_tron_wallet/common/widget/splash/splash_screen_view.dart'; 5 | import 'package:flash_tron_wallet/index/index_page.dart'; 6 | import 'package:flash_tron_wallet/locale/app_Locale.dart'; 7 | import 'package:flash_tron_wallet/provider/global_injection.dart'; 8 | import 'package:flash_tron_wallet/provider/global_service.dart'; 9 | import 'package:flash_tron_wallet/route/app_route.dart'; 10 | import 'package:flutter/material.dart'; 11 | import 'package:flutter/services.dart'; 12 | import 'package:get/get.dart'; 13 | import 'package:google_fonts/google_fonts.dart'; 14 | 15 | void main() async { 16 | WidgetsFlutterBinding.ensureInitialized(); 17 | await GlobalInjection.init(); 18 | runApp(MyApp()); 19 | 20 | if (Platform.isAndroid) { 21 | SystemUiOverlayStyle systemUiOverlayStyle = 22 | SystemUiOverlayStyle(statusBarColor: Colors.transparent); 23 | SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle); 24 | } 25 | } 26 | 27 | class MyApp extends StatelessWidget { 28 | @override 29 | Widget build(BuildContext context) { 30 | return GetMaterialApp( 31 | title: 'Flash Wallet', 32 | debugShowCheckedModeBanner: false, 33 | theme: MyTheme.lightTheme, 34 | getPages: AppRoute.pages, 35 | defaultTransition: Transition.cupertino, 36 | locale: 37 | GlobalService.to.langType ? Locale('zh', 'CN') : Locale('en', 'US'), 38 | translationsKeys: AppLocale.translations, 39 | home: _splashWidget(context), 40 | ); 41 | } 42 | 43 | Widget _splashWidget(BuildContext context) { 44 | bool flag = Platform.isAndroid; 45 | return SplashScreenView( 46 | home: IndexPage(), 47 | duration: 1500, 48 | imageSize: flag ? 95 : 110, 49 | imageSrc: flag ? 'asset/image/flash-logo.png' : 'asset/image/flash.png', 50 | text: '', 51 | textType: TextType.TyperAnimatedText, 52 | textStyle: GoogleFonts.lato( 53 | letterSpacing: 0.3, 54 | color: flag ? MyColorUtil.white : MyColorUtil.white, 55 | fontSize: 22, 56 | ), 57 | backgroundColor: flag ? MyColorUtil.theme : MyColorUtil.white, 58 | ); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /lib/model/swap_model.dart: -------------------------------------------------------------------------------- 1 | class SwapRespModel { 2 | int code; 3 | String msg; 4 | SwapData data; 5 | 6 | SwapRespModel({this.code, this.msg, this.data}); 7 | 8 | SwapRespModel.fromJson(Map json) { 9 | code = json['code']; 10 | msg = json['msg']; 11 | data = json['data'] != null ? new SwapData.fromJson(json['data']) : null; 12 | } 13 | 14 | Map toJson() { 15 | final Map data = new Map(); 16 | data['code'] = this.code; 17 | data['msg'] = this.msg; 18 | if (this.data != null) { 19 | data['data'] = this.data.toJson(); 20 | } 21 | return data; 22 | } 23 | } 24 | 25 | class SwapData { 26 | int total; 27 | List rows; 28 | 29 | SwapData({this.total, this.rows}); 30 | 31 | SwapData.fromJson(Map json) { 32 | total = json['total']; 33 | if (json['rows'] != null) { 34 | rows = new List(); 35 | json['rows'].forEach((v) { 36 | rows.add(new SwapRow.fromJson(v)); 37 | }); 38 | } 39 | } 40 | 41 | Map toJson() { 42 | final Map data = new Map(); 43 | data['total'] = this.total; 44 | if (this.rows != null) { 45 | data['rows'] = this.rows.map((v) => v.toJson()).toList(); 46 | } 47 | return data; 48 | } 49 | } 50 | 51 | class SwapRow { 52 | int id; 53 | String lpTokenAddress; 54 | String swapTokenAddress; 55 | String swapTokenName; 56 | int swapTokenType; 57 | int swapTokenPrecision; 58 | String swapPicUrl; 59 | String swapPairName; 60 | String swapPairAddress; 61 | String baseTokenAddress; 62 | String baseTokenName; 63 | int baseTokenType; 64 | int baseTokenPrecision; 65 | String basePicUrl; 66 | double swapTokenAmount; 67 | double baseTokenAmount; 68 | double totalLiquidity; 69 | double swapTokenPrice1; 70 | double swapTokenPrice2; 71 | double baseTokenPrice1; 72 | double baseTokenPrice2; 73 | double volume24h; 74 | double transaction24h; 75 | double swapTokenOpenPrice1; 76 | double swapTokenOpenPrice2; 77 | double swapTokenChange1; 78 | double swapTokenChange2; 79 | int swapTokenDecimal; 80 | 81 | SwapRow({ 82 | this.id, 83 | this.lpTokenAddress, 84 | this.swapTokenAddress, 85 | this.swapTokenName, 86 | this.swapTokenType, 87 | this.swapTokenPrecision, 88 | this.swapPicUrl, 89 | this.swapPairName, 90 | this.swapPairAddress, 91 | this.baseTokenAddress, 92 | this.baseTokenName, 93 | this.baseTokenType, 94 | this.baseTokenPrecision, 95 | this.basePicUrl, 96 | this.swapTokenAmount, 97 | this.baseTokenAmount, 98 | this.totalLiquidity, 99 | this.swapTokenPrice1, 100 | this.swapTokenPrice2, 101 | this.baseTokenPrice1, 102 | this.baseTokenPrice2, 103 | this.volume24h, 104 | this.transaction24h, 105 | this.swapTokenOpenPrice1, 106 | this.swapTokenOpenPrice2, 107 | this.swapTokenChange1, 108 | this.swapTokenChange2, 109 | this.swapTokenDecimal, 110 | }); 111 | 112 | SwapRow.fromJson(Map json) { 113 | id = json['id']; 114 | lpTokenAddress = json['lpTokenAddress']; 115 | swapTokenAddress = json['swapTokenAddress']; 116 | swapTokenName = json['swapTokenName']; 117 | swapTokenType = json['swapTokenType']; 118 | swapTokenPrecision = json['swapTokenPrecision']; 119 | swapPicUrl = json['swapPicUrl']; 120 | swapPairName = json['swapPairName']; 121 | swapPairAddress = json['swapPairAddress']; 122 | baseTokenAddress = json['baseTokenAddress']; 123 | baseTokenName = json['baseTokenName']; 124 | baseTokenType = json['baseTokenType']; 125 | baseTokenPrecision = json['baseTokenPrecision']; 126 | basePicUrl = json['basePicUrl']; 127 | swapTokenAmount = (json['swapTokenAmount'] as num)?.toDouble(); 128 | baseTokenAmount = (json['baseTokenAmount'] as num)?.toDouble(); 129 | totalLiquidity = (json['totalLiquidity'] as num)?.toDouble(); 130 | swapTokenPrice1 = (json['swapTokenPrice1'] as num)?.toDouble(); 131 | swapTokenPrice2 = (json['swapTokenPrice2'] as num)?.toDouble(); 132 | baseTokenPrice1 = (json['baseTokenPrice1'] as num)?.toDouble(); 133 | baseTokenPrice2 = (json['baseTokenPrice2'] as num)?.toDouble(); 134 | volume24h = (json['volume24h'] as num)?.toDouble(); 135 | transaction24h = (json['transaction24h'] as num)?.toDouble(); 136 | swapTokenOpenPrice1 = (json['swapTokenOpenPrice1'] as num)?.toDouble(); 137 | swapTokenOpenPrice2 = (json['swapTokenOpenPrice2'] as num)?.toDouble(); 138 | swapTokenChange1 = (json['swapTokenChange1'] as num)?.toDouble(); 139 | swapTokenChange2 = (json['swapTokenChange2'] as num)?.toDouble(); 140 | swapTokenDecimal = json['swapTokenDecimal']; 141 | } 142 | 143 | Map toJson() { 144 | final Map data = new Map(); 145 | data['id'] = this.id; 146 | data['lpTokenAddress'] = this.lpTokenAddress; 147 | data['swapTokenAddress'] = this.swapTokenAddress; 148 | data['swapTokenName'] = this.swapTokenName; 149 | data['swapTokenType'] = this.swapTokenType; 150 | data['swapTokenPrecision'] = this.swapTokenPrecision; 151 | data['swapPicUrl'] = this.swapPicUrl; 152 | data['swapPairName'] = this.swapPairName; 153 | data['swapPairAddress'] = this.swapPairAddress; 154 | data['baseTokenAddress'] = this.baseTokenAddress; 155 | data['baseTokenName'] = this.baseTokenName; 156 | data['baseTokenType'] = this.baseTokenType; 157 | data['baseTokenPrecision'] = this.baseTokenPrecision; 158 | data['basePicUrl'] = this.basePicUrl; 159 | data['swapTokenAmount'] = this.swapTokenAmount; 160 | data['baseTokenAmount'] = this.baseTokenAmount; 161 | data['totalLiquidity'] = this.totalLiquidity; 162 | data['swapTokenPrice1'] = this.swapTokenPrice1; 163 | data['swapTokenPrice2'] = this.swapTokenPrice2; 164 | data['baseTokenPrice1'] = this.baseTokenPrice1; 165 | data['baseTokenPrice2'] = this.baseTokenPrice2; 166 | data['volume24h'] = this.volume24h; 167 | data['transaction24h'] = this.transaction24h; 168 | data['swapTokenOpenPrice1'] = this.swapTokenOpenPrice1; 169 | data['swapTokenOpenPrice2'] = this.swapTokenOpenPrice2; 170 | data['swapTokenChange1'] = this.swapTokenChange1; 171 | data['swapTokenChange2'] = this.swapTokenChange2; 172 | data['swapTokenDecimal'] = this.swapTokenDecimal; 173 | return data; 174 | } 175 | } 176 | -------------------------------------------------------------------------------- /lib/model/tron_info_model.dart: -------------------------------------------------------------------------------- 1 | class TronInfoRespModel { 2 | int code; 3 | String msg; 4 | TronInfoData data; 5 | 6 | TronInfoRespModel({this.code, this.msg, this.data}); 7 | 8 | TronInfoRespModel.fromJson(Map json) { 9 | code = json['code']; 10 | msg = json['msg']; 11 | data = 12 | json['data'] != null ? new TronInfoData.fromJson(json['data']) : null; 13 | } 14 | 15 | Map toJson() { 16 | final Map data = new Map(); 17 | data['code'] = this.code; 18 | data['msg'] = this.msg; 19 | if (this.data != null) { 20 | data['data'] = this.data.toJson(); 21 | } 22 | return data; 23 | } 24 | } 25 | 26 | class TronInfoData { 27 | TronInfo tronInfo; 28 | List tokenRows; 29 | 30 | TronInfoData({this.tronInfo, this.tokenRows}); 31 | 32 | TronInfoData.fromJson(Map json) { 33 | tronInfo = json['tronInfo'] != null 34 | ? new TronInfo.fromJson(json['tronInfo']) 35 | : null; 36 | if (json['tokenRows'] != null) { 37 | tokenRows = new List(); 38 | json['tokenRows'].forEach((v) { 39 | tokenRows.add(new TokenRows.fromJson(v)); 40 | }); 41 | } 42 | } 43 | 44 | Map toJson() { 45 | final Map data = new Map(); 46 | if (this.tronInfo != null) { 47 | data['tronInfo'] = this.tronInfo.toJson(); 48 | } 49 | if (this.tokenRows != null) { 50 | data['tokenRows'] = this.tokenRows.map((v) => v.toJson()).toList(); 51 | } 52 | return data; 53 | } 54 | } 55 | 56 | class TronInfo { 57 | int id; 58 | int chainType; 59 | String tronGrpcIP; 60 | double trxPriceUsd; 61 | String swapContract; 62 | String androidVersionNum; 63 | int androidBuildNum; 64 | String androidDownloadUrl; 65 | String androidUpdateInfo1; 66 | String androidUpdateInfo2; 67 | int androidUpdateType; 68 | String iosVersionNum; 69 | int iosBuildNum; 70 | String iosDownloadUrl; 71 | String iosUpdateInfo1; 72 | String iosUpdateInfo2; 73 | int iosUpdateType; 74 | 75 | TronInfo( 76 | {this.id, 77 | this.chainType, 78 | this.tronGrpcIP, 79 | this.trxPriceUsd, 80 | this.swapContract, 81 | this.androidVersionNum, 82 | this.androidBuildNum, 83 | this.androidDownloadUrl, 84 | this.androidUpdateInfo1, 85 | this.androidUpdateInfo2, 86 | this.androidUpdateType, 87 | this.iosVersionNum, 88 | this.iosBuildNum, 89 | this.iosDownloadUrl, 90 | this.iosUpdateInfo1, 91 | this.iosUpdateInfo2, 92 | this.iosUpdateType}); 93 | 94 | TronInfo.fromJson(Map json) { 95 | id = json['id']; 96 | chainType = json['chainType']; 97 | tronGrpcIP = json['tronGrpcIP']; 98 | trxPriceUsd = (json['trxPriceUsd'] as num)?.toDouble(); 99 | swapContract = json['swapContract']; 100 | androidVersionNum = json['androidVersionNum']; 101 | androidBuildNum = json['androidBuildNum']; 102 | androidDownloadUrl = json['androidDownloadUrl']; 103 | androidUpdateInfo1 = json['androidUpdateInfo1']; 104 | androidUpdateInfo2 = json['androidUpdateInfo2']; 105 | androidUpdateType = json['androidUpdateType']; 106 | iosVersionNum = json['iosVersionNum']; 107 | iosBuildNum = json['iosBuildNum']; 108 | iosDownloadUrl = json['iosDownloadUrl']; 109 | iosUpdateInfo1 = json['iosUpdateInfo1']; 110 | iosUpdateInfo2 = json['iosUpdateInfo2']; 111 | iosUpdateType = json['iosUpdateType']; 112 | } 113 | 114 | Map toJson() { 115 | final Map data = new Map(); 116 | data['id'] = this.id; 117 | data['chainType'] = this.chainType; 118 | data['tronGrpcIP'] = this.tronGrpcIP; 119 | data['trxPriceUsd'] = this.trxPriceUsd; 120 | data['swapContract'] = this.swapContract; 121 | data['androidVersionNum'] = this.androidVersionNum; 122 | data['androidBuildNum'] = this.androidBuildNum; 123 | data['androidDownloadUrl'] = this.androidDownloadUrl; 124 | data['androidUpdateInfo1'] = this.androidUpdateInfo1; 125 | data['androidUpdateInfo2'] = this.androidUpdateInfo2; 126 | data['androidUpdateType'] = this.androidUpdateType; 127 | data['iosVersionNum'] = this.iosVersionNum; 128 | data['iosBuildNum'] = this.iosBuildNum; 129 | data['iosDownloadUrl'] = this.iosDownloadUrl; 130 | data['iosUpdateInfo1'] = this.iosUpdateInfo1; 131 | data['iosUpdateInfo2'] = this.iosUpdateInfo2; 132 | data['iosUpdateType'] = this.iosUpdateType; 133 | return data; 134 | } 135 | } 136 | 137 | class TokenRows { 138 | int id; 139 | int tokenType; 140 | String tokenShort; 141 | String tokenAddress; 142 | int tokenPrecision; 143 | String logoUrl; 144 | double priceTrx; 145 | double priceUsd; 146 | 147 | TokenRows( 148 | {this.id, 149 | this.tokenType, 150 | this.tokenShort, 151 | this.tokenAddress, 152 | this.tokenPrecision, 153 | this.logoUrl, 154 | this.priceTrx, 155 | this.priceUsd}); 156 | 157 | TokenRows.fromJson(Map json) { 158 | id = json['id']; 159 | tokenType = json['tokenType']; 160 | tokenShort = json['tokenShort']; 161 | tokenAddress = json['tokenAddress']; 162 | tokenPrecision = json['tokenPrecision']; 163 | logoUrl = json['logoUrl']; 164 | priceTrx = (json['priceTrx'] as num)?.toDouble(); 165 | priceUsd = (json['priceUsd'] as num)?.toDouble(); 166 | } 167 | 168 | Map toJson() { 169 | final Map data = new Map(); 170 | data['id'] = this.id; 171 | data['tokenType'] = this.tokenType; 172 | data['tokenShort'] = this.tokenShort; 173 | data['tokenAddress'] = this.tokenAddress; 174 | data['tokenPrecision'] = this.tokenPrecision; 175 | data['logoUrl'] = this.logoUrl; 176 | data['priceTrx'] = this.priceTrx; 177 | data['priceUsd'] = this.priceUsd; 178 | return data; 179 | } 180 | } 181 | -------------------------------------------------------------------------------- /lib/provider/global_injection.dart: -------------------------------------------------------------------------------- 1 | import 'package:flash_tron_wallet/provider/global_service.dart'; 2 | import 'package:get/get.dart'; 3 | 4 | class GlobalInjection { 5 | static Future init() async { 6 | Get.put(GlobalService()..initData()); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /lib/route/app_route.dart: -------------------------------------------------------------------------------- 1 | import 'package:flash_tron_wallet/index/asset/add_wallet/add_wallet_page.dart'; 2 | import 'package:flash_tron_wallet/index/asset/build_wallet/build_wallet_first_page.dart'; 3 | import 'package:flash_tron_wallet/index/asset/build_wallet/build_wallet_second_page.dart'; 4 | import 'package:flash_tron_wallet/index/asset/import_key/import_key_page.dart'; 5 | import 'package:flash_tron_wallet/index/asset/import_mnemonic/import_mnemonic_page.dart'; 6 | import 'package:flash_tron_wallet/index/asset/recevice_token/receive_token_page.dart'; 7 | import 'package:flash_tron_wallet/index/asset/send_token/send_token_page.dart'; 8 | import 'package:flash_tron_wallet/index/index_page.dart'; 9 | import 'package:flash_tron_wallet/index/mine/wallet_manage/wallet_manage_page.dart'; 10 | import 'package:flash_tron_wallet/index/qr/qr_scan_page.dart'; 11 | import 'package:get/get.dart'; 12 | import 'package:get/get_navigation/src/routes/get_route.dart'; 13 | 14 | class AppRoute { 15 | static String index = '/index'; 16 | 17 | static String assetAddWallet = '/asset/addWallet'; 18 | 19 | static String assetSendToken = '/asset/sendToken'; 20 | static String assetSendTokenSuffix = assetSendToken + '/:value'; 21 | 22 | static String assetReceiveToken = '/asset/receiveToken'; 23 | 24 | static String assetImportKey = '/asset/importKey'; 25 | static String assetImportKeySuffix = assetImportKey + '/:type'; 26 | 27 | static String assetImportMnemonic = '/asset/importMnemonic'; 28 | static String assetImportMnemonicSuffix = assetImportMnemonic + '/:type'; 29 | 30 | static String assetBuildFirstWallet = '/asset/buildFirstWallet'; 31 | static String assetBuildFirstWalletSuffix = assetBuildFirstWallet + '/:type'; 32 | 33 | static String assetBuildSecondWallet = '/asset/buildSecondWallet'; 34 | static String assetBuildSecondWalletSuffix = 35 | assetBuildSecondWallet + '/:type'; 36 | 37 | /*static String assetWalletDetail = 'asset/walletDetail'; 38 | static String assetWalletDetailSuffix = assetWalletDetail + '/:selectIndex'; 39 | 40 | static String assetBackupKey = '/asset/backupKey'; 41 | static String assetBackupMnemonic = '/asset/backupMnemonic'; 42 | static String assetUpdatePwd = '/asset/updatePwd';*/ 43 | 44 | static String assetQrScan = '/asset/qrScan'; 45 | static String assetQrScanSuffix = assetQrScan + '/:type'; 46 | 47 | static String mineWalletManage = '/mine/walletManage'; 48 | 49 | static List pages = [ 50 | GetPage( 51 | name: index, 52 | page: () => IndexPage(), 53 | transition: Transition.fadeIn, 54 | ), 55 | GetPage( 56 | name: assetAddWallet, 57 | page: () => AddWalletPage(), 58 | ), 59 | GetPage( 60 | name: assetSendTokenSuffix, 61 | page: () => SendTokenPage(), 62 | ), 63 | GetPage( 64 | name: assetReceiveToken, 65 | page: () => ReceiveTokenPage(), 66 | ), 67 | GetPage( 68 | name: assetImportKeySuffix, 69 | page: () => ImportKeyPage(), 70 | ), 71 | GetPage( 72 | name: assetImportMnemonicSuffix, 73 | page: () => ImportMnemonicPage(), 74 | ), 75 | GetPage( 76 | name: assetBuildFirstWalletSuffix, 77 | page: () => BuildWalletFirstPage(), 78 | ), 79 | GetPage( 80 | name: assetBuildSecondWalletSuffix, 81 | page: () => BuildWalletSecondPage(), 82 | ), 83 | /*GetPage( 84 | name: assetWalletDetailSuffix, 85 | page: () => WalletDetailPage(), 86 | ), 87 | GetPage( 88 | name: assetBackupKey, 89 | page: () => BackupKeyPage(), 90 | ), 91 | GetPage( 92 | name: assetBackupMnemonic, 93 | page: () => BackupMnemonicPage(), 94 | ), 95 | GetPage( 96 | name: assetUpdatePwd, 97 | page: () => UpdatePwdPage(), 98 | ),*/ 99 | GetPage( 100 | name: assetQrScanSuffix, 101 | page: () => QrScanPage(), 102 | transition: Transition.fadeIn, 103 | ), 104 | GetPage( 105 | name: mineWalletManage, 106 | page: () => WalletManagePage(), 107 | ), 108 | ]; 109 | } 110 | -------------------------------------------------------------------------------- /lib/tron/api/api.pbenum.dart: -------------------------------------------------------------------------------- 1 | /// 2 | // Generated code. Do not modify. 3 | // source: api/api.proto 4 | // 5 | // @dart = 2.3 6 | // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type 7 | 8 | // ignore_for_file: UNDEFINED_SHOWN_NAME,UNUSED_SHOWN_NAME 9 | import 'dart:core' as $core; 10 | import 'package:protobuf/protobuf.dart' as $pb; 11 | 12 | class Return_response_code extends $pb.ProtobufEnum { 13 | static const Return_response_code SUCCESS = Return_response_code._(0, 'SUCCESS'); 14 | static const Return_response_code SIGERROR = Return_response_code._(1, 'SIGERROR'); 15 | static const Return_response_code CONTRACT_VALIDATE_ERROR = Return_response_code._(2, 'CONTRACT_VALIDATE_ERROR'); 16 | static const Return_response_code CONTRACT_EXE_ERROR = Return_response_code._(3, 'CONTRACT_EXE_ERROR'); 17 | static const Return_response_code BANDWITH_ERROR = Return_response_code._(4, 'BANDWITH_ERROR'); 18 | static const Return_response_code DUP_TRANSACTION_ERROR = Return_response_code._(5, 'DUP_TRANSACTION_ERROR'); 19 | static const Return_response_code TAPOS_ERROR = Return_response_code._(6, 'TAPOS_ERROR'); 20 | static const Return_response_code TOO_BIG_TRANSACTION_ERROR = Return_response_code._(7, 'TOO_BIG_TRANSACTION_ERROR'); 21 | static const Return_response_code TRANSACTION_EXPIRATION_ERROR = Return_response_code._(8, 'TRANSACTION_EXPIRATION_ERROR'); 22 | static const Return_response_code SERVER_BUSY = Return_response_code._(9, 'SERVER_BUSY'); 23 | static const Return_response_code NO_CONNECTION = Return_response_code._(10, 'NO_CONNECTION'); 24 | static const Return_response_code NOT_ENOUGH_EFFECTIVE_CONNECTION = Return_response_code._(11, 'NOT_ENOUGH_EFFECTIVE_CONNECTION'); 25 | static const Return_response_code OTHER_ERROR = Return_response_code._(20, 'OTHER_ERROR'); 26 | 27 | static const $core.List values = [ 28 | SUCCESS, 29 | SIGERROR, 30 | CONTRACT_VALIDATE_ERROR, 31 | CONTRACT_EXE_ERROR, 32 | BANDWITH_ERROR, 33 | DUP_TRANSACTION_ERROR, 34 | TAPOS_ERROR, 35 | TOO_BIG_TRANSACTION_ERROR, 36 | TRANSACTION_EXPIRATION_ERROR, 37 | SERVER_BUSY, 38 | NO_CONNECTION, 39 | NOT_ENOUGH_EFFECTIVE_CONNECTION, 40 | OTHER_ERROR, 41 | ]; 42 | 43 | static final $core.Map<$core.int, Return_response_code> _byValue = $pb.ProtobufEnum.initByValue(values); 44 | static Return_response_code valueOf($core.int value) => _byValue[value]; 45 | 46 | const Return_response_code._($core.int v, $core.String n) : super(v, n); 47 | } 48 | 49 | class TransactionSignWeight_Result_response_code extends $pb.ProtobufEnum { 50 | static const TransactionSignWeight_Result_response_code ENOUGH_PERMISSION = TransactionSignWeight_Result_response_code._(0, 'ENOUGH_PERMISSION'); 51 | static const TransactionSignWeight_Result_response_code NOT_ENOUGH_PERMISSION = TransactionSignWeight_Result_response_code._(1, 'NOT_ENOUGH_PERMISSION'); 52 | static const TransactionSignWeight_Result_response_code SIGNATURE_FORMAT_ERROR = TransactionSignWeight_Result_response_code._(2, 'SIGNATURE_FORMAT_ERROR'); 53 | static const TransactionSignWeight_Result_response_code COMPUTE_ADDRESS_ERROR = TransactionSignWeight_Result_response_code._(3, 'COMPUTE_ADDRESS_ERROR'); 54 | static const TransactionSignWeight_Result_response_code PERMISSION_ERROR = TransactionSignWeight_Result_response_code._(4, 'PERMISSION_ERROR'); 55 | static const TransactionSignWeight_Result_response_code OTHER_ERROR = TransactionSignWeight_Result_response_code._(20, 'OTHER_ERROR'); 56 | 57 | static const $core.List values = [ 58 | ENOUGH_PERMISSION, 59 | NOT_ENOUGH_PERMISSION, 60 | SIGNATURE_FORMAT_ERROR, 61 | COMPUTE_ADDRESS_ERROR, 62 | PERMISSION_ERROR, 63 | OTHER_ERROR, 64 | ]; 65 | 66 | static final $core.Map<$core.int, TransactionSignWeight_Result_response_code> _byValue = $pb.ProtobufEnum.initByValue(values); 67 | static TransactionSignWeight_Result_response_code valueOf($core.int value) => _byValue[value]; 68 | 69 | const TransactionSignWeight_Result_response_code._($core.int v, $core.String n) : super(v, n); 70 | } 71 | 72 | class TransactionApprovedList_Result_response_code extends $pb.ProtobufEnum { 73 | static const TransactionApprovedList_Result_response_code SUCCESS = TransactionApprovedList_Result_response_code._(0, 'SUCCESS'); 74 | static const TransactionApprovedList_Result_response_code SIGNATURE_FORMAT_ERROR = TransactionApprovedList_Result_response_code._(1, 'SIGNATURE_FORMAT_ERROR'); 75 | static const TransactionApprovedList_Result_response_code COMPUTE_ADDRESS_ERROR = TransactionApprovedList_Result_response_code._(2, 'COMPUTE_ADDRESS_ERROR'); 76 | static const TransactionApprovedList_Result_response_code OTHER_ERROR = TransactionApprovedList_Result_response_code._(20, 'OTHER_ERROR'); 77 | 78 | static const $core.List values = [ 79 | SUCCESS, 80 | SIGNATURE_FORMAT_ERROR, 81 | COMPUTE_ADDRESS_ERROR, 82 | OTHER_ERROR, 83 | ]; 84 | 85 | static final $core.Map<$core.int, TransactionApprovedList_Result_response_code> _byValue = $pb.ProtobufEnum.initByValue(values); 86 | static TransactionApprovedList_Result_response_code valueOf($core.int value) => _byValue[value]; 87 | 88 | const TransactionApprovedList_Result_response_code._($core.int v, $core.String n) : super(v, n); 89 | } 90 | 91 | -------------------------------------------------------------------------------- /lib/tron/core/Contract.pbenum.dart: -------------------------------------------------------------------------------- 1 | /// 2 | // Generated code. Do not modify. 3 | // source: core/Contract.proto 4 | // 5 | // @dart = 2.3 6 | // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type 7 | 8 | // ignore_for_file: UNDEFINED_SHOWN_NAME,UNUSED_SHOWN_NAME 9 | import 'dart:core' as $core; 10 | import 'package:protobuf/protobuf.dart' as $pb; 11 | 12 | class ResourceCode extends $pb.ProtobufEnum { 13 | static const ResourceCode BANDWIDTH = ResourceCode._(0, 'BANDWIDTH'); 14 | static const ResourceCode ENERGY = ResourceCode._(1, 'ENERGY'); 15 | 16 | static const $core.List values = [ 17 | BANDWIDTH, 18 | ENERGY, 19 | ]; 20 | 21 | static final $core.Map<$core.int, ResourceCode> _byValue = $pb.ProtobufEnum.initByValue(values); 22 | static ResourceCode valueOf($core.int value) => _byValue[value]; 23 | 24 | const ResourceCode._($core.int v, $core.String n) : super(v, n); 25 | } 26 | 27 | -------------------------------------------------------------------------------- /lib/tron/core/Discover.pbenum.dart: -------------------------------------------------------------------------------- 1 | /// 2 | // Generated code. Do not modify. 3 | // source: core/Discover.proto 4 | // 5 | // @dart = 2.3 6 | // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type 7 | 8 | -------------------------------------------------------------------------------- /lib/tron/core/Discover.pbjson.dart: -------------------------------------------------------------------------------- 1 | /// 2 | // Generated code. Do not modify. 3 | // source: core/Discover.proto 4 | // 5 | // @dart = 2.3 6 | // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type 7 | 8 | const Endpoint$json = const { 9 | '1': 'Endpoint', 10 | '2': const [ 11 | const {'1': 'address', '3': 1, '4': 1, '5': 12, '10': 'address'}, 12 | const {'1': 'port', '3': 2, '4': 1, '5': 5, '10': 'port'}, 13 | const {'1': 'nodeId', '3': 3, '4': 1, '5': 12, '10': 'nodeId'}, 14 | ], 15 | }; 16 | 17 | const PingMessage$json = const { 18 | '1': 'PingMessage', 19 | '2': const [ 20 | const {'1': 'from', '3': 1, '4': 1, '5': 11, '6': '.protocol.Endpoint', '10': 'from'}, 21 | const {'1': 'to', '3': 2, '4': 1, '5': 11, '6': '.protocol.Endpoint', '10': 'to'}, 22 | const {'1': 'version', '3': 3, '4': 1, '5': 5, '10': 'version'}, 23 | const {'1': 'timestamp', '3': 4, '4': 1, '5': 3, '10': 'timestamp'}, 24 | ], 25 | }; 26 | 27 | const PongMessage$json = const { 28 | '1': 'PongMessage', 29 | '2': const [ 30 | const {'1': 'from', '3': 1, '4': 1, '5': 11, '6': '.protocol.Endpoint', '10': 'from'}, 31 | const {'1': 'echo', '3': 2, '4': 1, '5': 5, '10': 'echo'}, 32 | const {'1': 'timestamp', '3': 3, '4': 1, '5': 3, '10': 'timestamp'}, 33 | ], 34 | }; 35 | 36 | const FindNeighbours$json = const { 37 | '1': 'FindNeighbours', 38 | '2': const [ 39 | const {'1': 'from', '3': 1, '4': 1, '5': 11, '6': '.protocol.Endpoint', '10': 'from'}, 40 | const {'1': 'targetId', '3': 2, '4': 1, '5': 12, '10': 'targetId'}, 41 | const {'1': 'timestamp', '3': 3, '4': 1, '5': 3, '10': 'timestamp'}, 42 | ], 43 | }; 44 | 45 | const Neighbours$json = const { 46 | '1': 'Neighbours', 47 | '2': const [ 48 | const {'1': 'from', '3': 1, '4': 1, '5': 11, '6': '.protocol.Endpoint', '10': 'from'}, 49 | const {'1': 'neighbours', '3': 2, '4': 3, '5': 11, '6': '.protocol.Endpoint', '10': 'neighbours'}, 50 | const {'1': 'timestamp', '3': 3, '4': 1, '5': 3, '10': 'timestamp'}, 51 | ], 52 | }; 53 | 54 | const BackupMessage$json = const { 55 | '1': 'BackupMessage', 56 | '2': const [ 57 | const {'1': 'flag', '3': 1, '4': 1, '5': 8, '10': 'flag'}, 58 | const {'1': 'priority', '3': 2, '4': 1, '5': 5, '10': 'priority'}, 59 | ], 60 | }; 61 | 62 | -------------------------------------------------------------------------------- /lib/tron/core/TronInventoryItems.pb.dart: -------------------------------------------------------------------------------- 1 | /// 2 | // Generated code. Do not modify. 3 | // source: core/TronInventoryItems.proto 4 | // 5 | // @dart = 2.3 6 | // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type 7 | 8 | import 'dart:core' as $core; 9 | 10 | import 'package:protobuf/protobuf.dart' as $pb; 11 | 12 | class InventoryItems extends $pb.GeneratedMessage { 13 | static final $pb.BuilderInfo _i = $pb.BuilderInfo('InventoryItems', package: const $pb.PackageName('protocol'), createEmptyInstance: create) 14 | ..a<$core.int>(1, 'type', $pb.PbFieldType.O3) 15 | ..p<$core.List<$core.int>>(2, 'items', $pb.PbFieldType.PY) 16 | ..hasRequiredFields = false 17 | ; 18 | 19 | InventoryItems._() : super(); 20 | factory InventoryItems() => create(); 21 | factory InventoryItems.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); 22 | factory InventoryItems.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); 23 | InventoryItems clone() => InventoryItems()..mergeFromMessage(this); 24 | InventoryItems copyWith(void Function(InventoryItems) updates) => super.copyWith((message) => updates(message as InventoryItems)); 25 | $pb.BuilderInfo get info_ => _i; 26 | @$core.pragma('dart2js:noInline') 27 | static InventoryItems create() => InventoryItems._(); 28 | InventoryItems createEmptyInstance() => create(); 29 | static $pb.PbList createRepeated() => $pb.PbList(); 30 | @$core.pragma('dart2js:noInline') 31 | static InventoryItems getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); 32 | static InventoryItems _defaultInstance; 33 | 34 | @$pb.TagNumber(1) 35 | $core.int get type => $_getIZ(0); 36 | @$pb.TagNumber(1) 37 | set type($core.int v) { $_setSignedInt32(0, v); } 38 | @$pb.TagNumber(1) 39 | $core.bool hasType() => $_has(0); 40 | @$pb.TagNumber(1) 41 | void clearType() => clearField(1); 42 | 43 | @$pb.TagNumber(2) 44 | $core.List<$core.List<$core.int>> get items => $_getList(1); 45 | } 46 | 47 | -------------------------------------------------------------------------------- /lib/tron/core/TronInventoryItems.pbenum.dart: -------------------------------------------------------------------------------- 1 | /// 2 | // Generated code. Do not modify. 3 | // source: core/TronInventoryItems.proto 4 | // 5 | // @dart = 2.3 6 | // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type 7 | 8 | -------------------------------------------------------------------------------- /lib/tron/core/TronInventoryItems.pbjson.dart: -------------------------------------------------------------------------------- 1 | /// 2 | // Generated code. Do not modify. 3 | // source: core/TronInventoryItems.proto 4 | // 5 | // @dart = 2.3 6 | // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type 7 | 8 | const InventoryItems$json = const { 9 | '1': 'InventoryItems', 10 | '2': const [ 11 | const {'1': 'type', '3': 1, '4': 1, '5': 5, '10': 'type'}, 12 | const {'1': 'items', '3': 2, '4': 3, '5': 12, '10': 'items'}, 13 | ], 14 | }; 15 | 16 | -------------------------------------------------------------------------------- /lib/tron/grpc/grpc_client.dart: -------------------------------------------------------------------------------- 1 | import 'package:grpc/grpc.dart'; 2 | 3 | class ClientChannelManager { 4 | static Map clientChannels = Map(); 5 | // 连接上限数 6 | static int maxChannelNumber = 10; 7 | // 优先级最低的key 8 | static String exitKey = ''; 9 | 10 | static int port = 50051; 11 | 12 | static ClientChannel getChannel(String host) { 13 | host = host.trim(); 14 | //连接存在 取缓存 不存在则创建 15 | if (clientChannels.containsKey(host + '$port')) { 16 | //每取一次请求数量加1 17 | clientChannels[host + '$port'].number++; 18 | Future(() { 19 | sort(); 20 | }); 21 | return clientChannels[host + '$port'].clientChannel; 22 | } else { 23 | return createChannel(host, port); 24 | } 25 | } 26 | 27 | static ClientChannel createChannel(String host, int port) { 28 | //如果超过连接上限数 29 | if (clientChannels.length >= maxChannelNumber) { 30 | ClientChannelManagerObject object = clientChannels[exitKey]; 31 | object.clientChannel.shutdown(); // 关闭优先级最低的连接 32 | clientChannels.remove(exitKey); // 清出连接池 33 | } 34 | ClientChannel channel = new ClientChannel(host, 35 | port: port, 36 | options: const ChannelOptions( 37 | credentials: const ChannelCredentials.insecure())); 38 | clientChannels[host + '$port'] = ClientChannelManagerObject() 39 | ..clientChannel = channel 40 | ..number = 1 41 | ..createTime = new DateTime.now().millisecondsSinceEpoch; 42 | Future(() { 43 | sort(); 44 | }); 45 | return channel; 46 | } 47 | 48 | static void sort() { 49 | // 计算优先级 50 | int currentTime = new DateTime.now().millisecondsSinceEpoch; 51 | double maxProportion = 0.0; 52 | clientChannels.forEach((String key, ClientChannelManagerObject value) { 53 | value.proportion = (currentTime - value.createTime) / 54 | (value.number * 1.0); //时长除以次数,越小优先级越高 55 | if (value.proportion > maxProportion) { 56 | maxProportion = value.proportion; 57 | exitKey = key; 58 | } 59 | }); 60 | } 61 | } 62 | 63 | class ClientChannelManagerObject { 64 | ClientChannel clientChannel; 65 | int number; //总共请求次数 66 | int createTime; //第一次创建时间 67 | double proportion; //时长除以次数,越小优先级越高 68 | } 69 | -------------------------------------------------------------------------------- /lib/tron/service/msg_signature.dart: -------------------------------------------------------------------------------- 1 | import 'dart:typed_data'; 2 | 3 | class TronMsgSignature { 4 | final Uint8List r; 5 | final Uint8List s; 6 | final int v; 7 | 8 | TronMsgSignature(this.r, this.s, this.v); 9 | 10 | Uint8List getSignature() { 11 | Uint8List sig = Uint8List(65); 12 | arrayCopy(r, 0, sig, 0, 32); 13 | arrayCopy(s, 0, sig, 32, 32); 14 | sig[64] = v; 15 | return sig; 16 | } 17 | } 18 | 19 | List arrayCopy(bytes, srcOffset, result, destOffset, bytesLength) { 20 | for (var i = srcOffset; i < bytesLength; i++) { 21 | result[destOffset + i] = bytes[i]; 22 | } 23 | return result; 24 | } -------------------------------------------------------------------------------- /lib/tron/service/tron_asset.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'dart:typed_data'; 3 | 4 | import 'package:bs58check/bs58check.dart'; 5 | import 'package:ethereum_util/src/abi.dart' as abi; 6 | import 'package:flash_tron_wallet/entity/tron/abi_entity.dart'; 7 | import 'package:flash_tron_wallet/entity/tron/asset_entity.dart'; 8 | import 'package:flash_tron_wallet/model/tron_info_model.dart'; 9 | import 'package:flash_tron_wallet/provider/global_service.dart'; 10 | import 'package:flash_tron_wallet/tron/api/api.pbgrpc.dart'; 11 | import 'package:flash_tron_wallet/tron/core/Contract.pb.dart'; 12 | import 'package:flash_tron_wallet/tron/core/Tron.pb.dart'; 13 | import 'package:flash_tron_wallet/tron/grpc/grpc_client.dart'; 14 | import 'package:flutter/cupertino.dart'; 15 | import 'package:web3dart/crypto.dart'; 16 | 17 | class TronAsset { 18 | Future getAsset(BuildContext context, String userAddress, 19 | List tokenList) async { 20 | //print('TronAsset getAsset'); 21 | String tronGrpcIP = GlobalService.to.tronGrpcIP; 22 | List list = []; 23 | final channel = ClientChannelManager.getChannel(tronGrpcIP); 24 | final stub = WalletClient(channel); 25 | Uint8List originAddress = base58.decode(userAddress).sublist(0, 21); 26 | try { 27 | Account response = 28 | await stub.getAccount(Account()..address = originAddress); 29 | //print('getAsset response:\n ${response.toProto3Json().toString()}'); 30 | for (int i = 0; i < tokenList.length; i++) { 31 | if (tokenList[i].tokenType == 1) { 32 | AssetEntity trxEntity = 33 | TronAsset().getTrxBalance(response, userAddress, tokenList[i]); 34 | list.add(trxEntity); 35 | } else if (tokenList[i].tokenType == 2) { 36 | AssetEntity trc20Balance = await TronAsset() 37 | .getTrc20Balance(stub, userAddress, tokenList[i]); 38 | list.add(trc20Balance); 39 | } 40 | } 41 | GlobalService.to.updateAssetList(list); 42 | return true; 43 | } catch (e) { 44 | print(e); 45 | return false; 46 | } 47 | } 48 | 49 | AssetEntity getTrxBalance( 50 | Account response, String userAddress, TokenRows item) { 51 | AssetEntity entity = AssetEntity( 52 | type: 1, 53 | address: item.tokenAddress, 54 | name: item.tokenShort, 55 | precision: item.tokenPrecision, 56 | balance: 0, 57 | usd: 0, 58 | logoUrl: item.logoUrl, 59 | originBalance: '0', 60 | ); 61 | if (response != null && response.balance != null) { 62 | double trxBalance = 63 | response.balance.toDouble() / getPrecision(item.tokenPrecision); 64 | entity.balance = trxBalance; 65 | entity.usd = trxBalance * item.priceUsd; 66 | entity.originBalance = response.balance.toString(); 67 | } 68 | return entity; 69 | } 70 | 71 | Future getTrc20Balance( 72 | WalletClient stub, String userAddress, TokenRows item) async { 73 | AssetEntity entity = AssetEntity( 74 | type: 2, 75 | address: item.tokenAddress, 76 | name: item.tokenShort, 77 | precision: item.tokenPrecision, 78 | balance: 0, 79 | usd: 0, 80 | logoUrl: item.logoUrl, 81 | originBalance: '0', 82 | ); 83 | try { 84 | SmartContract response = await stub.getContract(BytesMessage() 85 | ..value = base58.decode(item.tokenAddress).sublist(0, 21)); 86 | String abiCode = jsonEncode(response.abi.toProto3Json()).substring(10); 87 | abiCode = abiCode.substring(0, abiCode.length - 1); 88 | 89 | String abiUserAddress = getAbiTronAddress(userAddress); 90 | String functionName = 'balanceOf'; 91 | 92 | AbiEntity abiEntity = AbiEntity.fromJson(response.abi.toProto3Json()); 93 | List inputList = []; 94 | if (abiEntity != null && abiEntity.entrys != null) { 95 | for (Entrys item in abiEntity.entrys) { 96 | if (functionName == item.name) { 97 | if (item.inputs != null) { 98 | for (Inputs input in item.inputs) { 99 | inputList.add(input.type); 100 | } 101 | } 102 | } 103 | } 104 | } 105 | Uint8List methodID = abi.methodID(functionName, inputList); 106 | Uint8List rawEncode = abi.rawEncode(inputList, [abiUserAddress]); 107 | Uint8List dataList = 108 | hexToBytes(bytesToHex(methodID) + bytesToHex(rawEncode)); 109 | 110 | TriggerSmartContract req = TriggerSmartContract(); 111 | req.ownerAddress = base58.decode(userAddress).sublist(0, 21); 112 | req.contractAddress = base58.decode(item.tokenAddress).sublist(0, 21); 113 | req.data = dataList; 114 | 115 | final result = await stub.triggerContract(req); 116 | if (result != null && 117 | result.constantResult != null && 118 | result.constantResult.length > 0) { 119 | double balance = bytesToInt(result.constantResult[0]).toDouble() / 120 | getPrecision(item.tokenPrecision); 121 | entity.balance = balance; 122 | entity.usd = balance * item.priceUsd; 123 | entity.originBalance = bytesToInt(result.constantResult[0]).toString(); 124 | } 125 | } catch (e) { 126 | print(e); 127 | } 128 | return entity; 129 | } 130 | 131 | String getAbiTronAddress(String base58Address) { 132 | Uint8List address = base58.decode(base58Address).sublist(1, 21); 133 | return '0x' + bytesToHex(address); 134 | } 135 | 136 | double getPrecision(int precision) { 137 | double result = 1; 138 | double baseValue = 10; 139 | for (int i = 0; i < precision; i++) { 140 | result = result * baseValue; 141 | } 142 | return result; 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /lib/tron/service/tron_swap_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flash_tron_wallet/tron/service/tron_swap.dart'; 2 | 3 | const String userAddress = ''; 4 | const String privateKey = ''; 5 | const String tronGrpcIP = '13.127.47.162'; 6 | 7 | void main() { 8 | //testGetTrxBalance(); 9 | testGetTrc20Balance(); 10 | 11 | //testAllowance(); 12 | 13 | //testApprove(); 14 | //testTrxToTokenSwap(); 15 | //testTokenToTrxSwap(); 16 | //testTokenToTokenSwap(); 17 | } 18 | 19 | void testGetTrxBalance() async { 20 | print('testGetTrxBalance start'); 21 | String result = await TronSwap().getTrxBalance(tronGrpcIP, userAddress); 22 | print('testGetTrxBalance end, result:$result'); 23 | } 24 | 25 | void testGetTrc20Balance() async { 26 | print('testGetTrc20Balance start'); 27 | String tokenAddress = 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t'; 28 | String result = 29 | await TronSwap().getTrc20Balance(tronGrpcIP, userAddress, tokenAddress); 30 | print('testGetTrc20Balance end, result: $result'); 31 | } 32 | 33 | void testAllowance() async { 34 | print('testAllowance start'); 35 | String swapTokenAddress = 'TMwFHYXLJaRUPeW6421aqXL4ZEzPRFGkGT'; 36 | String flashSwapAddress = 'TGS7NxoAQ44pQYCSAW3FPrVMhQ1TpdsTXg'; 37 | int tokenPrecision = 6; 38 | String result = await TronSwap() 39 | .allowance(tronGrpcIP, userAddress, swapTokenAddress, flashSwapAddress); 40 | print('testAllowance end result:$result'); 41 | } 42 | 43 | void testApprove() async { 44 | print('testApprove start'); 45 | String swapTokenAddress = 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t'; 46 | String flashSwapAddress = 'TGS7NxoAQ44pQYCSAW3FPrVMhQ1TpdsTXg'; 47 | bool result = await TronSwap().approve( 48 | tronGrpcIP, userAddress, privateKey, swapTokenAddress, flashSwapAddress); 49 | print('testApprove end, result: $result'); 50 | } 51 | 52 | void testTrxToTokenSwap() async { 53 | print('testTrxToTokenSwap start'); 54 | String flashSwapAddress = 'TGS7NxoAQ44pQYCSAW3FPrVMhQ1TpdsTXg'; 55 | String swapTokenAddress = 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t'; 56 | String lpTokenAddress = 'TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE'; 57 | String trxSold = '50.00'; 58 | 59 | bool result = await TronSwap().trxToTokenSwap(tronGrpcIP, userAddress, 60 | privateKey, flashSwapAddress, swapTokenAddress, lpTokenAddress, trxSold); 61 | print('testTrxToTokenSwap end, result:$result'); 62 | } 63 | 64 | void testTokenToTrxSwap() async { 65 | print('testTokenToTrxSwap start'); 66 | String flashSwapAddress = 'TGS7NxoAQ44pQYCSAW3FPrVMhQ1TpdsTXg'; 67 | String swapTokenAddress = 'TKkeiboTkxXKJpbmVFbv4a8ov5rAfRDMf9'; 68 | String lpTokenAddress = 'TUEYcyPAqc4hTg1fSuBCPc18vGWcJDECVw'; 69 | String tokensSold = '3.1'; 70 | bool result = await TronSwap().tokenToTrxSwap( 71 | tronGrpcIP, 72 | userAddress, 73 | privateKey, 74 | flashSwapAddress, 75 | swapTokenAddress, 76 | lpTokenAddress, 77 | tokensSold); 78 | print('testTokenToTrxSwap end, result:$result'); 79 | } 80 | 81 | void testTokenToTokenSwap() async { 82 | print('testTokenToTrxSwap start'); 83 | String flashSwapAddress = 'TGS7NxoAQ44pQYCSAW3FPrVMhQ1TpdsTXg'; 84 | String swapTokenAddress = 'TKkeiboTkxXKJpbmVFbv4a8ov5rAfRDMf9'; 85 | String lpTokenAddress = 'TUEYcyPAqc4hTg1fSuBCPc18vGWcJDECVw'; 86 | String tokensSold = '3.1'; 87 | String targetTokenAddress = 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t'; 88 | bool result = await TronSwap().tokenToTokenSwap( 89 | tronGrpcIP, 90 | userAddress, 91 | privateKey, 92 | flashSwapAddress, 93 | swapTokenAddress, 94 | lpTokenAddress, 95 | tokensSold, 96 | targetTokenAddress); 97 | print('testTokenToTrxSwap end, result:$result'); 98 | } 99 | -------------------------------------------------------------------------------- /lib/tron/service/tron_transaction.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'dart:typed_data'; 3 | 4 | import 'package:bs58check/bs58check.dart'; 5 | import 'package:crypto/crypto.dart'; 6 | import 'package:ethereum_util/src/abi.dart' as abi; 7 | import 'package:fixnum/fixnum.dart'; 8 | import 'package:flash_tron_wallet/entity/tron/abi_entity.dart'; 9 | import 'package:flash_tron_wallet/google/protobuf/any.pb.dart'; 10 | import 'package:flash_tron_wallet/provider/global_service.dart'; 11 | import 'package:flash_tron_wallet/tron/api/api.pbgrpc.dart'; 12 | import 'package:flash_tron_wallet/tron/core/Contract.pb.dart'; 13 | import 'package:flash_tron_wallet/tron/core/Tron.pb.dart'; 14 | import 'package:flash_tron_wallet/tron/grpc/grpc_client.dart'; 15 | import 'package:flutter/material.dart'; 16 | import 'package:web3dart/crypto.dart'; 17 | 18 | import 'msg_signature.dart'; 19 | 20 | class TronTransaction { 21 | Future transTrx(BuildContext context, String fromAddress, 22 | String toAddress, Int64 amount) async { 23 | String tronGrpcIP = GlobalService.to.tronGrpcIP; 24 | final channel = ClientChannelManager.getChannel(tronGrpcIP); 25 | final stub = WalletClient(channel); 26 | Uint8List originFromAddress = base58.decode(fromAddress).sublist(0, 21); 27 | Uint8List originToAddress = base58.decode(toAddress).sublist(0, 21); 28 | try { 29 | final tc = TransferContract(); 30 | tc.ownerAddress = originFromAddress; 31 | tc.toAddress = originToAddress; 32 | tc.amount = amount; 33 | 34 | TransactionExtention trxResult = await stub.createTransaction2(tc); 35 | Transaction transaction = trxResult.transaction; 36 | Transaction_raw rawData = trxResult.transaction.rawData; 37 | Uint8List hash = sha256.convert(rawData.writeToBuffer()).bytes; 38 | 39 | String hexPrivateKey = GlobalService.to.selectWalletEntity.privateKey; 40 | 41 | MsgSignature msgSignature = sign(hash, hexToBytes(hexPrivateKey)); 42 | 43 | TronMsgSignature msgSignature2 = TronMsgSignature( 44 | intToBytes(msgSignature.r), 45 | intToBytes(msgSignature.s), 46 | msgSignature.v); 47 | Uint8List ms2 = msgSignature2.getSignature(); 48 | 49 | transaction.signature.add(ms2); 50 | 51 | Return result = await stub.broadcastTransaction(transaction); 52 | if (result.toProto3Json().toString().contains('true') == true) { 53 | return true; 54 | } else { 55 | print('transTrx result error msg: ${utf8.decode(result.message)}'); 56 | return false; 57 | } 58 | } catch (e) { 59 | print(e); 60 | return false; 61 | } 62 | } 63 | 64 | Future transTrc20(BuildContext context, String contractAddress, 65 | String fromAddress, String toAddress, String amount) async { 66 | String tronGrpcIP = GlobalService.to.tronGrpcIP; 67 | final channel = ClientChannelManager.getChannel(tronGrpcIP); 68 | final stub = WalletClient(channel); 69 | try { 70 | SmartContract response = await stub.getContract(BytesMessage() 71 | ..value = base58.decode(contractAddress).sublist(0, 21)); 72 | String abiCode = jsonEncode(response.abi.toProto3Json()).substring(10); 73 | abiCode = abiCode.substring(0, abiCode.length - 1); 74 | 75 | String functionName = 'transfer'; 76 | AbiEntity abiEntity = AbiEntity.fromJson(response.abi.toProto3Json()); 77 | List inputList = []; 78 | if (abiEntity != null && abiEntity.entrys != null) { 79 | for (Entrys item in abiEntity.entrys) { 80 | if (functionName == item.name) { 81 | if (item.inputs != null) { 82 | for (Inputs input in item.inputs) { 83 | inputList.add(input.type); 84 | } 85 | } 86 | } 87 | } 88 | } 89 | 90 | Uint8List methodID = abi.methodID(functionName, inputList); 91 | 92 | List params = []; 93 | String abiToAddress = getAbiTronAddress(toAddress); 94 | params.add(abiToAddress); 95 | params.add(amount); 96 | 97 | Uint8List rawEncode = abi.rawEncode(inputList, params); 98 | Uint8List dataList = 99 | hexToBytes(bytesToHex(methodID) + bytesToHex(rawEncode)); 100 | //print('encode dataList1 hex: ${bytesToHex(dataList)}'); 101 | 102 | String hexPrivateKey = GlobalService.to.selectWalletEntity.privateKey; 103 | 104 | bool flag = await execute( 105 | stub, hexPrivateKey, fromAddress, contractAddress, dataList, 0); 106 | return flag; 107 | } catch (e) { 108 | print(e); 109 | return false; 110 | } 111 | } 112 | 113 | Future trc20Approve(BuildContext context, String contractAddress, 114 | String fromAddress, String toAddress, int amount) async { 115 | String tronGrpcIP = GlobalService.to.tronGrpcIP; 116 | final channel = ClientChannelManager.getChannel(tronGrpcIP); 117 | final stub = WalletClient(channel); 118 | try { 119 | SmartContract response = await stub.getContract(BytesMessage() 120 | ..value = base58.decode(contractAddress).sublist(0, 21)); 121 | String abiCode = jsonEncode(response.abi.toProto3Json()).substring(10); 122 | abiCode = abiCode.substring(0, abiCode.length - 1); 123 | 124 | String functionName = 'approve'; 125 | AbiEntity abiEntity = AbiEntity.fromJson(response.abi.toProto3Json()); 126 | List inputList = []; 127 | if (abiEntity != null && abiEntity.entrys != null) { 128 | for (Entrys item in abiEntity.entrys) { 129 | if (functionName == item.name) { 130 | if (item.inputs != null) { 131 | for (Inputs input in item.inputs) { 132 | inputList.add(input.type); 133 | } 134 | } 135 | } 136 | } 137 | } 138 | 139 | Uint8List methodID = abi.methodID(functionName, inputList); 140 | 141 | List params = []; 142 | String abiToAddress = getAbiTronAddress(toAddress); 143 | params.add(abiToAddress); 144 | params.add(BigInt.from(amount)); 145 | 146 | Uint8List rawEncode = abi.rawEncode(inputList, params); 147 | Uint8List dataList = 148 | hexToBytes(bytesToHex(methodID) + bytesToHex(rawEncode)); 149 | 150 | String hexPrivateKey = GlobalService.to.selectWalletEntity.privateKey; 151 | 152 | bool flag = await execute( 153 | stub, hexPrivateKey, fromAddress, contractAddress, dataList, 0); 154 | return flag; 155 | } catch (e) { 156 | print(e); 157 | return false; 158 | } 159 | } 160 | 161 | Future execute( 162 | WalletClient stub, 163 | String hexPrivateKey, 164 | String base58OwnerAddress, 165 | String base58ContractAddress, 166 | Uint8List dataList, 167 | int callValue) async { 168 | final TriggerSmartContract req = TriggerSmartContract(); 169 | req.ownerAddress = base58.decode(base58OwnerAddress).sublist(0, 21); 170 | req.contractAddress = base58.decode(base58ContractAddress).sublist(0, 21); 171 | req.callValue = Int64(callValue); 172 | req.data = dataList; 173 | 174 | Transaction trans = await buildTransaction(stub, req, hexPrivateKey, 175 | Transaction_Contract_ContractType.TriggerSmartContract, dataList); 176 | Return result = await stub.broadcastTransaction(trans); 177 | 178 | if (result.toProto3Json().toString().contains('true') == true) { 179 | return true; 180 | } else { 181 | print('execute error msg: ${utf8.decode(result.message)}'); 182 | return false; 183 | } 184 | } 185 | 186 | Future buildTransaction( 187 | WalletClient stub, 188 | TriggerSmartContract req, 189 | String hexPrivateKey, 190 | Transaction_Contract_ContractType ctxType, 191 | Uint8List data) async { 192 | Transaction trans = Transaction(); 193 | trans.rawData = Transaction_raw(); 194 | Transaction_Contract transContract = Transaction_Contract(); 195 | transContract.type = ctxType; 196 | transContract.parameter = Any.pack(req); 197 | trans.rawData.contract.add(transContract); 198 | 199 | BlockExtention resp = await stub.getNowBlock2(EmptyMessage()); 200 | trans.rawData.refBlockBytes = resp.blockHeader.rawData.number 201 | .toBytes() 202 | .reversed 203 | .toList() 204 | .sublist(6, 8); 205 | trans.rawData.refBlockHash = sha256 206 | .convert(resp.blockHeader.rawData.writeToBuffer()) 207 | .bytes 208 | .sublist(8, 16); 209 | trans.rawData.timestamp = 210 | Int64(DateTime.now().toUtc().millisecondsSinceEpoch); 211 | trans.rawData.feeLimit = Int64(10 * 1000000); 212 | trans.rawData.expiration = Int64(DateTime.now() 213 | .toUtc() 214 | .add(Duration(seconds: 180)) 215 | .millisecondsSinceEpoch); 216 | 217 | Uint8List hash = sha256.convert(trans.rawData.writeToBuffer()).bytes; 218 | 219 | MsgSignature msgSignature = sign(hash, hexToBytes(hexPrivateKey)); 220 | 221 | TronMsgSignature msgSignature2 = TronMsgSignature( 222 | intToBytes(msgSignature.r), intToBytes(msgSignature.s), msgSignature.v); 223 | Uint8List ms2 = msgSignature2.getSignature(); 224 | 225 | trans.signature.add(ms2); 226 | return trans; 227 | } 228 | 229 | String getAbiTronAddress(String base58Address) { 230 | Uint8List address = base58.decode(base58Address).sublist(1, 21); 231 | return '0x' + bytesToHex(address); 232 | } 233 | } 234 | -------------------------------------------------------------------------------- /lib/tron/service/tron_wallet.dart: -------------------------------------------------------------------------------- 1 | import 'dart:typed_data'; 2 | 3 | import 'package:bip39/bip39.dart' as bip39; 4 | import 'package:bs58check/bs58check.dart'; 5 | import 'package:crypto/crypto.dart'; 6 | import 'package:ed25519_hd_key/ed25519_hd_key.dart'; 7 | import 'package:flash_tron_wallet/entity/tron/wallet_entity.dart'; 8 | import "package:hex/hex.dart"; 9 | import 'package:web3dart/crypto.dart'; 10 | 11 | class TronWallet { 12 | WalletEntity createWallet(String name, String pwd) { 13 | String randomMnemonic = bip39.generateMnemonic(); 14 | String hexSeed = bip39.mnemonicToSeedHex(randomMnemonic); 15 | 16 | KeyData data = ED25519_HD_KEY.derivePath("m/44'/195'", hexSeed); 17 | 18 | String privateKey = HEX.encode(data.key); 19 | 20 | Uint8List key = privateKeyToPublic(hexToInt(privateKey)); 21 | 22 | Uint8List tronAddress = getTronAddress(key); 23 | 24 | String base58Address = getBase58Address(tronAddress); 25 | 26 | return WalletEntity( 27 | name: name, 28 | pwd: pwd, 29 | mnemonic: randomMnemonic, 30 | privateKey: privateKey, 31 | tronAddress: base58Address); 32 | } 33 | 34 | WalletEntity importWalletByMnemonic( 35 | String name, String pwd, String mnemonic) { 36 | String hexSeed = bip39.mnemonicToSeedHex(mnemonic); 37 | 38 | KeyData data = ED25519_HD_KEY.derivePath("m/44'/195'", hexSeed); 39 | var pb = ED25519_HD_KEY.getBublickKey(data.key); 40 | 41 | String privateKey = HEX.encode(data.key); 42 | 43 | Uint8List key = privateKeyToPublic(hexToInt(privateKey)); 44 | 45 | Uint8List tronAddress = getTronAddress(key); 46 | 47 | String base58Address = getBase58Address(tronAddress); 48 | 49 | return WalletEntity( 50 | name: name, 51 | pwd: pwd, 52 | mnemonic: mnemonic, 53 | privateKey: privateKey, 54 | tronAddress: base58Address); 55 | } 56 | 57 | WalletEntity importWalletByKey(String name, String pwd, String privateKey) { 58 | Uint8List key = privateKeyToPublic(hexToInt(privateKey)); 59 | 60 | Uint8List tronAddress = getTronAddress(key); 61 | 62 | String base58Address = getBase58Address(tronAddress); 63 | 64 | return WalletEntity( 65 | name: name, 66 | pwd: pwd, 67 | privateKey: privateKey, 68 | tronAddress: base58Address); 69 | } 70 | 71 | Uint8List getTronAddress(Uint8List pubKey) { 72 | Uint8List one = keccak256(pubKey); 73 | 74 | Uint8List two = one.sublist(12, 32); 75 | 76 | String three = '41' + bytesToHex(two); 77 | return hexToBytes(three); 78 | } 79 | 80 | String getBase58Address(Uint8List address) { 81 | var result = sha256.convert(address).bytes; 82 | Uint8List one = sha256.convert(result).bytes; 83 | Uint8List two = one.sublist(0, 4); 84 | Uint8List three = hexToBytes(bytesToHex(address) + bytesToHex(two)); 85 | String base58Address = base58.encode(three); 86 | return base58Address; 87 | } 88 | 89 | bool checkTronAddress(String tronAddress) { 90 | if (tronAddress.trim().length != 34) { 91 | return false; 92 | } else { 93 | Uint8List originAddress = base58.decode(tronAddress).sublist(0, 21); 94 | String hexAddress = bytesToHex(originAddress); 95 | if (hexAddress[0] != '4' || hexAddress[1] != '1') { 96 | return false; 97 | } 98 | } 99 | return true; 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flash_tron_wallet 2 | description: A new Flutter project. 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `pub publish`. This is preferred for private packages. 6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 7 | 8 | # The following defines the version and build number for your application. 9 | # A version number is three numbers separated by dots, like 1.2.43 10 | # followed by an optional build number separated by a +. 11 | # Both the version and the builder number may be overridden in flutter 12 | # build by specifying --build-name and --build-number, respectively. 13 | # In Android, build-name is used as versionName while build-number used as versionCode. 14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 16 | # Read more about iOS versioning at 17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 18 | version: 1.0.8+8 19 | 20 | environment: 21 | sdk: ">=2.8.0 <3.0.0" 22 | 23 | dependencies: 24 | flutter: 25 | sdk: flutter 26 | flutter_localizations: 27 | sdk: flutter 28 | 29 | dio: ^3.0.10 30 | flutter_screenutil: ^3.2.0 31 | flutter_easyrefresh: ^2.1.6 32 | fluttertoast: ^7.1.1 33 | shared_preferences: ^0.5.12+4 34 | common_utils: ^1.2.1 35 | synchronized: ^2.2.0+2 36 | grpc: ^2.7.0 37 | protobuf: ^1.1.0 38 | crypto: ^2.1.5 39 | bs58check: ^1.0.1 40 | bip39: ^1.0.3 41 | ed25519_hd_key: ^1.0.1 42 | ethereum_util: ^1.3.0 43 | qr_flutter: ^3.2.0 44 | web3dart: ^1.2.3 45 | google_fonts: ^1.1.1 46 | fixnum: ^0.10.11 47 | ota_update: ^2.4.1 48 | package_info: ^0.4.3+2 49 | path_provider: ^1.6.24 50 | open_file: ^3.0.3 51 | url_launcher: ^5.7.10 52 | cached_network_image: ^2.3.3 53 | scan: ^0.0.3 54 | decimal: ^0.3.5 55 | get: ^3.24.0 56 | 57 | # The following adds the Cupertino Icons font to your application. 58 | # Use with the CupertinoIcons class for iOS style icons. 59 | cupertino_icons: ^1.0.0 60 | 61 | dev_dependencies: 62 | flutter_test: 63 | sdk: flutter 64 | 65 | # For information on the generic Dart part of this file, see the 66 | # following page: https://dart.dev/tools/pub/pubspec 67 | 68 | # The following section is specific to Flutter. 69 | flutter: 70 | 71 | # The following line ensures that the Material Icons font is 72 | # included with your application, so that you can use the icons in 73 | # the material Icons class. 74 | uses-material-design: true 75 | 76 | assets: 77 | - asset/image/ 78 | 79 | fonts: 80 | - family: ZH-M 81 | fonts: 82 | - asset: asset/font/PingFangSC-Medium.ttf 83 | weight: 400 84 | 85 | - family: ZH-R 86 | fonts: 87 | - asset: asset/font/PingFangSC-Regular.ttf 88 | 89 | - family: EN-M 90 | fonts: 91 | - asset: asset/font/SF-Pro-Display-Medium.otf 92 | weight: 400 93 | 94 | - family: EN-R 95 | fonts: 96 | - asset: asset/font/SF-Pro-Display-Regular.otf 97 | 98 | - family: ICON 99 | fonts: 100 | - asset: asset/font/iconfont.ttf 101 | 102 | 103 | 104 | # To add assets to your application, add an assets section, like this: 105 | # assets: 106 | # - images/a_dot_burr.jpeg 107 | # - images/a_dot_ham.jpeg 108 | 109 | # An image asset can refer to one or more resolution-specific "variants", see 110 | # https://flutter.dev/assets-and-images/#resolution-aware. 111 | 112 | # For details regarding adding assets from package dependencies, see 113 | # https://flutter.dev/assets-and-images/#from-packages 114 | 115 | # To add custom fonts to your application, add a fonts section here, 116 | # in this "flutter" section. Each entry in this list should have a 117 | # "family" key with the font family name, and a "fonts" key with a 118 | # list giving the asset and other descriptors for the font. For 119 | # example: 120 | # fonts: 121 | # - family: Schyler 122 | # fonts: 123 | # - asset: fonts/Schyler-Regular.ttf 124 | # - asset: fonts/Schyler-Italic.ttf 125 | # style: italic 126 | # - family: Trajan Pro 127 | # fonts: 128 | # - asset: fonts/TrajanPro.ttf 129 | # - asset: fonts/TrajanPro_Bold.ttf 130 | # weight: 700 131 | # 132 | # For details regarding fonts from package dependencies, 133 | # see https://flutter.dev/custom-fonts/#from-packages -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:flash_tron_wallet/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | --------------------------------------------------------------------------------