├── .DS_Store ├── .github └── workflows │ └── dart.yml ├── .gitigonre ├── README.md ├── doc └── prd │ ├── youwallet用户故事地图.xlsx │ ├── 产品原型与流程.md │ └── 切图.zip ├── screenshots ├── WX20200412-214841.png ├── WX20200412-214854.png ├── WX20200412-214859.png ├── WX20200412-214909.png ├── WX20200412-214921.png ├── 创建钱包.gif ├── 导入钱包.gif ├── 币币兑换.gif └── 添加TOKEN.gif └── you_wallet ├── .gitignore ├── .metadata ├── .vscode ├── launch.json └── settings.json ├── README.md ├── android ├── .gitignore ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── you_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 │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── key.properties ├── settings.gradle └── settings_aar.gradle ├── assets ├── TempMatch.json ├── fonts │ ├── demo.css │ ├── demo_index.html │ ├── iconfont.css │ ├── iconfont.eot │ ├── iconfont.js │ ├── iconfont.json │ ├── iconfont.svg │ ├── iconfont.ttf │ ├── iconfont.woff │ └── iconfont.woff2 └── images │ ├── home-active.png │ ├── home.png │ ├── icon.png │ └── logo.png ├── fonts ├── demo.css ├── demo_index.html ├── iconfont.css ├── iconfont.eot ├── iconfont.js ├── iconfont.json ├── iconfont.svg ├── iconfont.ttf ├── iconfont.woff └── iconfont.woff2 ├── images ├── 2.0x │ ├── backup.png │ ├── empty.png │ ├── fingerprint.png │ ├── homebk-full.png │ ├── homebk.png │ ├── icon.png │ ├── logo.jpg │ ├── logo.png │ ├── new_wallet.png │ ├── qrcode.jpeg │ ├── qrcode.png │ ├── splash.jpeg │ ├── tab_exchange.png │ ├── tab_exchange_active.png │ ├── tab_receive.png │ ├── tab_receive_active.png │ ├── tab_transfer.png │ ├── tab_transfer_active.png │ ├── tab_wallet.png │ ├── tab_wallet_active.png │ ├── 图层 3@2x.png │ └── 指纹 拷贝@2x.png └── 3.0x │ ├── backup.png │ ├── empty.png │ ├── fingerprint.png │ ├── homebk-full.png │ ├── homebk.png │ ├── icon.png │ ├── logo.jpg │ ├── logo.png │ ├── new_wallet.png │ ├── qrcode.jpeg │ ├── qrcode.png │ ├── splash.jpeg │ ├── tab_exchange.png │ ├── tab_exchange_active.png │ ├── tab_receive.png │ ├── tab_receive_active.png │ ├── tab_transfer.png │ ├── tab_transfer_active.png │ ├── tab_wallet.png │ ├── tab_wallet_active.png │ ├── 图层 3@3x.png │ └── 指纹 拷贝@3x.png ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Podfile ├── Podfile.lock ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ └── contents.xcworkspacedata └── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-App-1024x1024@1x.png │ │ ├── Icon-App-20x20@1x.png │ │ ├── Icon-App-20x20@2x.png │ │ ├── Icon-App-20x20@3x.png │ │ ├── Icon-App-29x29@1x.png │ │ ├── Icon-App-29x29@2x.png │ │ ├── Icon-App-29x29@3x.png │ │ ├── Icon-App-40x40@1x.png │ │ ├── Icon-App-40x40@2x.png │ │ ├── Icon-App-40x40@3x.png │ │ ├── Icon-App-60x60@2x.png │ │ ├── Icon-App-60x60@3x.png │ │ ├── Icon-App-76x76@1x.png │ │ ├── Icon-App-76x76@2x.png │ │ └── Icon-App-83.5x83.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 ├── bus.dart ├── contracts │ └── TempMatch.json ├── db │ ├── provider.dart │ ├── sql_table_data.dart │ └── sql_util.dart ├── debug_page.dart ├── global.dart ├── main.dart ├── model.dart ├── model │ ├── book.dart │ ├── deal.dart │ ├── network.dart │ ├── token.dart │ ├── viewModel.dart │ └── wallet.dart ├── pages │ ├── form │ │ ├── getPassword.dart │ │ └── password.dart │ ├── keyboard │ │ ├── CustomJPasswordFieldWidget.dart │ │ ├── custom_keyboard_button.dart │ │ ├── keyboard_main.dart │ │ ├── keyboard_widget.dart │ │ └── pay_password.dart │ ├── login │ │ └── login.dart │ ├── manage_wallet │ │ ├── manage_list.dart │ │ └── set_wallet.dart │ ├── order │ │ ├── order_deep.dart │ │ └── order_detail.dart │ ├── routers.dart │ ├── scan │ │ └── scan.dart │ ├── set │ │ └── set_network.dart │ ├── splash │ │ └── splash.dart │ ├── success │ │ └── index.dart │ ├── tabs.dart │ ├── tabs │ │ ├── tab_exchange.dart │ │ ├── tab_receive.dart │ │ ├── tab_transfer.dart │ │ └── tab_wallet.dart │ ├── token │ │ ├── token_add.dart │ │ ├── token_history.dart │ │ └── token_info.dart │ └── wallet │ │ ├── new_wallet_check.dart │ │ ├── new_wallet_first.dart │ │ ├── new_wallet_guide.dart │ │ ├── new_wallet_load.dart │ │ ├── new_wallet_mnemonic.dart │ │ ├── new_wallet_second.dart │ │ ├── new_wallet_success.dart │ │ └── wallet_export.dart ├── service │ ├── TempMatch.json │ ├── app_server.dart │ ├── local_authentication_service.dart │ ├── service_locator.dart │ ├── token_service.dart │ └── trade.dart ├── util │ ├── eth_amount_formatter.dart │ ├── http_server.dart │ ├── locale_util.dart │ ├── md5_encrypt.dart │ ├── number_format.dart │ ├── transaction_process.dart │ ├── translations.dart │ └── wallet_crypt.dart └── widgets │ ├── addressFormat.dart │ ├── bottomSheetDialog.dart │ ├── customButton.dart │ ├── customStepper.dart │ ├── customTab.dart │ ├── custom_stepper.dart │ ├── hotToken.dart │ ├── input.dart │ ├── inputDialog.dart │ ├── listEmpty.dart │ ├── loadingDialog.dart │ ├── menu.dart │ ├── modalDialog.dart │ ├── priceNum.dart │ ├── rating.dart │ ├── slideButton.dart │ ├── tokenCard.dart │ ├── tokenList.dart │ ├── tokenLogo.dart │ ├── tokenSelect.dart │ ├── tokenSelectSheet.dart │ ├── tradesDeep.dart │ ├── transferList.dart │ ├── userMenu.dart │ └── walletList.dart ├── locale ├── i18n_en.json ├── i18n_ja.json └── i18n_zh.json ├── pubspec.lock ├── pubspec.yaml └── test └── widget_test.dart /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/.DS_Store -------------------------------------------------------------------------------- /.github/workflows/dart.yml: -------------------------------------------------------------------------------- 1 | name: Flutter CI 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | 7 | jobs: 8 | process: 9 | name: all process 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - uses: actions/checkout@v2 14 | 15 | # 建立 java 环境 16 | - name: Setup Java JDK 17 | uses: actions/setup-java@v1.3.0 18 | with: 19 | java-version: "12.x" 20 | 21 | # 建立 Flutter 环境 22 | - name: Flutter action 23 | uses: subosito/flutter-action@v1.1.1 24 | with: 25 | channel: "stable" 26 | 27 | # 下载项目依赖 28 | - name: Install dependencies 29 | run: | 30 | cd you_wallet 31 | flutter pub get 32 | flutter build apk --release 33 | - name: Release apk 34 | uses: ncipollo/release-action@v1.5.0 35 | with: 36 | artifacts: "build/app/outputs/apk/release/*.apk" 37 | token: ${{ secrets.GIT_RElEASE_TOKEN }} 38 | -------------------------------------------------------------------------------- /.gitigonre: -------------------------------------------------------------------------------- 1 | .DS_Store -------------------------------------------------------------------------------- /doc/prd/youwallet用户故事地图.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/doc/prd/youwallet用户故事地图.xlsx -------------------------------------------------------------------------------- /doc/prd/产品原型与流程.md: -------------------------------------------------------------------------------- 1 | # 产品原型地址 2 | https://org.modao.cc/app/e30cfca2a7bbd116bf20d986b4d2d828 3 | # 产品流程图 4 | https://www.processon.com/colla 5 | -------------------------------------------------------------------------------- /doc/prd/切图.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/doc/prd/切图.zip -------------------------------------------------------------------------------- /screenshots/WX20200412-214841.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/screenshots/WX20200412-214841.png -------------------------------------------------------------------------------- /screenshots/WX20200412-214854.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/screenshots/WX20200412-214854.png -------------------------------------------------------------------------------- /screenshots/WX20200412-214859.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/screenshots/WX20200412-214859.png -------------------------------------------------------------------------------- /screenshots/WX20200412-214909.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/screenshots/WX20200412-214909.png -------------------------------------------------------------------------------- /screenshots/WX20200412-214921.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/screenshots/WX20200412-214921.png -------------------------------------------------------------------------------- /screenshots/创建钱包.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/screenshots/创建钱包.gif -------------------------------------------------------------------------------- /screenshots/导入钱包.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/screenshots/导入钱包.gif -------------------------------------------------------------------------------- /screenshots/币币兑换.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/screenshots/币币兑换.gif -------------------------------------------------------------------------------- /screenshots/添加TOKEN.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/screenshots/添加TOKEN.gif -------------------------------------------------------------------------------- /you_wallet/.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 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | /build/ 32 | 33 | # Web related 34 | lib/generated_plugin_registrant.dart 35 | 36 | # Exceptions to above rules. 37 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 38 | -------------------------------------------------------------------------------- /you_wallet/.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: 27321ebbad34b0a3fafe99fac037102196d655ff 8 | channel: v1.12.13-hotfixes 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /you_wallet/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Flutter: Attach to Device", 9 | "type": "dart", 10 | "request": "attach" 11 | }, 12 | { 13 | "name": "Flutter", 14 | "request": "launch", 15 | "type": "dart" 16 | } 17 | ] 18 | } -------------------------------------------------------------------------------- /you_wallet/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.fontSize": 16 3 | } -------------------------------------------------------------------------------- /you_wallet/README.md: -------------------------------------------------------------------------------- 1 | ## you wallet 2 | 3 | A new Flutter project. 4 | 5 | ## Screenshots 6 | 7 | 8 | ## License 9 | MIT -------------------------------------------------------------------------------- /you_wallet/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | -------------------------------------------------------------------------------- /you_wallet/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 28 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.example.you_wallet" 46 | minSdkVersion 18 47 | targetSdkVersion 28 48 | versionCode flutterVersionCode.toInteger() 49 | versionName flutterVersionName 50 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 51 | } 52 | 53 | // 54 | signingConfigs { 55 | release { 56 | keyAlias keystoreProperties['keyAlias'] 57 | keyPassword keystoreProperties['keyPassword'] 58 | storeFile file('/Users/zhaobinglong/key.jks') 59 | storePassword keystoreProperties['storePassword'] 60 | } 61 | } 62 | buildTypes { 63 | release { 64 | signingConfig signingConfigs.release 65 | } 66 | } 67 | } 68 | 69 | flutter { 70 | source '../..' 71 | } 72 | 73 | dependencies { 74 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 75 | testImplementation 'junit:junit:4.12' 76 | androidTestImplementation 'androidx.test:runner:1.1.1' 77 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 78 | } 79 | -------------------------------------------------------------------------------- /you_wallet/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /you_wallet/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 22 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 39 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /you_wallet/android/app/src/main/kotlin/com/example/you_wallet/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.you_wallet 2 | 3 | import androidx.annotation.NonNull; 4 | import io.flutter.embedding.android.FlutterActivity 5 | import io.flutter.embedding.engine.FlutterEngine 6 | import io.flutter.plugins.GeneratedPluginRegistrant 7 | 8 | class MainActivity: FlutterActivity() { 9 | override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { 10 | GeneratedPluginRegistrant.registerWith(flutterEngine); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /you_wallet/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /you_wallet/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /you_wallet/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /you_wallet/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /you_wallet/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /you_wallet/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /you_wallet/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /you_wallet/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /you_wallet/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 | -------------------------------------------------------------------------------- /you_wallet/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /you_wallet/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 | -------------------------------------------------------------------------------- /you_wallet/android/key.properties: -------------------------------------------------------------------------------- 1 | storePassword=youwallet 2 | keyPassword=youwallet 3 | keyAlias=key 4 | storeFile=/Users/zhaobinglong/key.jks -------------------------------------------------------------------------------- /you_wallet/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /you_wallet/android/settings_aar.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /you_wallet/assets/fonts/iconfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/assets/fonts/iconfont.eot -------------------------------------------------------------------------------- /you_wallet/assets/fonts/iconfont.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "1579562", 3 | "name": "youwallet", 4 | "font_family": "iconfont", 5 | "css_prefix_text": "icon-", 6 | "description": "", 7 | "glyphs": [ 8 | { 9 | "icon_id": "8017484", 10 | "name": "empty", 11 | "font_class": "empty", 12 | "unicode": "e6a6", 13 | "unicode_decimal": 59046 14 | }, 15 | { 16 | "icon_id": "12911879", 17 | "name": "空", 18 | "font_class": "kong", 19 | "unicode": "e615", 20 | "unicode_decimal": 58901 21 | }, 22 | { 23 | "icon_id": "3105859", 24 | "name": "成功", 25 | "font_class": "chenggong", 26 | "unicode": "e617", 27 | "unicode_decimal": 58903 28 | }, 29 | { 30 | "icon_id": "2531537", 31 | "name": "转账", 32 | "font_class": "zhuanzhang", 33 | "unicode": "e616", 34 | "unicode_decimal": 58902 35 | }, 36 | { 37 | "icon_id": "6272919", 38 | "name": "兑换", 39 | "font_class": "duihuan", 40 | "unicode": "e6eb", 41 | "unicode_decimal": 59115 42 | }, 43 | { 44 | "icon_id": "10149600", 45 | "name": "收款", 46 | "font_class": "shoukuan", 47 | "unicode": "e624", 48 | "unicode_decimal": 58916 49 | }, 50 | { 51 | "icon_id": "5992794", 52 | "name": "icon_以太坊", 53 | "font_class": "icon_yitaifang", 54 | "unicode": "e648", 55 | "unicode_decimal": 58952 56 | }, 57 | { 58 | "icon_id": "4365480", 59 | "name": "扫码", 60 | "font_class": "saoma", 61 | "unicode": "e61d", 62 | "unicode_decimal": 58909 63 | }, 64 | { 65 | "icon_id": "4892945", 66 | "name": "银杏", 67 | "font_class": "weibiaoti--", 68 | "unicode": "e678", 69 | "unicode_decimal": 59000 70 | }, 71 | { 72 | "icon_id": "10172816", 73 | "name": "二维码", 74 | "font_class": "qrcode", 75 | "unicode": "e600", 76 | "unicode_decimal": 58880 77 | } 78 | ] 79 | } 80 | -------------------------------------------------------------------------------- /you_wallet/assets/fonts/iconfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/assets/fonts/iconfont.ttf -------------------------------------------------------------------------------- /you_wallet/assets/fonts/iconfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/assets/fonts/iconfont.woff -------------------------------------------------------------------------------- /you_wallet/assets/fonts/iconfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/assets/fonts/iconfont.woff2 -------------------------------------------------------------------------------- /you_wallet/assets/images/home-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/assets/images/home-active.png -------------------------------------------------------------------------------- /you_wallet/assets/images/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/assets/images/home.png -------------------------------------------------------------------------------- /you_wallet/assets/images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/assets/images/icon.png -------------------------------------------------------------------------------- /you_wallet/assets/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/assets/images/logo.png -------------------------------------------------------------------------------- /you_wallet/fonts/iconfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/fonts/iconfont.eot -------------------------------------------------------------------------------- /you_wallet/fonts/iconfont.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "1579562", 3 | "name": "youwallet", 4 | "font_family": "iconfont", 5 | "css_prefix_text": "icon-", 6 | "description": "", 7 | "glyphs": [ 8 | { 9 | "icon_id": "11993945", 10 | "name": "EOS", 11 | "font_class": "EOS", 12 | "unicode": "e7ef", 13 | "unicode_decimal": 59375 14 | }, 15 | { 16 | "icon_id": "11993930", 17 | "name": "BNB", 18 | "font_class": "BNB", 19 | "unicode": "e7ec", 20 | "unicode_decimal": 59372 21 | }, 22 | { 23 | "icon_id": "11994009", 24 | "name": "USDT", 25 | "font_class": "USDT", 26 | "unicode": "e7f8", 27 | "unicode_decimal": 59384 28 | }, 29 | { 30 | "icon_id": "6204754", 31 | "name": "成功", 32 | "font_class": "chenggong1", 33 | "unicode": "e64e", 34 | "unicode_decimal": 58958 35 | }, 36 | { 37 | "icon_id": "8017484", 38 | "name": "empty", 39 | "font_class": "empty", 40 | "unicode": "e6a6", 41 | "unicode_decimal": 59046 42 | }, 43 | { 44 | "icon_id": "12911879", 45 | "name": "空", 46 | "font_class": "kong", 47 | "unicode": "e615", 48 | "unicode_decimal": 58901 49 | }, 50 | { 51 | "icon_id": "13113215", 52 | "name": "空", 53 | "font_class": "kong-copy", 54 | "unicode": "e6ec", 55 | "unicode_decimal": 59116 56 | }, 57 | { 58 | "icon_id": "3105859", 59 | "name": "成功", 60 | "font_class": "chenggong", 61 | "unicode": "e617", 62 | "unicode_decimal": 58903 63 | }, 64 | { 65 | "icon_id": "2531537", 66 | "name": "转账", 67 | "font_class": "zhuanzhang", 68 | "unicode": "e616", 69 | "unicode_decimal": 58902 70 | }, 71 | { 72 | "icon_id": "6272919", 73 | "name": "兑换", 74 | "font_class": "duihuan", 75 | "unicode": "e6eb", 76 | "unicode_decimal": 59115 77 | }, 78 | { 79 | "icon_id": "10149600", 80 | "name": "收款", 81 | "font_class": "shoukuan", 82 | "unicode": "e624", 83 | "unicode_decimal": 58916 84 | }, 85 | { 86 | "icon_id": "5992794", 87 | "name": "icon_以太坊", 88 | "font_class": "icon_yitaifang", 89 | "unicode": "e648", 90 | "unicode_decimal": 58952 91 | }, 92 | { 93 | "icon_id": "4365480", 94 | "name": "扫码", 95 | "font_class": "saoma", 96 | "unicode": "e61d", 97 | "unicode_decimal": 58909 98 | }, 99 | { 100 | "icon_id": "4892945", 101 | "name": "银杏", 102 | "font_class": "weibiaoti--", 103 | "unicode": "e678", 104 | "unicode_decimal": 59000 105 | }, 106 | { 107 | "icon_id": "10172816", 108 | "name": "二维码", 109 | "font_class": "qrcode", 110 | "unicode": "e600", 111 | "unicode_decimal": 58880 112 | } 113 | ] 114 | } 115 | -------------------------------------------------------------------------------- /you_wallet/fonts/iconfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/fonts/iconfont.ttf -------------------------------------------------------------------------------- /you_wallet/fonts/iconfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/fonts/iconfont.woff -------------------------------------------------------------------------------- /you_wallet/fonts/iconfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/fonts/iconfont.woff2 -------------------------------------------------------------------------------- /you_wallet/images/2.0x/backup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/2.0x/backup.png -------------------------------------------------------------------------------- /you_wallet/images/2.0x/empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/2.0x/empty.png -------------------------------------------------------------------------------- /you_wallet/images/2.0x/fingerprint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/2.0x/fingerprint.png -------------------------------------------------------------------------------- /you_wallet/images/2.0x/homebk-full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/2.0x/homebk-full.png -------------------------------------------------------------------------------- /you_wallet/images/2.0x/homebk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/2.0x/homebk.png -------------------------------------------------------------------------------- /you_wallet/images/2.0x/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/2.0x/icon.png -------------------------------------------------------------------------------- /you_wallet/images/2.0x/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/2.0x/logo.jpg -------------------------------------------------------------------------------- /you_wallet/images/2.0x/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/2.0x/logo.png -------------------------------------------------------------------------------- /you_wallet/images/2.0x/new_wallet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/2.0x/new_wallet.png -------------------------------------------------------------------------------- /you_wallet/images/2.0x/qrcode.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/2.0x/qrcode.jpeg -------------------------------------------------------------------------------- /you_wallet/images/2.0x/qrcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/2.0x/qrcode.png -------------------------------------------------------------------------------- /you_wallet/images/2.0x/splash.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/2.0x/splash.jpeg -------------------------------------------------------------------------------- /you_wallet/images/2.0x/tab_exchange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/2.0x/tab_exchange.png -------------------------------------------------------------------------------- /you_wallet/images/2.0x/tab_exchange_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/2.0x/tab_exchange_active.png -------------------------------------------------------------------------------- /you_wallet/images/2.0x/tab_receive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/2.0x/tab_receive.png -------------------------------------------------------------------------------- /you_wallet/images/2.0x/tab_receive_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/2.0x/tab_receive_active.png -------------------------------------------------------------------------------- /you_wallet/images/2.0x/tab_transfer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/2.0x/tab_transfer.png -------------------------------------------------------------------------------- /you_wallet/images/2.0x/tab_transfer_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/2.0x/tab_transfer_active.png -------------------------------------------------------------------------------- /you_wallet/images/2.0x/tab_wallet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/2.0x/tab_wallet.png -------------------------------------------------------------------------------- /you_wallet/images/2.0x/tab_wallet_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/2.0x/tab_wallet_active.png -------------------------------------------------------------------------------- /you_wallet/images/2.0x/图层 3@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/2.0x/图层 3@2x.png -------------------------------------------------------------------------------- /you_wallet/images/2.0x/指纹 拷贝@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/2.0x/指纹 拷贝@2x.png -------------------------------------------------------------------------------- /you_wallet/images/3.0x/backup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/3.0x/backup.png -------------------------------------------------------------------------------- /you_wallet/images/3.0x/empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/3.0x/empty.png -------------------------------------------------------------------------------- /you_wallet/images/3.0x/fingerprint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/3.0x/fingerprint.png -------------------------------------------------------------------------------- /you_wallet/images/3.0x/homebk-full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/3.0x/homebk-full.png -------------------------------------------------------------------------------- /you_wallet/images/3.0x/homebk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/3.0x/homebk.png -------------------------------------------------------------------------------- /you_wallet/images/3.0x/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/3.0x/icon.png -------------------------------------------------------------------------------- /you_wallet/images/3.0x/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/3.0x/logo.jpg -------------------------------------------------------------------------------- /you_wallet/images/3.0x/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/3.0x/logo.png -------------------------------------------------------------------------------- /you_wallet/images/3.0x/new_wallet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/3.0x/new_wallet.png -------------------------------------------------------------------------------- /you_wallet/images/3.0x/qrcode.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/3.0x/qrcode.jpeg -------------------------------------------------------------------------------- /you_wallet/images/3.0x/qrcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/3.0x/qrcode.png -------------------------------------------------------------------------------- /you_wallet/images/3.0x/splash.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/3.0x/splash.jpeg -------------------------------------------------------------------------------- /you_wallet/images/3.0x/tab_exchange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/3.0x/tab_exchange.png -------------------------------------------------------------------------------- /you_wallet/images/3.0x/tab_exchange_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/3.0x/tab_exchange_active.png -------------------------------------------------------------------------------- /you_wallet/images/3.0x/tab_receive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/3.0x/tab_receive.png -------------------------------------------------------------------------------- /you_wallet/images/3.0x/tab_receive_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/3.0x/tab_receive_active.png -------------------------------------------------------------------------------- /you_wallet/images/3.0x/tab_transfer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/3.0x/tab_transfer.png -------------------------------------------------------------------------------- /you_wallet/images/3.0x/tab_transfer_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/3.0x/tab_transfer_active.png -------------------------------------------------------------------------------- /you_wallet/images/3.0x/tab_wallet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/3.0x/tab_wallet.png -------------------------------------------------------------------------------- /you_wallet/images/3.0x/tab_wallet_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/3.0x/tab_wallet_active.png -------------------------------------------------------------------------------- /you_wallet/images/3.0x/图层 3@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/3.0x/图层 3@3x.png -------------------------------------------------------------------------------- /you_wallet/images/3.0x/指纹 拷贝@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/images/3.0x/指纹 拷贝@3x.png -------------------------------------------------------------------------------- /you_wallet/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 | -------------------------------------------------------------------------------- /you_wallet/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 | 11.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /you_wallet/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /you_wallet/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /you_wallet/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '11.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 | -------------------------------------------------------------------------------- /you_wallet/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - barcode_scan (0.0.1): 3 | - Flutter 4 | - MTBBarcodeScanner 5 | - SwiftProtobuf 6 | - Bugly (2.5.2) 7 | - Flutter (1.0.0) 8 | - flutter_aes_ecb_pkcs5 (0.0.1): 9 | - Flutter 10 | - flutter_bugly (0.0.1): 11 | - Bugly 12 | - Flutter 13 | - fluttertoast (0.0.2): 14 | - Flutter 15 | - FMDB (2.7.5): 16 | - FMDB/standard (= 2.7.5) 17 | - FMDB/standard (2.7.5) 18 | - image_picker_saver (0.0.1): 19 | - Flutter 20 | - local_auth (0.0.1): 21 | - Flutter 22 | - MTBBarcodeScanner (5.0.11) 23 | - path_provider (0.0.1): 24 | - Flutter 25 | - share (0.0.1): 26 | - Flutter 27 | - shared_preferences (0.0.1): 28 | - Flutter 29 | - sqflite (0.0.2): 30 | - Flutter 31 | - FMDB (>= 2.7.5) 32 | - SwiftProtobuf (1.9.0) 33 | - url_launcher (0.0.1): 34 | - Flutter 35 | 36 | DEPENDENCIES: 37 | - barcode_scan (from `.symlinks/plugins/barcode_scan/ios`) 38 | - Flutter (from `Flutter`) 39 | - flutter_aes_ecb_pkcs5 (from `.symlinks/plugins/flutter_aes_ecb_pkcs5/ios`) 40 | - flutter_bugly (from `.symlinks/plugins/flutter_bugly/ios`) 41 | - fluttertoast (from `.symlinks/plugins/fluttertoast/ios`) 42 | - image_picker_saver (from `.symlinks/plugins/image_picker_saver/ios`) 43 | - local_auth (from `.symlinks/plugins/local_auth/ios`) 44 | - path_provider (from `.symlinks/plugins/path_provider/ios`) 45 | - share (from `.symlinks/plugins/share/ios`) 46 | - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) 47 | - sqflite (from `.symlinks/plugins/sqflite/ios`) 48 | - url_launcher (from `.symlinks/plugins/url_launcher/ios`) 49 | 50 | SPEC REPOS: 51 | trunk: 52 | - Bugly 53 | - FMDB 54 | - MTBBarcodeScanner 55 | - SwiftProtobuf 56 | 57 | EXTERNAL SOURCES: 58 | barcode_scan: 59 | :path: ".symlinks/plugins/barcode_scan/ios" 60 | Flutter: 61 | :path: Flutter 62 | flutter_aes_ecb_pkcs5: 63 | :path: ".symlinks/plugins/flutter_aes_ecb_pkcs5/ios" 64 | flutter_bugly: 65 | :path: ".symlinks/plugins/flutter_bugly/ios" 66 | fluttertoast: 67 | :path: ".symlinks/plugins/fluttertoast/ios" 68 | image_picker_saver: 69 | :path: ".symlinks/plugins/image_picker_saver/ios" 70 | local_auth: 71 | :path: ".symlinks/plugins/local_auth/ios" 72 | path_provider: 73 | :path: ".symlinks/plugins/path_provider/ios" 74 | share: 75 | :path: ".symlinks/plugins/share/ios" 76 | shared_preferences: 77 | :path: ".symlinks/plugins/shared_preferences/ios" 78 | sqflite: 79 | :path: ".symlinks/plugins/sqflite/ios" 80 | url_launcher: 81 | :path: ".symlinks/plugins/url_launcher/ios" 82 | 83 | SPEC CHECKSUMS: 84 | barcode_scan: a5c27959edfafaa0c771905bad0b29d6d39e4479 85 | Bugly: dbac48b55ad469a97cc4321045cd50df8f63d44f 86 | Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 87 | flutter_aes_ecb_pkcs5: fb682a7bb13f29cfbb33f88f7e1ed2211eacf5db 88 | flutter_bugly: c9800f4d5bc5bdc27ffdde3417a26ba44266e0c3 89 | fluttertoast: b644586ef3b16f67fae9a1f8754cef6b2d6b634b 90 | FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a 91 | image_picker_saver: 4f28bd70e1efdca68ad88beab0f11d22cffe04f6 92 | local_auth: 1740f55d7af0a2e2a8684ce225fe79d8931e808c 93 | MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb 94 | path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c 95 | share: 0b2c3e82132f5888bccca3351c504d0003b3b410 96 | shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d 97 | sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 98 | SwiftProtobuf: ecbec1be9036d15655f6b3443a1c4ea693c97932 99 | url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef 100 | 101 | PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3 102 | 103 | COCOAPODS: 1.11.3 104 | -------------------------------------------------------------------------------- /you_wallet/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /you_wallet/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 | -------------------------------------------------------------------------------- /you_wallet/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /you_wallet/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 | -------------------------------------------------------------------------------- /you_wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /you_wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /you_wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /you_wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /you_wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /you_wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /you_wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /you_wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /you_wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /you_wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /you_wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /you_wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /you_wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /you_wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /you_wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /you_wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /you_wallet/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 | -------------------------------------------------------------------------------- /you_wallet/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /you_wallet/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /you_wallet/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /you_wallet/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. -------------------------------------------------------------------------------- /you_wallet/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 | -------------------------------------------------------------------------------- /you_wallet/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 | -------------------------------------------------------------------------------- /you_wallet/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | NSCameraUsageDescription 8 | Camera permission is required for barcode scanning. 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | you_wallet 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 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 | CADisableMinimumFrameDurationOnPhone 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /you_wallet/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" -------------------------------------------------------------------------------- /you_wallet/lib/bus.dart: -------------------------------------------------------------------------------- 1 | //全局事件总线 2 | //对于简单的app,事件总线已经足够满足需求,引入全局状态管理会增加负担 3 | 4 | //事件总线通常实现了订阅者模式,订阅者模式包含发布者和订阅者两种角色,可以通过事件总线来触发事件和监听事件, 5 | 6 | //Dart中实现单例模式的标准做法就是使用static变量+工厂构造函数的方式,这样就可以保证new EventBus()始终返回都是同一个实例,读者应该理解并掌握这种方法。 7 | 8 | import 'package:event_bus/event_bus.dart'; 9 | 10 | /// 创建EventBus 11 | EventBus eventBus = EventBus(); 12 | 13 | class EventAddToken { 14 | Map token = null; 15 | EventAddToken(this.token); 16 | } 17 | 18 | class WalletChangeEvent { 19 | String address = null; 20 | WalletChangeEvent(this.address); 21 | } 22 | 23 | /// tab页面切换通知 24 | class TabChangeEvent { 25 | int index = 0; 26 | TabChangeEvent(this.index); 27 | } 28 | 29 | /// 交易历史记录操作结果通知 30 | class TransferDoneEvent { 31 | String res = ''; 32 | TransferDoneEvent(this.res); 33 | } 34 | 35 | /// tab切换时候的事件通知 36 | class CustomTabChangeEvent { 37 | String res = ''; 38 | CustomTabChangeEvent(this.res); 39 | } 40 | 41 | /// 挂单成功通知 42 | class OrderSuccessEvent { 43 | OrderSuccessEvent(); 44 | } 45 | 46 | /// 交易深度列表刷新通知 47 | class UpdateTeadeDeepEvent { 48 | UpdateTeadeDeepEvent(); 49 | } 50 | 51 | /// 交易历史列表刷新事件 52 | class UpdateOrderListEvent { 53 | UpdateOrderListEvent(); 54 | } 55 | 56 | /// 事件钩子,订单列表准备刷新 57 | class TransferUpdateStartEvent { 58 | TransferUpdateStartEvent(); 59 | } 60 | 61 | // token余额刷新通知 62 | class TokenListUpdateEvent { 63 | TokenListUpdateEvent(); 64 | } 65 | 66 | // app新版本检查 67 | class CheckVersion { 68 | CheckVersion(); 69 | } 70 | 71 | /// 事件钩子,订单列表准备刷新 72 | //class Event{ 73 | // TransferUpdateStartEvent(); 74 | //} 75 | -------------------------------------------------------------------------------- /you_wallet/lib/db/provider.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:path/path.dart'; 4 | import 'package:sqflite/sqflite.dart'; 5 | import 'sql_table_data.dart'; 6 | 7 | class ProviderSql { 8 | static Database db; 9 | 10 | // 获取数据库中所有的表 11 | Future getTables() async { 12 | if (db == null) { 13 | return Future.value([]); 14 | } 15 | List tables = await db 16 | .rawQuery('SELECT name FROM sqlite_master WHERE type = "table"'); 17 | List targetList = []; 18 | tables.forEach((item) { 19 | targetList.add(item['name']); 20 | }); 21 | return targetList; 22 | } 23 | 24 | // 检查数据库中, 表是否完整, 在部份android中, 会出现表丢失的情况 25 | Future checkTableIsRight() async { 26 | List expectTables = ['tokens','wallet','trade','transfer','book']; //将项目中使用的表的表名添加集合中 27 | 28 | List tables = await getTables(); 29 | 30 | for (int i = 0; i < expectTables.length; i++) { 31 | if (!tables.contains(expectTables[i])) { 32 | return false; 33 | } 34 | } 35 | return true; 36 | } 37 | 38 | //初始化数据库 39 | Future init() async { 40 | //Get a location using getDatabasesPath 41 | String databasesPath = await getDatabasesPath(); 42 | String path = join(databasesPath, 'wallet.db'); 43 | print(path); 44 | try { 45 | db = await openDatabase(path); 46 | } catch (e) { 47 | print("Error $e"); 48 | } 49 | 50 | bool tableIsRight = await this.checkTableIsRight(); 51 | 52 | if (!tableIsRight) { 53 | // 关闭上面打开的db,否则无法执行open 54 | print('there is no DB Table,new db'); 55 | db.close(); 56 | //表不完整 57 | // Delete the database 58 | await deleteDatabase(path); 59 | 60 | db = await openDatabase(path, version: 1, 61 | onCreate: (Database db, int version) async { 62 | // When creating the db, create the table 63 | await db.execute(SqlTable.sql_createTable_token); 64 | await db.execute(SqlTable.sql_createTable_wallet); 65 | await db.execute(SqlTable.sql_createTable_trade); 66 | await db.execute(SqlTable.sql_createTable_transfer); 67 | // await db.execute(SqlTable.sql_createTable_approve); 68 | await db.execute(SqlTable.sql_createTable_book); 69 | print('db created version is $version'); 70 | }, onOpen: (Database db) async { 71 | print('new db opened'); 72 | }); 73 | } else { 74 | print("Opening existing database"); 75 | } 76 | } 77 | 78 | // 删除数据库 79 | Future clearCache() async { 80 | //Get a location using getDatabasesPath 81 | String databasesPath = await getDatabasesPath(); 82 | String path = join(databasesPath, 'wallet.db'); 83 | await deleteDatabase(path); 84 | print('数据库删除,done'); 85 | } 86 | 87 | // 删除交易数据表,然后新建交易数据表 88 | Future clearTrade() async { 89 | String databasesPath = await getDatabasesPath(); 90 | String path = join(databasesPath, 'wallet.db'); 91 | await db.delete('trade'); 92 | await db.execute(SqlTable.sql_createTable_trade); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /you_wallet/lib/db/sql_table_data.dart: -------------------------------------------------------------------------------- 1 | // 定义项目要用到的表 2 | class SqlTable{ 3 | // token 4 | static final String sql_createTable_token = """ 5 | CREATE TABLE tokens ( 6 | id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, 7 | address TEXT NOT NULL, 8 | wallet TEXT NOT NULL, 9 | name TEXT NOT NULL, 10 | decimals TINYINT NOT NULL, 11 | balance TEXT, 12 | rmb TEXT, 13 | network TEXT); 14 | """; 15 | 16 | // token授权记录 17 | static final String sql_createTable_approve = """ 18 | CREATE TABLE approve ( 19 | id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, 20 | tokenAddress TEXT, 21 | walletAddress TEXT); 22 | """; 23 | 24 | // 钱包 25 | static final String sql_createTable_wallet = """ 26 | CREATE TABLE wallet ( 27 | id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, 28 | name TEXT, 29 | mnemonic TEXT, 30 | privateKey TEXT NOT NULL UNIQUE, 31 | address TEXT NOT NULL UNIQUE, 32 | balance TEXT); 33 | """; 34 | 35 | // 兑换记录 36 | static final String sql_createTable_trade = """ 37 | CREATE TABLE trade ( 38 | id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, 39 | orderType TEXT, 40 | price TEXT, 41 | amount TEXT, 42 | filled TEXT, 43 | token TEXT, 44 | tokenName TEXT, 45 | baseToken TEXT, 46 | baseTokenName TEXT, 47 | txnHash TEXT NOT NULL UNIQUE, 48 | odHash TEXT, 49 | bqHash TEXT, 50 | sqHash TEXT, 51 | createTime TEXT, 52 | status TEXT); 53 | """; 54 | 55 | // 转账记录 56 | static final String sql_createTable_transfer = """ 57 | CREATE TABLE transfer ( 58 | id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, 59 | fromAddress TEXT NOT NULL, 60 | toAddress TEXT NOT NULL, 61 | tokenName TEXT NOT NULL, 62 | tokenAddress TEXT NOT NULL, 63 | num TEXT NOT NULL, 64 | txnHash TEXT NOT NULL UNIQUE, 65 | createTime TEXT, 66 | status TEXT); 67 | """; 68 | 69 | // 常用转账人 70 | static final String sql_createTable_book = """ 71 | CREATE TABLE book ( 72 | id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, 73 | address TEXT NOT NULL UNIQUE, 74 | remark TEXT); 75 | """; 76 | } -------------------------------------------------------------------------------- /you_wallet/lib/db/sql_util.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by yangqc on 2019-04-10 3 | * sqflite工具类 4 | */ 5 | import 'dart:async'; 6 | import 'package:sqflite/sqflite.dart'; 7 | import 'provider.dart'; 8 | 9 | class BaseModel { 10 | Database db; 11 | final String table = ''; 12 | var querys; 13 | 14 | BaseModel(this.db) { 15 | querys = db.query; 16 | } 17 | } 18 | 19 | class SqlUtil extends BaseModel { 20 | final String tableName; 21 | 22 | SqlUtil.setTable(String name) 23 | : tableName = name, 24 | super(ProviderSql.db); 25 | 26 | //查询该表中的所有数据 27 | Future get() async { 28 | return await this.querys(tableName); 29 | } 30 | 31 | //插入数据 传入Sql语句和参数 返回插入数据的id 32 | Future rawInsert(String sql, List arguments) async { 33 | return await this.db.rawInsert(sql, arguments); 34 | } 35 | 36 | //插入一条新的数据 返回插入数据的id 37 | Future insert(Map params) async { 38 | return await this.db.insert(tableName, params); 39 | } 40 | 41 | //删除数据 传入Sql语句和参数 42 | Future rawDelete(String sql, List arguments) async { 43 | return await this.db.rawDelete(sql, arguments); 44 | } 45 | 46 | //删除一条或多条数据 单个条件 47 | Future delete(String key, dynamic value) async { 48 | return await this.db.delete(tableName, where:'$key = ?', whereArgs:[value]); 49 | } 50 | 51 | //删除一条或多条数据 多个条件 52 | Future deletes(Map conditions, String ao) async { 53 | String stringConditions = ''; 54 | 55 | int index = 0; 56 | if (ao == '') ao = 'and'; 57 | conditions.forEach((key, value) { 58 | if (value == null) { 59 | return ; 60 | } 61 | if (value.runtimeType == String) { 62 | stringConditions = '$stringConditions $key = "$value"'; 63 | } 64 | if (value.runtimeType == int) { 65 | stringConditions = '$stringConditions $key = $value'; 66 | } 67 | 68 | if (index >= 0 && index < conditions.length -1) { 69 | stringConditions = '$stringConditions $ao'; 70 | } 71 | index++; 72 | }); 73 | return await this.db.delete(tableName, where:stringConditions); 74 | } 75 | 76 | //修改数据 传入Sql语句和参数 77 | Future rawUpdate(String sql, List arguments) async { 78 | return await this.db.rawUpdate(sql, arguments); 79 | } 80 | 81 | //修改一条或多条数据 单个条件 82 | Future update(Map params, String key, dynamic value) async { 83 | return await this.db.update(tableName, params, where:'$key = ?', whereArgs:[value]); 84 | } 85 | 86 | //修改一条或多条数据 多个条件 87 | Future updates(Map params, Map conditions, String ao) async { 88 | String stringConditions = ''; 89 | 90 | int index = 0; 91 | if (ao == '') ao = 'and'; 92 | conditions.forEach((key, value) { 93 | if (value == null) { 94 | return ; 95 | } 96 | if (value.runtimeType == String) { 97 | stringConditions = '$stringConditions $key = "$value"'; 98 | } 99 | if (value.runtimeType == int) { 100 | stringConditions = '$stringConditions $key = $value'; 101 | } 102 | 103 | if (index >= 0 && index < conditions.length -1) { 104 | stringConditions = '$stringConditions $ao'; 105 | } 106 | index++; 107 | }); 108 | return await this.db.update(tableName, params, where:stringConditions); 109 | } 110 | 111 | //查询数据 传入Sql语句和参数 112 | Future rawQuery(String sql, List arguments) async { 113 | return await this.db.rawQuery(sql, arguments); 114 | } 115 | 116 | //通过条件查询,可以将表名作为参数传进来,作为公共方法,返回的是一个集合 117 | Future query({Map conditions}) async { 118 | // 如果传入条件为空,就查询该表全部数据 119 | if (conditions == null || conditions.isEmpty) { 120 | return this.get(); 121 | } 122 | String stringConditions = ''; 123 | 124 | int index = 0; 125 | conditions.forEach((key, value) { 126 | if (value == null) { 127 | return ; 128 | } 129 | if (value.runtimeType == String) { 130 | stringConditions = '$stringConditions $key = "$value"'; 131 | } 132 | if (value.runtimeType == int) { 133 | stringConditions = '$stringConditions $key = $value'; 134 | } 135 | 136 | if (index >= 0 && index < conditions.length -1) { 137 | stringConditions = '$stringConditions and'; 138 | } 139 | index++; 140 | }); 141 | // print("this is string condition for sql > $stringConditions"); 142 | return await this.querys(tableName, where: stringConditions); 143 | } 144 | } 145 | 146 | 147 | -------------------------------------------------------------------------------- /you_wallet/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'dart:io'; 3 | import 'package:flutter/services.dart'; 4 | import 'package:youwallet/pages/routers.dart'; 5 | import 'package:youwallet/global.dart'; 6 | import 'package:youwallet/service/service_locator.dart'; 7 | import 'package:youwallet/db/provider.dart'; 8 | import 'package:provider/provider.dart'; 9 | 10 | // 引入model 11 | import 'package:youwallet/model/token.dart'; 12 | import 'package:youwallet/model/wallet.dart'; 13 | import 'package:youwallet/model/network.dart'; 14 | import 'package:youwallet/model/deal.dart'; 15 | import 'package:youwallet/model/book.dart'; 16 | 17 | // 官方的国际化插件 18 | import 'package:flutter_localizations/flutter_localizations.dart'; 19 | import 'package:youwallet/util/locale_util.dart'; 20 | import 'package:youwallet/util/translations.dart'; 21 | 22 | // 奔溃收集和日志上报 23 | import 'package:flutter_bugly/flutter_bugly.dart'; 24 | 25 | void main() => FlutterBugly.postCatchedException(() async { 26 | WidgetsFlutterBinding.ensureInitialized(); 27 | setupLocator(); 28 | 29 | // 启动数据库 30 | final provider = new ProviderSql(); 31 | await provider.init(); 32 | 33 | // 全局变量, 其他页面导入global类即可以使用其中的变量 34 | // 全局变量就只是变量,它一般不更改,即使更改,也不需要通知其他组件 35 | await Global.init(); 36 | Provider.debugCheckInvalidValueType = null; 37 | 38 | runApp( 39 | MultiProvider( 40 | providers: [ 41 | ChangeNotifierProvider(create: (_) => Token()), 42 | ChangeNotifierProvider(create: (_) => Wallet()), 43 | ChangeNotifierProvider(create: (_) => Network()), 44 | ChangeNotifierProvider(create: (_) => Deal()), 45 | ChangeNotifierProvider(create: (_) => Book()) 46 | ], 47 | child: MyApp(), 48 | ), 49 | ); 50 | 51 | // 当平台是安卓的时候 52 | // 设置android状态栏为透明的沉浸。写在组件渲染之后,是为了在渲染后进行set赋值,覆盖状态栏,写在渲染之前MaterialApp组件会覆盖掉这个值 53 | if (Platform.isAndroid) { 54 | SystemUiOverlayStyle systemUiOverlayStyle = 55 | SystemUiOverlayStyle(statusBarColor: Colors.transparent); 56 | SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle); 57 | } 58 | }); 59 | 60 | // APP最外层的widget,每个app都是这样 61 | class MyApp extends StatelessWidget { 62 | @override 63 | Widget build(BuildContext context) { 64 | return MaterialApp( 65 | // 本地化代理 66 | localizationsDelegates: [ 67 | const TranslationsDelegate(), 68 | GlobalMaterialLocalizations.delegate, 69 | GlobalWidgetsLocalizations.delegate, 70 | ], 71 | // const Locale(languageCode,countryCode) 72 | // Locale类是用来标识用户的语言环境的,它包括语言和国家两个标志,languageCode和countryCode: 73 | // supportedLocales: [ 74 | // const Locale('en', 'US'), // 美国英语 75 | // const Locale('zh', 'CN'), // 中文简体 76 | // //其它Locales 77 | // ], 78 | supportedLocales: localeUtil.supportedLocales(), 79 | debugShowCheckedModeBanner: false, //关闭调试 80 | theme: 81 | ThemeData(primarySwatch: Colors.blue, primaryColor: Colors.white), 82 | initialRoute: 'splash', 83 | //routes: routes, // 因为定义了onGenerateRoute,所以就不需要routes这个参数了 84 | onGenerateRoute: onGenerateRoute // 为了传递参数 85 | //home: new SplashWidget(tabIndex: 0) 86 | ); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /you_wallet/lib/model.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | //全局状态管理 4 | class Counter with ChangeNotifier { 5 | //1 6 | int _count; 7 | Counter(this._count); 8 | 9 | void add() { 10 | _count++; 11 | notifyListeners(); //2 12 | } 13 | 14 | get count => _count; //3 15 | } 16 | -------------------------------------------------------------------------------- /you_wallet/lib/model/book.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:youwallet/db/sql_util.dart'; 3 | 4 | /// ChangeNotifier 是 Flutter SDK 中的一个简单的类。 5 | /// 它用于向监听器发送通知。换言之,如果被定义为 ChangeNotifier, 6 | /// 你可以订阅它的状态变化。(这和大家所熟悉的观察者模式相类似)。 7 | 8 | /// 在 provider 中,ChangeNotifier 是一种能够封装应用程序状态的方法。 9 | /// 对于特别简单的程序,你可以通过一个 ChangeNotifier 来满足全部需求。 10 | /// 在相对复杂的应用中,由于会有多个模型,所以可能会有多个 ChangeNotifier。 11 | /// (不是必须得把 ChangeNotifier 和 provider 结合起来用,不过它确实是一个特别简单的类)。 12 | 13 | class Book extends ChangeNotifier { 14 | 15 | // 构造函数 16 | Book() { 17 | this.getBookList(); 18 | } 19 | 20 | List _items = []; 21 | 22 | 23 | // 获取列表 24 | List get items => _items; 25 | 26 | 27 | /// 从数据库获取当前兑换列表, 28 | void getBookList() async { 29 | var sql = SqlUtil.setTable("book"); 30 | List list = await sql.get(); 31 | this._items = list; 32 | notifyListeners(); 33 | } 34 | 35 | /// 更新订单匹配的交易额到数据库 36 | // Future updateFilled(Map item, String filled ) async { 37 | // var sql = SqlUtil.setTable("trade"); 38 | // String status = '进行中'; 39 | // if(double.parse(item['amount']) == double.parse(filled)) { 40 | // status = '成功'; 41 | // } 42 | // int i = await sql.update({'filled': filled, 'status': status}, 'txnHash', item['txnHash']); 43 | // return i; 44 | // } 45 | 46 | /// 更新联系人备注 47 | Future updateBookReamrk(Map item) async { 48 | var sql = SqlUtil.setTable("book"); 49 | int i = await sql.update({'remark': item['remark']}, 'address', item['address']); 50 | this.getBookList(); 51 | } 52 | 53 | /// 根据id删除指定的交易记录 54 | // Future deleteTrader(int id) async { 55 | // var sql = SqlUtil.setTable("trade"); 56 | // int i = await sql.delete('id', id); 57 | // return i; 58 | // } 59 | 60 | /// 保存联系人地址和备注到数据库 61 | Future saveBookAddress(List list) async { 62 | bool result = items.any((element)=>(element['address']==list[0])); 63 | if (result) { 64 | print('当前地址已保存,直接下一步'); 65 | return 0; 66 | } 67 | var sql = SqlUtil.setTable("book"); 68 | String sqlInsert ='INSERT INTO book(address, remark) VALUES(?,?)'; 69 | int id = await sql.rawInsert(sqlInsert, list); 70 | this.getBookList(); 71 | return id; 72 | } 73 | 74 | } -------------------------------------------------------------------------------- /you_wallet/lib/model/deal.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:youwallet/db/sql_util.dart'; 3 | 4 | /// ChangeNotifier 是 Flutter SDK 中的一个简单的类。 5 | /// 它用于向监听器发送通知。换言之,如果被定义为 ChangeNotifier, 6 | /// 你可以订阅它的状态变化。(这和大家所熟悉的观察者模式相类似)。 7 | 8 | /// 在 provider 中,ChangeNotifier 是一种能够封装应用程序状态的方法。 9 | /// 对于特别简单的程序,你可以通过一个 ChangeNotifier 来满足全部需求。 10 | /// 在相对复杂的应用中,由于会有多个模型,所以可能会有多个 ChangeNotifier。 11 | /// (不是必须得把 ChangeNotifier 和 provider 结合起来用,不过它确实是一个特别简单的类)。 12 | 13 | class Deal extends ChangeNotifier { 14 | // User get user => _profile.user; 15 | 16 | // 构造函数,获取本地保存的token' 17 | List _items = []; 18 | 19 | // 获取钱包列表 20 | List get items => _items; 21 | 22 | /// 从数据库获取兑换列表, 23 | Future getTraderList() async { 24 | var sql = SqlUtil.setTable("trade"); 25 | List list = await sql.get(); 26 | return list; 27 | } 28 | 29 | /// 更新订单匹配的交易额到数据库 30 | Future updateFilled(Map item, String filled) async { 31 | var sql = SqlUtil.setTable("trade"); 32 | int i = await sql.update({'filled': filled}, 'txnHash', item['txnHash']); 33 | return i; 34 | } 35 | 36 | /// 更新订单状态 37 | Future updateOrderStatus(String txnHash, String status) async { 38 | var sql = SqlUtil.setTable("trade"); 39 | int i = await sql.update({'status': status}, 'txnHash', txnHash); 40 | return i; 41 | } 42 | 43 | /// 根据id删除指定的交易记录 44 | Future deleteTrader(int id) async { 45 | var sql = SqlUtil.setTable("trade"); 46 | int i = await sql.delete('id', id); 47 | return i; 48 | } 49 | 50 | /// 保存兑换的订单到数据库 51 | Future saveTrader(List list) async { 52 | var sql = SqlUtil.setTable("trade"); 53 | String sqlInsert = 54 | 'INSERT INTO trade(orderType, price, amount,filled, token,tokenName, baseToken,baseTokenname, txnHash, odHash, bqHash, sqHash,createtime,status) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?)'; 55 | int id = await sql.rawInsert(sqlInsert, list); 56 | print("db trade id => ${id}"); 57 | return id; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /you_wallet/lib/model/network.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:shared_preferences/shared_preferences.dart'; 3 | 4 | /// ChangeNotifier 是 Flutter SDK 中的一个简单的类。 5 | /// 它用于向监听器发送通知。换言之,如果被定义为 ChangeNotifier, 6 | /// 你可以订阅它的状态变化。(这和大家所熟悉的观察者模式相类似)。 7 | 8 | /// 在 provider 中,ChangeNotifier 是一种能够封装应用程序状态的方法。 9 | /// 对于特别简单的程序,你可以通过一个 ChangeNotifier 来满足全部需求。 10 | /// 在相对复杂的应用中,由于会有多个模型,所以可能会有多个 ChangeNotifier。 11 | /// (不是必须得把 ChangeNotifier 和 provider 结合起来用,不过它确实是一个特别简单的类)。 12 | 13 | class Network extends ChangeNotifier { 14 | // 构造函数,获取本地保存的token' 15 | Network() { 16 | this._getNetwork(); 17 | } 18 | 19 | String _network = ""; 20 | String _rpcUrl = ""; 21 | 22 | // 23 | String get network => _network; 24 | 25 | // 获取jsonrpc请求所用的url 26 | String get rpcUrl => _rpcUrl; 27 | 28 | Future _getNetwork() async { 29 | SharedPreferences prefs = await SharedPreferences.getInstance(); 30 | String network = prefs.getString("network") ?? 'ropsten'; 31 | await this.changeNetwork(network); 32 | } 33 | 34 | Future changeNetwork(String network) async { 35 | SharedPreferences prefs = await SharedPreferences.getInstance(); 36 | await prefs.setString("network", network); 37 | this._network = network; 38 | this._rpcUrl = 'https://' + network + '.infura.io/'; 39 | notifyListeners(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /you_wallet/lib/model/token.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:youwallet/db/sql_util.dart'; 3 | import 'package:shared_preferences/shared_preferences.dart'; 4 | import 'package:youwallet/service/token_service.dart'; 5 | import 'package:youwallet/global.dart'; 6 | /// ChangeNotifier 是 Flutter SDK 中的一个简单的类。 7 | /// 它用于向监听器发送通知。换言之,如果被定义为 ChangeNotifier, 8 | /// 你可以订阅它的状态变化。(这和大家所熟悉的观察者模式相类似)。 9 | 10 | /// 在 provider 中,ChangeNotifier 是一种能够封装应用程序状态的方法。 11 | /// 对于特别简单的程序,你可以通过一个 ChangeNotifier 来满足全部需求。 12 | /// 在相对复杂的应用中,由于会有多个模型,所以可能会有多个 ChangeNotifier。 13 | /// (不是必须得把 ChangeNotifier 和 provider 结合起来用,不过它确实是一个特别简单的类)。 14 | 15 | class Token extends ChangeNotifier { 16 | // User get user => _profile.user; 17 | 18 | // 构造函数,获取本地保存的token' 19 | Token() { 20 | this._fetchToken(); 21 | } 22 | 23 | /// 获取token,只获取当前网络下的token 24 | /// 从数据库中读出来的数据不能直接修改,否则报错read-only 25 | /// 所以在查询的时候,直接就把最终的数据查出来,这样就不用过滤了 26 | void _fetchToken() async { 27 | var sql = SqlUtil.setTable("tokens"); 28 | String network = Global.getPrefs('network'); 29 | this._items = await sql.query(conditions: {'network': network}); 30 | notifyListeners(); 31 | } 32 | 33 | /// 供外部调用刷新token列表 34 | Future refreshTokenList() async { 35 | this._fetchToken(); 36 | } 37 | 38 | // APP是否登录(如果有用户信息,则证明登录过) 39 | // bool get isLogin => user != null; 40 | 41 | //用户信息发生变化,更新用户信息并通知依赖它的子孙Widgets更新 42 | // set user(User user) { 43 | // if (user?.login != _profile.user?.login) { 44 | // _profile.lastLogin = _profile.user?.login; 45 | // _profile.user = user; 46 | // notifyListeners(); 47 | // } 48 | // } 49 | 50 | /// 51 | List _items = []; 52 | 53 | 54 | /// 获取所有token 55 | List get items => _items; 56 | 57 | /// 保存一个token,注意token重复保存, 58 | /// 用户可能在不同的网络下添加同一种token 59 | Future add(Map token) async { 60 | var sql = SqlUtil.setTable("tokens"); 61 | var map = {'address': token['address'],'wallet': token['wallet'],'network': token['network']}; 62 | List json = await sql.query(conditions: map); 63 | if (json.isEmpty) { 64 | String sql_insert ='INSERT INTO tokens(address, wallet, name, decimals, balance, rmb, network) VALUES(?, ?, ?, ?, ?, ?, ?)'; 65 | List list = [token['address'], token['wallet'], token['name'], token['decimals'], token['balance'],token['rmb'], token['network']]; 66 | int id = await sql.rawInsert(sql_insert, list); 67 | this._fetchToken(); 68 | return id; 69 | } else { 70 | print('token添加重复'); 71 | return 0; 72 | } 73 | } 74 | 75 | /// 移除一个token 76 | Future remove(Map item) async { 77 | _items.remove(item); 78 | var sql = SqlUtil.setTable("tokens"); 79 | int id = await sql.delete('id', item['id']); 80 | this._fetchToken(); 81 | } 82 | 83 | /// 更新指定的token余额 84 | /// 余额变动话,主动重新_fetchToken 85 | /// 首页的token列表余额自动更新 86 | Future updateTokenBalance(Map item,String balance) async { 87 | var sql = SqlUtil.setTable("tokens"); 88 | int i = await sql.update({'balance': balance}, 'id', item['id']); 89 | print('updateTokenBalance => ${i}'); 90 | this._fetchToken(); 91 | } 92 | 93 | /// 在授权表中增加一份记录 94 | Future approveAdd(String address) async { 95 | SharedPreferences prefs = await SharedPreferences.getInstance(); 96 | var sql = SqlUtil.setTable("approve"); 97 | String sqlInsert ='INSERT INTO approve(tokenAddress, walletAddress) VALUES(?, ?)'; 98 | String walletAddress = prefs.getString("currentWallet"); 99 | List list = [address, walletAddress]; 100 | int id = await sql.rawInsert(sqlInsert, list); 101 | return id; 102 | } 103 | 104 | /// 在授权表中查询该token是否被授权 105 | Future approveSearch(String address) async { 106 | SharedPreferences prefs = await SharedPreferences.getInstance(); 107 | String walletAddress = prefs.getString("currentWallet"); 108 | var sql = SqlUtil.setTable("approve"); 109 | var map = {'tokenAddress': address, 'walletAddress': walletAddress}; 110 | List json = await sql.query(conditions: map); 111 | return json.length; 112 | } 113 | 114 | /// 刷新当前用户token列表中所有token的余额 115 | /// address:用户当前钱包地址 116 | Future updateBalance(String address) async{ 117 | for(var i = 0; i cardColors; 20 | 21 | /// 有效期 22 | final String balance; 23 | 24 | const TokenCardViewModel({ 25 | this.bankName, 26 | this.bankLogoUrl, 27 | this.cardType, 28 | this.cardNumber, 29 | this.cardColors, 30 | this.balance, 31 | }); 32 | } 33 | -------------------------------------------------------------------------------- /you_wallet/lib/pages/keyboard/CustomJPasswordFieldWidget.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | import 'package:flutter/cupertino.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'dart:math'; 5 | 6 | 7 | /// 自定义 密码输入框 8 | 9 | class CustomJPasswordField extends StatelessWidget { 10 | 11 | /// 传入当前密码 12 | String data; 13 | CustomJPasswordField(this.data); 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return CustomPaint( 18 | painter: MyCustom(data), 19 | ); 20 | } 21 | } 22 | 23 | class MyCustom extends CustomPainter { 24 | 25 | 26 | String pwdLength; 27 | MyCustom(this.pwdLength); 28 | 29 | 30 | @override 31 | void paint(Canvas canvas, Size size) { 32 | 33 | 34 | // 密码画笔 35 | Paint mPwdPaint; 36 | Paint mRectPaint; 37 | Rect mRect; 38 | int mInputLength; 39 | 40 | 41 | // 初始化密码画笔   42 | mPwdPaint = new Paint(); 43 | mPwdPaint..color = Colors.black; 44 | 45 | // mPwdPaint.setAntiAlias(true); 46 | // 初始化密码框   47 | mRectPaint = new Paint(); 48 | mRectPaint..color = Color(0xff707070); 49 | 50 | 51 | RRect r = new RRect.fromLTRBR( 52 | 0.0, 0.0, size.width, size.height, new Radius.circular(size.height / 12)); 53 | mRectPaint.style = PaintingStyle.stroke; 54 | canvas.drawRRect(r, mRectPaint); 55 | 56 | 57 | var per = size.width / 6.0; 58 | var offsetX = per; 59 | while (offsetX < size.width) { 60 | canvas.drawLine( 61 | new Offset(offsetX, 0.0), new Offset(offsetX, size.height), mRectPaint); 62 | offsetX += per; 63 | } 64 | 65 | var half = per/2; 66 | var radio = per/8; 67 | 68 | mPwdPaint.style = PaintingStyle.fill; 69 | for(int i =0; i< pwdLength.length && i< 6; i++){ 70 | canvas.drawArc(new Rect.fromLTRB(i*per+half-radio, size.height/2-radio, i*per+half+radio, size.height/2+radio), 0.0, 2*pi, true, mPwdPaint); 71 | } 72 | } 73 | 74 | @override 75 | bool shouldRepaint(CustomPainter oldDelegate) { 76 | return true; 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /you_wallet/lib/pages/keyboard/custom_keyboard_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | 4 | /// 自定义 键盘 按钮 5 | 6 | class CustomKbBtn extends StatefulWidget { 7 | String text; 8 | 9 | CustomKbBtn({Key key, this.text, this.callback}) : super(key: key); 10 | final callback; 11 | 12 | @override 13 | State createState() { 14 | return ButtonState(); 15 | } 16 | } 17 | 18 | class ButtonState extends State { 19 | ///回调函数执行体 20 | var backMethod; 21 | 22 | void back() { 23 | widget.callback('$backMethod'); 24 | } 25 | 26 | @override 27 | Widget build(BuildContext context) { 28 | 29 | MediaQueryData mediaQuery = MediaQuery.of(context); 30 | var _screenWidth = mediaQuery.size.width; 31 | 32 | return new Container( 33 | height:50.0, 34 | width: _screenWidth / 3, 35 | child: new OutlineButton( 36 | // 直角 37 | shape: new RoundedRectangleBorder( 38 | borderRadius: new BorderRadius.circular(0.0)), 39 | // 边框颜色 40 | borderSide: new BorderSide(color: Color(0x10333333)), 41 | child: new Text( 42 | widget.text, 43 | style: new TextStyle(color: Color(0xff333333), fontSize: 20.0), 44 | ), 45 | onPressed: back, 46 | )); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /you_wallet/lib/pages/keyboard/keyboard_main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:youwallet/pages/keyboard/CustomJPasswordFieldWidget.dart'; 3 | import 'package:youwallet/pages/keyboard/keyboard_widget.dart'; 4 | import 'package:youwallet/pages/keyboard/pay_password.dart'; 5 | 6 | 7 | /// 支付密码 + 自定义键盘 8 | 9 | class main_keyboard extends StatefulWidget { 10 | static final String sName = "enter"; 11 | 12 | @override 13 | State createState() { 14 | return new keyboardState(); 15 | } 16 | } 17 | 18 | 19 | class keyboardState extends State { 20 | String pwdData = ''; 21 | 22 | final GlobalKey _scaffoldKey = GlobalKey(); 23 | 24 | VoidCallback _showBottomSheetCallback; 25 | 26 | @override 27 | void initState() { 28 | 29 | _showBottomSheetCallback = _showBottomSheet; 30 | } 31 | 32 | @override 33 | Widget build(BuildContext context) { 34 | return new Scaffold( 35 | key: _scaffoldKey, 36 | // appBar: AppBar( 37 | // title: Text("账户密码"), 38 | // ), 39 | body: _buildContent(context), 40 | ); 41 | } 42 | 43 | Widget _buildContent(BuildContext c) { 44 | return new Container( 45 | width: double.maxFinite, 46 | height: 300.0, 47 | color: Color(0xffffffff), 48 | child: new Column( 49 | children: [ 50 | 51 | new Padding( 52 | padding: const EdgeInsets.only(top: 50.0), 53 | child: new Text( 54 | '请输入账户密码', 55 | style: new TextStyle(fontSize: 18.0, color: Color(0xff333333)), 56 | ), 57 | ), 58 | 59 | ///密码框 60 | new Padding( 61 | padding: const EdgeInsets.only(top: 15.0), 62 | child: _buildPwd(pwdData), 63 | ), 64 | 65 | // new Padding( 66 | // padding: const EdgeInsets.only(top: 20.0), 67 | // child: new Text( 68 | // '不是登录密码或连续数字', 69 | // style: new TextStyle(fontSize: 12.0, color: Color(0xff999999)), 70 | // ), 71 | // ), 72 | 73 | // new Padding( 74 | // padding: const EdgeInsets.only(top: 30.0), //0xffff0303 75 | // child: new Text( 76 | // '密码输入错误,还可输入2次,超出将锁定账户。', 77 | // style: new TextStyle(fontSize: 12.0, color: Color(0xffffffff)), 78 | // ), 79 | // ), 80 | ], 81 | ), 82 | ); 83 | } 84 | 85 | /// 密码键盘 确认按钮 事件 86 | void onAffirmButton() { 87 | print('输入的密码是=》${pwdData}'); 88 | Navigator.of(context).pop(pwdData); 89 | } 90 | 91 | void _onKeyDown(KeyEvent data){ 92 | print(data.key); 93 | if (data.isDelete()) { 94 | if (pwdData.length > 0) { 95 | pwdData = pwdData.substring(0, pwdData.length - 1); 96 | setState(() {}); 97 | } 98 | } else if (data.isCommit()) { 99 | if (pwdData.length != 6) { 100 | // Fluttertoast.showToast(msg: "密码不足6位,请重试", gravity: ToastGravity.CENTER); 101 | print('密码不足6位'); 102 | return; 103 | } 104 | Navigator.of(context).pop(); 105 | onAffirmButton(); 106 | } else { 107 | if (pwdData.length < 6) { 108 | pwdData += data.key; 109 | } 110 | setState(() {}); 111 | } 112 | } 113 | 114 | /// 底部弹出 自定义键盘 下滑消失 115 | void _showBottomSheet() { 116 | setState(() { 117 | // disable the button 118 | _showBottomSheetCallback = null; 119 | }); 120 | _scaffoldKey.currentState 121 | .showBottomSheet((BuildContext context) { 122 | return new MyKeyboard(_onKeyDown); 123 | }) 124 | .closed 125 | .whenComplete(() { 126 | if (mounted) { 127 | setState(() { 128 | // re-enable the button 129 | _showBottomSheetCallback = _showBottomSheet; 130 | }); 131 | } 132 | }); 133 | } 134 | 135 | // 自定义一个密码输入框 136 | Widget _buildPwd(var pwd) { 137 | return new GestureDetector( 138 | child: new Container( 139 | width: 250.0, 140 | height:40.0, 141 | // color: Colors.white, 142 | child: new CustomJPasswordField(pwd), 143 | ), 144 | onTap: () { 145 | // 点击密码输入框,地步的自定义键盘要滑出来 146 | _showBottomSheetCallback(); 147 | }, 148 | ); 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /you_wallet/lib/pages/keyboard/keyboard_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:youwallet/pages/keyboard/pay_password.dart'; 2 | import 'package:youwallet/pages/keyboard/custom_keyboard_button.dart'; 3 | import 'package:flutter/material.dart'; 4 | 5 | 6 | /// 自定义密码 键盘 7 | 8 | class MyKeyboard extends StatefulWidget { 9 | final callback; 10 | 11 | MyKeyboard(this.callback); 12 | 13 | @override 14 | State createState() { 15 | return new MyKeyboardStat(); 16 | } 17 | } 18 | 19 | class MyKeyboardStat extends State { 20 | final GlobalKey _scaffoldKey = GlobalKey(); 21 | 22 | /// 定义 确定 按钮 接口 暴露给调用方 23 | ///回调函数执行体 24 | var backMethod; 25 | void onCommitChange() { 26 | widget.callback(new KeyEvent("commit")); 27 | } 28 | 29 | void onOneChange(BuildContext cont) { 30 | widget.callback(new KeyEvent("1")); 31 | } 32 | 33 | void onTwoChange(BuildContext cont) { 34 | widget.callback(new KeyEvent("2")); 35 | } 36 | 37 | void onThreeChange(BuildContext cont) { 38 | widget.callback(new KeyEvent("3")); 39 | } 40 | 41 | void onFourChange(BuildContext cont) { 42 | widget.callback(new KeyEvent("4")); 43 | } 44 | 45 | void onFiveChange(BuildContext cont) { 46 | widget.callback(new KeyEvent("5")); 47 | } 48 | 49 | void onSixChange(BuildContext cont) { 50 | widget.callback(new KeyEvent("6")); 51 | } 52 | 53 | void onSevenChange(BuildContext cont) { 54 | widget.callback(new KeyEvent("7")); 55 | } 56 | 57 | void onEightChange(BuildContext cont) { 58 | widget.callback(new KeyEvent("8")); 59 | } 60 | 61 | void onNineChange(BuildContext cont) { 62 | widget.callback(new KeyEvent("9")); 63 | } 64 | 65 | void onZeroChange(BuildContext cont) { 66 | widget.callback(new KeyEvent("0")); 67 | } 68 | 69 | /// 点击删除 70 | void onDeleteChange() { 71 | widget.callback(new KeyEvent("del")); 72 | } 73 | 74 | @override 75 | Widget build(BuildContext context) { 76 | return new Container( 77 | key: _scaffoldKey, 78 | width: double.infinity, 79 | height: 250.0, 80 | color: Colors.white, 81 | child: new Column( 82 | children: [ 83 | new Container( 84 | height:30.0, 85 | color: Colors.white, 86 | alignment: Alignment.center, 87 | child: new Text( 88 | '下滑隐藏', 89 | style: new TextStyle(fontSize: 12.0, color: Color(0xff999999)), 90 | ), 91 | ), 92 | 93 | /// 键盘主体 94 | new Column( 95 | children: [ 96 | /// 第一行 97 | new Row( 98 | children: [ 99 | CustomKbBtn( 100 | text: '1', callback: (val) => onOneChange(context)), 101 | CustomKbBtn( 102 | text: '2', callback: (val) => onTwoChange(context)), 103 | CustomKbBtn( 104 | text: '3', callback: (val) => onThreeChange(context)), 105 | ], 106 | ), 107 | 108 | /// 第二行 109 | new Row( 110 | children: [ 111 | CustomKbBtn( 112 | text: '4', callback: (val) => onFourChange(context)), 113 | CustomKbBtn( 114 | text: '5', callback: (val) => onFiveChange(context)), 115 | CustomKbBtn( 116 | text: '6', callback: (val) => onSixChange(context)), 117 | ], 118 | ), 119 | 120 | /// 第三行 121 | new Row( 122 | children: [ 123 | CustomKbBtn( 124 | text: '7', callback: (val) => onSevenChange(context)), 125 | CustomKbBtn( 126 | text: '8', callback: (val) => onEightChange(context)), 127 | CustomKbBtn( 128 | text: '9', callback: (val) => onNineChange(context)), 129 | ], 130 | ), 131 | 132 | /// 第四行 133 | new Row( 134 | children: [ 135 | CustomKbBtn(text: '删除', callback: (val) => onDeleteChange()), 136 | CustomKbBtn( 137 | text: '0', callback: (val) => onZeroChange(context)), 138 | CustomKbBtn(text: '确定', callback: (val) => onCommitChange()), 139 | ], 140 | ), 141 | ], 142 | ) 143 | ], 144 | ), 145 | ); 146 | } 147 | } 148 | -------------------------------------------------------------------------------- /you_wallet/lib/pages/keyboard/pay_password.dart: -------------------------------------------------------------------------------- 1 | /// 支符密码 用于 密码输入框和键盘之间进行通信 2 | class KeyEvent { 3 | String key; 4 | 5 | KeyEvent(this.key); 6 | 7 | bool isDelete() => this.key == "del"; 8 | bool isCommit() => this.key == "commit"; 9 | } 10 | -------------------------------------------------------------------------------- /you_wallet/lib/pages/login/login.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:flutter/material.dart'; 3 | 4 | 5 | class Login extends StatefulWidget { 6 | Login() : super(); 7 | @override 8 | _LoginState createState() => _LoginState(); 9 | } 10 | 11 | class _LoginState extends State { 12 | 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return Scaffold( 17 | body: new Center( 18 | child: Column( 19 | mainAxisAlignment: MainAxisAlignment.center, 20 | crossAxisAlignment: CrossAxisAlignment.center, 21 | children: [ 22 | new Container( 23 | margin: const EdgeInsets.only(bottom: 30.0), 24 | child: new Image.asset( 25 | 'images/new_wallet.png' 26 | ), 27 | ), 28 | new Container( 29 | margin: const EdgeInsets.only(top: 50.0, bottom: 20.0), 30 | child: new Image.asset( 31 | 'images/fingerprint.png' 32 | ), 33 | ), 34 | new Text('点击唤醒验证'), 35 | ], 36 | ), 37 | ) 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /you_wallet/lib/pages/manage_wallet/manage_list.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:youwallet/model/wallet.dart'; 3 | import 'package:provider/provider.dart'; 4 | import 'package:youwallet/global.dart'; 5 | 6 | class ManageWallet extends StatefulWidget { 7 | final arguments; 8 | 9 | ManageWallet({Key key ,this.arguments}) : super(key: key); 10 | 11 | @override 12 | State createState() { 13 | // TODO: implement createState 14 | 15 | return new Page(); 16 | } 17 | } 18 | 19 | class Page extends State { 20 | 21 | List wallets = []; 22 | String currentAddress = ""; 23 | 24 | @override // override是重写父类中的函数 25 | void initState() { 26 | super.initState(); 27 | } 28 | 29 | @override 30 | Widget build(BuildContext context) { 31 | return layout(context); 32 | } 33 | 34 | Widget layout(BuildContext context) { 35 | return new Scaffold( 36 | appBar: buildAppBar(context), 37 | body: new Container( 38 | padding: const EdgeInsets.all(16.0), 39 | child: Consumer( 40 | builder: (context, Wallet, child) { 41 | return new ListView( 42 | children: Wallet.items.map((item) => walletCard(item)).toList() 43 | ); 44 | }, 45 | ), 46 | // child: new ListView( 47 | // children: this.wallets.map((item) => walletCard(item)).toList() 48 | // ), 49 | ), 50 | ); 51 | } 52 | 53 | Widget buildAppBar(BuildContext context) { 54 | return new AppBar( 55 | title: const Text('钱包管理'), 56 | actions: this.appBarActions(), 57 | //leading: new Icon(Icons.account_balance_wallet), 58 | ); 59 | } 60 | 61 | // 定义bar右侧的icon按钮 62 | appBarActions() { 63 | return [ 64 | new Container( 65 | width: 50.0, 66 | child: new IconButton( 67 | icon: new Icon(Icons.add_circle_outline ), 68 | onPressed: () { 69 | Navigator.pushNamed(context, "wallet_guide"); 70 | }, 71 | ), 72 | ) 73 | ]; 74 | } 75 | 76 | 77 | Widget walletCard(item) { 78 | print(item); 79 | String name = item['name'].length > 0 ? item['name']:'Account${item['id']}'; 80 | return new Card( 81 | color: Colors.white, //背景色 82 | child: new Container( 83 | padding: const EdgeInsets.all(28.0), 84 | child: new Row( 85 | children: [ 86 | new Container( 87 | margin: const EdgeInsets.only(right: 16.0), 88 | child: Consumer( 89 | builder: (context, wallet, child) { 90 | return new Radio( 91 | groupValue: wallet.currentWallet, 92 | activeColor: Colors.blue, 93 | value: item['address'], 94 | onChanged: (v) { 95 | print(v); 96 | Provider.of(context).changeWallet(v); 97 | }, 98 | ); 99 | }, 100 | ), 101 | ), 102 | new Expanded( 103 | child: new Column( 104 | crossAxisAlignment: CrossAxisAlignment.start, 105 | children: [ 106 | new Text( 107 | name, 108 | style: new TextStyle(fontSize: 32.0, color: Colors.black), 109 | ), 110 | new Text(Global.maskAddress(item['address'])), 111 | ], 112 | ), 113 | ), 114 | new Container( 115 | child: new IconButton( 116 | icon: new Icon(Icons.settings), 117 | onPressed: () { 118 | print(item); 119 | Navigator.pushNamed(context, "wallet_export",arguments:{ 120 | 'address': item['address'], 121 | }); 122 | }, 123 | ), 124 | 125 | ) 126 | ], 127 | ) 128 | ) 129 | ); 130 | 131 | 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /you_wallet/lib/pages/manage_wallet/set_wallet.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'dart:convert'; 3 | import 'package:http/http.dart'; 4 | import 'package:web3dart/json_rpc.dart'; 5 | import 'package:youwallet/widgets/menu.dart'; 6 | 7 | class SetWallet extends StatefulWidget { 8 | @override 9 | State createState() { 10 | // TODO: implement createState 11 | 12 | return new Page(); 13 | } 14 | } 15 | 16 | class Page extends State { 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | return layout(context); 21 | } 22 | 23 | Widget layout(BuildContext context) { 24 | return new Scaffold( 25 | appBar: buildAppBar(context), 26 | body: new Container( 27 | padding: const EdgeInsets.all(16.0), 28 | child: new ListView( 29 | children: [ 30 | walleCard(context), 31 | Menu(['导出助记词','导出私钥']), 32 | new MaterialButton( 33 | color: Colors.blue, 34 | textColor: Colors.white, 35 | minWidth: 300, // 控制按钮宽度 36 | child: new Text('创建钱包'), 37 | onPressed: () { 38 | Navigator.pushNamed(context, "set_wallet_name"); 39 | }, 40 | ), 41 | ], 42 | ), 43 | ), 44 | ); 45 | } 46 | 47 | Widget buildAppBar(BuildContext context) { 48 | return new AppBar( 49 | title: const Text('钱包设置'), 50 | //leading: new Icon(Icons.account_balance_wallet), 51 | ); 52 | } 53 | 54 | // 构建单个钱包卡片 55 | Widget walleCard(BuildContext context) { 56 | return new Card( 57 | color: Colors.white,//背景色 58 | child: new Container( 59 | padding: const EdgeInsets.all(28.0), 60 | child: new Row( 61 | children: [ 62 | new Container( 63 | margin: const EdgeInsets.only(right: 16.0), 64 | decoration: new BoxDecoration( 65 | border: new Border.all(width: 2.0, color: Colors.black26), 66 | borderRadius: new BorderRadius.all(new Radius.circular(20.0)), 67 | ), 68 | child: new Image.asset( 69 | 'assets/images/icon.png', 70 | height: 40.0, 71 | width: 40.0, 72 | fit: BoxFit.cover, 73 | ), 74 | ), 75 | new Expanded( 76 | child: new Column( 77 | crossAxisAlignment: CrossAxisAlignment.start, 78 | children: [ 79 | new Text( 80 | 'TFT', 81 | style: new TextStyle(fontSize: 32.0,color: Colors.black), 82 | ), 83 | new Text('0xxxxxxxxxxxxxxxxxxxxx'), 84 | ], 85 | ), 86 | ), 87 | new Container( 88 | child: new Column( 89 | children: [ 90 | new IconButton( 91 | icon: new Icon(Icons.arrow_forward_ios ), 92 | onPressed: () { 93 | // ... 94 | }, 95 | ), 96 | ], 97 | ) 98 | ) 99 | ], 100 | ) 101 | ) 102 | ); 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /you_wallet/lib/pages/order/order_deep.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:youwallet/service/trade.dart'; 3 | import 'dart:math'; 4 | import 'package:youwallet/widgets/loadingDialog.dart'; 5 | import 'package:youwallet/global.dart'; 6 | import 'package:decimal/decimal.dart'; 7 | import 'package:youwallet/util/number_format.dart'; 8 | import 'package:youwallet/widgets/listEmpty.dart'; 9 | 10 | class OrderDeep extends StatefulWidget { 11 | 12 | final arguments; 13 | 14 | OrderDeep({Key key ,this.arguments}) : super(key: key); 15 | 16 | @override 17 | State createState() { 18 | return new Page(); 19 | } 20 | } 21 | 22 | class Page extends State { 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | return layout(context); 27 | } 28 | 29 | @override 30 | void didChangeDependencies() { 31 | super.didChangeDependencies(); 32 | } 33 | 34 | Widget layout(BuildContext context) { 35 | return new Scaffold( 36 | appBar: buildAppBar(context), 37 | body: FutureBuilder( 38 | future: this.getOrderDeep(), 39 | builder: (BuildContext context, AsyncSnapshot snapshot) { 40 | /*表示数据成功返回*/ 41 | if (snapshot.hasData) { 42 | List response = snapshot.data; 43 | if(response.length == 0) { 44 | return ListEmpty( 45 | text: '还没有交易' 46 | ); 47 | } else { 48 | return new ListView( 49 | children: [ 50 | Column( 51 | children: response.map((item) => buildItem(item, context)).toList(), 52 | ) 53 | ], 54 | ); 55 | } 56 | } else { 57 | return LoadingDialog(); 58 | } 59 | }, 60 | ) 61 | ); 62 | } 63 | 64 | 65 | // 构建app bar 66 | Widget buildAppBar(BuildContext context) { 67 | return new AppBar( 68 | backgroundColor: Colors.white, 69 | title: new Text('交易深度') 70 | ); 71 | } 72 | 73 | // 获取所有的交易深度 74 | // 先用两个token获取到唯一的bq hash 75 | // 注意这里token的顺序,BTA-BTC和BTC-BTA的bq hash是不一样的 76 | // 同一个队列,卖单和买单的bq hash是一样的 77 | /* 订单深度条目 78 | * baseTokenAmount, quoteTokenAmount: 由这两个算出价格 = quoteTokenAmount / baseTokenAmount 79 | * amount: base-token 数量 80 | **/ 81 | // struct OrderItem 82 | // { 83 | // uint256 baseTokenAmount; 84 | // uint256 quoteTokenAmount; 85 | // uint256 amount; 86 | // } 87 | 88 | Future getOrderDeep() async { 89 | print('start getOrderDeep'); 90 | print(widget.arguments); 91 | String leftToken = widget.arguments['leftToken']['address']; 92 | String rightToken = widget.arguments['rightToken']['address']; 93 | print(leftToken); 94 | print(rightToken); 95 | try { 96 | List arr = await Trade.getOrderDepth(leftToken, rightToken); 97 | print(arr); 98 | return arr; 99 | } catch (e) { 100 | this.showSnackBar(e.toString()); 101 | return []; 102 | } 103 | } 104 | 105 | void showSnackBar(String text) { 106 | final snackBar = new SnackBar(content: new Text(text)); 107 | Scaffold.of(context).showSnackBar(snackBar); 108 | } 109 | 110 | Widget buildItem(Map item, context) { 111 | return new Container( 112 | color: Colors.black12, //16进制颜色 113 | padding: const EdgeInsets.all(10.0), 114 | margin: const EdgeInsets.only(top: 10.0), 115 | child: new Row( 116 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 117 | children: [ 118 | new Text( 119 | item['price'], 120 | style: TextStyle(color: item['is_sell'] ? Colors.deepOrange : Colors.green) 121 | ), 122 | // new Icon( 123 | // Icons.close, 124 | // size: 20.0, 125 | // color: item['is_sell'] ? Colors.deepOrange : Colors.green 126 | // ), 127 | new Text(item['amount']), 128 | ], 129 | ), 130 | ); 131 | } 132 | 133 | 134 | } 135 | -------------------------------------------------------------------------------- /you_wallet/lib/pages/routers.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:youwallet/pages/splash/splash.dart'; // 启动页面 3 | import 'package:youwallet/debug_page.dart'; // 全局调试 4 | import 'package:youwallet/pages/login/login.dart'; // 解锁登录 5 | import 'package:youwallet/pages/wallet/new_wallet_guide.dart'; // 钱包引导页 6 | 7 | // 钱包操作 8 | import 'package:youwallet/pages/wallet/new_wallet_first.dart'; 9 | import 'package:youwallet/pages/wallet/new_wallet_second.dart'; 10 | import 'package:youwallet/pages/wallet/new_wallet_load.dart'; 11 | import 'package:youwallet/pages/wallet/new_wallet_check.dart'; 12 | import 'package:youwallet/pages/wallet/new_wallet_mnemonic.dart'; 13 | import 'package:youwallet/pages/wallet/new_wallet_success.dart'; 14 | import 'package:youwallet/pages/manage_wallet/manage_list.dart'; // 新建钱包名字 15 | import 'package:youwallet/pages/manage_wallet/set_wallet.dart'; // 新建钱包名字 16 | import 'package:youwallet/pages/wallet/wallet_export.dart'; // 导出钱包 17 | 18 | // token 19 | import 'package:youwallet/pages/token/token_history.dart'; // token交易历史 20 | import 'package:youwallet/pages/token/token_add.dart'; // 添加一种token 21 | import 'package:youwallet/pages/token/token_info.dart'; // 添加一种token 22 | 23 | // 设置 24 | import 'package:youwallet/pages/set/set_network.dart'; // 网络设置 25 | import 'package:youwallet/pages/tabs.dart'; 26 | import 'package:youwallet/pages/keyboard/keyboard_main.dart'; 27 | 28 | // 表单 29 | import 'package:youwallet/pages/form/password.dart'; 30 | import 'package:youwallet/pages/form/getPassword.dart'; 31 | 32 | // 订单 33 | import 'package:youwallet/pages/order/order_detail.dart'; 34 | import 'package:youwallet/pages/order/order_deep.dart'; 35 | 36 | // 扫码 37 | import 'package:youwallet/pages/scan/scan.dart'; 38 | 39 | // 操作反馈 40 | import 'package:youwallet/pages/success/index.dart'; 41 | 42 | // 定义全局的路由对象 43 | final routes = { 44 | '/': (context) => new TabsPage(), 45 | "debug_page": (context) => new DebugPage(), 46 | "wallet_guide": (context) => new WalletGuide(), 47 | "set_wallet_name": (context) => new NewWalletName(), 48 | "manage_wallet": (context) => new ManageWallet(), 49 | "set_wallet": (context) => new SetWallet(), 50 | "add_token": (context,{arguments}) => new AddToken(arguments: arguments), 51 | "token_history":(context) => new TokenHistory(), 52 | "token_info":(context, {arguments}) => new TokenInfo(arguments: arguments), 53 | "login": (context) => new Login(), 54 | "backup_wallet": (context, {arguments}) => new BackupWallet(arguments: arguments), 55 | "load_wallet": (context,{arguments}) => new LoadWallet(arguments: arguments), 56 | "wallet_mnemonic": (context,{arguments}) => new WalletMnemonic(arguments: arguments), 57 | "wallet_check": (context) => new WalletCheck(), 58 | "wallet_success": (context) => new WalletSuccess(), 59 | "set_network": (context) => new NetworkPage(), 60 | "wallet_export": (context,{arguments}) => new WalletExport(arguments: arguments), 61 | "keyboard_main": (context) => new main_keyboard(), 62 | "password": (context) => new PasswordPage(), 63 | "getPassword": (context, {arguments}) => new GetPasswordPage(arguments: arguments), 64 | "splash": (context) => new Splash(), 65 | "order_detail": (context, {arguments}) => new OrderDetail(arguments: arguments), 66 | "order_deep": (context, {arguments}) => new OrderDeep(arguments: arguments), 67 | "scan": (context, {arguments}) => new Scan(arguments: arguments), 68 | "success": (context, {arguments}) => new Success(arguments: arguments), 69 | // "tabs": (context) => new ContainerPage() 70 | }; 71 | 72 | var onGenerateRoute = (RouteSettings settings) { // 统一处理 73 | final String name = settings.name; 74 | final Function pageContentBuilder = routes[name]; 75 | if (pageContentBuilder != null) { 76 | if (settings.arguments != null) { 77 | final Route route = MaterialPageRoute( 78 | builder: (context) => pageContentBuilder(context, arguments: settings.arguments) 79 | ); 80 | return route; 81 | }else{ 82 | final Route route = MaterialPageRoute( 83 | builder: (context) => pageContentBuilder(context)); 84 | return route; 85 | } 86 | } 87 | }; 88 | 89 | -------------------------------------------------------------------------------- /you_wallet/lib/pages/scan/scan.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:flutter/material.dart'; 3 | import 'package:youwallet/widgets/customButton.dart'; 4 | import 'package:flutter/services.dart'; 5 | 6 | class Scan extends StatefulWidget { 7 | 8 | final arguments; 9 | Scan({Key key,this.arguments}) : super(key: key); 10 | 11 | @override 12 | Page createState() => Page(); 13 | } 14 | 15 | class Page extends State { 16 | 17 | final globalKey = GlobalKey(); 18 | void showSnackbar(String text) { 19 | final snackBar = SnackBar(content: Text(text)); 20 | globalKey.currentState.showSnackBar(snackBar); 21 | } 22 | 23 | @override 24 | Widget build(BuildContext context) { 25 | return Scaffold( 26 | key: globalKey, 27 | appBar: AppBar( 28 | elevation: 3, 29 | title: Text("操作结果"), 30 | ), 31 | body: Center( 32 | child: Column( 33 | mainAxisAlignment: MainAxisAlignment.center, 34 | crossAxisAlignment: CrossAxisAlignment.center, 35 | children: [ 36 | new Container( 37 | color: Colors.black12, 38 | padding: const EdgeInsets.all(12.0), 39 | margin: const EdgeInsets.only(bottom: 20.0), 40 | width: MediaQuery.of(context).size.width * 0.8, 41 | height: 150.0, 42 | child: new Text( 43 | widget.arguments['res']??'', 44 | style: new TextStyle( 45 | fontSize: 24.0, 46 | color: Colors.lightBlue 47 | ) 48 | ), 49 | ), 50 | showButton() 51 | // new CustomButton( 52 | // content: '添加token', 53 | // onSuccessChooseEvent:(res){ 54 | // Navigator.pushNamed(context, "set_wallet_name"); 55 | // } 56 | // ), 57 | // new CustomButton( 58 | // content: '转账', 59 | // onSuccessChooseEvent:(res){ 60 | // Navigator.pushNamed(context, "load_wallet"); 61 | // } 62 | // ) 63 | ], 64 | ), 65 | ) 66 | ); 67 | } 68 | 69 | // 通过arguments中的参数来判是否显示复制按钮 70 | Widget showButton() { 71 | if (widget.arguments['allowCopy']) { 72 | return CustomButton( 73 | content: '复制', 74 | onSuccessChooseEvent: (res) { 75 | ClipboardData data = new ClipboardData( 76 | text: widget.arguments['res'] ?? ''); 77 | Clipboard.setData(data); 78 | this.showSnackbar('复制成功'); 79 | } 80 | ); 81 | }else { 82 | return CustomButton( 83 | content: '确定', 84 | onSuccessChooseEvent: (res) { 85 | Navigator.of(context).pop(); 86 | } 87 | ); 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /you_wallet/lib/pages/set/set_network.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:flutter/material.dart'; // 官方组件库 3 | import 'package:flutter/cupertino.dart'; 4 | import 'package:provider/provider.dart'; 5 | import 'package:youwallet/model/network.dart'; 6 | import 'package:youwallet/model/token.dart'; 7 | 8 | 9 | class NetworkPage extends StatefulWidget { 10 | NetworkPage() : super(); 11 | @override 12 | _NetworkPageState createState() => _NetworkPageState(); 13 | } 14 | 15 | class _NetworkPageState extends State { 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | return Scaffold( 20 | appBar: AppBar( 21 | title: Text("网络配置"), 22 | ), 23 | body: Center( 24 | child: Consumer( 25 | builder: (context, network, child) { 26 | return Column( 27 | mainAxisAlignment: MainAxisAlignment.center, 28 | children: [ 29 | RadioListTile( 30 | value: 'mainnet', 31 | title: Text('Mainnet'), 32 | groupValue: network.network, 33 | onChanged: (value) { 34 | setNetWork(value); 35 | }, 36 | ), 37 | RadioListTile( 38 | value: 'ropsten', 39 | title: Text('Ropsten'), 40 | groupValue: network.network, 41 | onChanged: (value) { 42 | setNetWork(value); 43 | }, 44 | ), 45 | ], 46 | ); 47 | }, 48 | ), 49 | ) 50 | ); 51 | } 52 | 53 | void setNetWork(name) async{ 54 | await Provider.of(context).changeNetwork(name); 55 | await Provider.of(context).refreshTokenList(); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /you_wallet/lib/pages/splash/splash.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'dart:async'; 3 | import 'package:youwallet/model/wallet.dart'; 4 | import 'package:provider/provider.dart'; 5 | import 'package:flutter_bugly/flutter_bugly.dart'; 6 | 7 | class Splash extends StatefulWidget { 8 | @override 9 | _SplashState createState() => _SplashState(); 10 | } 11 | 12 | class _SplashState extends State{ 13 | // String _platformVersion = 'Unknown'; 14 | 15 | @override 16 | void initState() { 17 | // TODO: implement initState 18 | super.initState(); 19 | countDown(); 20 | FlutterBugly.init( 21 | androidAppId: "0dad6da2da", 22 | iOSAppId: "a5e595c93b", 23 | ).then((_result) { 24 | setState(() { 25 | // _platformVersion = _result.message; 26 | print(_result.appId); 27 | }); 28 | }); 29 | } 30 | 31 | @override 32 | Widget build(BuildContext context) { 33 | return new Scaffold( 34 | body: new Column( 35 | mainAxisAlignment: MainAxisAlignment.center, 36 | children: [ 37 | new Center( 38 | child: new Image.asset( 39 | "images/logo.png", 40 | width: 120.0, 41 | height: 120.0, 42 | fit: BoxFit.fill, 43 | ), 44 | ), 45 | Text( 46 | 'youWallet', 47 | style: TextStyle( 48 | fontSize: 28.0, 49 | height: 2.0, 50 | ) 51 | ) 52 | // new Container( 53 | // alignment: Alignment.topRight, 54 | // padding: const EdgeInsets.fromLTRB(0.0, 45.0, 10.0, 0.0), 55 | // child: OutlineButton( 56 | // child: new Text( 57 | // "跳过", 58 | // textAlign: TextAlign.center, 59 | // style: new TextStyle(color: Colors.white), 60 | // ), 61 | // // StadiumBorder椭圆的形状 62 | // shape: new StadiumBorder(), 63 | // onPressed: () { 64 | // go2HomePage(); 65 | // }, 66 | // ), 67 | // ), 68 | ], 69 | ), 70 | ); 71 | } 72 | 73 | 74 | 75 | // 倒计时 76 | void countDown() { 77 | var _duration = new Duration(seconds: 5); 78 | new Future.delayed(_duration, go2HomePage); 79 | } 80 | 81 | // 前往首页 82 | // 如果用户在本地还没有钱包,则跳转钱包新建页面 83 | void go2HomePage() { 84 | List wallets = Provider.of(context).items; 85 | if (wallets.length == 0) { 86 | Navigator.pushReplacementNamed(context, 'wallet_guide'); 87 | } else { 88 | Navigator.pushReplacementNamed(context, '/'); 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /you_wallet/lib/pages/success/index.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:flutter/material.dart'; 3 | import 'package:youwallet/widgets/customButton.dart'; 4 | 5 | class Success extends StatefulWidget { 6 | final arguments; 7 | Success({Key key,this.arguments}) : super(key: key); 8 | 9 | @override 10 | _SuccessState createState() => _SuccessState(); 11 | } 12 | 13 | class _SuccessState extends State { 14 | 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return Scaffold( 19 | // appBar: AppBar( 20 | // title: Text(""), 21 | // ), 22 | body: Center( 23 | child: Column( 24 | mainAxisAlignment: MainAxisAlignment.center, 25 | crossAxisAlignment: CrossAxisAlignment.center, 26 | children: [ 27 | new Container( 28 | margin: const EdgeInsets.only(top: 50.0, bottom: 60.0), 29 | child: Icon(IconData(0xe617, fontFamily: 'iconfont'),size: 150.0, color: Colors.lightBlue), 30 | ), 31 | new CustomButton( 32 | content: widget.arguments['msg'], 33 | onSuccessChooseEvent:(res){ 34 | Navigator.pop(context); 35 | // Navigator.popAndPushNamed(context, '/'); 36 | //Navigator.of(context).pushNamedAndRemoveUntil('/', ModalRoute.withName('wallet_success')); 37 | // Navigator.popUntil(context, ModalRoute.withName('/')); 38 | } 39 | ) 40 | ], 41 | ), 42 | ) 43 | ); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /you_wallet/lib/pages/tabs.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:youwallet/pages/tabs/tab_wallet.dart'; // 钱包引导页TabExchange 3 | import 'package:youwallet/pages/tabs/tab_exchange.dart'; // 钱包引导页 4 | import 'package:youwallet/pages/tabs/tab_receive.dart'; // 钱包引导页 5 | import 'package:youwallet/pages/tabs/tab_transfer.dart'; // 钱包引导页 6 | import 'package:youwallet/db/sql_util.dart'; 7 | import 'package:youwallet/bus.dart'; 8 | 9 | class _Item { 10 | String name, activeIcon, normalIcon; 11 | _Item(this.name, this.activeIcon, this.normalIcon); 12 | } 13 | 14 | 15 | ///这个页面是作为四个tab页的容器,以Tab为基础控制每个item的显示与隐藏 16 | class TabsPage extends StatefulWidget { 17 | 18 | // 实例化 19 | TabsPage({Key key}) : super(key: key); 20 | 21 | @override 22 | State createState() { 23 | return _ContainerPageState(); 24 | } 25 | } 26 | 27 | 28 | class _ContainerPageState extends State { 29 | 30 | List pages; // 存放tab页面的数组 31 | 32 | int myIndex; 33 | 34 | int _selectIndex = 0; // 当前tab的索引 35 | 36 | final defaultItemColor = Color.fromARGB(255, 125, 125, 125); 37 | 38 | final itemNames = [ 39 | _Item('首页', 'images/tab_wallet_active.png','images/tab_wallet.png'), 40 | _Item('Token兑换', 'images/tab_exchange_active.png','images/tab_exchange.png'), 41 | _Item('收款', 'images/tab_receive_active.png','images/tab_receive.png'), 42 | _Item('转账', 'images/tab_transfer_active.png','images/tab_transfer.png'), 43 | ]; 44 | 45 | List itemList; 46 | Future _future; 47 | 48 | List wallets = []; 49 | 50 | // 构造函数 51 | // _ContainerPageState({Key key, @required this.myIndex,}) : super(key: key); 52 | 53 | @override 54 | void initState() { 55 | super.initState(); 56 | _future = getWallet(); 57 | // 将四个tab页面初始化为一个数组pages 58 | if(pages == null){ 59 | pages = [ 60 | new TabWallet(), 61 | new TabExchange(), 62 | new TabReceive(), 63 | new TabTransfer() 64 | ]; 65 | } 66 | if(itemList == null){ 67 | this.itemList = itemNames.map((item) => 68 | BottomNavigationBarItem( 69 | icon: Image.asset( 70 | item.normalIcon, 71 | width: 30.0, 72 | height: 30.0, 73 | ), 74 | title: Text( 75 | item.name, 76 | style: TextStyle(fontSize: 12.0), 77 | ), 78 | activeIcon: Image.asset(item.activeIcon, width: 26.0, height: 26.0)) 79 | ).toList(); 80 | } 81 | 82 | eventBus.on().listen((event) { 83 | setState(() { 84 | _selectIndex = event.index; 85 | }); 86 | }); 87 | 88 | } 89 | 90 | // todo: 删除这个函数,从全局状态容器中调用它的逻辑 91 | Future getWallet() async { 92 | var sql = SqlUtil.setTable("wallet"); 93 | List res = await sql.get(); 94 | this.wallets = res; 95 | } 96 | 97 | 98 | //Stack(层叠布局)+ Offstage组合,解决状态被重置的问题 99 | Widget _getPagesWidget(int index) { 100 | // print(index); 101 | return Offstage( 102 | offstage: _selectIndex != index, 103 | child: TickerMode( 104 | enabled: _selectIndex == index, 105 | child: pages[index], 106 | ), 107 | ); 108 | } 109 | 110 | 111 | @override 112 | void didUpdateWidget(TabsPage oldWidget) { 113 | super.didUpdateWidget(oldWidget); 114 | } 115 | 116 | @override 117 | Widget build(BuildContext context) { 118 | // List wallets = Provider.of(context).items; 119 | // if (wallets.length == 0) { 120 | // Navigator.pushNamed(context, "wallet_guide"); 121 | // } 122 | return Scaffold( 123 | body: new Stack( 124 | children: [ 125 | _getPagesWidget(0), 126 | _getPagesWidget(1), 127 | _getPagesWidget(2), 128 | _getPagesWidget(3), 129 | ], 130 | ), 131 | backgroundColor: Colors.white, 132 | bottomNavigationBar: BottomNavigationBar( 133 | items: itemList, 134 | onTap: (int index) { 135 | print('当前tab索引=> ${index}'); 136 | eventBus.fire(TabChangeEvent(index)); 137 | setState(() { 138 | _selectIndex = index; 139 | }); 140 | }, 141 | iconSize: 26, //图标大小 142 | currentIndex: _selectIndex, 143 | selectedItemColor: Colors.lightBlue, 144 | unselectedItemColor: Colors.black54, 145 | //选中后,底部BottomNavigationBar内容的颜色(选中时,默认为主题色)(仅当type: BottomNavigationBarType.fixed,时生效) 146 | // fixedColor: Colors.lightBlue, 147 | type: BottomNavigationBarType.fixed, 148 | ), 149 | ); 150 | } 151 | } -------------------------------------------------------------------------------- /you_wallet/lib/pages/wallet/new_wallet_first.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:flutter/material.dart'; 3 | import 'package:shared_preferences/shared_preferences.dart'; 4 | import 'package:youwallet/service/service_locator.dart'; 5 | import 'package:youwallet/service/local_authentication_service.dart'; 6 | import 'package:youwallet/widgets/customButton.dart'; 7 | 8 | class NewWalletName extends StatefulWidget { 9 | NewWalletName() : super(); 10 | @override 11 | _NewWalletNameState createState() => _NewWalletNameState(); 12 | } 13 | 14 | class _NewWalletNameState extends State { 15 | 16 | final globalKey = GlobalKey(); 17 | final LocalAuthenticationService _localAuth = locator(); 18 | TextEditingController _name = TextEditingController(); 19 | 20 | void showSnackbar(String text) { 21 | final snackBar = SnackBar(content: Text(text)); 22 | globalKey.currentState.showSnackBar(snackBar); 23 | } 24 | 25 | @override // override是重写父类中的函数 26 | void initState() { 27 | super.initState(); 28 | } 29 | 30 | @override 31 | void didChangeDependencies() { 32 | super.didChangeDependencies(); 33 | } 34 | 35 | @override 36 | Widget build(BuildContext context) { 37 | return Scaffold( 38 | key: globalKey, 39 | appBar: AppBar( 40 | title: Text("新建钱包"), 41 | ), 42 | body: new Container( 43 | padding: const EdgeInsets.all(16.0), // 四周填充边距32像素 44 | child: Column( 45 | mainAxisAlignment: MainAxisAlignment.center, 46 | crossAxisAlignment: CrossAxisAlignment.center, 47 | children: [ 48 | new Container( 49 | margin: const EdgeInsets.only(bottom: 30.0), 50 | child: new Image.asset( 51 | 'images/new_wallet.png' 52 | ), 53 | ), 54 | new TextField( 55 | controller: _name, 56 | decoration: InputDecoration( 57 | fillColor: Colors.black12, 58 | filled: true, 59 | hintText: "输入钱包名称", 60 | border: OutlineInputBorder( 61 | borderRadius: BorderRadius.circular(8.0), // 设置圆角 62 | borderSide: BorderSide.none // 设置不要边框 63 | ), 64 | ), 65 | ), 66 | new SizedBox( 67 | height: 50.0, 68 | ), 69 | new CustomButton( 70 | content: '下一步', 71 | onSuccessChooseEvent:(res) async{ 72 | if (_name.text.length == 0) { 73 | this.showSnackbar('钱包名字不能为空'); 74 | } else { 75 | // 这里把名字直接保存在本地缓存中,不通过url传递 76 | SharedPreferences prefs = await SharedPreferences.getInstance(); 77 | prefs.setString("new_wallet_name", _name.text); 78 | Navigator.pushNamed(context, "backup_wallet", arguments: null); 79 | // Navigator.pushNamed(context, "keyboard_main").then((data){ 80 | // print('你设置的交易密码是=》${data.toString()}'); 81 | // prefs.setString("new_wallet_pw", data.toString()); 82 | // Navigator.pushNamed(context, "backup_wallet", arguments: {}); 83 | // }); 84 | } 85 | } 86 | ) 87 | ], 88 | ), 89 | ) 90 | ); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /you_wallet/lib/pages/wallet/new_wallet_guide.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:flutter/material.dart'; 3 | import 'package:youwallet/widgets/customButton.dart'; 4 | 5 | import 'package:provider/provider.dart'; 6 | import 'package:youwallet/model/wallet.dart'; 7 | 8 | class WalletGuide extends StatefulWidget { 9 | WalletGuide() : super(); 10 | @override 11 | _WalletGuideState createState() => _WalletGuideState(); 12 | } 13 | 14 | class _WalletGuideState extends State { 15 | 16 | final globalKey = GlobalKey(); 17 | void showSnackbar(String text) { 18 | final snackBar = SnackBar(content: Text(text)); 19 | globalKey.currentState.showSnackBar(snackBar); 20 | } 21 | 22 | @override 23 | Widget build(BuildContext context) { 24 | return Scaffold( 25 | key: globalKey, 26 | appBar: AppBar( 27 | elevation: Provider.of(context).items.length > 0 ? 3:0, 28 | title: Text(""), 29 | ), 30 | body: Center( 31 | child: Column( 32 | mainAxisAlignment: MainAxisAlignment.center, 33 | crossAxisAlignment: CrossAxisAlignment.center, 34 | children: [ 35 | new Text( 36 | '创建您的第一个数字钱包', 37 | style: new TextStyle( 38 | fontSize: 28.0, 39 | color: Colors.lightBlue 40 | ) 41 | ), 42 | new Container( 43 | margin: const EdgeInsets.only(top: 50.0, bottom: 60.0), 44 | child: new Image.asset( 45 | 'images/new_wallet.png' 46 | ), 47 | ), 48 | new CustomButton( 49 | content: '创建钱包', 50 | onSuccessChooseEvent:(res){ 51 | Navigator.pushNamed(context, "set_wallet_name"); 52 | } 53 | ), 54 | new CustomButton( 55 | content: '导入钱包', 56 | onSuccessChooseEvent:(res){ 57 | Navigator.pushNamed(context, "load_wallet"); 58 | } 59 | ) 60 | ], 61 | ), 62 | ) 63 | ); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /you_wallet/lib/pages/wallet/new_wallet_mnemonic.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:flutter/material.dart'; 3 | import 'package:youwallet/service/token_service.dart'; 4 | import 'package:shared_preferences/shared_preferences.dart'; 5 | import 'package:youwallet/widgets/customButton.dart'; 6 | 7 | class WalletMnemonic extends StatefulWidget { 8 | final arguments; 9 | 10 | WalletMnemonic({Key key ,this.arguments}) : super(key: key); 11 | 12 | @override 13 | Page createState() => Page(arguments: this.arguments); 14 | } 15 | 16 | class Page extends State { 17 | 18 | Map arguments; 19 | Page({this.arguments}); 20 | bool showBtn; 21 | 22 | // List randomMnemonic = []; 23 | // List randomMnemonicAgain = []; 24 | TextEditingController _name = TextEditingController(); 25 | 26 | @override // override是重写父类中的函数 每次初始化的时候执行一次,类似于小程序中的onLoad 27 | void initState() { 28 | super.initState(); 29 | String randomMnemonic = ''; 30 | bool _showBtn = true; 31 | if (this.arguments == null) { 32 | randomMnemonic = TokenService.generateMnemonic(); 33 | } else { 34 | randomMnemonic = this.arguments['mnemonic']; 35 | _showBtn = false; 36 | } 37 | setState(() { 38 | this._name.text = randomMnemonic; 39 | this.showBtn = _showBtn; 40 | }); 41 | } 42 | 43 | 44 | // void setRandomMnemonic() async { 45 | // SharedPreferences prefs = await SharedPreferences.getInstance(); 46 | // String randomMnemonic = prefs.getString("randomMnemonic"); 47 | // setState(() { 48 | //// this.randomMnemonic = randomMnemonic.split(' '); 49 | // this._name.text = randomMnemonic; 50 | // }); 51 | // } 52 | 53 | @override 54 | Widget build(BuildContext context) { 55 | return Scaffold( 56 | appBar: AppBar( 57 | title: Text("助记词"), 58 | ), 59 | body: new Container( 60 | padding: const EdgeInsets.all(16.0), // 四周填充边距32像素 61 | child: Column( 62 | mainAxisAlignment: MainAxisAlignment.center, 63 | crossAxisAlignment: CrossAxisAlignment.center, 64 | children: [ 65 | new Container( 66 | margin: const EdgeInsets.only(bottom: 30.0), 67 | child: new Image.asset( 68 | 'images/new_wallet.png' 69 | ), 70 | ), 71 | new TextField( 72 | controller: this._name, 73 | maxLines: 3, 74 | enabled: false, 75 | decoration: InputDecoration( 76 | filled: true, 77 | fillColor: Colors.black12, 78 | contentPadding: new EdgeInsets.all(6.0), // 内部边距,默认不是0 79 | border:InputBorder.none, // 没有任何边线 80 | enabledBorder: OutlineInputBorder( 81 | borderRadius: BorderRadius.circular(6.0), 82 | borderSide: BorderSide( 83 | width: 0, //边线宽度为2 84 | ), 85 | ) 86 | ), 87 | ), 88 | new SizedBox( 89 | height: 50.0, 90 | ), 91 | new CustomButton( 92 | content: '我已备份,下一步', 93 | onSuccessChooseEvent:(res) async { 94 | SharedPreferences prefs = await SharedPreferences.getInstance(); 95 | prefs.setString("randomMnemonic", this._name.text ); 96 | Navigator.of(context).pushReplacementNamed("wallet_check"); 97 | } 98 | ), 99 | 100 | ], 101 | ), 102 | ) 103 | ); 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /you_wallet/lib/pages/wallet/new_wallet_success.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:flutter/material.dart'; 3 | import 'package:youwallet/widgets/customButton.dart'; 4 | 5 | class WalletSuccess extends StatefulWidget { 6 | WalletSuccess() : super(); 7 | @override 8 | _WalletGuideState createState() => _WalletGuideState(); 9 | } 10 | 11 | class _WalletGuideState extends State { 12 | 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return Scaffold( 17 | // appBar: AppBar( 18 | // title: Text(""), 19 | // ), 20 | body: Center( 21 | child: Column( 22 | mainAxisAlignment: MainAxisAlignment.center, 23 | crossAxisAlignment: CrossAxisAlignment.center, 24 | children: [ 25 | // new Text( 26 | // '创建成功', 27 | // style: new TextStyle( 28 | // fontSize: 28.0, 29 | // color: Colors.lightBlue 30 | // ) 31 | // ), 32 | new Container( 33 | margin: const EdgeInsets.only(top: 50.0, bottom: 60.0), 34 | child: Icon(IconData(0xe617, fontFamily: 'iconfont'),size: 150.0, color: Colors.lightBlue), 35 | ), 36 | new CustomButton( 37 | content: '查看钱包', 38 | onSuccessChooseEvent:(res){ 39 | Navigator.popAndPushNamed(context, '/'); 40 | //Navigator.of(context).pushNamedAndRemoveUntil('/', ModalRoute.withName('wallet_success')); 41 | // Navigator.popUntil(context, ModalRoute.withName('/')); 42 | } 43 | ) 44 | ], 45 | ), 46 | ) 47 | ); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /you_wallet/lib/service/app_server.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:bip39/bip39.dart' as bip39; 4 | import 'package:web3dart/credentials.dart'; 5 | import 'package:shared_preferences/shared_preferences.dart'; 6 | import 'package:http/http.dart'; 7 | import 'dart:convert'; 8 | import 'package:web3dart/web3dart.dart'; 9 | import 'package:bip32/bip32.dart' as bip32; 10 | import 'package:web3dart/crypto.dart'; 11 | 12 | import 'package:provider/provider.dart'; 13 | import 'package:youwallet/model/wallet.dart' as walletModel; 14 | import 'package:youwallet/global.dart'; 15 | import 'package:youwallet/util/http_server.dart'; 16 | import "package:hex/hex.dart"; 17 | import 'package:dio/dio.dart'; 18 | import 'package:html/parser.dart' show parse; 19 | import 'package:html/dom.dart'; 20 | import 'dart:convert' show json; 21 | 22 | //abstract class TokenService { 23 | // String generateMnemonic(); 24 | // String maskAddress(String address); 25 | // String getPrivateKey(String mnemonic); 26 | // Future getPublicAddress(String privateKey); 27 | // Future setupFromMnemonic(String mnemonic); 28 | // Future setupFromPrivateKey(String privateKey); 29 | // String entropyToMnemonic(String entropyMnemonic); 30 | //} 31 | 32 | class APPService { 33 | // IConfigurationService _configService; 34 | // AddressService(this._configService); 35 | String customeAgent = ""; 36 | 37 | /// 获取指定钱包的余额,这里获取的是ETH的余额 38 | static Future getBalance(String address) async { 39 | String rpcUrl = Global.getBaseUrl(); 40 | final client = Web3Client(rpcUrl, Client()); 41 | EtherAmount balance = 42 | await client.getBalance(EthereumAddress.fromHex(address)); 43 | double b = balance.getValueInUnit(EtherUnit.ether); 44 | return b.toStringAsFixed(4); 45 | } 46 | 47 | /* 获取APP最新版本信息 - R 48 | * 从github的release上读取 49 | * */ 50 | static Future getVersion() async { 51 | String url = 'https://github.com/youwallet/wallet/tags'; 52 | var response = await new Dio().get(url); 53 | var document = parse(response.data); 54 | // var app = document.querySelector(".commit-title").querySelectorAll("a"); 55 | List app = document.querySelectorAll('.commit-title > a'); 56 | // print('app====>${app}'); 57 | var data = List.generate(app.length, (i) { 58 | // return app[i].attributes['href']; 59 | return app[i].innerHtml; 60 | }); 61 | return data[0].trim(); 62 | } 63 | 64 | /* 获取第三方gas信息 - R 65 | * 66 | * 返回值: 67 | * 68 | */ 69 | static Future getGasList() async { 70 | String url = 'https://www.gasnow.org/api/v3/gas/price?utm_source=youwallet'; 71 | var response = await new Dio().get(url); 72 | print(response); 73 | var jsonList = json.decode(response.toString()); 74 | return [ 75 | {'name': '极速', 'checked': false, 'value': jsonList['data']['rapid']}, 76 | {'name': '快速', 'checked': true, 'value': jsonList['data']['fast']}, 77 | {'name': '标准', 'checked': false, 'value': jsonList['data']['standard']}, 78 | {'name': '慢速', 'checked': false, 'value': jsonList['data']['slow']} 79 | ]; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /you_wallet/lib/service/local_authentication_service.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io' show Platform; 2 | import 'package:local_auth/local_auth.dart'; 3 | import 'package:flutter/services.dart'; 4 | 5 | /** 6 | * 7 | * link: https://www.jianshu.com/p/06ba43743b1f 8 | * _auth变量只是实例化LocalAuthentication库,这里没什么特别的。 9 | * bool _isProtectionEnabled跟踪相应的设置,在真实的应用程序中,它应该存储在共享首选项中,尽管它超出了本文的范围。 10 | * isAuthenticated变量将跟踪身份验证 11 | * 最后,authenticate方法使用OS相关对话框启动身份验证流程。 12 | * stickyAuth属性设置为true,因此如果应用程序被系统置于后台,则插件不会返回失败。例如,如果用户在有机会进行身份验证之前收到了呼叫。将stickyAuth属性设置为false,插件将返回我们的dart代码失败。 13 | **/ 14 | 15 | class LocalAuthenticationService { 16 | final _auth = LocalAuthentication(); 17 | bool _isProtectionEnabled = false; 18 | 19 | bool get isProtectionEnabled => _isProtectionEnabled; 20 | 21 | set isProtectionEnabled(bool enabled) => _isProtectionEnabled = enabled; 22 | 23 | bool isAuthenticated = false; 24 | 25 | Future authenticate() async { 26 | if (_isProtectionEnabled) { 27 | try { 28 | List availableBiometrics = 29 | await _auth.getAvailableBiometrics(); 30 | 31 | if (Platform.isIOS) { 32 | if (availableBiometrics.contains(BiometricType.face)) { 33 | // Face ID. 34 | } else if (availableBiometrics.contains(BiometricType.fingerprint)) { 35 | print("there is touch id"); 36 | // Touch ID. 37 | } 38 | } 39 | isAuthenticated = await _auth.authenticateWithBiometrics( 40 | localizedReason: 'authenticate to access', 41 | useErrorDialogs: true, 42 | stickyAuth: true, 43 | ); 44 | print(isAuthenticated); 45 | } on PlatformException catch (e) { 46 | print(e); 47 | } 48 | } else { 49 | return false; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /you_wallet/lib/service/service_locator.dart: -------------------------------------------------------------------------------- 1 | import 'package:youwallet/service/local_authentication_service.dart'; 2 | import 'package:get_it/get_it.dart'; 3 | 4 | GetIt locator = GetIt.instance; 5 | 6 | void setupLocator() { 7 | locator.registerLazySingleton(() => LocalAuthenticationService()); 8 | } -------------------------------------------------------------------------------- /you_wallet/lib/util/eth_amount_formatter.dart: -------------------------------------------------------------------------------- 1 | import 'package:web3dart/web3dart.dart'; 2 | 3 | class EthAmountFormatter { 4 | EthAmountFormatter(this.amount); 5 | 6 | final BigInt amount; 7 | String format({ 8 | fromUnit = EtherUnit.wei, 9 | toUnit = EtherUnit.ether, 10 | }) { 11 | if (amount == null) return "-"; 12 | 13 | return EtherAmount.fromUnitAndValue(fromUnit, amount) 14 | .getValueInUnit(toUnit) 15 | .toString(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /you_wallet/lib/util/http_server.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:dio/dio.dart'; 4 | import 'package:youwallet/global.dart'; 5 | import 'package:web3dart/web3dart.dart'; 6 | import 'package:http/http.dart' as httpLib; 7 | import 'package:web3dart/crypto.dart'; 8 | 9 | class Http { 10 | static Http instance; 11 | static String token; 12 | static Dio _dio; 13 | BaseOptions _options; 14 | 15 | // 获取实例,如果实例存在就不用新建 16 | static Http getInstance() { 17 | if (instance == null) { 18 | instance = new Http(); 19 | } 20 | return instance; 21 | } 22 | 23 | // http类的构造函数 24 | // 初始化 Options 25 | Http() { 26 | _options = new BaseOptions( 27 | baseUrl: Global.getBaseUrl(), 28 | // connectTimeout: _config.connectTimeout, 29 | // receiveTimeout: _config.receiveTimeout, 30 | headers: {'Content-Type': 'application/json', 'User-Agent': 'youwallet'}, 31 | ); 32 | 33 | _dio = new Dio(_options); 34 | 35 | // 请求拦截器 36 | _dio.interceptors 37 | .add(InterceptorsWrapper(onRequest: (RequestOptions options) async { 38 | // Do something before request is sent 39 | return options; //continue 40 | // If you want to resolve the request with some custom data, 41 | // you can return a `Response` object or return `dio.resolve(data)`. 42 | // If you want to reject the request with a error message, 43 | // you can return a `DioError` object or return `dio.reject(errMsg)` 44 | }, onResponse: (Response response) async { 45 | // Do something with response data 46 | return response; // continue 47 | }, onError: (DioError e) async { 48 | // Do something with response error 49 | return e; //continue 50 | })); 51 | } 52 | 53 | // get 请求封装 54 | get(url, {options, cancelToken}) async { 55 | print('get:::url:$url '); 56 | Response response; 57 | try { 58 | response = await _dio.get(url, cancelToken: cancelToken); 59 | } on DioError catch (e) { 60 | if (CancelToken.isCancel(e)) { 61 | print('get请求取消! ' + e.message); 62 | } else { 63 | print('get请求发生错误:$e'); 64 | } 65 | } 66 | return response.data; 67 | } 68 | 69 | // post请求封装 70 | // url还必须有一个默认值 71 | // 这个跟以太坊进行交互,所有请求的url都是固定的 72 | // 但是也不能保证后期不会有其他的url进来 73 | /* 74 | * 参数说明 75 | * url _options中已经配置了baseUrl,它就是一个完整的URL,和以太坊的所有交互都是同一个url 76 | * params 接口调用时拼接的数据 77 | * to 合约地址,默认是tempMatchAddress合约,大部分情况下都可以不传 78 | * method 以太坊的调用函数,默认是eth_call,读操作,不需要gas 79 | */ 80 | post( 81 | {url = "", 82 | options, 83 | cancelToken, 84 | params = null, 85 | to = Global.tempMatchAddress, 86 | method = 'eth_call'}) async { 87 | Response response; 88 | Map data = { 89 | 'jsonrpc': '2.0', 90 | 'method': method, 91 | 'id': DateTime.now().millisecondsSinceEpoch, 92 | 'params': [] 93 | }; 94 | // 调用eth_call,params里面需要加上合约地址,就是参数to 95 | if (method == 'eth_call') { 96 | params['to'] = to; 97 | data['params'] = [params, 'latest']; 98 | } else { 99 | data['params'] = params; 100 | } 101 | try { 102 | response = await _dio.post(url, data: data, cancelToken: cancelToken); 103 | } on DioError catch (e) { 104 | if (CancelToken.isCancel(e)) { 105 | print('get请求取消! ' + e.message); 106 | } else { 107 | print('post请求发生错误:$e'); 108 | } 109 | } 110 | return response.data; 111 | } 112 | 113 | /* 114 | * 发起交易(转账,取消交易,兑换)所有需要写链的操作都可以调用这个接口 115 | * 参数说明 116 | * address token地址 117 | * obj 118 | * postData 119 | */ 120 | transaction(String address, Map obj, String postData) async { 121 | print('start http server transaction'); 122 | String rpcUrl = Global.getBaseUrl(); 123 | final client = Web3Client(rpcUrl, httpLib.Client()); 124 | final credentials = 125 | await client.credentialsFromPrivateKey(obj['privateKey']); 126 | 127 | var rsp = await client.sendTransaction( 128 | credentials, 129 | Transaction( 130 | to: EthereumAddress.fromHex(address), 131 | gasPrice: obj['gasPrice'], 132 | maxGas: obj['gasLimit'], 133 | value: EtherAmount.fromUnitAndValue(EtherUnit.ether, 0), 134 | data: hexToBytes(postData)), 135 | chainId: 136 | 3 // 没有这个参数会报RPCError: got code -32000 with msg "invalid sender". 137 | ); 138 | print("transaction => $rsp"); 139 | return rsp; 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /you_wallet/lib/util/locale_util.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | typedef void LocaleChangeCallback(Locale locale); 4 | 5 | // 工具类,用来处理app国际化的资源翻译问题 6 | class LocaleUtil { 7 | 8 | // Support languages list 9 | final List supportedLanguages = ['en','zh', 'ja']; 10 | 11 | // Support Locales list 12 | Iterable supportedLocales() => supportedLanguages.map((lang) => new Locale(lang, '')); 13 | 14 | // Callback for manual locale changed 15 | LocaleChangeCallback onLocaleChanged; 16 | 17 | Locale locale; 18 | String languageCode; 19 | 20 | static final LocaleUtil _localeUtil = new LocaleUtil._internal(); 21 | 22 | factory LocaleUtil() { 23 | return _localeUtil; 24 | } 25 | 26 | LocaleUtil._internal(); 27 | 28 | /// 获取当前系统语言 29 | String getLanguageCode() { 30 | if(languageCode == null) { 31 | return "en"; 32 | } 33 | return languageCode; 34 | } 35 | } 36 | 37 | LocaleUtil localeUtil = new LocaleUtil(); -------------------------------------------------------------------------------- /you_wallet/lib/util/md5_encrypt.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'package:convert/convert.dart'; 3 | import 'package:crypto/crypto.dart'; 4 | 5 | class Md5Encrypt { 6 | 7 | final String pwd; 8 | Md5Encrypt(this.pwd); 9 | 10 | String init() { 11 | var content = new Utf8Encoder().convert(pwd); 12 | var digest = md5.convert(content); 13 | return hex.encode(digest.bytes); 14 | } 15 | } -------------------------------------------------------------------------------- /you_wallet/lib/util/number_format.dart: -------------------------------------------------------------------------------- 1 | import 'package:web3dart/web3dart.dart'; 2 | 3 | class NumberFormat { 4 | NumberFormat(this.amount); 5 | 6 | var amount; 7 | String format() { 8 | String str = amount.toString(); 9 | // print(str); 10 | List arr = str.split('.'); 11 | // print(arr); 12 | if (arr.length == 2) { 13 | String dem = this.delZero(arr[1]); 14 | // print('接收到dem => ${dem}'); 15 | if (dem == null) { 16 | // print('format return => ${arr[0]}'); 17 | return arr[0]; 18 | } else { 19 | // print('format return => ${arr[0] +'.'+dem}'); 20 | return arr[0] +'.'+dem; 21 | } 22 | } else { 23 | return str; 24 | } 25 | } 26 | 27 | // 去掉右侧的0 28 | String delZero(String str) { 29 | // print(str); 30 | // print(str.length); 31 | if (str.length == 0) { 32 | return ''; 33 | } 34 | if (str.substring(str.length -1) == '0') { 35 | this.delZero(str.substring(0, str.length -1)); 36 | } else { 37 | // print('start return => ${str}'); 38 | return str; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /you_wallet/lib/util/transaction_process.dart: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youwallet/wallet/0a807f15e7b571b5e3d7937106a710c78fbb092a/you_wallet/lib/util/transaction_process.dart -------------------------------------------------------------------------------- /you_wallet/lib/util/translations.dart: -------------------------------------------------------------------------------- 1 | import 'package:youwallet/util/locale_util.dart'; 2 | 3 | import 'dart:async'; 4 | import 'dart:convert'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:flutter/services.dart' show rootBundle; 7 | 8 | /// Class for Translate 9 | /// 10 | /// For example: 11 | /// 12 | /// import 'package:workout/translations.dart'; 13 | /// 14 | /// ```dart 15 | /// For TextField content 16 | /// Translations.of(context).text("home_page_title"); 17 | /// ``` 18 | /// 19 | /// ```dart 20 | /// For speak string 21 | /// Note: Tts will speak english if currentLanguage[# Tts's parameter] can't support 22 | /// 23 | /// Translations.of(context).speakText("home_page_title"); 24 | /// ``` 25 | /// 26 | /// "home_page_title" is the key for text value 27 | /// 28 | /// 29 | /// 系统提供了LocalizationsDelegate类帮助我们监听系统语言的切换, 30 | /// 所以我们可以继承LocalizationsDelegate类监听语言切换, 31 | /// 并在切换时加载不同的json文件,来获取不同的语言文案。 32 | /// 这里我们的translations工具类就是利用这样的原理来加载不同的语言文案: 33 | /// 我们看到有两个继承自LocalizationsDelegate类的代理类, 34 | /// SpecificLocalizationDelegate类是提供一种让我们强制指定一种位置的方式, 35 | /// 通过改变传进来的local来达到从新load新json的方式。 36 | /// 如果你没有这种需求,可以只关心TranslationsDelegate这种默认方式。 37 | class Translations { 38 | Translations(Locale locale) { 39 | this.locale = locale; 40 | _localizedValues = null; 41 | } 42 | 43 | Locale locale; 44 | static Map _localizedValues; 45 | static Map _localizedValuesEn; // English map 46 | 47 | static Translations of(BuildContext context) { 48 | return Localizations.of(context, Translations); 49 | } 50 | 51 | 52 | String text(String key) { 53 | try { 54 | String value = _localizedValues[key]; 55 | if(value == null || value.isEmpty) { 56 | return englishText(key); 57 | } else { 58 | return value; 59 | } 60 | } catch (e) { 61 | return englishText(key); 62 | } 63 | } 64 | 65 | String englishText(String key) { 66 | return _localizedValuesEn[key] ?? '** $key not found'; 67 | } 68 | 69 | static Future load(Locale locale) async { 70 | Translations translations = new Translations(locale); 71 | String jsonContent = await rootBundle.loadString("locale/i18n_${locale.languageCode}.json"); 72 | _localizedValues = json.decode(jsonContent); 73 | String enJsonContent = await rootBundle.loadString("locale/i18n_en.json"); 74 | _localizedValuesEn = json.decode(enJsonContent); 75 | return translations; 76 | } 77 | 78 | get currentLanguage => locale.languageCode; 79 | } 80 | 81 | class TranslationsDelegate extends LocalizationsDelegate { 82 | const TranslationsDelegate(); 83 | 84 | // Support languages 85 | @override 86 | bool isSupported(Locale locale) { 87 | localeUtil.languageCode = locale.languageCode; 88 | return localeUtil.supportedLanguages.contains(locale.languageCode); 89 | } 90 | 91 | @override 92 | Future load(Locale locale) => Translations.load(locale); 93 | 94 | @override 95 | bool shouldReload(TranslationsDelegate old) => true; 96 | } 97 | 98 | // Delegate strong init a Translations instance when language was changed 99 | class SpecificLocalizationDelegate extends LocalizationsDelegate { 100 | final Locale overriddenLocale; 101 | 102 | const SpecificLocalizationDelegate(this.overriddenLocale); 103 | 104 | @override 105 | bool isSupported(Locale locale) => overriddenLocale != null; 106 | 107 | @override 108 | Future load(Locale locale) => Translations.load(overriddenLocale); 109 | 110 | @override 111 | bool shouldReload(LocalizationsDelegate old) => true; 112 | } -------------------------------------------------------------------------------- /you_wallet/lib/util/wallet_crypt.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'package:convert/convert.dart'; 3 | import 'package:crypto/crypto.dart'; 4 | import 'package:flutter_aes_ecb_pkcs5/flutter_aes_ecb_pkcs5.dart'; 5 | // 钱包加密和解密 6 | class WalletCrypt { 7 | 8 | final String pwd; 9 | final String data; 10 | 11 | WalletCrypt(this.pwd, this.data); 12 | 13 | // 给钱包加密 14 | Future encrypt() async{ 15 | var content = new Utf8Encoder().convert(this.pwd); 16 | var digest = md5.convert(content); 17 | final passwordMd5 = hex.encode(digest.bytes); 18 | try{ 19 | String res = await FlutterAesEcbPkcs5.encryptString(this.data, passwordMd5); 20 | return res; 21 | } catch(e){ 22 | return e.toString(); 23 | } 24 | } 25 | 26 | // 给钱包解密 27 | Future decrypt() async{ 28 | var content = new Utf8Encoder().convert(this.pwd); 29 | var digest = md5.convert(content); 30 | final passwordMd5 = hex.encode(digest.bytes); 31 | try{ 32 | String res = await FlutterAesEcbPkcs5.decryptString(this.data, passwordMd5); 33 | return res; 34 | } catch(e) { 35 | return e.toString(); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /you_wallet/lib/widgets/addressFormat.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:youwallet/global.dart'; 3 | 4 | class AddressFormat extends StatelessWidget { 5 | final address; 6 | AddressFormat(this.address, {Key key}) 7 | : super(key: key); 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return Text( 12 | Global.maskAddress(this.address) , 13 | style: TextStyle( 14 | fontSize: 22, 15 | letterSpacing: 0, 16 | color: Colors.white, 17 | fontWeight: FontWeight.w800 18 | ), 19 | ); 20 | } 21 | } -------------------------------------------------------------------------------- /you_wallet/lib/widgets/bottomSheetDialog.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class BottomSheetDialog extends StatelessWidget { 4 | 5 | List content = []; // modal中的内容 6 | Function onSuccessChooseEvent; 7 | 8 | // 构造函数 9 | BottomSheetDialog({ 10 | Key key, 11 | @required this.content, 12 | @required this.onSuccessChooseEvent, 13 | }) : super(key: key); 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return Container( 18 | decoration: new BoxDecoration( 19 | borderRadius: BorderRadius.only( 20 | topLeft: Radius.circular(18), 21 | topRight: Radius.circular(18) 22 | ), 23 | color: Colors.white 24 | ), 25 | padding: const EdgeInsets.only(top: 18.0), // 四周填充边距32像素, 26 | height: 57.0*this.content.length + 18, 27 | child: Column( 28 | children: this.content.map((item) => this.buildItem(item, context)).toList() 29 | ), 30 | ); 31 | } 32 | 33 | Widget buildItem(item, context) { 34 | return Container( 35 | 36 | decoration: new BoxDecoration( 37 | border: Border(bottom: BorderSide(color: Colors.grey,width: 0.5)) 38 | ), 39 | child: ListTile( 40 | title: Text( 41 | item['name'], 42 | textAlign: TextAlign.center, 43 | style: new TextStyle(fontWeight: FontWeight.w700), 44 | ), 45 | onTap: () { 46 | this.onSuccessChooseEvent(item); 47 | Navigator.of(context).pop(); 48 | }, 49 | ) 50 | ); 51 | } 52 | 53 | } -------------------------------------------------------------------------------- /you_wallet/lib/widgets/customButton.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | 4 | 5 | class CustomButton extends StatelessWidget { 6 | 7 | String content = ""; // 按钮上的文本 8 | String type = ""; // 按钮类型 9 | Map customData ; // 用户传过来的自定义数据,点击按钮后需要回传 10 | Function onSuccessChooseEvent; 11 | Map buttonMap = { 12 | 'default': Color(0xff409eff), 13 | 'danger': Color(0xfff56c6c) 14 | }; 15 | 16 | // 构造函数 17 | CustomButton({ 18 | Key key, 19 | this.type = "default", 20 | this.content = "确定", 21 | this.customData = null, 22 | @required this.onSuccessChooseEvent, 23 | }) : super(key: key); 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | return Row( 28 | mainAxisAlignment: MainAxisAlignment.center, 29 | children: [ 30 | FlatButton( 31 | splashColor: Colors.transparent, 32 | highlightColor: Colors.transparent, 33 | shape: StadiumBorder(), 34 | child: Text( 35 | this.content, 36 | style: new TextStyle( 37 | fontSize: 20.0, 38 | fontWeight: FontWeight.w700 39 | )), 40 | padding: EdgeInsets.fromLTRB(60,8,60,8), 41 | //elevation: 0, // 按钮阴影高度 42 | color: this.buttonMap[this.type], 43 | textColor: Colors.white, 44 | onPressed: () { 45 | this.onSuccessChooseEvent(this.customData); 46 | }, 47 | ) 48 | ], 49 | ); 50 | 51 | 52 | } 53 | 54 | } -------------------------------------------------------------------------------- /you_wallet/lib/widgets/customTab.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:youwallet/bus.dart'; 3 | 4 | class CustomTab extends StatefulWidget { 5 | List buttons = []; 6 | String activeIndex; 7 | 8 | CustomTab({ 9 | Key key, 10 | @required this.activeIndex, // 激活第几个tab 11 | @required this.buttons, 12 | }) : super(key: key); 13 | 14 | Page createState() => new Page(); 15 | } 16 | 17 | class Page extends State { 18 | @override 19 | void initState() { 20 | super.initState(); 21 | } 22 | 23 | @override 24 | Widget build(BuildContext context) { 25 | return new Container( 26 | padding: const EdgeInsets.only(bottom: 12.0), // 四周填充边距32像素 27 | child: new Row( 28 | children: widget.buttons 29 | .map((item) => buildItem(item, context)) 30 | .toList())); 31 | } 32 | 33 | Widget buildItem(item, context) { 34 | return new Container( 35 | padding: const EdgeInsets.all(10.0), // 四周填充边距32像素 36 | decoration: new BoxDecoration( 37 | border: Border( 38 | bottom: BorderSide( 39 | color: widget.activeIndex == item 40 | ? Colors.lightBlue 41 | : Colors.transparent, 42 | width: 1.0)), 43 | ), 44 | child: GestureDetector( 45 | onTap: () { 46 | setState(() { 47 | widget.activeIndex = item; 48 | }); 49 | eventBus.fire(CustomTabChangeEvent(item)); 50 | }, //写入方法名称就可以了,但是是无参的 51 | child: new Text(item, 52 | style: TextStyle( 53 | color: widget.activeIndex == item 54 | ? Colors.lightBlue 55 | : Colors.grey)), 56 | ), 57 | ); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /you_wallet/lib/widgets/hotToken.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:youwallet/global.dart'; 3 | 4 | class HotToken extends StatelessWidget { 5 | final onHotTokenCallBack; 6 | HotToken({Key key, this.onHotTokenCallBack}) : super(key: key); 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | return Wrap( 11 | spacing: 10.0, // 主轴(水平)方向间距 12 | runSpacing: 4.0, // 纵轴(垂直)方向间距 13 | children: Global.hotToken.map((item) => buildTagItem(item)).toList()); 14 | } 15 | 16 | // 构建wrap用的小选项 17 | Widget buildTagItem(item) { 18 | if (item['network'] == Global.getPrefs('network')) { 19 | return new Chip( 20 | avatar: Icon(IconData(item['icon'], fontFamily: 'iconfont'), 21 | size: 20.0, color: item['color']), 22 | label: GestureDetector( 23 | child: new Text(item['name']), 24 | onTap: () { 25 | this.onHotTokenCallBack(item); 26 | }, 27 | )); 28 | } else { 29 | return SizedBox(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /you_wallet/lib/widgets/input.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class Input extends StatelessWidget { 4 | // 输入框中的提示字符 5 | String hintText = ""; 6 | String suffixText = ""; 7 | Function onSuccessChooseEvent; 8 | final controllerEdit ; 9 | 10 | // 构造函数 11 | Input({ 12 | Key key, 13 | this.hintText = "", 14 | this.suffixText = "", 15 | @required this.controllerEdit, 16 | @required this.onSuccessChooseEvent, 17 | }) : super(key: key); 18 | 19 | @override 20 | Widget build(BuildContext context) { 21 | return new ConstrainedBox( 22 | constraints: BoxConstraints( 23 | maxWidth: 200, 24 | maxHeight: 40.0 25 | ), 26 | child: new TextField( 27 | controller: this.controllerEdit, 28 | keyboardType: TextInputType.number,//键盘类型,数字键盘 29 | decoration: InputDecoration(// 输入框内部右侧增加一个icon 30 | suffixText: this.suffixText,//位于尾部的填充文字 31 | suffixStyle: new TextStyle( 32 | fontSize: 14.0, 33 | color: Colors.black38 34 | ), 35 | hintText: this.hintText, 36 | filled: true, // 填充背景颜色 37 | fillColor: Colors.black12, 38 | contentPadding: new EdgeInsets.only(left: 6.0), // 内部边距,默认不是0 39 | border: OutlineInputBorder( 40 | borderRadius: BorderRadius.circular(6.0), 41 | borderSide: BorderSide.none 42 | ), 43 | ), 44 | onChanged: (text) { 45 | //内容输入完成的回调 46 | this.onSuccessChooseEvent(text); 47 | }, 48 | ), 49 | 50 | ); 51 | } 52 | } -------------------------------------------------------------------------------- /you_wallet/lib/widgets/listEmpty.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class ListEmpty extends StatelessWidget { 4 | String text = ""; // 提示文字 5 | 6 | // 构造函数 7 | ListEmpty({ 8 | Key key, 9 | this.text = "", 10 | }) : super(key: key); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return Container( 15 | width: MediaQuery.of(context).size.width, 16 | child: Column( 17 | children: [ 18 | Padding( 19 | padding: new EdgeInsets.all(40.0), 20 | child: Icon(IconData(0xe6a6, fontFamily: 'iconfont'), 21 | size: 100.0, color: Colors.black12), 22 | ), 23 | Text( 24 | this.text, 25 | style: TextStyle(color: Colors.grey), 26 | ) 27 | ], 28 | ), 29 | ); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /you_wallet/lib/widgets/loadingDialog.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | // ignore: must_be_immutable 4 | class LoadingDialog extends Dialog { 5 | String text; 6 | LoadingDialog({ 7 | Key key, 8 | this.text = "加载中..." 9 | }) : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return new Material( //创建透明层 14 | type: MaterialType.transparency, //透明类型 15 | child: new Center( //保证控件居中效果 16 | child: new SizedBox( 17 | width: 120.0, 18 | height: 120.0, 19 | child: new Container( 20 | decoration: ShapeDecoration( 21 | color: Color(0xffffffff), 22 | shape: RoundedRectangleBorder( 23 | borderRadius: BorderRadius.all( 24 | Radius.circular(8.0), 25 | ), 26 | ), 27 | ), 28 | child: new Column( 29 | mainAxisAlignment: MainAxisAlignment.center, 30 | crossAxisAlignment: CrossAxisAlignment.center, 31 | children: [ 32 | new CircularProgressIndicator(), 33 | new Padding( 34 | padding: const EdgeInsets.only( 35 | top: 20.0, 36 | ), 37 | child: new Text( 38 | text, 39 | style: new TextStyle(fontSize: 12.0), 40 | ), 41 | ), 42 | ], 43 | ), 44 | ), 45 | ), 46 | ), 47 | ); 48 | } 49 | } -------------------------------------------------------------------------------- /you_wallet/lib/widgets/menu.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class Menu extends StatelessWidget { 4 | List Menus ; 5 | final double size; 6 | final double fontSize; 7 | final color = Color.fromARGB(255, 255, 170, 71); 8 | 9 | Menu(this.Menus, {Key key, this.size = 18.0, this.fontSize = 13.0}) 10 | : super(key: key); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | List MenuList = []; 15 | print(Menus); 16 | for(var i = 0; i < Menus.length; i++) { 17 | MenuList.add(new Container( 18 | padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), 19 | decoration: new BoxDecoration( 20 | // 设置容器边框粗细和颜色 21 | border: Border(bottom: BorderSide(color: Colors.black26, width: 0.5)), 22 | ), 23 | 24 | child: new Row( 25 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 26 | children: [ 27 | new Text(Menus[i]), 28 | new Icon( 29 | Icons.arrow_forward_ios, 30 | size: 20.0, 31 | ), 32 | ], 33 | ), 34 | )); 35 | } 36 | return Container( 37 | padding: const EdgeInsets.only(left:10.0,right: 10.0), 38 | child: Column( 39 | children: MenuList, 40 | ), 41 | ); 42 | } 43 | } -------------------------------------------------------------------------------- /you_wallet/lib/widgets/modalDialog.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class GenderChooseDialog extends Dialog { 4 | var title; //modal的标题 5 | String content = ""; // modal中的内容 6 | Function onCancelChooseEvent; 7 | Function onSuccessChooseEvent; 8 | 9 | // 构造函数 10 | GenderChooseDialog({ 11 | Key key, 12 | this.title = "提示", 13 | this.content, 14 | this.onCancelChooseEvent, 15 | @required this.onSuccessChooseEvent, 16 | }) : super(key: key); 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | return new Padding( 21 | padding: const EdgeInsets.all(24.0), 22 | child: new Material( 23 | type: MaterialType.transparency, 24 | child: new Column( 25 | mainAxisAlignment: MainAxisAlignment.center, 26 | children: [ 27 | new Container( 28 | padding: 29 | const EdgeInsets.fromLTRB(10.0, 40.0, 10.0, 10.0), 30 | decoration: ShapeDecoration( 31 | color: Color(0xFFFFFFFF), 32 | shape: RoundedRectangleBorder( 33 | borderRadius: BorderRadius.all( 34 | Radius.circular(8.0), 35 | ))), 36 | margin: const EdgeInsets.all(12.0), 37 | child: new Column(children: [ 38 | // 标题区域 39 | new Container( 40 | padding: const EdgeInsets.fromLTRB( 41 | 10.0, 10.0, 10.0, 10.0), 42 | child: Center( 43 | child: new Text(title, 44 | style: new TextStyle(fontSize: 24.0)))), 45 | // 内容区域 46 | new Container( 47 | padding: new EdgeInsets.all(10.0), 48 | child: new Text(content), 49 | ), 50 | // 选择按钮区域 51 | new Row( 52 | mainAxisAlignment: MainAxisAlignment.spaceAround, 53 | mainAxisSize: MainAxisSize.max, 54 | crossAxisAlignment: CrossAxisAlignment.center, 55 | children: [ 56 | _buttonChooseItemWid(1), 57 | _buttonChooseItemWid(2) 58 | ]) 59 | ])) 60 | ]))); 61 | } 62 | 63 | Widget _buttonChooseItemWid(var gender) { 64 | return GestureDetector( 65 | onTap: () { 66 | // 这里调用回调函数必须是函数名字+() 67 | if (gender == 1) { 68 | print(gender); 69 | this.onCancelChooseEvent(); 70 | } else { 71 | print(gender); 72 | this.onSuccessChooseEvent(); 73 | } 74 | }, 75 | child: Container( 76 | decoration: new BoxDecoration( 77 | borderRadius: new BorderRadius.all(new Radius.circular(40.0)), 78 | color: gender == 1 ? Colors.black12 : Colors.lightBlue, 79 | ), 80 | alignment: Alignment.center, 81 | width: 100, 82 | height: 40, 83 | child: Text(gender == 1 ? '取消' : '确定', 84 | style: TextStyle( 85 | color: gender == 1 ? Colors.grey : Colors.white, 86 | fontSize: 15.0)), 87 | )); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /you_wallet/lib/widgets/priceNum.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class priceNum extends StatelessWidget { 4 | final double size; 5 | final double fontSize; 6 | final color = Color.fromARGB(255, 255, 170, 71); 7 | List arr; 8 | 9 | priceNum({Key key, this.size = 18.0, this.fontSize = 13.0, this.arr}) 10 | : super(key: key); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | List DataList = []; 15 | for(var i = 0; i < arr.length; i++) { 16 | DataList.add(new Container( 17 | color: Colors.black12, //16进制颜色 18 | padding: const EdgeInsets.all(4.0), 19 | margin: const EdgeInsets.only(top: 10.0), 20 | child: new Row( 21 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 22 | children: [ 23 | new Text( 24 | arr[i]['left'], 25 | style: TextStyle(color: arr[i]['isSell'] ? Colors.deepOrange : Colors.green) 26 | ), 27 | new Icon( 28 | Icons.close, 29 | size: 20.0, 30 | color: arr[i]['isSell'] ? Colors.deepOrange : Colors.green 31 | ), 32 | new Text(this.arr[i]['right'].toString()), 33 | ], 34 | ), 35 | )); 36 | } 37 | return Container( 38 | child: Column( 39 | children: DataList, 40 | ), 41 | ); 42 | } 43 | } -------------------------------------------------------------------------------- /you_wallet/lib/widgets/rating.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class RatingBar extends StatelessWidget { 4 | var stars; 5 | final double size; 6 | final double fontSize; 7 | final color = Color.fromARGB(255, 255, 170, 71); 8 | 9 | RatingBar(this.stars, {Key key, this.size = 18.0, this.fontSize = 13.0}) 10 | : super(key: key); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | stars = stars * 1.0; 15 | List startList = []; 16 | //实心星星 17 | var startNumber = stars ~/ 2; 18 | //半实心星星 19 | var startHalf = 0; 20 | if (stars.toString().contains('.')) { 21 | int tmp = int.parse((stars.toString().split('.')[1])); 22 | if (tmp >= 5) { 23 | startHalf = 1; 24 | } 25 | } 26 | //空心星星 27 | var startEmpty = 5 - startNumber - startHalf; 28 | 29 | for (var i = 0; i < startNumber; i++) { 30 | startList.add(Icon( 31 | Icons.star, 32 | color: color, 33 | size: size, 34 | )); 35 | } 36 | if (startHalf > 0) { 37 | startList.add(Icon( 38 | Icons.star_half, 39 | color: color, 40 | size: size, 41 | )); 42 | } 43 | for (var i = 0; i < startEmpty; i++) { 44 | startList.add(Icon( 45 | Icons.star_border, 46 | color: Colors.grey, 47 | size: size, 48 | )); 49 | } 50 | startList.add(Text( 51 | '$stars', 52 | style: TextStyle(color: Colors.grey, fontSize: fontSize), 53 | )); 54 | return Container( 55 | alignment: Alignment.topLeft, 56 | child: Row( 57 | children: startList, 58 | ), 59 | ); 60 | } 61 | } -------------------------------------------------------------------------------- /you_wallet/lib/widgets/slideButton.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/gestures.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class SlideButton extends StatefulWidget { 5 | Widget child; 6 | List buttons; 7 | GlobalKey key; 8 | double singleButtonWidth; 9 | 10 | VoidCallback onSlideStarted; 11 | 12 | VoidCallback onSlideCompleted; 13 | 14 | VoidCallback onSlideCanceled; 15 | 16 | SlideButton( 17 | {this.key, 18 | @required this.child, 19 | @required this.singleButtonWidth, 20 | @required this.buttons, 21 | this.onSlideStarted, 22 | this.onSlideCompleted, 23 | this.onSlideCanceled}) 24 | : super(key: key); 25 | 26 | @override 27 | State createState() { 28 | return SlideButtonState(); 29 | } 30 | } 31 | 32 | class SlideButtonState extends State 33 | with TickerProviderStateMixin { 34 | double translateX = 0; 35 | double maxDragDistance; 36 | final Map gestures = 37 | {}; 38 | 39 | AnimationController animationController; 40 | 41 | @override 42 | void initState() { 43 | super.initState(); 44 | maxDragDistance = widget.singleButtonWidth * widget.buttons.length; 45 | gestures[HorizontalDragGestureRecognizer] = 46 | GestureRecognizerFactoryWithHandlers( 47 | () => HorizontalDragGestureRecognizer(debugOwner: this), 48 | (HorizontalDragGestureRecognizer instance) { 49 | instance 50 | ..onDown = onHorizontalDragDown 51 | ..onUpdate = onHorizontalDragUpdate 52 | ..onEnd = onHorizontalDragEnd; 53 | }, 54 | ); 55 | animationController = AnimationController( 56 | lowerBound: -maxDragDistance, 57 | upperBound: 0, 58 | vsync: this, 59 | duration: Duration(milliseconds: 300)) 60 | ..addListener(() { 61 | translateX = animationController.value; 62 | setState(() {}); 63 | }); 64 | } 65 | 66 | @override 67 | Widget build(BuildContext context) { 68 | return WillPopScope(child: Stack( 69 | children: [ 70 | Positioned.fill( 71 | child: Row( 72 | mainAxisAlignment: MainAxisAlignment.end, 73 | children: widget.buttons, 74 | )), 75 | RawGestureDetector( 76 | gestures: gestures, 77 | child: Transform.translate( 78 | offset: Offset(translateX, 0), 79 | child: Row( 80 | children: [ 81 | Expanded( 82 | flex: 1, 83 | child: widget.child, 84 | ) 85 | ], 86 | ), 87 | ), 88 | ) 89 | ], 90 | ), onWillPop: ()async{ 91 | if (translateX != 0){ 92 | close(); 93 | return false; 94 | } 95 | return true; 96 | }); 97 | } 98 | 99 | void onHorizontalDragDown(DragDownDetails details) { 100 | if (widget.onSlideStarted != null) widget.onSlideStarted.call(); 101 | } 102 | 103 | void onHorizontalDragUpdate(DragUpdateDetails details) { 104 | translateX = (translateX + details.delta.dx).clamp(-maxDragDistance, 0.0); 105 | setState(() {}); 106 | } 107 | 108 | void onHorizontalDragEnd(DragEndDetails details) { 109 | animationController.value = translateX; 110 | if (details.velocity.pixelsPerSecond.dx > 200) { 111 | close(); 112 | } else if (details.velocity.pixelsPerSecond.dx < -200) { 113 | open(); 114 | } else { 115 | if (translateX.abs() > maxDragDistance / 2) { 116 | open(); 117 | } else { 118 | close(); 119 | } 120 | } 121 | } 122 | 123 | void open() { 124 | if (translateX != -maxDragDistance) 125 | animationController.animateTo(-maxDragDistance).then((_) { 126 | if (widget.onSlideCompleted != null) widget.onSlideCompleted.call(); 127 | }); 128 | } 129 | 130 | void close() { 131 | if (translateX != 0) 132 | animationController.animateTo(0).then((_) { 133 | if (widget.onSlideCanceled != null) widget.onSlideCanceled.call(); 134 | }); 135 | } 136 | 137 | @override 138 | void dispose() { 139 | animationController.dispose(); 140 | super.dispose(); 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /you_wallet/lib/widgets/tokenCard.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:youwallet/model/viewModel.dart'; 3 | import 'package:youwallet/widgets/tokenLogo.dart'; 4 | import 'package:youwallet/widgets/addressFormat.dart'; 5 | 6 | class TokenCard extends StatelessWidget { 7 | final TokenCardViewModel data; 8 | const TokenCard({Key key, this.data}) : super(key: key); 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | return Container( 13 | height: 140, 14 | margin: EdgeInsets.fromLTRB(0, 16.0, 0, 0), 15 | padding: EdgeInsets.only(left: 20, top: 20), 16 | decoration: BoxDecoration( 17 | color: Colors.lightBlue, 18 | borderRadius: BorderRadius.circular(8), 19 | // gradient: LinearGradient( 20 | // begin: Alignment.topLeft, 21 | // end: Alignment.bottomRight, 22 | // colors: this.data.cardColors, 23 | // ), 24 | // 25 | boxShadow: [ 26 | BoxShadow( 27 | blurRadius: 6, 28 | spreadRadius: 4, 29 | color: Color.fromARGB(20, 0, 0, 0), 30 | ), 31 | ], 32 | ), 33 | child: Column( 34 | crossAxisAlignment: CrossAxisAlignment.start, 35 | children: [ 36 | Row( 37 | crossAxisAlignment: CrossAxisAlignment.start, 38 | children: [ 39 | TokenLogo(address: this.data.cardNumber), 40 | Padding(padding: EdgeInsets.only(left: 15)), 41 | Column( 42 | crossAxisAlignment: CrossAxisAlignment.start, 43 | children: [ 44 | new Row( 45 | children: [ 46 | Text( 47 | this.data.bankName, 48 | style: TextStyle( 49 | fontSize: 19, 50 | fontWeight: FontWeight.bold, 51 | color: Colors.white, 52 | ), 53 | ), 54 | Padding(padding: EdgeInsets.only(left: 15)), 55 | GestureDetector( 56 | child: Icon( 57 | IconData(0xe600, fontFamily: 'iconfont'), 58 | color: Colors.white, 59 | ), 60 | onTap: () { 61 | Map token = { 62 | 'name': this.data.bankName, 63 | 'address': this.data.cardNumber, 64 | }; 65 | Navigator.pushNamed(context, "token_info", 66 | arguments: token); 67 | }, 68 | ), 69 | ], 70 | ), 71 | Text( 72 | this.data.balance, 73 | style: TextStyle( 74 | fontSize: 14, 75 | color: Color.fromARGB(200, 255, 255, 255), 76 | ), 77 | ), 78 | ], 79 | ), 80 | Padding(padding: EdgeInsets.only(left: 10)), 81 | ], 82 | ), 83 | Padding( 84 | padding: EdgeInsets.only(left: 65, top: 20), 85 | child: new AddressFormat(this.data.cardNumber)), 86 | ], 87 | ), 88 | ); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /you_wallet/lib/widgets/tokenList.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:provider/provider.dart'; 3 | import 'package:youwallet/model/token.dart'; 4 | import 'package:youwallet/model/viewModel.dart'; 5 | import 'package:youwallet/widgets/listEmpty.dart'; 6 | import 'package:youwallet/widgets/tokenCard.dart'; 7 | import 'package:flutter_slidable/flutter_slidable.dart'; 8 | import 'package:youwallet/widgets/customButton.dart'; 9 | 10 | // 类的名字需要大写字母开头 11 | class tokenList extends StatelessWidget { 12 | List arr = []; 13 | String network = "ropsten"; 14 | Map currentWalletObject = {}; 15 | tokenList( 16 | {Key key, this.arr, this.network = "ropsten", this.currentWalletObject}) 17 | : super(key: key); 18 | 19 | final SlidableController slidableController = SlidableController(); 20 | 21 | @override 22 | Widget build(BuildContext context) { 23 | List filterArr = []; 24 | this.arr.forEach((element) { 25 | // 必须当前你选择的网络和当前你的钱包地址 26 | if (element['wallet'] == this.currentWalletObject['address']) { 27 | filterArr.add(element); 28 | } 29 | }); 30 | // 没有token则显示添加token的 31 | if (filterArr != null && filterArr.length == 0) { 32 | return Column( 33 | children: [ 34 | ListEmpty(), 35 | new CustomButton( 36 | content: '添加token', 37 | onSuccessChooseEvent: (res) async { 38 | Navigator.pushNamed(context, "add_token", arguments: {}); 39 | }) 40 | ], 41 | ); 42 | } else { 43 | return Column( 44 | children: filterArr.reversed 45 | .map((item) => buildSilde(item, context)) 46 | .toList(), 47 | ); 48 | } 49 | } 50 | 51 | // 给数据列表中的每一个项包裹一层滑动组件 52 | Widget buildSilde(item, context) { 53 | TokenCardViewModel cardData = TokenCardViewModel( 54 | bankName: item['name'], 55 | bankLogoUrl: 'assets/images/icon.png', 56 | cardType: '以太坊', 57 | cardNumber: item['address'], 58 | cardColors: [Color(0xFFF17B68), Color(0xFFE95F66)], 59 | balance: item['balance'], 60 | ); 61 | return Slidable( 62 | controller: slidableController, 63 | actionPane: SlidableScrollActionPane(), //滑出选项的面板 动画 64 | actionExtentRatio: 0.25, 65 | child: TokenCard(data: cardData), 66 | secondaryActions: [ 67 | //右侧按钮列表 68 | IconSlideAction( 69 | caption: '删除', 70 | // color: Color(0xfff56c6c), 71 | icon: Icons.delete, 72 | onTap: () async { 73 | await Provider.of(context).remove(item); 74 | }, 75 | ) 76 | ], 77 | ); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /you_wallet/lib/widgets/tokenLogo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:youwallet/global.dart'; 3 | 4 | // 显示token对应的logo 5 | class TokenLogo extends StatelessWidget { 6 | final String address; 7 | 8 | TokenLogo({Key key, @required this.address}) : super(key: key); 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | Map token = Global.hotToken.firstWhere( 13 | (element) => (element['address'] == this.address), 14 | orElse: () => ({})); 15 | if (token.isEmpty) { 16 | // return Icon(IconData(0xe648, fontFamily: 'iconfont'),size: 50.0, color: Colors.black26); 17 | return Stack( 18 | children: [ 19 | Container( 20 | width: 50.0, 21 | height: 50.0, 22 | decoration: new BoxDecoration( 23 | border: new Border.all(width: 2.4, color: Colors.transparent), 24 | borderRadius: new BorderRadius.all(new Radius.circular(25.0))), 25 | ), 26 | Positioned( 27 | child: Icon(IconData(0xe648, fontFamily: 'iconfont'), 28 | size: 50.0, color: Colors.white)), 29 | ], 30 | ); 31 | } else { 32 | return Stack( 33 | children: [ 34 | Container( 35 | width: 50.0, 36 | height: 50.0, 37 | decoration: new BoxDecoration( 38 | border: new Border.all(width: 2.4, color: Colors.transparent), 39 | color: Colors.white, 40 | borderRadius: new BorderRadius.all(new Radius.circular(25.0))), 41 | ), 42 | Positioned( 43 | top: -2.0, 44 | child: Icon(IconData(token['icon'], fontFamily: 'iconfont'), 45 | size: 50.0, color: token['color'])), 46 | ], 47 | ); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /you_wallet/lib/widgets/tokenSelect.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:youwallet/service/token_service.dart' ; 3 | import 'package:provider/provider.dart'; 4 | import 'package:youwallet/model/token.dart'; 5 | 6 | // 类的名字需要大写字母开头 7 | class TokenSelect extends StatelessWidget { 8 | 9 | List arr = []; 10 | TokenSelect({Key key, this.arr}) : super(key: key); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | 15 | return Column( 16 | children: arr.map((item) => walletCard(item, context)).toList() 17 | ); 18 | // return '' 19 | } 20 | } 21 | 22 | // 构建下拉列表 23 | List getListData(context){ 24 | List items=new List(); 25 | List tokens = Provider.of(context).items; 26 | for (var value in tokens) { 27 | items.add(new DropdownMenuItem( 28 | child:new Text(value['name']), 29 | value: value['address'], 30 | )); 31 | } 32 | 33 | return items; 34 | } 35 | 36 | Widget walletCard(item, context) { 37 | return new Dismissible( 38 | background: Container( 39 | color: Colors.red, 40 | child: Center( 41 | child: Text("删除", 42 | style: TextStyle( 43 | color: Colors.white 44 | ), 45 | ), 46 | ) 47 | ), 48 | key: new Key(item['id'].toString()), 49 | onDismissed: (direction) { 50 | // 更新token model中的token数组 51 | Provider.of(context).remove(item); 52 | final snackBar = SnackBar(content: new Text("移除成功")); 53 | Scaffold.of(context).showSnackBar(snackBar); 54 | }, 55 | child: new Card( 56 | color: Colors.white, //背景色 57 | child: new Container( 58 | padding: const EdgeInsets.all(28.0), 59 | child: new Row( 60 | children: [ 61 | new Container( 62 | margin: const EdgeInsets.only(right: 16.0), 63 | decoration: new BoxDecoration( 64 | border: new Border.all(width: 2.0, color: Colors.black26), 65 | borderRadius: new BorderRadius.all(new Radius.circular(20.0)), 66 | ), 67 | child: new Image.asset( 68 | 'images/icon.png', 69 | height: 40.0, 70 | width: 40.0, 71 | fit: BoxFit.cover, 72 | ), 73 | ), 74 | new Expanded( 75 | child: new Column( 76 | crossAxisAlignment: CrossAxisAlignment.start, 77 | children: [ 78 | new Text( 79 | item['name']?? '--', 80 | style: new TextStyle(fontSize: 32.0, color: Colors.black), 81 | ), 82 | GestureDetector( 83 | child: new Text(TokenService.maskAddress(item['address'])), 84 | onTap: () async { 85 | print(item['address']); 86 | // balance = await TokenService.getBalance(item['address']); 87 | // print(balance); 88 | }, 89 | ) 90 | 91 | ], 92 | ), 93 | ), 94 | new Container( 95 | child: new Column( 96 | children: [ 97 | new Text( 98 | item['balance'] + 'ETH', 99 | style: new TextStyle(fontSize: 16.0, 100 | color: Color.fromARGB(100, 6, 147, 193)), 101 | ), 102 | new Text('¥${item['rmb']??'-'}'), 103 | ], 104 | ) 105 | 106 | ) 107 | ], 108 | ) 109 | ), 110 | ) 111 | ); 112 | } 113 | 114 | -------------------------------------------------------------------------------- /you_wallet/lib/widgets/tokenSelectSheet.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:youwallet/widgets/bottomSheetDialog.dart'; 3 | import 'package:youwallet/global.dart'; 4 | import 'package:provider/provider.dart'; 5 | import 'package:youwallet/model/wallet.dart' as walletModel; 6 | 7 | // token下拉选择模块 8 | class TokenSelectSheet extends StatefulWidget { 9 | // 类型,一个应用中有多个地方都要选择token,selectType用来标记用户点击的是哪个地方 10 | String selectType = ''; 11 | Function onCallBackEvent; 12 | List selectArr = []; 13 | 14 | // 构造函数 15 | TokenSelectSheet({ 16 | Key key, 17 | this.selectType = 'default', 18 | this.selectArr, 19 | @required this.onCallBackEvent, 20 | }) : super(key: key); 21 | 22 | Page createState() => new Page(); 23 | } 24 | 25 | class Page extends State { 26 | String showText = '选择币种'; 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | return GestureDetector( 31 | onTap: () { 32 | if (widget.selectArr.length == 0) { 33 | print('当前选项数量为0,不弹出'); 34 | Global.showSnackBar(context, '请先前往首页添加token'); 35 | } else { 36 | this.selectToken(context); 37 | } 38 | }, 39 | child: new Container( 40 | padding: const EdgeInsets.all(4.0), 41 | margin: const EdgeInsets.only(bottom: 10.0), 42 | width: MediaQuery.of(context).size.width / 2, 43 | alignment: Alignment.centerLeft, 44 | height: 36.0, 45 | decoration: new BoxDecoration( 46 | borderRadius: new BorderRadius.all(new Radius.circular(6.0)), 47 | border: new Border.all(width: 1.0, color: Colors.black12), 48 | color: Colors.black12, 49 | ), 50 | child: Text( 51 | this.showText, 52 | style: TextStyle(fontSize: 18.0), 53 | ), 54 | ), 55 | ); 56 | } 57 | 58 | /// 弹出底部的选择列表 59 | /// 转账模式下,要把ETH加进去 60 | selectToken(context) async { 61 | Map wallet = Provider.of(context).currentWalletObject; 62 | 63 | List tokens = [ 64 | { 65 | 'id': 0, 66 | 'name': 'ETH', 67 | 'decimals': '18', 68 | 'balance': wallet['balance'], 69 | 'address': '' // ETH没有地址 70 | }, 71 | ...widget.selectArr, 72 | ]; 73 | // List tokens = Provider.of(context) 74 | // .items 75 | // .where((e) => (e['wallet'] == wallet)) 76 | // .toList(); 77 | // if (tokens.length == 0) { 78 | // print('当前钱包没有token'); 79 | // final snackBar = new SnackBar(content: new Text('还没有添加token')); 80 | // Scaffold.of(context).showSnackBar(snackBar); 81 | // return; 82 | // } 83 | showModalBottomSheet( 84 | backgroundColor: Colors.transparent, 85 | context: context, 86 | builder: (BuildContext context) { 87 | return BottomSheetDialog( 88 | content: 89 | widget.selectType == 'transfer' ? tokens : widget.selectArr, 90 | onSuccessChooseEvent: (res) { 91 | print('showModalBottomSheet => ${res}'); 92 | setState(() { 93 | this.showText = res['name']; 94 | }); 95 | widget.onCallBackEvent(res); 96 | }); 97 | }); 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /you_wallet/lib/widgets/userMenu.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:url_launcher/url_launcher.dart'; 3 | import 'package:youwallet/db/provider.dart'; 4 | import 'package:youwallet/service/app_server.dart'; 5 | import 'package:youwallet/widgets/modalDialog.dart'; 6 | import 'package:youwallet/global.dart'; 7 | import 'package:youwallet/bus.dart'; 8 | 9 | // 类的名字需要大写字母开头 10 | class UserMenu extends StatelessWidget { 11 | UserMenu({Key key}) : super(key: key); 12 | @override 13 | Widget build(BuildContext context) { 14 | return Drawer( 15 | child: ListView( 16 | padding: EdgeInsets.zero, 17 | children: [ 18 | UserAccountsDrawerHeader( 19 | accountName: Text( 20 | 'youWallet', 21 | style: 22 | TextStyle(fontWeight: FontWeight.bold, color: Colors.white), 23 | ), 24 | accountEmail: Text('https://youwallet.github.io/', 25 | style: TextStyle( 26 | fontWeight: FontWeight.bold, color: Colors.white)), 27 | //currentAccountPicture: CircleAvatar( backgroundImage: NetworkImage('https://upyun-assets.ethfans.org/assets/ethereum-logo-fe43a240b78711a6d427e9638f03163f3dc88ca8c112510644ce7b5f6be07dbe.png')), 28 | // currentAccountPicture: Icon( 29 | // IconData(0xe648, fontFamily: 'iconfont'), 30 | // size: 60.0 31 | // ), 32 | currentAccountPicture: 33 | Image(image: AssetImage("images/logo.png"), width: 100.0), 34 | decoration: BoxDecoration( 35 | color: Colors.lightBlue, 36 | // image: DecorationImage( 37 | // image: NetworkImage( 'url'), 38 | // fit: BoxFit.cover, 39 | // colorFilter: ColorFilter.mode( Colors.yellow.withOpacity(0.3), BlendMode.lighten, ), 40 | // ) 41 | ), 42 | ), 43 | ListTile( 44 | title: Text('切换网络'), 45 | leading: Icon(Icons.network_check), 46 | onTap: () { 47 | Navigator.pushNamed(context, "set_network"); 48 | }, 49 | ), 50 | // ListTile( 51 | // title: Text('进入调试'), 52 | // leading: Icon(Icons.adb), 53 | // onTap: () { 54 | // Navigator.pushNamed(context, "debug_page"); 55 | // }, 56 | // ), 57 | ListTile( 58 | title: Text('清空缓存'), 59 | leading: Icon(Icons.cached), 60 | onTap: () async { 61 | showDialog( 62 | context: context, 63 | barrierDismissible: false, 64 | builder: (BuildContext context) { 65 | return GenderChooseDialog( 66 | title: '确定要清空缓存吗?', 67 | content: '钱包和交易记录将不可找回!', 68 | onSuccessChooseEvent: () async { 69 | print('===========ok'); 70 | final provider = new ProviderSql(); 71 | await provider.clearCache(); 72 | Navigator.pop(context); 73 | }, 74 | onCancelChooseEvent: () { 75 | Navigator.pop(context); 76 | }); 77 | }); 78 | }, 79 | ), 80 | ListTile( 81 | title: Text('意见反馈'), 82 | leading: Icon(Icons.feedback), 83 | onTap: () async { 84 | const url = 'https://github.com/youwallet/wallet/issues'; 85 | await launch(url); 86 | }, 87 | ), 88 | ListTile( 89 | title: new Row( 90 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 91 | children: [Text('版本号'), Text('v1.0.0')], 92 | ), 93 | leading: Icon(Icons.exit_to_app), 94 | onTap: () async { 95 | // 先收起侧边栏 96 | Navigator.pop(context); // close the drawer 97 | // 通知首页检查最新版本 98 | eventBus.fire(CheckVersion()); 99 | }, 100 | ), 101 | ], 102 | ), 103 | ); 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /you_wallet/lib/widgets/walletList.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | // 类的名字需要大写字母开头 4 | class WalletList extends StatelessWidget { 5 | List arr = []; 6 | WalletList({Key key, this.arr}) : super(key: key); 7 | @override 8 | Widget build(BuildContext context) { 9 | return Column(children: arr.map((item) => walletCard(item)).toList()); 10 | } 11 | } 12 | 13 | void setNetWork(name) async { 14 | // setState(() { 15 | //// _newValue = name; 16 | //// }); 17 | //// SharedPreferences prefs = await SharedPreferences.getInstance(); 18 | //// prefs.setString("network", name); 19 | //// print(prefs.getString('network')); 20 | } 21 | 22 | //item['address_filter'] = item['address'].substring(0,5) + '*****' + item['address'].substring(30); 23 | //token['address_filter'] = 24 | 25 | Widget walletCard(item) { 26 | String current_address = item['address']; 27 | return new Card( 28 | color: Colors.white, //背景色 29 | child: GestureDetector( 30 | child: new Container( 31 | padding: const EdgeInsets.all(28.0), 32 | child: new Row( 33 | children: [ 34 | new Container( 35 | margin: const EdgeInsets.only(right: 16.0), 36 | child: new Radio( 37 | groupValue: current_address, 38 | activeColor: Colors.blue, 39 | value: item['address'], 40 | onChanged: (v) { 41 | // val 与 value 的类型对应 42 | print(v); 43 | // setState(() { 44 | // current_address = v; // aaa 45 | // }); 46 | }, 47 | ), 48 | ), 49 | new Expanded( 50 | child: new Column( 51 | crossAxisAlignment: CrossAxisAlignment.start, 52 | children: [ 53 | new Text( 54 | item['name'], 55 | style: 56 | new TextStyle(fontSize: 32.0, color: Colors.black), 57 | ), 58 | new Text(item['address']), 59 | ], 60 | ), 61 | ), 62 | // new Container( 63 | // child: new Column( 64 | // children: [ 65 | // new Text( 66 | // item['balance'], 67 | // style: new TextStyle(fontSize: 16.0, 68 | // color: Color.fromARGB(100, 6, 147, 193)), 69 | // ), 70 | // new Text('¥${item['rmb']}'), 71 | // ], 72 | // ) 73 | // 74 | // ) 75 | ], 76 | )), 77 | onTap: () { 78 | print("点击token =》 ${item}"); 79 | }, 80 | )); 81 | } 82 | -------------------------------------------------------------------------------- /you_wallet/locale/i18n_en.json: -------------------------------------------------------------------------------- 1 | { 2 | "tab_home":"home", 3 | "title_tab_exchange": "兑换" 4 | } -------------------------------------------------------------------------------- /you_wallet/locale/i18n_ja.json: -------------------------------------------------------------------------------- 1 | { 2 | "tab_home":"home" 3 | } -------------------------------------------------------------------------------- /you_wallet/locale/i18n_zh.json: -------------------------------------------------------------------------------- 1 | { 2 | "tab_home":"home", 3 | "title_tab_exchange": "兑换" 4 | } -------------------------------------------------------------------------------- /you_wallet/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: youwallet 2 | description: A new Flutter application. 3 | 4 | # The following defines the version and build number for your application. 5 | # A version number is three numbers separated by dots, like 1.2.43 6 | # followed by an optional build number separated by a +. 7 | # Both the version and the builder number may be overridden in flutter 8 | # build by specifying --build-name and --build-number, respectively. 9 | # In Android, build-name is used as versionName while build-number used as versionCode. 10 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 11 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 12 | # Read more about iOS versioning at 13 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 14 | version: 1.0.0+1 15 | 16 | environment: 17 | sdk: ">=2.4.0 <3.0.0" 18 | 19 | dependencies: 20 | flutter_localizations: 21 | sdk: flutter 22 | cupertino_icons: ^0.1.2 23 | image_picker_saver: ^0.3.0 24 | share: ^0.6.1+1 25 | bip39: ^1.0.3 26 | barcode_scan: ^3.0.1 27 | shared_preferences: ^0.5.4+6 28 | steel_crypt: ^1.5.1+1 29 | sqflite: ^1.0.0 30 | path_provider: ^1.5.1 31 | dart_sql: ^0.0.7 32 | provider: ^3.2.0 33 | event_bus: ^1.1.0 34 | ed25519_hd_key: ^1.0.1 35 | get_it: ^3.0.3 36 | qr_flutter: ^3.1.0 37 | common_utils: ^1.1.3 38 | sacco: ^0.1.0 39 | flutter_aes_ecb_pkcs5: ^0.1.1 40 | url_launcher: ^5.4.1 41 | groovin_material_icons: ^1.1.6 42 | fluttertoast: ^3.1.3 43 | flutter_slidable: ^0.5.4 44 | dio: ^3.0.9 45 | decimal: ^0.3.0 46 | hex: ^0.1.2 47 | flutter_bugly: ^0.2.8 48 | flutter_spinkit: ^4.1.2 49 | html: ^0.14.0+3 50 | http: ^0.12.2 51 | local_auth: ^1.1.11 52 | bitcoin_flutter: ^2.0.2 53 | web3dart: ^1.2.3 54 | dev_dependencies: 55 | flutter_test: 56 | sdk: flutter 57 | 58 | # For information on the generic Dart part of this file, see the 59 | # following page: https://dart.dev/tools/pub/pubspec 60 | 61 | # The following section is specific to Flutter. 62 | flutter: 63 | # The following line ensures that the Material Icons font is 64 | # included with your application, so that you can use the icons in 65 | # the material Icons class. 66 | uses-material-design: true 67 | 68 | # To add assets to your application, add an assets section, like this: 69 | # assets: 70 | # - images/a_dot_burr.jpeg 71 | # - images/a_dot_ham.jpeg 72 | assets: 73 | - locale/i18n_en.json 74 | - locale/i18n_zh.json 75 | - locale/i18n_ja.json 76 | - assets/images/logo.png 77 | - assets/images/home.png 78 | - assets/images/home-active.png 79 | - assets/images/icon.png 80 | - TempMatch.json 81 | - images/new_wallet.png 82 | - images/fingerprint.png 83 | - images/tab_wallet_active.png 84 | - images/tab_wallet.png 85 | - images/tab_exchange_active.png 86 | - images/tab_exchange.png 87 | - images/tab_receive_active.png 88 | - images/tab_receive.png 89 | - images/tab_transfer_active.png 90 | - images/tab_transfer.png 91 | - images/qrcode.png 92 | - images/backup.png 93 | - images/icon.png 94 | - images/qrcode.jpeg 95 | - images/homebk.png 96 | - images/homebk-full.png 97 | - images/splash.jpeg 98 | - images/empty.png 99 | - images/logo.png 100 | # An image asset can refer to one or more resolution-specific "variants", see 101 | # https://flutter.dev/assets-and-images/#resolution-aware. 102 | 103 | # For details regarding adding assets from package dependencies, see 104 | # https://flutter.dev/assets-and-images/#from-packages 105 | 106 | # To add custom fonts to your application, add a fonts section here, 107 | # in this "flutter" section. Each entry in this list should have a 108 | # "family" key with the font family name, and a "fonts" key with a 109 | # list giving the asset and other descriptors for the font. For 110 | # example: 111 | # fonts: 112 | # - family: Schyler 113 | # fonts: 114 | # - asset: fonts/Schyler-Regular.ttf 115 | # - asset: fonts/Schyler-Italic.ttf 116 | # style: italic 117 | # - family: Trajan Pro 118 | # fonts: 119 | # - asset: fonts/TrajanPro.ttf 120 | # - asset: fonts/TrajanPro_Bold.ttf 121 | # weight: 700 122 | # 123 | fonts: 124 | - family: iconfont 125 | fonts: 126 | - asset: fonts/iconfont.ttf 127 | # For details regarding fonts from package dependencies, 128 | # see https://flutter.dev/custom-fonts/#from-packages 129 | -------------------------------------------------------------------------------- /you_wallet/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:you_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 | --------------------------------------------------------------------------------