├── .gitignore ├── .metadata ├── README.md ├── android ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── flutter_widgets │ │ │ │ └── MainActivity.java │ │ └── 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 └── settings.gradle ├── images ├── 1.png ├── 10.png ├── 2.png ├── 3.png ├── 4.png ├── 5.png ├── 6.png ├── 7.png ├── 8.png ├── 9.png └── mic │ ├── 1.png │ ├── 10.png │ ├── 11.png │ ├── 12.png │ ├── 13.png │ ├── 14.png │ ├── 15.png │ ├── 16.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ ├── 5.png │ ├── 6.png │ ├── 7.png │ ├── 8.png │ └── 9.png ├── ios ├── 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 │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings └── Runner │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── 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 │ └── main.m ├── lib ├── DetailPage.dart ├── main.dart ├── models │ ├── BsbdjData.dart │ ├── HotModel.dart │ ├── ListenModel.dart │ ├── MusicDetailModel.dart │ ├── WYNewsModel.dart │ ├── WidgetJSON.dart │ ├── dioDatas.dart │ ├── musicDatas.dart │ ├── post.dart │ └── videoDatas.dart ├── route │ ├── flutter_buttons.dart │ ├── flutter_chips.dart │ ├── flutter_dataTables.dart │ ├── flutter_dialogs.dart │ ├── flutter_dios.dart │ ├── flutter_dios_detail.dart │ ├── flutter_hots.dart │ ├── flutter_interActives.dart │ ├── flutter_listen_music.dart │ ├── flutter_listen_music_detail.dart │ ├── flutter_music_detail.dart │ ├── flutter_musics.dart │ ├── flutter_others.dart │ ├── flutter_tuijians.dart │ ├── flutter_videos.dart │ ├── flutter_wynews.dart │ └── flutter_wynews_detail.dart ├── tools │ └── DioTool.dart └── widgets │ ├── MainColor.dart │ ├── needle_anim.dart │ └── record_anim.dart ├── pubspec.lock ├── pubspec.yaml └── test └── widget_test.dart /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # Visual Studio Code related 19 | .vscode/ 20 | 21 | # Flutter/Dart/Pub related 22 | **/doc/api/ 23 | .dart_tool/ 24 | .flutter-plugins 25 | .packages 26 | .pub-cache/ 27 | .pub/ 28 | /build/ 29 | 30 | # Android related 31 | **/android/**/gradle-wrapper.jar 32 | **/android/.gradle 33 | **/android/captures/ 34 | **/android/gradlew 35 | **/android/gradlew.bat 36 | **/android/local.properties 37 | **/android/**/GeneratedPluginRegistrant.java 38 | 39 | # iOS/XCode related 40 | **/ios/**/*.mode1v3 41 | **/ios/**/*.mode2v3 42 | **/ios/**/*.moved-aside 43 | **/ios/**/*.pbxuser 44 | **/ios/**/*.perspectivev3 45 | **/ios/**/*sync/ 46 | **/ios/**/.sconsign.dblite 47 | **/ios/**/.tags* 48 | **/ios/**/.vagrant/ 49 | **/ios/**/DerivedData/ 50 | **/ios/**/Icon? 51 | **/ios/**/Pods/ 52 | **/ios/**/.symlinks/ 53 | **/ios/**/profile 54 | **/ios/**/xcuserdata 55 | **/ios/.generated/ 56 | **/ios/Flutter/App.framework 57 | **/ios/Flutter/Flutter.framework 58 | **/ios/Flutter/Generated.xcconfig 59 | **/ios/Flutter/app.flx 60 | **/ios/Flutter/app.zip 61 | **/ios/Flutter/flutter_assets/ 62 | **/ios/ServiceDefinitions.json 63 | **/ios/Runner/GeneratedPluginRegistrant.* 64 | 65 | # Exceptions to above rules. 66 | !**/ios/**/default.mode1v3 67 | !**/ios/**/default.mode2v3 68 | !**/ios/**/default.pbxuser 69 | !**/ios/**/default.perspectivev3 70 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 71 | -------------------------------------------------------------------------------- /.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: 8661d8aecd626f7f57ccbcb735553edc05a2e713 8 | channel: beta 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # flutter_widgets 2 | 3 | A new Flutter application. 4 | 5 | #### 内容涉及: 6 | ###### 1.基础界面的搭建,常见Widgets的使用; 7 | ###### 2.Dio网络请求、JSON Parse与数据渲染; 8 | ###### 3.下拉刷新与上拉加载更多; 9 | ###### 4.音视频播放; 10 | ###### 5. 其他; 11 | 12 | ## App兼容iOS与Android; 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 | -------------------------------------------------------------------------------- /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 from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 26 | 27 | android { 28 | compileSdkVersion 28 29 | 30 | lintOptions { 31 | disable 'InvalidPackage' 32 | } 33 | 34 | defaultConfig { 35 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 36 | applicationId "com.example.flutter_widgets" 37 | minSdkVersion 16 38 | targetSdkVersion 28 39 | versionCode flutterVersionCode.toInteger() 40 | versionName flutterVersionName 41 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 42 | } 43 | 44 | buildTypes { 45 | release { 46 | // TODO: Add your own signing config for the release build. 47 | // Signing with the debug keys for now, so `flutter run --release` works. 48 | signingConfig signingConfigs.debug 49 | } 50 | } 51 | } 52 | 53 | flutter { 54 | source '../..' 55 | } 56 | 57 | dependencies { 58 | testImplementation 'junit:junit:4.12' 59 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 60 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 61 | } 62 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | 13 | 20 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/example/flutter_widgets/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.flutter_widgets; 2 | 3 | import android.os.Bundle; 4 | import io.flutter.app.FlutterActivity; 5 | import io.flutter.plugins.GeneratedPluginRegistrant; 6 | 7 | public class MainActivity extends FlutterActivity { 8 | @Override 9 | protected void onCreate(Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | GeneratedPluginRegistrant.registerWith(this); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.2.1' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | google() 15 | jcenter() 16 | } 17 | } 18 | 19 | rootProject.buildDir = '../build' 20 | subprojects { 21 | project.buildDir = "${rootProject.buildDir}/${project.name}" 22 | } 23 | subprojects { 24 | project.evaluationDependsOn(':app') 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | -------------------------------------------------------------------------------- /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-4.10.2-all.zip 7 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /images/ 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/images/ 1.png -------------------------------------------------------------------------------- /images/ 10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/images/ 10.png -------------------------------------------------------------------------------- /images/ 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/images/ 2.png -------------------------------------------------------------------------------- /images/ 3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/images/ 3.png -------------------------------------------------------------------------------- /images/ 4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/images/ 4.png -------------------------------------------------------------------------------- /images/ 5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/images/ 5.png -------------------------------------------------------------------------------- /images/ 6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/images/ 6.png -------------------------------------------------------------------------------- /images/ 7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/images/ 7.png -------------------------------------------------------------------------------- /images/ 8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/images/ 8.png -------------------------------------------------------------------------------- /images/ 9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/images/ 9.png -------------------------------------------------------------------------------- /images/mic/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/images/mic/1.png -------------------------------------------------------------------------------- /images/mic/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/images/mic/10.png -------------------------------------------------------------------------------- /images/mic/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/images/mic/11.png -------------------------------------------------------------------------------- /images/mic/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/images/mic/12.png -------------------------------------------------------------------------------- /images/mic/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/images/mic/13.png -------------------------------------------------------------------------------- /images/mic/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/images/mic/14.png -------------------------------------------------------------------------------- /images/mic/15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/images/mic/15.png -------------------------------------------------------------------------------- /images/mic/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/images/mic/16.png -------------------------------------------------------------------------------- /images/mic/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/images/mic/2.png -------------------------------------------------------------------------------- /images/mic/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/images/mic/3.png -------------------------------------------------------------------------------- /images/mic/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/images/mic/4.png -------------------------------------------------------------------------------- /images/mic/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/images/mic/5.png -------------------------------------------------------------------------------- /images/mic/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/images/mic/6.png -------------------------------------------------------------------------------- /images/mic/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/images/mic/7.png -------------------------------------------------------------------------------- /images/mic/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/images/mic/8.png -------------------------------------------------------------------------------- /images/mic/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/images/mic/9.png -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def parse_KV_file(file, separator='=') 14 | file_abs_path = File.expand_path(file) 15 | if !File.exists? file_abs_path 16 | return []; 17 | end 18 | pods_ary = [] 19 | skip_line_start_symbols = ["#", "/"] 20 | File.foreach(file_abs_path) { |line| 21 | next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } 22 | plugin = line.split(pattern=separator) 23 | if plugin.length == 2 24 | podname = plugin[0].strip() 25 | path = plugin[1].strip() 26 | podpath = File.expand_path("#{path}", file_abs_path) 27 | pods_ary.push({:name => podname, :path => podpath}); 28 | else 29 | puts "Invalid plugin specification: #{line}" 30 | end 31 | } 32 | return pods_ary 33 | end 34 | 35 | target 'Runner' do 36 | # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock 37 | # referring to absolute paths on developers' machines. 38 | system('rm -rf .symlinks') 39 | system('mkdir -p .symlinks/plugins') 40 | 41 | # Flutter Pods 42 | generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig') 43 | if generated_xcode_build_settings.empty? 44 | puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first." 45 | end 46 | generated_xcode_build_settings.map { |p| 47 | if p[:name] == 'FLUTTER_FRAMEWORK_DIR' 48 | symlink = File.join('.symlinks', 'flutter') 49 | File.symlink(File.dirname(p[:path]), symlink) 50 | pod 'Flutter', :path => File.join(symlink, File.basename(p[:path])) 51 | end 52 | } 53 | 54 | # Plugin Pods 55 | plugin_pods = parse_KV_file('../.flutter-plugins') 56 | plugin_pods.map { |p| 57 | symlink = File.join('.symlinks', 'plugins', p[:name]) 58 | File.symlink(p[:path], symlink) 59 | pod p[:name], :path => File.join(symlink, 'ios') 60 | } 61 | end 62 | 63 | post_install do |installer| 64 | installer.pods_project.targets.each do |target| 65 | target.build_configurations.each do |config| 66 | config.build_settings['ENABLE_BITCODE'] = 'NO' 67 | end 68 | end 69 | end 70 | -------------------------------------------------------------------------------- /ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - audioplayer (0.0.1): 3 | - Flutter 4 | - Flutter (1.0.0) 5 | - flutter_webview_plugin (0.0.1): 6 | - Flutter 7 | - fluttertoast (0.0.2): 8 | - Flutter 9 | - video_player (0.0.1): 10 | - Flutter 11 | 12 | DEPENDENCIES: 13 | - audioplayer (from `.symlinks/plugins/audioplayer/ios`) 14 | - Flutter (from `.symlinks/flutter/ios`) 15 | - flutter_webview_plugin (from `.symlinks/plugins/flutter_webview_plugin/ios`) 16 | - fluttertoast (from `.symlinks/plugins/fluttertoast/ios`) 17 | - video_player (from `.symlinks/plugins/video_player/ios`) 18 | 19 | EXTERNAL SOURCES: 20 | audioplayer: 21 | :path: ".symlinks/plugins/audioplayer/ios" 22 | Flutter: 23 | :path: ".symlinks/flutter/ios" 24 | flutter_webview_plugin: 25 | :path: ".symlinks/plugins/flutter_webview_plugin/ios" 26 | fluttertoast: 27 | :path: ".symlinks/plugins/fluttertoast/ios" 28 | video_player: 29 | :path: ".symlinks/plugins/video_player/ios" 30 | 31 | SPEC CHECKSUMS: 32 | audioplayer: 3cc64e4f5f3e231c715c8923a9bc26a19dc5da3b 33 | Flutter: 9d0fac939486c9aba2809b7982dfdbb47a7b0296 34 | flutter_webview_plugin: 116575b48572029304775b768e9f15ebfc316274 35 | fluttertoast: 0a20dcbbb8ecfd1a61b6285651ff2d5989d033fb 36 | video_player: 906796a841943c8d370ac7c13b18039aa9b56498 37 | 38 | PODFILE CHECKSUM: aff02bfeed411c636180d6812254b2daeea14d09 39 | 40 | COCOAPODS: 1.5.3 41 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 02153E679909923D31BCBD51 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78778FEA71F34EEC66983DC7 /* libPods-Runner.a */; }; 11 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 12 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 13 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 14 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 15 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 16 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 17 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 18 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 19 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 20 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 21 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 22 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXCopyFilesBuildPhase section */ 26 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 27 | isa = PBXCopyFilesBuildPhase; 28 | buildActionMask = 2147483647; 29 | dstPath = ""; 30 | dstSubfolderSpec = 10; 31 | files = ( 32 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 33 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 34 | ); 35 | name = "Embed Frameworks"; 36 | runOnlyForDeploymentPostprocessing = 0; 37 | }; 38 | /* End PBXCopyFilesBuildPhase section */ 39 | 40 | /* Begin PBXFileReference section */ 41 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 42 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 43 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 44 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 45 | 78778FEA71F34EEC66983DC7 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 47 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 48 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 49 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 50 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 51 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 52 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 54 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 55 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 56 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 57 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 58 | /* End PBXFileReference section */ 59 | 60 | /* Begin PBXFrameworksBuildPhase section */ 61 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 62 | isa = PBXFrameworksBuildPhase; 63 | buildActionMask = 2147483647; 64 | files = ( 65 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 66 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 67 | 02153E679909923D31BCBD51 /* libPods-Runner.a in Frameworks */, 68 | ); 69 | runOnlyForDeploymentPostprocessing = 0; 70 | }; 71 | /* End PBXFrameworksBuildPhase section */ 72 | 73 | /* Begin PBXGroup section */ 74 | 2001D60057F76DAD20E8196D /* Frameworks */ = { 75 | isa = PBXGroup; 76 | children = ( 77 | 78778FEA71F34EEC66983DC7 /* libPods-Runner.a */, 78 | ); 79 | name = Frameworks; 80 | sourceTree = ""; 81 | }; 82 | 9740EEB11CF90186004384FC /* Flutter */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | 3B80C3931E831B6300D905FE /* App.framework */, 86 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 87 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 88 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 89 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 90 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 91 | ); 92 | name = Flutter; 93 | sourceTree = ""; 94 | }; 95 | 97C146E51CF9000F007C117D = { 96 | isa = PBXGroup; 97 | children = ( 98 | 9740EEB11CF90186004384FC /* Flutter */, 99 | 97C146F01CF9000F007C117D /* Runner */, 100 | 97C146EF1CF9000F007C117D /* Products */, 101 | CB645C21AD5B11512F9D66C7 /* Pods */, 102 | 2001D60057F76DAD20E8196D /* Frameworks */, 103 | ); 104 | sourceTree = ""; 105 | }; 106 | 97C146EF1CF9000F007C117D /* Products */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | 97C146EE1CF9000F007C117D /* Runner.app */, 110 | ); 111 | name = Products; 112 | sourceTree = ""; 113 | }; 114 | 97C146F01CF9000F007C117D /* Runner */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 118 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 119 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 120 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 121 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 122 | 97C147021CF9000F007C117D /* Info.plist */, 123 | 97C146F11CF9000F007C117D /* Supporting Files */, 124 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 125 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 126 | ); 127 | path = Runner; 128 | sourceTree = ""; 129 | }; 130 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 131 | isa = PBXGroup; 132 | children = ( 133 | 97C146F21CF9000F007C117D /* main.m */, 134 | ); 135 | name = "Supporting Files"; 136 | sourceTree = ""; 137 | }; 138 | CB645C21AD5B11512F9D66C7 /* Pods */ = { 139 | isa = PBXGroup; 140 | children = ( 141 | ); 142 | name = Pods; 143 | sourceTree = ""; 144 | }; 145 | /* End PBXGroup section */ 146 | 147 | /* Begin PBXNativeTarget section */ 148 | 97C146ED1CF9000F007C117D /* Runner */ = { 149 | isa = PBXNativeTarget; 150 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 151 | buildPhases = ( 152 | 5341A6EFC2CDCF1B5F31713A /* [CP] Check Pods Manifest.lock */, 153 | 9740EEB61CF901F6004384FC /* Run Script */, 154 | 97C146EA1CF9000F007C117D /* Sources */, 155 | 97C146EB1CF9000F007C117D /* Frameworks */, 156 | 97C146EC1CF9000F007C117D /* Resources */, 157 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 158 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 159 | 0B876F6AE92B02CC78EB088F /* [CP] Embed Pods Frameworks */, 160 | ); 161 | buildRules = ( 162 | ); 163 | dependencies = ( 164 | ); 165 | name = Runner; 166 | productName = Runner; 167 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 168 | productType = "com.apple.product-type.application"; 169 | }; 170 | /* End PBXNativeTarget section */ 171 | 172 | /* Begin PBXProject section */ 173 | 97C146E61CF9000F007C117D /* Project object */ = { 174 | isa = PBXProject; 175 | attributes = { 176 | LastUpgradeCheck = 0910; 177 | ORGANIZATIONNAME = "The Chromium Authors"; 178 | TargetAttributes = { 179 | 97C146ED1CF9000F007C117D = { 180 | CreatedOnToolsVersion = 7.3.1; 181 | DevelopmentTeam = 2R8GD39REK; 182 | ProvisioningStyle = Manual; 183 | SystemCapabilities = { 184 | com.apple.BackgroundModes = { 185 | enabled = 1; 186 | }; 187 | }; 188 | }; 189 | }; 190 | }; 191 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 192 | compatibilityVersion = "Xcode 3.2"; 193 | developmentRegion = English; 194 | hasScannedForEncodings = 0; 195 | knownRegions = ( 196 | English, 197 | en, 198 | Base, 199 | ); 200 | mainGroup = 97C146E51CF9000F007C117D; 201 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 202 | projectDirPath = ""; 203 | projectRoot = ""; 204 | targets = ( 205 | 97C146ED1CF9000F007C117D /* Runner */, 206 | ); 207 | }; 208 | /* End PBXProject section */ 209 | 210 | /* Begin PBXResourcesBuildPhase section */ 211 | 97C146EC1CF9000F007C117D /* Resources */ = { 212 | isa = PBXResourcesBuildPhase; 213 | buildActionMask = 2147483647; 214 | files = ( 215 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 216 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 217 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 218 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 219 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 220 | ); 221 | runOnlyForDeploymentPostprocessing = 0; 222 | }; 223 | /* End PBXResourcesBuildPhase section */ 224 | 225 | /* Begin PBXShellScriptBuildPhase section */ 226 | 0B876F6AE92B02CC78EB088F /* [CP] Embed Pods Frameworks */ = { 227 | isa = PBXShellScriptBuildPhase; 228 | buildActionMask = 2147483647; 229 | files = ( 230 | ); 231 | inputPaths = ( 232 | "${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", 233 | "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework", 234 | ); 235 | name = "[CP] Embed Pods Frameworks"; 236 | outputPaths = ( 237 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework", 238 | ); 239 | runOnlyForDeploymentPostprocessing = 0; 240 | shellPath = /bin/sh; 241 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; 242 | showEnvVarsInLog = 0; 243 | }; 244 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 245 | isa = PBXShellScriptBuildPhase; 246 | buildActionMask = 2147483647; 247 | files = ( 248 | ); 249 | inputPaths = ( 250 | ); 251 | name = "Thin Binary"; 252 | outputPaths = ( 253 | ); 254 | runOnlyForDeploymentPostprocessing = 0; 255 | shellPath = /bin/sh; 256 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 257 | }; 258 | 5341A6EFC2CDCF1B5F31713A /* [CP] Check Pods Manifest.lock */ = { 259 | isa = PBXShellScriptBuildPhase; 260 | buildActionMask = 2147483647; 261 | files = ( 262 | ); 263 | inputPaths = ( 264 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 265 | "${PODS_ROOT}/Manifest.lock", 266 | ); 267 | name = "[CP] Check Pods Manifest.lock"; 268 | outputPaths = ( 269 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 270 | ); 271 | runOnlyForDeploymentPostprocessing = 0; 272 | shellPath = /bin/sh; 273 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 274 | showEnvVarsInLog = 0; 275 | }; 276 | 9740EEB61CF901F6004384FC /* Run Script */ = { 277 | isa = PBXShellScriptBuildPhase; 278 | buildActionMask = 2147483647; 279 | files = ( 280 | ); 281 | inputPaths = ( 282 | ); 283 | name = "Run Script"; 284 | outputPaths = ( 285 | ); 286 | runOnlyForDeploymentPostprocessing = 0; 287 | shellPath = /bin/sh; 288 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 289 | }; 290 | /* End PBXShellScriptBuildPhase section */ 291 | 292 | /* Begin PBXSourcesBuildPhase section */ 293 | 97C146EA1CF9000F007C117D /* Sources */ = { 294 | isa = PBXSourcesBuildPhase; 295 | buildActionMask = 2147483647; 296 | files = ( 297 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 298 | 97C146F31CF9000F007C117D /* main.m in Sources */, 299 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 300 | ); 301 | runOnlyForDeploymentPostprocessing = 0; 302 | }; 303 | /* End PBXSourcesBuildPhase section */ 304 | 305 | /* Begin PBXVariantGroup section */ 306 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 307 | isa = PBXVariantGroup; 308 | children = ( 309 | 97C146FB1CF9000F007C117D /* Base */, 310 | ); 311 | name = Main.storyboard; 312 | sourceTree = ""; 313 | }; 314 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 315 | isa = PBXVariantGroup; 316 | children = ( 317 | 97C147001CF9000F007C117D /* Base */, 318 | ); 319 | name = LaunchScreen.storyboard; 320 | sourceTree = ""; 321 | }; 322 | /* End PBXVariantGroup section */ 323 | 324 | /* Begin XCBuildConfiguration section */ 325 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 326 | isa = XCBuildConfiguration; 327 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 328 | buildSettings = { 329 | ALWAYS_SEARCH_USER_PATHS = NO; 330 | CLANG_ANALYZER_NONNULL = YES; 331 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 332 | CLANG_CXX_LIBRARY = "libc++"; 333 | CLANG_ENABLE_MODULES = YES; 334 | CLANG_ENABLE_OBJC_ARC = YES; 335 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 336 | CLANG_WARN_BOOL_CONVERSION = YES; 337 | CLANG_WARN_COMMA = YES; 338 | CLANG_WARN_CONSTANT_CONVERSION = YES; 339 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 340 | CLANG_WARN_EMPTY_BODY = YES; 341 | CLANG_WARN_ENUM_CONVERSION = YES; 342 | CLANG_WARN_INFINITE_RECURSION = YES; 343 | CLANG_WARN_INT_CONVERSION = YES; 344 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 345 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 346 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 347 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 348 | CLANG_WARN_STRICT_PROTOTYPES = YES; 349 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 350 | CLANG_WARN_UNREACHABLE_CODE = YES; 351 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 352 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 353 | COPY_PHASE_STRIP = NO; 354 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 355 | ENABLE_NS_ASSERTIONS = NO; 356 | ENABLE_STRICT_OBJC_MSGSEND = YES; 357 | GCC_C_LANGUAGE_STANDARD = gnu99; 358 | GCC_NO_COMMON_BLOCKS = YES; 359 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 360 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 361 | GCC_WARN_UNDECLARED_SELECTOR = YES; 362 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 363 | GCC_WARN_UNUSED_FUNCTION = YES; 364 | GCC_WARN_UNUSED_VARIABLE = YES; 365 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 366 | MTL_ENABLE_DEBUG_INFO = NO; 367 | SDKROOT = iphoneos; 368 | TARGETED_DEVICE_FAMILY = "1,2"; 369 | VALIDATE_PRODUCT = YES; 370 | }; 371 | name = Profile; 372 | }; 373 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 374 | isa = XCBuildConfiguration; 375 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 376 | buildSettings = { 377 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 378 | CODE_SIGN_STYLE = Manual; 379 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 380 | DEVELOPMENT_TEAM = 2R8GD39REK; 381 | ENABLE_BITCODE = NO; 382 | FRAMEWORK_SEARCH_PATHS = ( 383 | "$(inherited)", 384 | "$(PROJECT_DIR)/Flutter", 385 | ); 386 | INFOPLIST_FILE = Runner/Info.plist; 387 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 388 | LIBRARY_SEARCH_PATHS = ( 389 | "$(inherited)", 390 | "$(PROJECT_DIR)/Flutter", 391 | ); 392 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterWidgets; 393 | PRODUCT_NAME = "$(TARGET_NAME)"; 394 | PROVISIONING_PROFILE_SPECIFIER = devUse; 395 | VERSIONING_SYSTEM = "apple-generic"; 396 | }; 397 | name = Profile; 398 | }; 399 | 97C147031CF9000F007C117D /* Debug */ = { 400 | isa = XCBuildConfiguration; 401 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 402 | buildSettings = { 403 | ALWAYS_SEARCH_USER_PATHS = NO; 404 | CLANG_ANALYZER_NONNULL = YES; 405 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 406 | CLANG_CXX_LIBRARY = "libc++"; 407 | CLANG_ENABLE_MODULES = YES; 408 | CLANG_ENABLE_OBJC_ARC = YES; 409 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 410 | CLANG_WARN_BOOL_CONVERSION = YES; 411 | CLANG_WARN_COMMA = YES; 412 | CLANG_WARN_CONSTANT_CONVERSION = YES; 413 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 414 | CLANG_WARN_EMPTY_BODY = YES; 415 | CLANG_WARN_ENUM_CONVERSION = YES; 416 | CLANG_WARN_INFINITE_RECURSION = YES; 417 | CLANG_WARN_INT_CONVERSION = YES; 418 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 419 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 420 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 421 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 422 | CLANG_WARN_STRICT_PROTOTYPES = YES; 423 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 424 | CLANG_WARN_UNREACHABLE_CODE = YES; 425 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 426 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 427 | COPY_PHASE_STRIP = NO; 428 | DEBUG_INFORMATION_FORMAT = dwarf; 429 | ENABLE_STRICT_OBJC_MSGSEND = YES; 430 | ENABLE_TESTABILITY = YES; 431 | GCC_C_LANGUAGE_STANDARD = gnu99; 432 | GCC_DYNAMIC_NO_PIC = NO; 433 | GCC_NO_COMMON_BLOCKS = YES; 434 | GCC_OPTIMIZATION_LEVEL = 0; 435 | GCC_PREPROCESSOR_DEFINITIONS = ( 436 | "DEBUG=1", 437 | "$(inherited)", 438 | ); 439 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 440 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 441 | GCC_WARN_UNDECLARED_SELECTOR = YES; 442 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 443 | GCC_WARN_UNUSED_FUNCTION = YES; 444 | GCC_WARN_UNUSED_VARIABLE = YES; 445 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 446 | MTL_ENABLE_DEBUG_INFO = YES; 447 | ONLY_ACTIVE_ARCH = YES; 448 | SDKROOT = iphoneos; 449 | TARGETED_DEVICE_FAMILY = "1,2"; 450 | }; 451 | name = Debug; 452 | }; 453 | 97C147041CF9000F007C117D /* Release */ = { 454 | isa = XCBuildConfiguration; 455 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 456 | buildSettings = { 457 | ALWAYS_SEARCH_USER_PATHS = NO; 458 | CLANG_ANALYZER_NONNULL = YES; 459 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 460 | CLANG_CXX_LIBRARY = "libc++"; 461 | CLANG_ENABLE_MODULES = YES; 462 | CLANG_ENABLE_OBJC_ARC = YES; 463 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 464 | CLANG_WARN_BOOL_CONVERSION = YES; 465 | CLANG_WARN_COMMA = YES; 466 | CLANG_WARN_CONSTANT_CONVERSION = YES; 467 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 468 | CLANG_WARN_EMPTY_BODY = YES; 469 | CLANG_WARN_ENUM_CONVERSION = YES; 470 | CLANG_WARN_INFINITE_RECURSION = YES; 471 | CLANG_WARN_INT_CONVERSION = YES; 472 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 473 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 474 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 475 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 476 | CLANG_WARN_STRICT_PROTOTYPES = YES; 477 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 478 | CLANG_WARN_UNREACHABLE_CODE = YES; 479 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 480 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 481 | COPY_PHASE_STRIP = NO; 482 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 483 | ENABLE_NS_ASSERTIONS = NO; 484 | ENABLE_STRICT_OBJC_MSGSEND = YES; 485 | GCC_C_LANGUAGE_STANDARD = gnu99; 486 | GCC_NO_COMMON_BLOCKS = YES; 487 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 488 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 489 | GCC_WARN_UNDECLARED_SELECTOR = YES; 490 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 491 | GCC_WARN_UNUSED_FUNCTION = YES; 492 | GCC_WARN_UNUSED_VARIABLE = YES; 493 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 494 | MTL_ENABLE_DEBUG_INFO = NO; 495 | SDKROOT = iphoneos; 496 | TARGETED_DEVICE_FAMILY = "1,2"; 497 | VALIDATE_PRODUCT = YES; 498 | }; 499 | name = Release; 500 | }; 501 | 97C147061CF9000F007C117D /* Debug */ = { 502 | isa = XCBuildConfiguration; 503 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 504 | buildSettings = { 505 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 506 | CODE_SIGN_STYLE = Manual; 507 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 508 | DEVELOPMENT_TEAM = 2R8GD39REK; 509 | ENABLE_BITCODE = NO; 510 | FRAMEWORK_SEARCH_PATHS = ( 511 | "$(inherited)", 512 | "$(PROJECT_DIR)/Flutter", 513 | ); 514 | INFOPLIST_FILE = Runner/Info.plist; 515 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 516 | LIBRARY_SEARCH_PATHS = ( 517 | "$(inherited)", 518 | "$(PROJECT_DIR)/Flutter", 519 | ); 520 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterWidgets; 521 | PRODUCT_NAME = "$(TARGET_NAME)"; 522 | PROVISIONING_PROFILE_SPECIFIER = devUse; 523 | VERSIONING_SYSTEM = "apple-generic"; 524 | }; 525 | name = Debug; 526 | }; 527 | 97C147071CF9000F007C117D /* Release */ = { 528 | isa = XCBuildConfiguration; 529 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 530 | buildSettings = { 531 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 532 | CODE_SIGN_STYLE = Manual; 533 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 534 | DEVELOPMENT_TEAM = 2R8GD39REK; 535 | ENABLE_BITCODE = NO; 536 | FRAMEWORK_SEARCH_PATHS = ( 537 | "$(inherited)", 538 | "$(PROJECT_DIR)/Flutter", 539 | ); 540 | INFOPLIST_FILE = Runner/Info.plist; 541 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 542 | LIBRARY_SEARCH_PATHS = ( 543 | "$(inherited)", 544 | "$(PROJECT_DIR)/Flutter", 545 | ); 546 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterWidgets; 547 | PRODUCT_NAME = "$(TARGET_NAME)"; 548 | PROVISIONING_PROFILE_SPECIFIER = devUse; 549 | VERSIONING_SYSTEM = "apple-generic"; 550 | }; 551 | name = Release; 552 | }; 553 | /* End XCBuildConfiguration section */ 554 | 555 | /* Begin XCConfigurationList section */ 556 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 557 | isa = XCConfigurationList; 558 | buildConfigurations = ( 559 | 97C147031CF9000F007C117D /* Debug */, 560 | 97C147041CF9000F007C117D /* Release */, 561 | 249021D3217E4FDB00AE95B9 /* Profile */, 562 | ); 563 | defaultConfigurationIsVisible = 0; 564 | defaultConfigurationName = Release; 565 | }; 566 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 567 | isa = XCConfigurationList; 568 | buildConfigurations = ( 569 | 97C147061CF9000F007C117D /* Debug */, 570 | 97C147071CF9000F007C117D /* Release */, 571 | 249021D4217E4FDB00AE95B9 /* Profile */, 572 | ); 573 | defaultConfigurationIsVisible = 0; 574 | defaultConfigurationName = Release; 575 | }; 576 | /* End XCConfigurationList section */ 577 | }; 578 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 579 | } 580 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildSystemType 6 | Original 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : FlutterAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "GeneratedPluginRegistrant.h" 3 | #import 4 | #import 5 | #import 6 | 7 | @interface AppDelegate() 8 | @property(nonatomic,strong)UIImagePickerController *imagePickerController; 9 | @end 10 | 11 | @implementation AppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application 14 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 15 | [GeneratedPluginRegistrant registerWithRegistry:self]; 16 | [self initFlutterChannel]; 17 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 18 | } 19 | 20 | -(void)initFlutterChannel{ 21 | 22 | FlutterViewController * controller = (FlutterViewController *)self.window.rootViewController; 23 | FlutterMethodChannel * channel = [FlutterMethodChannel methodChannelWithName:@"flutter_widgets_demo" binaryMessenger:controller]; 24 | 25 | __weak typeof (self)wSelf = self; 26 | [channel setMethodCallHandler:^(FlutterMethodCall * _Nonnull call, FlutterResult _Nonnull result) { 27 | 28 | if ([call.method isEqualToString:@"openLibrary"]) { 29 | //打开系统相机 30 | [wSelf openLibrary]; 31 | 32 | }else{ 33 | // @[FlutterMethodNotImplemented]; 34 | } 35 | }]; 36 | 37 | } 38 | -(UIImagePickerController *)imagePickerController{ 39 | if (!_imagePickerController) { 40 | 41 | _imagePickerController = [[UIImagePickerController alloc] init]; 42 | _imagePickerController.delegate = self; 43 | //跳转动画效果 44 | _imagePickerController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; 45 | _imagePickerController.allowsEditing = YES; 46 | } 47 | return _imagePickerController; 48 | } 49 | 50 | -(void)openLibrary{ 51 | UIAlertController *alertCtl =[[UIAlertController alloc]init]; 52 | 53 | UIAlertAction *cancel =[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { 54 | NSLog(@"cancel"); 55 | }]; 56 | UIAlertAction *xiangji =[UIAlertAction actionWithTitle:@"相机" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { 57 | NSLog(@"xiangji"); 58 | 59 | [self openCamera]; 60 | }]; 61 | UIAlertAction *xiangce =[UIAlertAction actionWithTitle:@"相册" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { 62 | NSLog(@"xiangce"); 63 | 64 | [self openPhotoLibrary]; 65 | }]; 66 | 67 | [alertCtl addAction:cancel]; 68 | [alertCtl addAction:xiangji]; 69 | [alertCtl addAction:xiangce]; 70 | 71 | [self.window.rootViewController presentViewController:alertCtl animated:YES completion:nil]; 72 | 73 | 74 | } 75 | 76 | /** 77 | * 调用照相机 78 | */ 79 | -(void)openCamera{ 80 | 81 | //判断是否可以打开照相机 82 | if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]){ 83 | //摄像头 84 | self.imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera; 85 | [self.window.rootViewController presentViewController:self.imagePickerController animated:YES completion:nil]; 86 | } 87 | else{ 88 | NSLog(@"没有摄像头"); 89 | } 90 | } 91 | /** 92 | * 打开相册 93 | */ 94 | -(void)openPhotoLibrary{ 95 | 96 | // 进入相册 97 | if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) 98 | { 99 | self.imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 100 | [self.window.rootViewController presentViewController:self.imagePickerController animated:YES completion:^{ 101 | NSLog(@"打开相册"); 102 | }]; 103 | }else{ 104 | NSLog(@"不能打开相册"); 105 | } 106 | } 107 | #pragma mark - UIImagePickerControllerDelegate 108 | // 拍照完成回调 109 | - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(nullable NSDictionary *)editingInfo NS_DEPRECATED_IOS(2_0, 3_0){ 110 | [picker dismissViewControllerAnimated:YES completion:nil]; 111 | } 112 | 113 | //进入拍摄页面点击取消按钮 114 | - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker{ 115 | [picker dismissViewControllerAnimated:YES completion:nil]; 116 | } 117 | 118 | @end 119 | 120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder4why/flutter_widgets/e5222f588f99d119973813f84d195e017313e530/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | Google 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | flutter_widgets 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | NSAppTransportSecurity 28 | 29 | NSAllowsArbitraryLoads 30 | 31 | NSExceptionDomains 32 | 33 | localhost 34 | 35 | NSExceptionAllowsInsecureHTTPLoads 36 | 37 | 38 | 39 | 40 | NSCameraUsageDescription 41 | 42 | NSPhotoLibraryUsageDescription 43 | 44 | UIBackgroundModes 45 | 46 | fetch 47 | remote-notification 48 | 49 | UILaunchStoryboardName 50 | LaunchScreen 51 | UIMainStoryboardFile 52 | Main 53 | UISupportedInterfaceOrientations 54 | 55 | UIInterfaceOrientationPortrait 56 | UIInterfaceOrientationLandscapeLeft 57 | UIInterfaceOrientationLandscapeRight 58 | 59 | UISupportedInterfaceOrientations~ipad 60 | 61 | UIInterfaceOrientationPortrait 62 | UIInterfaceOrientationPortraitUpsideDown 63 | UIInterfaceOrientationLandscapeLeft 64 | UIInterfaceOrientationLandscapeRight 65 | 66 | UIViewControllerBasedStatusBarAppearance 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /ios/Runner/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char* argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /lib/DetailPage.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'dart:convert'; 3 | import 'package:http/http.dart' as http; 4 | import 'package:toast/toast.dart'; 5 | import 'dart:math'; 6 | import 'package:flutter_walkthrough/flutter_walkthrough.dart'; 7 | import 'package:flutter_walkthrough/walkthrough.dart'; 8 | 9 | class DetailPage extends StatefulWidget { 10 | //外部参数 11 | DetailPage(this.title); 12 | 13 | String title; 14 | 15 | @override 16 | _DetailPageState createState() => _DetailPageState(); 17 | } 18 | 19 | class _DetailPageState extends State 20 | with SingleTickerProviderStateMixin { 21 | AnimationController _controller; 22 | var bsJSon; 23 | String imageUrl = ''; 24 | final List list = [ 25 | Walkthrough( 26 | title: "Title 1", 27 | content: "Content 1", 28 | imageIcon: Icons.restaurant_menu, 29 | ), 30 | Walkthrough( 31 | title: "Title 2", 32 | content: "Content 2", 33 | imageIcon: Icons.search, 34 | ), 35 | Walkthrough( 36 | title: "Title 3", 37 | content: "Content 3", 38 | imageIcon: Icons.shopping_cart, 39 | ), 40 | Walkthrough( 41 | title: "Title 4", 42 | content: "Content 4", 43 | imageIcon: Icons.verified_user, 44 | ), 45 | ]; 46 | 47 | _loadDatas() async { 48 | //https://jsonplaceholder.typicode.com/posts 49 | // http://d.api.budejie.com/topic/list/zuixin/41/bs0315-ios-4.5.9/0-20.json 50 | String dataURL = 51 | "http://d.api.budejie.com/topic/list/zuixin/41/bs0315-ios-4.5.9/0-20.json"; 52 | http.Response response = await http.get(dataURL); 53 | setState(() { 54 | bsJSon = json.decode(response.body); 55 | imageUrl = bsJSon['list'][Random().nextInt(19)]['video']['thumbnail'][0] 56 | .toString(); 57 | }); 58 | 59 | // _alertMegs(bsJSon['list'][Random().nextInt(19)]['video']['thumbnail'][0].toString()); 60 | } 61 | 62 | _alertMegs(String text) { 63 | Toast.show(text, context, 64 | gravity: 0, 65 | backgroundRadius: 4, 66 | backgroundColor: Colors.black87, 67 | duration: 2); 68 | } 69 | 70 | @override 71 | void initState() { 72 | _controller = AnimationController(vsync: this); 73 | super.initState(); 74 | _loadDatas(); 75 | } 76 | 77 | @override 78 | void dispose() { 79 | _controller.dispose(); 80 | super.dispose(); 81 | } 82 | 83 | @override 84 | Widget build(BuildContext context) { 85 | return Material( 86 | child: Scaffold( 87 | appBar: AppBar( 88 | title: Text(widget.title, style: TextStyle(fontSize: 15.0)), 89 | ), 90 | body: Center( 91 | child: IntroScreen(list, null 92 | // new MaterialPageRoute(builder: (context) => null), 93 | ), 94 | // child: Column( 95 | // crossAxisAlignment: CrossAxisAlignment.center, 96 | // mainAxisAlignment: MainAxisAlignment.spaceEvenly, 97 | // children: [ 98 | // Text( 99 | // widget.title, 100 | // style: TextStyle(fontSize: 20.0), 101 | // ), 102 | // ClipRRect( 103 | // borderRadius: BorderRadius.all(Radius.circular(10)), 104 | // child: Image.network( 105 | // imageUrl, 106 | // fit: BoxFit.fitWidth, 107 | // width: 250, 108 | // ), 109 | // ) 110 | // ], 111 | // ), 112 | )), 113 | ); 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'DetailPage.dart'; 3 | import 'package:flutter_widgets/models/WidgetJSON.dart'; 4 | import 'route/flutter_buttons.dart'; 5 | import 'route/flutter_dialogs.dart'; 6 | import 'route/flutter_chips.dart'; 7 | import 'route/flutter_dataTables.dart'; 8 | import 'route/flutter_others.dart'; 9 | import 'route/flutter_interActives.dart'; 10 | import 'route/flutter_dios.dart'; 11 | import 'route/flutter_dios_detail.dart'; 12 | import 'models/dioDatas.dart'; 13 | import 'route/flutter_musics.dart'; 14 | import 'route/flutter_music_detail.dart'; 15 | import 'route/flutter_videos.dart'; 16 | import 'package:flutter/services.dart'; 17 | import 'route/flutter_tuijians.dart'; 18 | import 'route/flutter_listen_music.dart'; 19 | import 'route/flutter_listen_music_detail.dart'; 20 | import 'route/flutter_wynews.dart'; 21 | import 'route/flutter_wynews_detail.dart'; 22 | void main() => runApp(MyApp()); 23 | // 24 | 25 | Color themeColor = Colors.green; 26 | 27 | class MyApp extends StatelessWidget { 28 | static const MaterialColor blackColor = 29 | const MaterialColor(_redPrimaryValue, const { 30 | 200: const Color(0xFFE57373), 31 | 500: const Color(_redPrimaryValue), 32 | }); 33 | static const int _redPrimaryValue = 0xFF333333; 34 | 35 | @override 36 | Widget build(BuildContext context) { 37 | return MaterialApp( 38 | title: 'Flutter Widgets', 39 | theme: ThemeData( 40 | // primarySwatch: blackColor, 41 | primaryColor: blackColor, 42 | ), 43 | debugShowCheckedModeBanner: true, 44 | home: MyHomePage(), 45 | //设置路由: 46 | routes: { 47 | 'DetailPage': (BuildContext context) => new DetailPage(''), 48 | 'FlutterButtons': (BuildContext context) => new FlutterButtons(), 49 | 'FlutterDiaglos': (BuildContext context) => new FlutterDiaglos(), 50 | 'FlutterChips': (BuildContext context) => new FlutterChips(), 51 | 'FlutterDataTables': (BuildContext context) => new FlutterDataTables(0), 52 | 'FlutterOthers': (BuildContext context) => new FlutterOthers(), 53 | 'InterActives': (BuildContext context) => new InterActives(0), 54 | 'DiosDetail': (BuildContext context) => 55 | new DiosDetail(DioData('', '', '', '', '', '', '', '', '', '')), 56 | 'MusicPage': (BuildContext context) => new MusicPage(), 57 | 'MusicDetailPage': (BuildContext context) => new MusicDetailPage(null), 58 | 'VideoPage': (BuildContext context) => new VideoPage(), 59 | 'TuiJianPage': (BuildContext context) => new TuiJianDemo(false), 60 | 'ListenMusicDetailPage': (BuildContext context) => new ListenMusicDetailPage('','',), 61 | 'WYNewsDetailPage': (BuildContext context) =>new WYNewsDetailPage(null), 62 | }, 63 | ); 64 | } 65 | } 66 | 67 | class MyHomePage extends StatefulWidget { 68 | _MyHomePageState createState() => _MyHomePageState(); 69 | } 70 | 71 | class _MyHomePageState extends State 72 | with SingleTickerProviderStateMixin { 73 | static TabController _tabController; 74 | int _currentIndex = 0; 75 | 76 | @override 77 | void initState() { 78 | super.initState(); 79 | _tabController = 80 | new TabController(vsync: this, length: posts.length, initialIndex: 0); 81 | } 82 | 83 | @override 84 | void dispose() { 85 | _tabController.dispose(); 86 | super.dispose(); 87 | } 88 | 89 | _listItems(BuildContext context) { 90 | var listViews = new List(); 91 | // var tabBarViews = new List(); 92 | for (int x = 0; x < posts.length; x++) { 93 | var items = new List(); 94 | if (x == 0) { 95 | items.add(DioWidgets()); 96 | } else if(x==1){ 97 | items.add(TuiJianDemo(true)); 98 | } else if(x==2){ 99 | items.add(WYNewsPage()); 100 | } else { 101 | for (int i = 0; i < posts[x].widgets.length; i++) { 102 | items.add( 103 | GestureDetector( 104 | onTap: () => Navigator.of(context) 105 | .push(new MaterialPageRoute(builder: (context) { 106 | if (x == 7) { 107 | //交互模型 108 | return new InterActives(i); 109 | } else if (x == posts.length - 5) { 110 | return new FlutterButtons(); //按钮 111 | } else if (x == posts.length - 4) { 112 | return new FlutterDiaglos(); //对话框 113 | } else if (x == posts.length - 3) { 114 | return new FlutterChips(); //Chips 115 | } else if (x == posts.length - 2) { 116 | return new FlutterDataTables(i); //列表 117 | } else if (x == posts.length - 1) { 118 | return new FlutterOthers(); //其他 119 | } else { 120 | return new DetailPage(posts[x].widgets[i]); //详情 121 | } 122 | })), 123 | child: Container( 124 | color: Colors.black12, 125 | padding: EdgeInsets.only(left: 2, top: 10, bottom: 10), 126 | margin: EdgeInsets.all(10), 127 | child: Text( 128 | posts[x].widgets[i], 129 | style: TextStyle(fontSize: 17.0), 130 | ), 131 | )), 132 | ); 133 | } 134 | } 135 | listViews.add(new ListView( 136 | children: items, 137 | )); 138 | } 139 | return listViews; 140 | } 141 | 142 | _listTiles() { 143 | var tiles = new List(); 144 | var icons = [Icons.message, Icons.favorite, Icons.settings]; 145 | var titles = ['听音乐', '看视频', '设置']; 146 | for (int i = 0; i < titles.length; i++) { 147 | tiles.add(ListTile( 148 | title: Text( 149 | titles[i], 150 | style: TextStyle(fontSize: 18), 151 | textAlign: TextAlign.left, 152 | ), 153 | trailing: Icon(icons[i], color: Colors.black12, size: 22.0), 154 | onTap: () { i==2?null: 155 | Navigator.of(context) 156 | .push(new MaterialPageRoute(builder: (context) { 157 | return i == 0 ? new MusicPage() : VideoPage(); 158 | })); 159 | })); 160 | } 161 | return tiles; 162 | } 163 | 164 | _drawer() { 165 | return Drawer( 166 | child: ListView( 167 | padding: EdgeInsets.zero, 168 | children: [ 169 | UserAccountsDrawerHeader( 170 | accountName: 171 | Text('Ds.Hpk', style: TextStyle(fontWeight: FontWeight.bold)), 172 | accountEmail: Text('https://gtihub.com/hupingkang'), 173 | currentAccountPicture: CircleAvatar( 174 | backgroundColor: Theme.of(context).primaryColor, 175 | backgroundImage: NetworkImage( 176 | 'https://gss3.bdstatic.com/7Po3dSag_xI4khGkpoWK1HF6hhy/baike/c0%3Dbaike116%2C5%2C5%2C116%2C38/sign=cec6b575a944ad343ab28fd5b1cb6791/d4628535e5dde711cf0a546eafefce1b9c166149.jpg'), 177 | ), 178 | decoration: BoxDecoration( 179 | // color: Colors.green[200], 180 | image: DecorationImage( 181 | image: NetworkImage( 182 | 'https://gss2.bdstatic.com/-fo3dSag_xI4khGkpoWK1HF6hhy/baike/h%3D250/sign=65c54448c4ea15ce5eeee70c86023a25/fcfaaf51f3deb48feaaa8b13fd1f3a292cf5783f.jpg'), 183 | fit: BoxFit.cover, 184 | colorFilter: ColorFilter.mode( 185 | Theme.of(context).primaryColor, BlendMode.hardLight), 186 | ), 187 | ), 188 | ), 189 | _listTiles()[0], 190 | _listTiles()[1], 191 | _listTiles()[2] 192 | ], 193 | ), 194 | ); 195 | } 196 | 197 | _appBars() { 198 | var style = TextStyle(fontSize: 18.0, color: Colors.white); 199 | var items = new List(); 200 | for (int i = 0; i < posts.length; i++) { 201 | items.add(new Tab( 202 | icon: Text( 203 | posts[i].title, 204 | style: style, 205 | ), 206 | )); 207 | } 208 | return new TabBar( 209 | tabs: items, 210 | indicatorColor: Colors.white, 211 | indicatorSize: TabBarIndicatorSize.label, 212 | isScrollable: true, 213 | controller: _tabController, 214 | ); 215 | } 216 | 217 | //调用原生方法:打开系统相机和相册; 218 | _openLibrary() { 219 | MethodChannel channel = MethodChannel('flutter_widgets_demo'); 220 | channel.invokeMethod('openLibrary'); 221 | } 222 | 223 | _appBar(BuildContext context) { 224 | return new DefaultTabController( 225 | length: posts.length, 226 | child: Scaffold( 227 | floatingActionButton: _currentIndex == 1 228 | ? null 229 | : FloatingActionButton( 230 | backgroundColor: Theme.of(context).primaryColor, 231 | onPressed: _openLibrary, 232 | child: Icon( 233 | Icons.camera, 234 | color: Colors.white, 235 | ), 236 | ), 237 | drawer: _currentIndex == 1 ? null : _drawer(), 238 | appBar: _currentIndex == 1 239 | ? null 240 | : AppBar( 241 | title: _appBars() //Text('Flutter Widgets Use'), 242 | // bottom: , 243 | ), 244 | body: _currentIndex == 1 245 | ? ListenMusicPage() 246 | : new TabBarView( 247 | children: _listItems(context), 248 | controller: _tabController, 249 | ), 250 | bottomNavigationBar: BottomNavigationBar( 251 | items: [ 252 | BottomNavigationBarItem( 253 | icon: Icon(Icons.home), title: Text('首页')), 254 | BottomNavigationBarItem( 255 | icon: Icon(Icons.library_music), title: Text('听歌')) 256 | ], 257 | // fixedColor: Colors.red, 258 | type: BottomNavigationBarType.fixed, 259 | currentIndex: _currentIndex, 260 | onTap: (index) { 261 | setState(() { 262 | _currentIndex = index; 263 | }); 264 | }, 265 | ), 266 | )); 267 | } 268 | 269 | @override 270 | Widget build(BuildContext context) { 271 | return _appBar(context); 272 | } 273 | } 274 | -------------------------------------------------------------------------------- /lib/models/BsbdjData.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'dart:convert'; 3 | 4 | class Meida { 5 | final List list; 6 | 7 | Meida(this.list); 8 | 9 | Meida.fromJson(Map json) 10 | : list = json['list']; 11 | 12 | Map toJson() => 13 | { 14 | 'list': list, 15 | }; 16 | 17 | } 18 | 19 | class MediaModel { 20 | final List tags; 21 | MediaModel(this.tags); 22 | 23 | } 24 | 25 | 26 | class TagModel { 27 | final String name; 28 | final String image_list; 29 | 30 | TagModel(this.name,this.image_list); 31 | 32 | } -------------------------------------------------------------------------------- /lib/models/HotModel.dart: -------------------------------------------------------------------------------- 1 | 2 | import '../tools/DioTool.dart'; 3 | 4 | class HotModel { 5 | // type=text : 文字 6 | // type=image : 图片 7 | // type=gif : Gif 8 | // type=video: 视频 9 | String type; 10 | String text; 11 | String username; 12 | String uid; 13 | 14 | String header; 15 | String comment; 16 | String top_commentsVoiceuri; 17 | String top_commentsContent; 18 | 19 | String top_commentsHeader; 20 | String top_commentsName; 21 | String passtime; 22 | String soureid; 23 | 24 | String up; 25 | String down; 26 | String forward; 27 | String image; 28 | 29 | String gif; 30 | String thumbnail; 31 | String video; 32 | 33 | HotModel( 34 | this.type, 35 | this.text, 36 | this.username, 37 | this.uid, 38 | this.header, 39 | this.comment, 40 | this.top_commentsVoiceuri, 41 | this.top_commentsContent, 42 | this.passtime, 43 | this.soureid, 44 | this.up, 45 | this.down, 46 | this.forward, 47 | this.image, 48 | this.gif, 49 | this.thumbnail, 50 | this.video, 51 | ); 52 | 53 | static Future> getHotModels() async { 54 | 55 | Map response = await DioTool.get('https://www.apiopen.top/satinGodApi?type=1&page=1'); 56 | return jsonToModel(response); 57 | } 58 | 59 | 60 | static List jsonToModel(Map repsonse) { 61 | List datas = new List(); 62 | List result = repsonse['data']; 63 | for (int i = 0; i < result.length; i++) { 64 | Map rowData = result[i]; 65 | HotModel dataModel = new HotModel( 66 | rowData['type'].toString(), 67 | rowData['text'], 68 | rowData['username'], 69 | rowData['uid'], 70 | rowData['header'], 71 | rowData['comment'].toString(), 72 | rowData['top_commentsVoiceuri'], 73 | rowData['top_commentsContent'], 74 | rowData['passtime'], 75 | rowData['soureid'].toString(), 76 | rowData['up'].toString(), 77 | rowData['down'].toString(), 78 | rowData['forward'].toString(), 79 | rowData['image'], 80 | rowData['gif'], 81 | rowData['thumbnail'], 82 | rowData['video'], 83 | ); 84 | 85 | datas.add(dataModel); 86 | } 87 | 88 | return datas; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /lib/models/ListenModel.dart: -------------------------------------------------------------------------------- 1 | import '../tools/DioTool.dart'; 2 | class ListenModel{ 3 | 4 | // https://api.apiopen.top/musicRankings 5 | String pic_s210; 6 | String bg_pic; 7 | String pic_s444; 8 | 9 | String count; 10 | String type; 11 | List content; 12 | String name; 13 | 14 | String comment; 15 | String pic_s192; 16 | String pic_s260; 17 | 18 | ListenModel(this.pic_s210, 19 | this.bg_pic, 20 | this.pic_s444, 21 | this.count, 22 | this.type, 23 | this.content, 24 | this.name, 25 | this.comment, 26 | this.pic_s192, 27 | this.pic_s260, 28 | ); 29 | 30 | static Future> getMusics() async { 31 | // https://api.apiopen.top/musicRankings 32 | Map response = await DioTool.get('https://api.apiopen.top/musicRankings'); 33 | return ListenModel.jsonToModel(response); 34 | } 35 | 36 | static List jsonToModel(Map repsonse) { 37 | List datas = new List(); 38 | List result = repsonse['result']; 39 | for (int i = 0; i < result.length; i++) { 40 | Map rowData = result[i]; 41 | List content = new List.from(rowData['content']); 42 | ListenModel dataModel = new ListenModel( 43 | rowData['pic_s210'], 44 | rowData['bg_pic'], 45 | rowData['pic_s444'], 46 | rowData['count'].toString(), 47 | rowData['type'].toString(), 48 | ContentModel.contentToModel(content), 49 | rowData['name'], 50 | rowData['comment'], 51 | rowData['pic_s192'], 52 | rowData['pic_s260'], 53 | ); 54 | 55 | datas.add(dataModel); 56 | } 57 | 58 | return datas; 59 | } 60 | } 61 | 62 | class ContentModel { 63 | String song_id; 64 | String author; 65 | String album_id; 66 | 67 | String pic_small; 68 | String title; 69 | String pic_s260; 70 | 71 | String pic_big; 72 | String album_title; 73 | 74 | ContentModel(this.song_id, 75 | this.author, 76 | this.album_id, 77 | this.pic_small, 78 | this.title, 79 | this.pic_s260, 80 | this.pic_big, 81 | this.album_title); 82 | 83 | static List contentToModel(List content) { 84 | List listModels = new List(); 85 | content.map((f) { 86 | ContentModel model = new ContentModel( 87 | f['song_id'], 88 | f['author'], 89 | f['album_id'], 90 | f['pic_small'], 91 | f['title'], 92 | f['pic_s260'], 93 | f['pic_big'], 94 | f['album_title'],); 95 | listModels.add(model); 96 | }).toList(); 97 | 98 | return listModels; 99 | } 100 | 101 | } 102 | 103 | -------------------------------------------------------------------------------- /lib/models/MusicDetailModel.dart: -------------------------------------------------------------------------------- 1 | import '../tools/DioTool.dart'; 2 | import 'dart:convert'; 3 | class MusicDetailModel{ 4 | 5 | // https://api.apiopen.top/musicRankingsDetails?type=2 6 | String country; 7 | String artist_name; 8 | String language; 9 | 10 | String album_1000_1000; 11 | String pic_huge; 12 | String song_id; 13 | String album_500_500; 14 | 15 | String rank; 16 | String pic_premium; 17 | String si_proxycompany; 18 | 19 | String author; 20 | String all_artist_ting_uid; 21 | String publishtime; 22 | 23 | String album_id; 24 | String pic_big; 25 | String title; 26 | 27 | String lrclink; 28 | String pic_radio; 29 | String pic_s500; 30 | 31 | String pic_small; 32 | String album_title; 33 | 34 | MusicDetailModel(this.country, 35 | this.artist_name, 36 | this.language, 37 | this.album_1000_1000, 38 | this.pic_huge, 39 | this.song_id, 40 | this.album_500_500, 41 | this.rank, 42 | this.pic_premium, 43 | this.si_proxycompany, 44 | 45 | this.author, 46 | this.all_artist_ting_uid, 47 | this.publishtime, 48 | this.album_id, 49 | this.pic_big, 50 | this.title, 51 | this.lrclink, 52 | this.pic_radio, 53 | this.pic_s500, 54 | this.pic_small, 55 | this.album_title, 56 | ); 57 | 58 | static Future> getMusics(String type) async { 59 | // https://api.apiopen.top/musicRankings 60 | Map response = await DioTool.get('https://api.apiopen.top/musicRankingsDetails?type=$type'); 61 | return MusicDetailModel.jsonToModel(response); 62 | } 63 | 64 | static List jsonToModel(Map repsonse) { 65 | List datas = new List(); 66 | List result = repsonse['result']; 67 | for (int i = 0; i < result.length; i++) { 68 | Map rowData = result[i]; 69 | MusicDetailModel dataModel = new MusicDetailModel( 70 | rowData['country'], 71 | rowData['artist_name'], 72 | rowData['language'], 73 | rowData['album_1000_1000'], 74 | rowData['pic_huge'], 75 | rowData['song_id'], 76 | rowData['album_500_500'], 77 | rowData['rank'], 78 | rowData['pic_premium'], 79 | rowData['si_proxycompany'], 80 | rowData['author'], 81 | rowData['all_artist_ting_uid'], 82 | rowData['publishtime'], 83 | rowData['album_id'], 84 | rowData['pic_big'], 85 | rowData['title'], 86 | rowData['lrclink'], 87 | rowData['pic_radio'], 88 | rowData['pic_s500'], 89 | rowData['pic_small'], 90 | rowData['album_title'], 91 | ); 92 | 93 | datas.add(dataModel); 94 | } 95 | 96 | return datas; 97 | } 98 | } 99 | 100 | class MusicXQModel{ 101 | // https://api.apiopen.top/musicDetails?id=604392760 102 | ListsongList; 103 | MusicXQModel(this.songList); 104 | static Future getMusics(String song_id) async { 105 | // https://api.apiopen.top/musicRankings 106 | Map response = await DioTool.get('https://api.apiopen.top/musicDetails?id=$song_id'); 107 | return MusicXQModel.jsonToModel(response); 108 | } 109 | static MusicXQModel jsonToModel(Map repsonse) { 110 | MusicXQModel xqModel = new MusicXQModel([]); 111 | Map result = new Map.from(repsonse['result']); 112 | List songList = new List.from(result['songList']); 113 | for (int i = 0; i < songList.length; i++) { 114 | SongListModel model = SongListModel.jsonToModel(songList[i]); 115 | xqModel.songList.add(model); 116 | } 117 | return xqModel; 118 | } 119 | } 120 | 121 | class SongListModel{ 122 | String songName; 123 | String albumName; 124 | String albumId; 125 | String songPicBig; 126 | 127 | String songLink; 128 | String lrcLink; 129 | String artistName; 130 | 131 | String songPicSmall; 132 | String songPicRadio; 133 | String showLink; 134 | 135 | SongListModel(this.songName, 136 | this.albumName, 137 | this.albumId, 138 | this.songPicBig, 139 | this.songLink, 140 | this.lrcLink, 141 | this.artistName, 142 | this.songPicSmall, 143 | this.songPicRadio, 144 | this.showLink, 145 | ); 146 | 147 | static SongListModel jsonToModel(Map repsonse) { 148 | List datas = new List(); 149 | Map rowData = repsonse; 150 | SongListModel dataModel = new SongListModel( 151 | rowData['songName'], 152 | rowData['albumName'], 153 | rowData['albumId'].toString(), 154 | rowData['songPicBig'], 155 | rowData['songLink'], 156 | rowData['lrcLink'], 157 | rowData['artistName'], 158 | rowData['songPicSmall'], 159 | rowData['songPicRadio'], 160 | rowData['showLink'], 161 | ); 162 | 163 | return dataModel; 164 | } 165 | } -------------------------------------------------------------------------------- /lib/models/WYNewsModel.dart: -------------------------------------------------------------------------------- 1 | import '../tools/DioTool.dart'; 2 | 3 | class WYNewsModel { 4 | List picInfo; 5 | String link; 6 | String source; 7 | String title; 8 | String unlikeReason; 9 | String digest; 10 | String category; 11 | String ptime; 12 | 13 | WYNewsModel( 14 | this.picInfo, 15 | this.link, 16 | this.source, 17 | this.title, 18 | this.unlikeReason, 19 | this.digest, 20 | this.category, 21 | this.ptime, 22 | ); 23 | 24 | static Future> getWYNews() async { 25 | Map response = await DioTool.get('https://www.apiopen.top/journalismApi'); 26 | return WYNewsModel.jsonToModel(response); 27 | } 28 | 29 | static List jsonToModel(Map repsonse) { 30 | List datas = new List(); 31 | Map result = Map.from(repsonse['data']); 32 | 33 | Listtech = List.from(result['tech']); 34 | Listauto = List.from(result['auto']); 35 | Listmoney = List.from(result['money']); 36 | Listsports = List.from(result['sports']); 37 | Listdy = List.from(result['dy']); 38 | Listwar = List.from(result['war']); 39 | Listent = List.from(result['ent']); 40 | Listtoutiao = List.from(result['toutiao']); 41 | 42 | Listresults = new List(); 43 | tech.map((item){ 44 | results.add(item); 45 | }).toList(); 46 | auto.map((item){ 47 | results.add(item); 48 | }).toList(); 49 | money.map((item){ 50 | results.add(item); 51 | }).toList(); 52 | sports.map((item){ 53 | results.add(item); 54 | }).toList(); 55 | dy.map((item){ 56 | results.add(item); 57 | }).toList(); 58 | war.map((item){ 59 | results.add(item); 60 | }).toList(); 61 | ent.map((item){ 62 | results.add(item); 63 | }).toList(); 64 | war.map((item){ 65 | results.add(item); 66 | }).toList(); 67 | 68 | for (int i = 0; i < results.length; i++) { 69 | Map rowData = results[i]; 70 | WYNewsModel dataModel = new WYNewsModel( 71 | PicInfoModel.jsonToModel(List.from(rowData['picInfo'])), 72 | rowData['link']==null?'':rowData['link'], 73 | rowData['source']==null?'':rowData['source'], 74 | rowData['title']==null?'':rowData['title'], 75 | rowData['unlikeReason']==null?'':rowData['unlikeReason'], 76 | rowData["digest"]==null?'':rowData['digest'], 77 | rowData['category']==null?'':rowData['category'], 78 | rowData['ptime']==null?'':rowData['ptime'], 79 | ); 80 | 81 | datas.add(dataModel); 82 | } 83 | 84 | return datas; 85 | } 86 | } 87 | 88 | class PicInfoModel { 89 | String url; 90 | PicInfoModel( 91 | this.url, 92 | ); 93 | 94 | static List jsonToModel(List result) { 95 | List datas = new List(); 96 | for (int i = 0; i < result.length; i++) { 97 | Map rowData = result[i]; 98 | PicInfoModel dataModel = new PicInfoModel( 99 | rowData['url'], 100 | ); 101 | datas.add(dataModel); 102 | } 103 | 104 | return datas; 105 | } 106 | 107 | 108 | } 109 | -------------------------------------------------------------------------------- /lib/models/WidgetJSON.dart: -------------------------------------------------------------------------------- 1 | class Post { 2 | Post({ 3 | this.title, 4 | this.widgets, 5 | }); 6 | 7 | final String title; 8 | final List widgets; 9 | } 10 | 11 | final List posts = [ 12 | Post( 13 | title: '视频', 14 | widgets: [ 15 | ], 16 | ), 17 | Post( 18 | title: '推荐', 19 | widgets: [ 20 | ], 21 | ), 22 | Post( 23 | title: '头条', 24 | widgets: [ 25 | ], 26 | ), 27 | // Post( 28 | // title: 'Material Components', 29 | // widgets: [ 30 | // 'Scaffold', 31 | // 'Appbar', 32 | // 'BottomNavigationBar', 33 | // 'TabBar', 34 | // 'TabBarView', 35 | // 'MaterialApp', 36 | // 'WidgetsApp', 37 | // 'Drawer', 38 | // 'FloatingActionButton', 39 | // 'FlatButton', 40 | // 'IconButton', 41 | // 'RaisedButton', 42 | // 'PopupMenuButton', 43 | // 'ButtonBar', 44 | // 'TextField', 45 | // 'Checkbox', 46 | // 'Radio', 47 | // 'Switch', 48 | // 'Slider', 49 | // 'Date & Time Pickers', 50 | // 'SimpleDialog', 51 | // 'AlertDialog', 52 | // 'BottomSheet', 53 | // 'ExpansionPanel', 54 | // 'SnackBar', 55 | // 'Icon', 56 | // 'Chip', 57 | // 'Tooltip', 58 | // 'DataTable', 59 | // 'Card', 60 | // 'LinearProgressIndicator', 61 | // 'ListTile', 62 | // 'Stepper', 63 | // 'Divider', 64 | // 'FlutterLogo', 65 | // 'Placeholder', 66 | // ], 67 | // ), 68 | // Post( 69 | // title: 'Cupertino(iOS风格的widget)', 70 | // widgets: [ 71 | // 'CupertinoActivityIndicator', 72 | // 'CupertinoAlertDialog', 73 | // 'CupertinoButton', 74 | // 'CupertinoDialog', 75 | // 'CupertinoDialogAction', 76 | // 'CupertinoSlider', 77 | // 'CupertinoSwitch', 78 | // 'CupertinoPageTransition', 79 | // 'CupertinoFullscreenDialogTransition', 80 | // 'CupertinoNavigationBar', 81 | // 'CupertinoTabBar', 82 | // 'CupertinoPageScaffold', 83 | // 'CupertinoTabScaffold', 84 | // 'CupertinoTabView', 85 | // ], 86 | // ), 87 | // Post( 88 | // title: 'Layout', 89 | // widgets: [ 90 | // 'Container', 91 | // 'Row', 92 | // 'Column', 93 | // 'Padding', 94 | // 'Center', 95 | // 'Align', 96 | // 'FittedBox', 97 | // 'AspectRatio', 98 | // 'ConstrainedBox', 99 | // 'Baseline', 100 | // 'FractionallySizedBox', 101 | // 'IntrinsicHeight', 102 | // 'IntrinsicWidth', 103 | // 'LimitedBox', 104 | // 'Offstage', 105 | // 'OverflowBox', 106 | // 'SizedBox', 107 | // 'SizedOverflowBox', 108 | // 'Transform', 109 | // 'CustomSingleChildLayout', 110 | // 'Stack', 111 | // 'IndexedStack', 112 | // 'Flow', 113 | // 'Table', 114 | // 'Wrap', 115 | // 'ListBody', 116 | // 'ListView', 117 | // 'LayoutBuilder', 118 | // ], 119 | // ), 120 | // Post( 121 | // title: 'Text', 122 | // widgets: [ 123 | // 'Text', 124 | // 'RichText', 125 | // 'DefaultTextStyle', 126 | // ], 127 | // ), 128 | // Post( 129 | // title: 'Assets、图片、Icons', 130 | // widgets: [ 131 | // 'Image', 132 | // 'Icon', 133 | // 'RawImage', 134 | // 'AssetBundle', 135 | // ], 136 | // ), 137 | // Post( 138 | // title: 'Input', 139 | // widgets: [ 140 | // 'Form', 141 | // 'FormField', 142 | // 'RawKeyboardListener', 143 | // ], 144 | // ), 145 | // Post( 146 | // title: '动画和Motion', 147 | // widgets: [ 148 | // 'AnimatedContainer', 149 | // 'AnimatedCrossFade', 150 | // 'Hero', 151 | // 'AnimatedBuilder', 152 | // 'DecoratedBoxTransition', 153 | // 'FadeTransition', 154 | // 'PositionedTransition', 155 | // 'RotationTransition', 156 | // 'ScaleTransition', 157 | // 'SizeTransition', 158 | // 'SlideTransition', 159 | // 'AnimatedDefaultTextStyle', 160 | // 'AnimatedListState', 161 | // 'AnimatedModalBarrier', 162 | // 'AnimatedOpacity', 163 | // 'AnimatedPhysicalModel', 164 | // 'AnimatedPositioned', 165 | // 'AnimatedSize', 166 | // 'AnimatedWidget', 167 | // 'AnimatedWidgetBaseState', 168 | // ], 169 | // ), 170 | // Post( 171 | // title: '交互模型', 172 | // widgets: [ 173 | // 'LongPressDraggable', 174 | // 'GestureDetector', 175 | // 'DragTarget', 176 | // 'Dismissible', 177 | // 'IgnorePointer', 178 | // 'AbsorbPointer', 179 | // 'Navigator', 180 | // 'Scrollable', 181 | // ], 182 | // ), 183 | // Post( 184 | // title: '样式', 185 | // widgets: [ 186 | // 'Padding', 187 | // 'Theme', 188 | // 'MediaQuery', 189 | // ], 190 | // ), 191 | // Post( 192 | // title: '绘制和效果', 193 | // widgets: [ 194 | // 'Opacity', 195 | // 'Transform', 196 | // 'DecoratedBox', 197 | // 'FractionalTranslation', 198 | // 'RotatedBox', 199 | // 'ClipOval', 200 | // 'ClipPath', 201 | // 'ClipRect', 202 | // 'CustomPaint', 203 | // 'BackdropFilter', 204 | // ], 205 | // ), 206 | // Post( 207 | // title: 'Async', 208 | // widgets: [ 209 | // 'FutureBuilder', 210 | // 'StreamBuilder', 211 | // ], 212 | // ), 213 | // Post( 214 | // title: '滚动', 215 | // widgets: [ 216 | // 'ListView', 217 | // 'NestedScrollView', 218 | // 'GridView', 219 | // 'SingleChildScrollView', 220 | // 'Scrollable', 221 | // 'Scrollbar', 222 | // 'CustomScrollView', 223 | // 'NotificationListener', 224 | // 'ScrollConfiguration', 225 | // 'RefreshIndicator', 226 | // 'SliverAppBar', 227 | // 'SliverSafeArea', 228 | // ], 229 | // ), 230 | // Post( 231 | // title: '辅助功能', 232 | // widgets: [ 233 | // 'Semantics', 234 | // 'MergeSemantics', 235 | // 'ExcludeSemantics', 236 | // ], 237 | // ), 238 | // Post( 239 | // title: 'Flutter按钮', 240 | // widgets: [ 241 | // 'MaterialButton', 242 | // 'FloatingActionButton', 243 | // 'FlatButton', 244 | // 'IconButton', 245 | // 'RaisedButton', 246 | // 'PopupMenuButton', 247 | // 'ButtonBar', //一组带边距的横排显示按钮 248 | // 'CupertinoButton', 249 | // 'DropdownButton', 250 | // ], 251 | // ), 252 | // Post( 253 | // title: 'Flutter 对话框', 254 | // widgets: [ 255 | // 'SimpleDialog', 256 | // 'AlertDialog', 257 | // 'BottomSheet', 258 | // 'SnackBar', 259 | // 'ExpansionPanel', 260 | // ], 261 | // ), 262 | // Post( 263 | // title: 'Chip Widgets', 264 | // widgets: [ 265 | // 'Chip', 266 | // 'ActionChip', 267 | // 'FilterChip', 268 | // 'ChoiceChip', 269 | // ], 270 | // ), 271 | // Post( 272 | // title: '数据表格', 273 | // widgets: [ 274 | // 'DataTable', 275 | // 'PaginatedDataTable', 276 | // 'Card', 277 | // 'Stepper', 278 | // ], 279 | // ), 280 | // Post( 281 | // title: '其他组件', 282 | // widgets: [ 283 | // 'Slider', 284 | // 'Switch', 285 | // 'SwitchListTile', 286 | // 'DatePicker', 287 | // 'TimePicker', 288 | // 'Radio', 289 | // 'RadioListTile', 290 | // 'CheckBox', 291 | // 'CheckBoxListTile', 292 | // ], 293 | // ), 294 | ]; 295 | -------------------------------------------------------------------------------- /lib/models/dioDatas.dart: -------------------------------------------------------------------------------- 1 | import '../tools/DioTool.dart'; 2 | 3 | class DioData { 4 | final String text; 5 | final String thumbnail; 6 | final String video; 7 | final String up; 8 | 9 | final String down; 10 | final String forword; 11 | final String comment; 12 | 13 | final String header; 14 | final String name; 15 | final String passtime; 16 | 17 | DioData(this.text, this.thumbnail, this.video, this.up, this.down, 18 | this.forword, this.comment, this.header, this.name, this.passtime); 19 | 20 | static Future> getDioData(String url) async { 21 | Map response = await DioTool.get(url); 22 | 23 | return jsonToModel(response); 24 | } 25 | 26 | static List jsonToModel(Map repsonse) { 27 | List datas = new List(); 28 | List result = repsonse['result']; 29 | for (int i = 0; i < result.length; i++) { 30 | Map rowData = result[i]; 31 | DioData dataModel = new DioData( 32 | rowData['text'], 33 | rowData['thumbnail'], 34 | rowData['video'], 35 | rowData['up'], 36 | rowData['down'], 37 | rowData['forward'], 38 | rowData['comment'], 39 | rowData['header'], 40 | rowData['name'], 41 | rowData['passtime'], 42 | ); 43 | 44 | datas.add(dataModel); 45 | } 46 | 47 | return datas; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /lib/models/musicDatas.dart: -------------------------------------------------------------------------------- 1 | import '../tools/DioTool.dart'; 2 | 3 | class MusicModel { 4 | final String author; 5 | final String link; 6 | final String pic; 7 | final String type; 8 | final String title; 9 | final String lrc; 10 | final String songid; 11 | final String url; 12 | 13 | 14 | MusicModel(this.author, this.link, this.pic, this.type, this.title, 15 | this.lrc, this.songid, this.url); 16 | 17 | static Future> getMusicData(String searchText) async { 18 | Map response = await DioTool.get('https://api.apiopen.top/searchMusic?name=$searchText'); 19 | return jsonToModel(response); 20 | } 21 | 22 | static List jsonToModel(Map repsonse) { 23 | List datas = new List(); 24 | List result = repsonse['result']; 25 | for (int i = 0; i < result.length; i++) { 26 | Map rowData = result[i]; 27 | MusicModel dataModel = new MusicModel( 28 | rowData['author'], 29 | rowData['link'], 30 | rowData['pic'], 31 | rowData['type'], 32 | rowData['title'], 33 | rowData['lrc'], 34 | rowData['songid'].toString(), 35 | rowData['url'], 36 | ); 37 | 38 | datas.add(dataModel); 39 | } 40 | 41 | return datas; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /lib/models/post.dart: -------------------------------------------------------------------------------- 1 | class Post { 2 | Post({ 3 | this.title, 4 | this.author, 5 | this.imageUrl, 6 | this.description, 7 | }); 8 | 9 | final String title; 10 | final String author; 11 | final String imageUrl; 12 | final String description; 13 | 14 | bool selected = false; 15 | } 16 | 17 | final List posts = [ 18 | Post( 19 | title: 'Candy Shop', 20 | author: 'Mohamed Chahin', 21 | description: 'Esse ut nulla velit reprehenderit veniam sint nostrud nulla exercitation ipsum. Officia deserunt aliquip aliquip excepteur eiusmod dolor. Elit amet ipsum labore sint occaecat dolore tempor officia irure voluptate ad. Veniam laboris deserunt aute excepteur sit deserunt dolor esse dolor velit sint nulla anim ut. Reprehenderit voluptate adipisicing culpa magna ea nulla ullamco consectetur. Cupidatat adipisicing consequat adipisicing sit consectetur dolor occaecat.', 22 | imageUrl: 'https://resources.ninghao.org/images/candy-shop.jpg', 23 | ), 24 | Post( 25 | title: 'Childhood in a picture', 26 | author: 'Mohamed Chahin', 27 | description: 'Esse ut nulla velit reprehenderit veniam sint nostrud nulla exercitation ipsum. Officia deserunt aliquip aliquip excepteur eiusmod dolor. Elit amet ipsum labore sint occaecat dolore tempor officia irure voluptate ad. Veniam laboris deserunt aute excepteur sit deserunt dolor esse dolor velit sint nulla anim ut. Reprehenderit voluptate adipisicing culpa magna ea nulla ullamco consectetur. Cupidatat adipisicing consequat adipisicing sit consectetur dolor occaecat.', 28 | imageUrl: 'https://resources.ninghao.org/images/childhood-in-a-picture.jpg', 29 | ), 30 | Post( 31 | title: 'Contained', 32 | author: 'Mohamed Chahin', 33 | description: 'Esse ut nulla velit reprehenderit veniam sint nostrud nulla exercitation ipsum. Officia deserunt aliquip aliquip excepteur eiusmod dolor. Elit amet ipsum labore sint occaecat dolore tempor officia irure voluptate ad. Veniam laboris deserunt aute excepteur sit deserunt dolor esse dolor velit sint nulla anim ut. Reprehenderit voluptate adipisicing culpa magna ea nulla ullamco consectetur. Cupidatat adipisicing consequat adipisicing sit consectetur dolor occaecat.', 34 | imageUrl: 'https://resources.ninghao.org/images/contained.jpg', 35 | ), 36 | Post( 37 | title: 'Dragon', 38 | author: 'Mohamed Chahin', 39 | description: 'Esse ut nulla velit reprehenderit veniam sint nostrud nulla exercitation ipsum. Officia deserunt aliquip aliquip excepteur eiusmod dolor. Elit amet ipsum labore sint occaecat dolore tempor officia irure voluptate ad. Veniam laboris deserunt aute excepteur sit deserunt dolor esse dolor velit sint nulla anim ut. Reprehenderit voluptate adipisicing culpa magna ea nulla ullamco consectetur. Cupidatat adipisicing consequat adipisicing sit consectetur dolor occaecat.', 40 | imageUrl: 'https://resources.ninghao.org/images/dragon.jpg', 41 | ), 42 | Post( 43 | title: 'Free Hugs', 44 | author: 'Mohamed Chahin', 45 | description: 'Esse ut nulla velit reprehenderit veniam sint nostrud nulla exercitation ipsum. Officia deserunt aliquip aliquip excepteur eiusmod dolor. Elit amet ipsum labore sint occaecat dolore tempor officia irure voluptate ad. Veniam laboris deserunt aute excepteur sit deserunt dolor esse dolor velit sint nulla anim ut. Reprehenderit voluptate adipisicing culpa magna ea nulla ullamco consectetur. Cupidatat adipisicing consequat adipisicing sit consectetur dolor occaecat.', 46 | imageUrl: 'https://resources.ninghao.org/images/free_hugs.jpg', 47 | ), 48 | Post( 49 | title: 'Gravity Falls', 50 | author: 'Mohamed Chahin', 51 | description: 'Esse ut nulla velit reprehenderit veniam sint nostrud nulla exercitation ipsum. Officia deserunt aliquip aliquip excepteur eiusmod dolor. Elit amet ipsum labore sint occaecat dolore tempor officia irure voluptate ad. Veniam laboris deserunt aute excepteur sit deserunt dolor esse dolor velit sint nulla anim ut. Reprehenderit voluptate adipisicing culpa magna ea nulla ullamco consectetur. Cupidatat adipisicing consequat adipisicing sit consectetur dolor occaecat.', 52 | imageUrl: 'https://resources.ninghao.org/images/gravity-falls.png', 53 | ), 54 | Post( 55 | title: 'Icecream Truck', 56 | author: 'Mohamed Chahin', 57 | description: 'Esse ut nulla velit reprehenderit veniam sint nostrud nulla exercitation ipsum. Officia deserunt aliquip aliquip excepteur eiusmod dolor. Elit amet ipsum labore sint occaecat dolore tempor officia irure voluptate ad. Veniam laboris deserunt aute excepteur sit deserunt dolor esse dolor velit sint nulla anim ut. Reprehenderit voluptate adipisicing culpa magna ea nulla ullamco consectetur. Cupidatat adipisicing consequat adipisicing sit consectetur dolor occaecat.', 58 | imageUrl: 'https://resources.ninghao.org/images/icecreamtruck.png', 59 | ), 60 | Post( 61 | title: 'keyclack', 62 | author: 'Mohamed Chahin', 63 | description: 'Esse ut nulla velit reprehenderit veniam sint nostrud nulla exercitation ipsum. Officia deserunt aliquip aliquip excepteur eiusmod dolor. Elit amet ipsum labore sint occaecat dolore tempor officia irure voluptate ad. Veniam laboris deserunt aute excepteur sit deserunt dolor esse dolor velit sint nulla anim ut. Reprehenderit voluptate adipisicing culpa magna ea nulla ullamco consectetur. Cupidatat adipisicing consequat adipisicing sit consectetur dolor occaecat.', 64 | imageUrl: 'https://resources.ninghao.org/images/keyclack.jpg', 65 | ), 66 | Post( 67 | title: 'Overkill', 68 | author: 'Mohamed Chahin', 69 | description: 'Esse ut nulla velit reprehenderit veniam sint nostrud nulla exercitation ipsum. Officia deserunt aliquip aliquip excepteur eiusmod dolor. Elit amet ipsum labore sint occaecat dolore tempor officia irure voluptate ad. Veniam laboris deserunt aute excepteur sit deserunt dolor esse dolor velit sint nulla anim ut. Reprehenderit voluptate adipisicing culpa magna ea nulla ullamco consectetur. Cupidatat adipisicing consequat adipisicing sit consectetur dolor occaecat.', 70 | imageUrl: 'https://resources.ninghao.org/images/overkill.png', 71 | ), 72 | Post( 73 | title: 'Say Hello to Barry', 74 | author: 'Mohamed Chahin', 75 | description: 'Esse ut nulla velit reprehenderit veniam sint nostrud nulla exercitation ipsum. Officia deserunt aliquip aliquip excepteur eiusmod dolor. Elit amet ipsum labore sint occaecat dolore tempor officia irure voluptate ad. Veniam laboris deserunt aute excepteur sit deserunt dolor esse dolor velit sint nulla anim ut. Reprehenderit voluptate adipisicing culpa magna ea nulla ullamco consectetur. Cupidatat adipisicing consequat adipisicing sit consectetur dolor occaecat.', 76 | imageUrl: 'https://resources.ninghao.org/images/say-hello-to-barry.jpg', 77 | ), 78 | Post( 79 | title: 'Space Skull', 80 | author: 'Mohamed Chahin', 81 | description: 'Esse ut nulla velit reprehenderit veniam sint nostrud nulla exercitation ipsum. Officia deserunt aliquip aliquip excepteur eiusmod dolor. Elit amet ipsum labore sint occaecat dolore tempor officia irure voluptate ad. Veniam laboris deserunt aute excepteur sit deserunt dolor esse dolor velit sint nulla anim ut. Reprehenderit voluptate adipisicing culpa magna ea nulla ullamco consectetur. Cupidatat adipisicing consequat adipisicing sit consectetur dolor occaecat.', 82 | imageUrl: 'https://resources.ninghao.org/images/space-skull.jpg', 83 | ), 84 | Post( 85 | title: 'The Old Fashioned', 86 | author: 'Mohamed Chahin', 87 | description: 'Esse ut nulla velit reprehenderit veniam sint nostrud nulla exercitation ipsum. Officia deserunt aliquip aliquip excepteur eiusmod dolor. Elit amet ipsum labore sint occaecat dolore tempor officia irure voluptate ad. Veniam laboris deserunt aute excepteur sit deserunt dolor esse dolor velit sint nulla anim ut. Reprehenderit voluptate adipisicing culpa magna ea nulla ullamco consectetur. Cupidatat adipisicing consequat adipisicing sit consectetur dolor occaecat.', 88 | imageUrl: 'https://resources.ninghao.org/images/the-old-fashioned.png', 89 | ), 90 | Post( 91 | title: 'Tornado', 92 | author: 'Mohamed Chahin', 93 | description: 'Esse ut nulla velit reprehenderit veniam sint nostrud nulla exercitation ipsum. Officia deserunt aliquip aliquip excepteur eiusmod dolor. Elit amet ipsum labore sint occaecat dolore tempor officia irure voluptate ad. Veniam laboris deserunt aute excepteur sit deserunt dolor esse dolor velit sint nulla anim ut. Reprehenderit voluptate adipisicing culpa magna ea nulla ullamco consectetur. Cupidatat adipisicing consequat adipisicing sit consectetur dolor occaecat.', 94 | imageUrl: 'https://resources.ninghao.org/images/tornado.jpg', 95 | ), 96 | Post( 97 | title: 'Undo', 98 | author: 'Mohamed Chahin', 99 | description: 'Esse ut nulla velit reprehenderit veniam sint nostrud nulla exercitation ipsum. Officia deserunt aliquip aliquip excepteur eiusmod dolor. Elit amet ipsum labore sint occaecat dolore tempor officia irure voluptate ad. Veniam laboris deserunt aute excepteur sit deserunt dolor esse dolor velit sint nulla anim ut. Reprehenderit voluptate adipisicing culpa magna ea nulla ullamco consectetur. Cupidatat adipisicing consequat adipisicing sit consectetur dolor occaecat.', 100 | imageUrl: 'https://resources.ninghao.org/images/undo.jpg', 101 | ), 102 | Post( 103 | title: 'White Dragon', 104 | author: 'Mohamed Chahin', 105 | description: 'Esse ut nulla velit reprehenderit veniam sint nostrud nulla exercitation ipsum. Officia deserunt aliquip aliquip excepteur eiusmod dolor. Elit amet ipsum labore sint occaecat dolore tempor officia irure voluptate ad. Veniam laboris deserunt aute excepteur sit deserunt dolor esse dolor velit sint nulla anim ut. Reprehenderit voluptate adipisicing culpa magna ea nulla ullamco consectetur. Cupidatat adipisicing consequat adipisicing sit consectetur dolor occaecat.', 106 | imageUrl: 'https://resources.ninghao.org/images/white-dragon.jpg', 107 | ) 108 | ]; -------------------------------------------------------------------------------- /lib/models/videoDatas.dart: -------------------------------------------------------------------------------- 1 | import '../tools/DioTool.dart'; 2 | 3 | class VideoModel { 4 | final String text; 5 | final String name; 6 | final String screen_name; 7 | final String profile_image; 8 | final String love; 9 | final String hate; 10 | final String comment; 11 | 12 | final String repost; 13 | final String bookmark; 14 | 15 | final String bimageuri; 16 | 17 | final String videouri; 18 | final String playcount; 19 | final String image1; 20 | 21 | VideoModel( 22 | this.text, 23 | this.name, 24 | this.screen_name, 25 | this.profile_image, 26 | this.love, 27 | this.hate, 28 | this.comment, 29 | this.repost, 30 | this.bookmark, 31 | this.bimageuri, 32 | this.videouri, 33 | this.playcount, 34 | this.image1, 35 | ); 36 | 37 | static Future> getVideoData(int page) async { 38 | Map response = 39 | await DioTool.get('https://www.apiopen.top/satinApi?type=1&page=$page'); 40 | 41 | return jsonToModel(response); 42 | } 43 | 44 | static List jsonToModel(Map repsonse) { 45 | List datas = new List(); 46 | List result = repsonse['data']; 47 | for (int i = 0; i < result.length; i++) { 48 | Map rowData = result[i]; 49 | VideoModel dataModel = new VideoModel( 50 | rowData['text'], 51 | rowData['name'], 52 | rowData['screen_name'], 53 | rowData['profile_image'], 54 | rowData['love'], 55 | rowData['hate'], 56 | rowData['comment'], 57 | rowData['repost'], 58 | rowData['bookmark'], 59 | rowData['bimageuri'], 60 | rowData['videouri'], 61 | rowData['playcount'], 62 | rowData['image1'], 63 | ); 64 | 65 | datas.add(dataModel); 66 | } 67 | 68 | return datas; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /lib/route/flutter_buttons.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:toast/toast.dart'; 3 | import 'package:flutter/cupertino.dart'; 4 | import 'package:flutter/src/material/dropdown.dart'; 5 | 6 | class FlutterButtons extends StatefulWidget { 7 | @override 8 | _FlutterButtonsState createState() => _FlutterButtonsState(); 9 | } 10 | 11 | class _FlutterButtonsState extends State 12 | with SingleTickerProviderStateMixin { 13 | AnimationController _controller; 14 | 15 | @override 16 | void initState() { 17 | _controller = AnimationController(vsync: this); 18 | super.initState(); 19 | } 20 | 21 | @override 22 | void dispose() { 23 | _controller.dispose(); 24 | super.dispose(); 25 | } 26 | // 'MaterialButton', 27 | // 'FloatingActionButton' 28 | // 'FlatButton' 29 | // 'IconButton', 30 | // 'RaisedButton', 31 | // 'PopupMenuButton', 32 | // 'ButtonBar', //一组带边距的横排显示按钮 33 | // 'CupertinoButton', 34 | // 'DropdownButton' 35 | // 'Radio' 36 | @override 37 | Widget build(BuildContext context) { 38 | List getListData() { 39 | List items = new List(); 40 | items.add(DropdownMenuItem(child: Text("北京"), value: "BeiJing")); 41 | items.add(DropdownMenuItem(child: Text("上海"), value: "ShangHai")); 42 | return items; 43 | } 44 | 45 | return Scaffold( 46 | appBar: AppBar( 47 | title: Text('Flutter Buttons', style: TextStyle(fontSize: 20.0)), 48 | ), 49 | body: Column( 50 | crossAxisAlignment: CrossAxisAlignment.center, 51 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 52 | children: [ 53 | MaterialButton(onPressed: (){}, 54 | child: Icon(Icons.directions_boat,color: Colors.purple,), 55 | ), 56 | FloatingActionButton( 57 | onPressed: () {}, 58 | child: Icon( 59 | Icons.add, 60 | color: Colors.white, 61 | ), 62 | ), 63 | FlatButton( 64 | color: Colors.green, 65 | onPressed: () {}, 66 | child: Icon( 67 | Icons.list, 68 | color: Colors.white, 69 | )), 70 | IconButton( 71 | iconSize: 38.0, 72 | color: Colors.purple, 73 | icon: Icon(Icons.cloud), 74 | onPressed: () {}), 75 | RaisedButton( 76 | onPressed: () {}, 77 | child: Icon( 78 | Icons.domain, 79 | color: Colors.white, 80 | ), 81 | color: Colors.brown, 82 | ), 83 | PopupMenuButton( 84 | onSelected: (String value) { 85 | Toast.show(value, context); 86 | }, 87 | itemBuilder: (BuildContext context) => >[ 88 | new PopupMenuItem( 89 | value: "Android-Google", child: new Text("Android")), 90 | new PopupMenuItem( 91 | value: "iOS-Apple", child: new Text("iOS")) 92 | ]), 93 | ButtonBar( 94 | alignment: MainAxisAlignment.center, 95 | children: [ 96 | OutlineButton.icon( 97 | onPressed: () {}, 98 | icon: Icon( 99 | Icons.local_shipping, 100 | color: Colors.green, 101 | ), 102 | label: Text( 103 | 'A', 104 | style: TextStyle(color: Colors.green), 105 | )), 106 | OutlineButton.icon( 107 | onPressed: () {}, 108 | icon: Icon( 109 | Icons.local_shipping, 110 | color: Colors.green, 111 | ), 112 | label: Text( 113 | 'B', 114 | style: TextStyle(color: Colors.green), 115 | )), 116 | ], 117 | ), 118 | CupertinoButton( 119 | child: Icon( 120 | Icons.spa, 121 | color: Colors.teal, 122 | ), 123 | onPressed: () {}), 124 | DropdownButton( 125 | items: getListData(), 126 | hint: new Text('下拉选择你想要的数据'), 127 | //当没有默认值的时候可以设置的提示 128 | // value: '下拉', 129 | //下拉菜单选择完之后显示给用户的值 130 | onChanged: (T) { 131 | Toast.show(T, context); 132 | }, 133 | elevation: 24, 134 | //设置阴影的高度 135 | style: new TextStyle( 136 | //设置文本框里面文字的样式 137 | color: Colors.purple, 138 | fontWeight: FontWeight.bold, 139 | ), 140 | isDense: false, 141 | //减少按钮的高度。默认情况下,此按钮的高度与其菜单项的高度相同。如果isDense为true,则按钮的高度减少约一半。 这个当按钮嵌入添加的容器中时,非常有用 142 | iconSize: 35.0, //设置三角标icon的大小 143 | ), 144 | ], 145 | ), 146 | ); 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /lib/route/flutter_chips.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:toast/toast.dart'; 3 | 4 | class FlutterChips extends StatefulWidget { 5 | @override 6 | _FlutterChipsState createState() => _FlutterChipsState(); 7 | } 8 | 9 | class _FlutterChipsState extends State 10 | with SingleTickerProviderStateMixin { 11 | List texts; 12 | List images; 13 | List colors; 14 | List selected; 15 | int selectIndex = 0; 16 | @override 17 | void initState() { 18 | // TODO: implement initState 19 | super.initState(); 20 | _resetData(); 21 | } 22 | 23 | _resetData() { 24 | selected = new List(); 25 | texts = [ 26 | 'Apple', 27 | 'Google', 28 | 'Amazon', 29 | ]; 30 | images = [ 31 | 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1552970295055&di=79f268bfaf1b9a14fbf671c9b6895470&imgtype=0&src=http%3A%2F%2Fimg0.pconline.com.cn%2Fpconline%2F1508%2F27%2F6879418_1955_thumb.jpg', 32 | 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1552970295055&di=cd93cf1cc9861e5304b2aa4604fc146e&imgtype=0&src=http%3A%2F%2Fimg0.pconline.com.cn%2Fpconline%2F1511%2F29%2F7257120_901_thumb.jpg', 33 | 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1552970295050&di=e4dfff4fa62228ad343e81f78447ccef&imgtype=0&src=http%3A%2F%2Fpic85.nipic.com%2Ffile%2F20151217%2F19738529_153944186231_2.jpg', 34 | ]; 35 | colors = [ 36 | Colors.red, 37 | Colors.grey, 38 | Colors.teal, 39 | ]; 40 | } 41 | 42 | _chips() { 43 | var chips = new List(); 44 | for (int i = 0; i < colors.length; i++) { 45 | String text = texts[i]; 46 | Color color = colors[i]; 47 | String image = images[i]; 48 | chips.add(Chip( 49 | label: Text( 50 | text, 51 | style: TextStyle(color: Colors.white), 52 | ), 53 | avatar: i==0?CircleAvatar(backgroundImage: NetworkImage(image)):null, 54 | backgroundColor: color, 55 | deleteButtonTooltipMessage: 'Delete', 56 | deleteIcon: i==1?Icon( 57 | Icons.delete_forever, 58 | color: Colors.white, 59 | ):null, 60 | onDeleted: () { 61 | setState(() { 62 | colors.remove(color); 63 | texts.remove(text); 64 | images.remove(image); 65 | }); 66 | }, 67 | )); 68 | chips.add(SizedBox( 69 | width: 8, 70 | )); 71 | } 72 | return chips; 73 | } 74 | 75 | _actionChips() { 76 | List actionChips = new List(); 77 | actionChips.add(Divider( 78 | color: Colors.grey, 79 | height: 32.0, 80 | )); 81 | for (int i = 0; i < colors.length; i++) { 82 | actionChips.add(ActionChip( 83 | label: Text(texts[i]), 84 | onPressed: () { 85 | Toast.show(texts[i], context); 86 | })); 87 | actionChips.add(SizedBox( 88 | width: 8, 89 | )); 90 | } 91 | 92 | return actionChips; 93 | } 94 | 95 | _filterChips() { 96 | List filterChips = new List(); 97 | filterChips.add(Divider( 98 | color: Colors.grey, 99 | height: 32.0, 100 | )); 101 | 102 | for (int i = 0; i < texts.length; i++) { 103 | filterChips.add(FilterChip( 104 | label: Text(texts[i]), 105 | selected: selected.contains(texts[i]), 106 | onSelected: (value) { 107 | Toast.show(texts[i], context); 108 | setState(() { 109 | if (selected.contains(texts[i])) { 110 | selected.remove(texts[i]); 111 | } else { 112 | selected.add(texts[i]); 113 | } 114 | }); 115 | }, 116 | )); 117 | filterChips.add(SizedBox( 118 | width: 8, 119 | )); 120 | } 121 | 122 | return filterChips; 123 | } 124 | 125 | _choiceChips() { 126 | List choiceChips = new List(); 127 | choiceChips.add(Divider( 128 | color: Colors.grey, 129 | height: 32.0, 130 | )); 131 | 132 | for (int i = 0; i < texts.length; i++) { 133 | choiceChips.add(ChoiceChip( 134 | backgroundColor: Colors.grey, 135 | label: Text(texts[i],style: TextStyle(color: Colors.white),), 136 | selected: selectIndex == i, 137 | selectedColor: Colors.black, 138 | onSelected: (value) { 139 | setState(() { 140 | selectIndex = i; 141 | }); 142 | }, 143 | )); 144 | choiceChips.add(SizedBox( 145 | width: 8, 146 | )); 147 | } 148 | 149 | return choiceChips; 150 | } 151 | 152 | _widgets() { 153 | List widgets = new List(); 154 | _chips().map((chip) { 155 | widgets.add(chip); 156 | }).toList(); 157 | _actionChips().map((item) { 158 | widgets.add(item); 159 | }).toList(); 160 | 161 | _filterChips().map((item) { 162 | widgets.add(item); 163 | }).toList(); 164 | 165 | _choiceChips().map((item){ 166 | widgets.add(item); 167 | }).toList(); 168 | return widgets; 169 | } 170 | 171 | @override 172 | Widget build(BuildContext context) { 173 | return Scaffold( 174 | floatingActionButton: FloatingActionButton( 175 | onPressed: () { 176 | setState(() { 177 | _resetData(); 178 | }); 179 | }, 180 | backgroundColor: Colors.red, 181 | child: Icon( 182 | Icons.refresh, 183 | color: Colors.white, 184 | ), 185 | ), 186 | appBar: AppBar( 187 | title: Text('Flutter Chips', style: TextStyle(fontSize: 20.0)), 188 | ), 189 | body: Container( 190 | padding: EdgeInsets.symmetric(horizontal: 10), 191 | child: Column( 192 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 193 | children: [ 194 | Wrap( 195 | children: _widgets(), 196 | ) 197 | ], 198 | )), 199 | ); 200 | } 201 | } 202 | -------------------------------------------------------------------------------- /lib/route/flutter_dataTables.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_widgets/models/post.dart'; 3 | 4 | class FlutterDataTables extends StatefulWidget { 5 | //外部参数 6 | FlutterDataTables(this.selectIndex); 7 | 8 | int selectIndex; 9 | 10 | @override 11 | _FlutterDataTablesState createState() => _FlutterDataTablesState(); 12 | } 13 | 14 | //'DataTable', 15 | //'PaginatedDataTable', 16 | //'Card', 17 | //'Stepper', 18 | class _FlutterDataTablesState extends State 19 | with SingleTickerProviderStateMixin { 20 | int stepSelectIndex = 0; 21 | 22 | _dataTableWidgets() { 23 | return DataTable( 24 | columns: [ 25 | DataColumn( 26 | label: Text('Title'), 27 | ), 28 | DataColumn( 29 | label: Text('Author'), 30 | ), 31 | DataColumn( 32 | label: Text('Image'), 33 | ), 34 | ], 35 | rows: posts.map((f) { 36 | return DataRow(cells: [ 37 | DataCell(Text(f.title)), 38 | DataCell(Text(f.author)), 39 | DataCell(Image.network(f.imageUrl)), 40 | ]); 41 | }).toList()); 42 | } 43 | 44 | _paginatedDataTable() { 45 | return PaginatedDataTable( 46 | header: Text('Hello Flutter'), 47 | columns: [ 48 | DataColumn( 49 | label: Text('Title'), 50 | ), 51 | DataColumn( 52 | label: Text('Image'), 53 | ), 54 | ], 55 | source: DataSource()); 56 | } 57 | 58 | _card() { 59 | return Column( 60 | children: posts.map((p) { 61 | return Card( 62 | child: Column( 63 | children: [ 64 | AspectRatio( 65 | aspectRatio: 16 / 9, 66 | child: Image.network( 67 | p.imageUrl, 68 | fit: BoxFit.cover, 69 | ), 70 | ), 71 | ListTile( 72 | leading: CircleAvatar( 73 | backgroundImage: NetworkImage(p.imageUrl), 74 | ), 75 | title: Text(p.title), 76 | subtitle: Text(p.author), 77 | ), 78 | Container( 79 | padding: EdgeInsets.all(16.0), 80 | child: Text( 81 | p.description, 82 | maxLines: 2, 83 | overflow: TextOverflow.ellipsis, 84 | ), 85 | ), 86 | ButtonTheme.bar( 87 | child: ButtonBar( 88 | children: [ 89 | FlatButton( 90 | onPressed: null, 91 | child: Text( 92 | 'LIKE', 93 | style: TextStyle(color: Colors.blue), 94 | )), 95 | FlatButton( 96 | onPressed: null, 97 | child: Text( 98 | 'READ', 99 | style: TextStyle(color: Colors.blue), 100 | )) 101 | ], 102 | ), 103 | ) 104 | ], 105 | ), 106 | ); 107 | }).toList(), 108 | ); 109 | } 110 | 111 | _stepper() { 112 | return Stepper( 113 | type: StepperType.vertical, 114 | currentStep: stepSelectIndex, 115 | onStepTapped: (int index) { 116 | setState(() { 117 | stepSelectIndex = index; 118 | }); 119 | }, 120 | onStepCancel: () {}, 121 | onStepContinue: () {}, 122 | steps: posts.map((post) { 123 | return Step( 124 | title: Text(post.title), 125 | subtitle: Text(post.author), 126 | content: Image.network(post.imageUrl), 127 | isActive: posts.indexOf(post) == stepSelectIndex); 128 | }).toList(), 129 | ); 130 | } 131 | 132 | _widgets() { 133 | List widgets = [ 134 | _dataTableWidgets(), 135 | _paginatedDataTable(), 136 | _card(), 137 | _stepper() 138 | ]; 139 | return widgets[widget.selectIndex]; 140 | } 141 | 142 | @override 143 | Widget build(BuildContext context) { 144 | return Scaffold( 145 | appBar: AppBar( 146 | title: Text('Flutter DataTables', style: TextStyle(fontSize: 20.0)), 147 | ), 148 | body: ListView( 149 | children: [ 150 | Column( 151 | crossAxisAlignment: CrossAxisAlignment.center, 152 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 153 | children: [_widgets()], 154 | ) 155 | ], 156 | ), 157 | ); 158 | } 159 | } 160 | 161 | class DataSource extends DataTableSource { 162 | /*数据源*/ 163 | final List _desserts = posts; 164 | 165 | int selectCount = 0; 166 | 167 | @override 168 | // TODO: implement isRowCountApproximate 169 | bool get isRowCountApproximate => false; 170 | 171 | @override 172 | // TODO: implement rowCount 173 | int get rowCount => posts.length; 174 | 175 | @override 176 | // TODO: implement selectedRowCount 177 | int get selectedRowCount => selectCount; 178 | 179 | @override 180 | DataRow getRow(int index) { 181 | // TODO: implement getRow 182 | if (index >= posts.length) { 183 | return null; 184 | } else { 185 | final Post p = posts[index]; 186 | return DataRow.byIndex( 187 | index: index, 188 | selected: p.selected, 189 | onSelectChanged: (value) { 190 | if (p.selected != value) { 191 | selectCount += value ? 1 : -1; 192 | p.selected = value; 193 | } 194 | }, 195 | cells: [ 196 | DataCell(Text('${p.title}')), 197 | // DataCell(Text('${p.author}')), 198 | DataCell(Image.network(p.imageUrl)), 199 | ], 200 | ); 201 | } 202 | } 203 | } 204 | -------------------------------------------------------------------------------- /lib/route/flutter_dialogs.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/src/widgets/navigator.dart'; 3 | //import 'package:flutter/src/animation/animation.dart'; 4 | 5 | class FlutterDiaglos extends StatefulWidget { 6 | @override 7 | _FlutterDiaglosState createState() => _FlutterDiaglosState(); 8 | } 9 | 10 | class _FlutterDiaglosState extends State 11 | with SingleTickerProviderStateMixin { 12 | @override 13 | Widget build(BuildContext context) { 14 | _simpleDiaglos() { 15 | return SimpleDialog( 16 | title: Text('SimpleDialog'), 17 | children: [ 18 | SimpleDialogOption( 19 | child: Text('Options A'), 20 | onPressed: () { 21 | Navigator.pop(context); 22 | }, 23 | ), 24 | SimpleDialogOption( 25 | child: Text('Options B'), 26 | onPressed: () { 27 | Navigator.pop(context); 28 | }, 29 | ), 30 | ], 31 | ); 32 | } 33 | 34 | _alertDialogs() { 35 | return AlertDialog( 36 | title: Text('SimpleDialog'), 37 | content: SingleChildScrollView( 38 | child: ListBody( 39 | children: [ 40 | Text('静夜诗'), 41 | Text('床前明月光'), 42 | Text('疑是地上霜'), 43 | Text('举头望明月'), 44 | Text('低头思故乡'), 45 | ], 46 | ), 47 | ), 48 | actions: [ 49 | FlatButton( 50 | onPressed: () { 51 | Navigator.pop(context); 52 | }, 53 | child: Text('确定')), 54 | ], 55 | ); 56 | } 57 | 58 | _showSimpleDialogs() { 59 | showDialog( 60 | context: context, 61 | builder: (BuildContext context) { 62 | return _simpleDiaglos(); 63 | }); 64 | } 65 | 66 | _showAlertDialogs() { 67 | showDialog( 68 | context: context, 69 | builder: (BuildContext context) { 70 | return _alertDialogs(); 71 | }); 72 | } 73 | 74 | _listTiles() { 75 | var tiles = new List(); 76 | var icons = [Icons.message, Icons.favorite, Icons.settings]; 77 | var titles = ['Messages', 'Favorite', 'Settings']; 78 | for (int i = 0; i < titles.length; i++) { 79 | tiles.add(ListTile( 80 | title: Text( 81 | titles[i], 82 | textAlign: TextAlign.left, 83 | ), 84 | trailing: Icon(icons[i], color: Colors.black12, size: 22.0), 85 | onTap: () => Navigator.pop(context), 86 | )); 87 | } 88 | return tiles; 89 | } 90 | 91 | _showBottomSheet() { 92 | showModalBottomSheet( 93 | context: context, 94 | builder: (BuildContext context) { 95 | return new BottomSheet( 96 | onClosing: () {}, 97 | builder: (BuildContext context) { 98 | return Container( 99 | height: 240, 100 | child: Column( 101 | children: _listTiles(), 102 | ), 103 | ); 104 | }, 105 | ); 106 | }); 107 | } 108 | 109 | var _scaffoldkey = new GlobalKey(); 110 | 111 | _showSnackBar() { 112 | _scaffoldkey.currentState.showSnackBar(SnackBar( 113 | // backgroundColor: Colors.red, 114 | content: Text( 115 | 'Processing...', 116 | style: TextStyle(color: Colors.white, fontSize: 24.0), 117 | ), 118 | action: SnackBarAction( 119 | textColor: Colors.white, label: 'Ok', onPressed: () {}), 120 | )); 121 | } 122 | 123 | _pannel() { 124 | var _isExp = false; 125 | return // 126 | Container( 127 | padding: EdgeInsets.symmetric(horizontal: 20), 128 | child: ExpansionPanelList( 129 | expansionCallback: ((index, exp) { 130 | setState(() { 131 | _isExp = !_isExp; 132 | }); 133 | }), 134 | children: [ 135 | new ExpansionPanel( 136 | isExpanded: _isExp, 137 | body: new Padding( 138 | padding: EdgeInsets.all(10.0), 139 | child: new ListBody( 140 | children: [ 141 | new Text('这是标题A的内容'), 142 | ], 143 | ), 144 | ), 145 | headerBuilder: (context, isExpanded) { 146 | return new ListTile( 147 | title: new Text('这是标题A'), 148 | ); 149 | }), 150 | ], 151 | )); 152 | } 153 | 154 | _flats() { 155 | return [ 156 | FlatButton( 157 | onPressed: _showSimpleDialogs, 158 | color: Colors.green, 159 | child: Text( 160 | 'SimpleDialog', 161 | style: TextStyle(color: Colors.white), 162 | )), 163 | FlatButton( 164 | onPressed: _showAlertDialogs, 165 | color: Colors.green, 166 | child: Text( 167 | 'AlertDialog', 168 | style: TextStyle(color: Colors.white), 169 | )), 170 | FlatButton( 171 | onPressed: _showBottomSheet, 172 | color: Colors.green, 173 | child: Text( 174 | 'BottomSheet', 175 | style: TextStyle(color: Colors.white), 176 | )), 177 | FlatButton( 178 | onPressed: _showSnackBar, 179 | color: Colors.green, 180 | child: Text( 181 | 'SnackBar', 182 | style: TextStyle(color: Colors.white), 183 | )), 184 | _pannel(), 185 | ]; 186 | } 187 | 188 | return Scaffold( 189 | key: _scaffoldkey, 190 | appBar: AppBar( 191 | title: Text('Flutter Dialogs', style: TextStyle(fontSize: 20.0)), 192 | ), 193 | body: Container( 194 | child: Column( 195 | crossAxisAlignment: CrossAxisAlignment.center, 196 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 197 | children: _flats(), 198 | )), 199 | ); 200 | } 201 | } 202 | -------------------------------------------------------------------------------- /lib/route/flutter_dios.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../models/dioDatas.dart'; 3 | import 'flutter_dios_detail.dart'; 4 | import 'dart:math'; 5 | import "package:pulltorefresh_flutter/pulltorefresh_flutter.dart"; 6 | 7 | class DioWidgets extends StatefulWidget { 8 | @override 9 | _DioWidgetsState createState() => _DioWidgetsState(); 10 | } 11 | 12 | class _DioWidgetsState extends State 13 | with SingleTickerProviderStateMixin { 14 | int currentIndex = Random().nextInt(20) % 10; 15 | List datas = new List(); 16 | ScrollController _scrollController = ScrollController(); //listview的控制器 17 | bool isLoading = false; //是否正在加载数据 18 | bool isTop = true; 19 | 20 | Future _requestData() async { 21 | currentIndex++; 22 | List responses = await DioData.getDioData( 23 | 'https://api.apiopen.top/getJoke?page=$currentIndex&count=10&type=video'); 24 | if (responses.length == 0) { 25 | return; 26 | } 27 | setState(() { 28 | isLoading = false; 29 | responses.map((f) { 30 | datas.add(f); 31 | }).toList(); 32 | }); 33 | } 34 | 35 | Future _loadMore() async { 36 | setState(() { 37 | isLoading = true; 38 | }); 39 | await Future.delayed(Duration(seconds: 1), () { 40 | _requestData(); 41 | }); 42 | } 43 | 44 | @override 45 | void initState() { 46 | super.initState(); 47 | _requestData(); 48 | _scrollController.addListener(() { 49 | if (_scrollController.position.pixels == 50 | _scrollController.position.maxScrollExtent) { 51 | setState(() { 52 | isTop = false; 53 | }); 54 | print('滑动到了最底部'); 55 | _loadMore(); 56 | } else if (_scrollController.position.pixels == 57 | _scrollController.position.minScrollExtent) { 58 | setState(() { 59 | isTop = true; 60 | }); 61 | print('滑动到了最顶部'); 62 | _loadMore(); 63 | } 64 | }); 65 | } 66 | 67 | _content(int index) { 68 | return Container( 69 | // padding: EdgeInsets.only(bottom: 5), 70 | width: MediaQuery.of(context).size.width, 71 | child: Column( 72 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 73 | crossAxisAlignment: CrossAxisAlignment.center, 74 | children: [ 75 | ListTile( 76 | leading: ClipRRect( 77 | borderRadius: BorderRadius.all(Radius.circular(20.0)), 78 | child: Image.network( 79 | datas[index].header, 80 | width: 40, 81 | height: 40, 82 | fit: BoxFit.cover, 83 | ), 84 | ), 85 | title: Text( 86 | datas[index].name, 87 | style: TextStyle(color: Colors.white70, fontSize: 14.0), 88 | ), 89 | subtitle: Text( 90 | datas[index].text, 91 | style: TextStyle(color: Colors.grey, fontSize: 12.0), 92 | ), 93 | ), 94 | Image.network( 95 | datas[index].thumbnail, 96 | fit: BoxFit.none, 97 | // height: 400, 98 | ), 99 | SizedBox( 100 | height: 10, 101 | ), 102 | Row( 103 | crossAxisAlignment: CrossAxisAlignment.center, 104 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 105 | children: _bottoms(datas[index]), 106 | ), 107 | SizedBox( 108 | height: 10, 109 | ), 110 | Divider( 111 | height: 0.5, 112 | color: Colors.grey.withOpacity(0.5), 113 | ) 114 | ], 115 | ), 116 | ); 117 | } 118 | 119 | @override 120 | void dispose() { 121 | super.dispose(); 122 | _scrollController.dispose(); 123 | } 124 | 125 | Widget _listItemBuilder(BuildContext context, int index) { 126 | return index < datas.length 127 | ? GestureDetector( 128 | child: _content(index), 129 | onTap: () { 130 | Navigator.of(context) 131 | .push(new MaterialPageRoute(builder: (context) { 132 | return DiosDetail(datas[index]); 133 | })); 134 | }, 135 | ) 136 | : havaNoMore(); 137 | } 138 | 139 | _bottoms(DioData dataModel) { 140 | List modelDatas = [ 141 | dataModel.up, 142 | dataModel.down, 143 | dataModel.forword, 144 | dataModel.comment 145 | ]; 146 | List iCons = [ 147 | Icons.thumb_up, 148 | Icons.thumb_down, 149 | Icons.forward, 150 | Icons.comment 151 | ]; 152 | 153 | List widgets = new List(); 154 | for (int i = 0; i < modelDatas.length; i++) { 155 | widgets.add(Container( 156 | height: 30, 157 | child: Row( 158 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 159 | crossAxisAlignment: CrossAxisAlignment.center, 160 | children: [ 161 | Icon( 162 | iCons[i], 163 | size: 15, 164 | color: Colors.grey, 165 | ), 166 | SizedBox( 167 | width: 10, 168 | ), 169 | Text( 170 | modelDatas[i].toString(), 171 | style: TextStyle(color: Colors.grey, fontSize: 14.0), 172 | ), 173 | ], 174 | ), 175 | )); 176 | } 177 | 178 | return widgets; 179 | } 180 | 181 | Widget havaNoMore() { 182 | return Container( 183 | alignment: Alignment.center, 184 | child: isLoading 185 | ? SizedBox( 186 | height: 180, 187 | child: Column( 188 | children: [ 189 | SizedBox( 190 | height: 10, 191 | ), 192 | Container( 193 | // height: 60, 194 | child: CircularProgressIndicator( 195 | strokeWidth: 3, 196 | backgroundColor: Theme.of(context).primaryColor, 197 | ), 198 | ), 199 | Container( 200 | height: 30, 201 | alignment: Alignment.center, 202 | child: Text( 203 | '正在拼命加载中...', 204 | textAlign: TextAlign.center, 205 | style: TextStyle(color: Colors.grey, fontSize: 15.0), 206 | ), 207 | ) 208 | ], 209 | ), 210 | ) 211 | : isTop 212 | ? null 213 | : Column( 214 | children: [ 215 | Padding( 216 | padding: const EdgeInsets.only(top: 18.0, bottom: 30.0), 217 | child: Text( 218 | "没有更过内容了,去别的地方看看吧(^_^)", 219 | style: TextStyle( 220 | fontSize: 18.0, 221 | fontWeight: FontWeight.bold, 222 | color: Colors.grey), 223 | ), 224 | ) 225 | ], 226 | ), 227 | ); 228 | } 229 | 230 | _onOffsetCallback() { 231 | // return PullAndPush(loadData: null, scrollPhysicsChanged: null, listView: null) 232 | } 233 | 234 | Future _onRefresh(bool refresh) async {} 235 | 236 | _scrollPhysicsChanged(ScrollPhysics physics) { 237 | print('状态改变了:${physics.toString()}'); 238 | // if(physics==NeverScrollableScrollPhysics){ 239 | // //正在下来 240 | // _loadMore(); 241 | // }else{ 242 | // 243 | // } 244 | return ''; 245 | } 246 | 247 | @override 248 | Widget build(BuildContext context) { 249 | return Container( 250 | height: MediaQuery.of(context).size.height - 127, 251 | // color: Colors.black, 252 | child: ListView.builder( 253 | controller: _scrollController, 254 | padding: new EdgeInsets.all(3), 255 | itemCount: datas.length + 1, 256 | // itemExtent: 50.0, 257 | itemBuilder: _listItemBuilder, 258 | ), 259 | ); 260 | } 261 | } 262 | /** 263 | * PullAndPush( 264 | headerRefreshBox: Container( 265 | alignment: Alignment.center, 266 | color: Colors.white, 267 | // height: 20, 268 | // width: 375, 269 | child: Row( 270 | mainAxisAlignment: MainAxisAlignment.center, 271 | children: [ 272 | Icon(Icons.arrow_upward,color: Colors.black,size: 20,), 273 | SizedBox(width: 3,), 274 | Text( 275 | '正在拼命加载中....', 276 | // textAlign: TextAlign.center, 277 | style: TextStyle(color: Colors.black, fontSize: 14), 278 | ) 279 | ], 280 | ), 281 | ), 282 | footerRefreshBox:Container( 283 | alignment: Alignment.center, 284 | color: Colors.white, 285 | // height: 35, 286 | // width: 375, 287 | child: Row( 288 | mainAxisAlignment: MainAxisAlignment.center, 289 | children: [ 290 | Icon(Icons.arrow_upward,color: Colors.black,size: 20,), 291 | SizedBox(width: 3,), 292 | Text( 293 | '正在加载更多....', 294 | // textAlign: TextAlign.center, 295 | style: TextStyle(color: Colors.black, fontSize: 14), 296 | ) 297 | ], 298 | ), 299 | ) , 300 | loadData: _onRefresh, 301 | isPullEnable: true, 302 | isPushEnable: true, 303 | triggerPullController: TriggerPullController(), 304 | scrollPhysicsChanged: _scrollPhysicsChanged, 305 | listView: ListView.builder( 306 | controller: _scrollController, 307 | padding: new EdgeInsets.all(3), 308 | itemCount: datas.length + 1, 309 | // itemExtent: 50.0, 310 | itemBuilder: _listItemBuilder, 311 | ), 312 | ), 313 | * */ -------------------------------------------------------------------------------- /lib/route/flutter_dios_detail.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:video_player/video_player.dart'; 3 | import '../models/dioDatas.dart'; 4 | 5 | class DiosDetail extends StatefulWidget { 6 | 7 | DiosDetail(this.dataModel); 8 | DioData dataModel; 9 | 10 | @override 11 | _DiosDetailState createState() => _DiosDetailState(); 12 | } 13 | 14 | class _DiosDetailState extends State 15 | with SingleTickerProviderStateMixin { 16 | VideoPlayerController controller; 17 | bool initialized = false; 18 | bool isPlaying = true; 19 | 20 | @override 21 | void initState() { 22 | super.initState(); 23 | //初始化播放控件 24 | controller = VideoPlayerController.network(widget.dataModel.video); 25 | 26 | //视频初始化 27 | controller.initialize().then((value) { 28 | initialized = true; 29 | //刷新页面显示播放器 30 | setState(() { 31 | controller.play(); 32 | isPlaying = true; 33 | }); 34 | }); 35 | } 36 | 37 | _video() { 38 | if (initialized) { 39 | final Size size = controller.value.size; 40 | return SizedBox( 41 | width: controller.value.size.width - 10, 42 | child: AspectRatio( 43 | aspectRatio: size.width / size.height, 44 | child: VideoPlayer(controller), 45 | )); 46 | } else { 47 | return new Container(); 48 | } 49 | } 50 | 51 | @override 52 | void dispose() { 53 | super.dispose(); 54 | controller.pause(); 55 | controller.dispose(); 56 | } 57 | 58 | @override 59 | Widget build(BuildContext context) { 60 | return Material( 61 | child: Scaffold( 62 | floatingActionButton: FloatingActionButton( 63 | backgroundColor: Theme.of(context).primaryColor, 64 | onPressed: () { 65 | setState(() { 66 | isPlaying ? controller.pause() : controller.play(); 67 | isPlaying = !isPlaying; 68 | }); 69 | }, 70 | child: Icon( 71 | isPlaying ? Icons.play_arrow : Icons.pause, 72 | color: Colors.white, 73 | ), 74 | ), 75 | appBar: AppBar( 76 | title: Text('视频', style: TextStyle(fontSize: 18.0)), 77 | ), 78 | body: ListView(children: [ 79 | Column( 80 | crossAxisAlignment: CrossAxisAlignment.center, 81 | mainAxisAlignment: MainAxisAlignment.start, 82 | children: [ 83 | _video(), 84 | Container( 85 | padding: EdgeInsets.all(5), 86 | alignment: Alignment.center, 87 | child: ListTile( 88 | leading: ClipRRect( 89 | borderRadius: BorderRadius.circular(30.0), 90 | child: Image.network(widget.dataModel.header,width: 60,height: 60,), 91 | ), 92 | title: Text(widget.dataModel.name), 93 | subtitle: Text(widget.dataModel.text), 94 | ), 95 | ), 96 | ], 97 | ) 98 | ]), 99 | )); 100 | ; 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /lib/route/flutter_hots.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | 4 | class HotPage extends StatefulWidget { 5 | @override 6 | _HotPageState createState() => _HotPageState(); 7 | } 8 | 9 | class _HotPageState extends State with SingleTickerProviderStateMixin { 10 | 11 | @override 12 | void initState() { 13 | super.initState(); 14 | } 15 | 16 | @override 17 | void dispose() { 18 | super.dispose(); 19 | } 20 | 21 | @override 22 | Widget build(BuildContext context) { 23 | return Container(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /lib/route/flutter_interActives.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:toast/toast.dart'; 3 | 4 | class InterActives extends StatefulWidget { 5 | int index; 6 | 7 | InterActives(this.index); 8 | 9 | @override 10 | _InterActivesState createState() => _InterActivesState(); 11 | } 12 | 13 | class _InterActivesState extends State 14 | with SingleTickerProviderStateMixin { 15 | GlobalKey scaffoldState; 16 | 17 | @override 18 | void initState() { 19 | super.initState(); 20 | scaffoldState = new GlobalKey(); 21 | } 22 | 23 | @override 24 | void dispose() { 25 | super.dispose(); 26 | } 27 | 28 | // 'LongPressDraggable', 29 | // 'GestureDetector', 30 | // 'DragTarget', 31 | // 'Dismissible', 32 | // 'IgnorePointer', 33 | // 'AbsorbPointer', 34 | // 'Navigator', 35 | // 'Scrollable', 36 | @override 37 | Widget build(BuildContext context) { 38 | //长按 39 | _longPressDraggable() { 40 | 41 | return LongPressDraggable( 42 | onDragCompleted: () { 43 | Toast.show('onDragCompleted', context); 44 | }, 45 | child: Icon( 46 | Icons.add_alert, 47 | color: Colors.green, 48 | size: 30, 49 | ), 50 | feedback: Icon(Icons.mouse,color: Colors.grey,) ); 51 | } 52 | 53 | _gestureDetector() { 54 | return GestureDetector( 55 | onLongPress: (){ 56 | Toast.show('我长按了一下', context); 57 | }, 58 | onTap: () { 59 | Toast.show('点击手势', context); 60 | }, 61 | child: Icon( 62 | Icons.wb_sunny, 63 | color: Colors.indigo, 64 | size: 30, 65 | ), 66 | ); 67 | } 68 | 69 | _dismissibel() { 70 | return Dismissible( 71 | key: Key('dismissible'), 72 | secondaryBackground: Text( 73 | 'Delete', 74 | style: TextStyle(color: Colors.red, fontSize: 33), 75 | ), 76 | direction: DismissDirection.endToStart, 77 | onDismissed: (direction) { 78 | Toast.show('删除成功', context); 79 | scaffoldState.currentState.showSnackBar(SnackBar( 80 | content: Text( 81 | 'Dismissible Processed...', 82 | style: TextStyle(color: Colors.white, fontSize: 24.0), 83 | ), 84 | action: SnackBarAction( 85 | textColor: Colors.white, label: 'Ok', onPressed: () {}), 86 | )); 87 | }, 88 | background: new Container( 89 | color: Colors.red, 90 | ), 91 | child: ListTile( 92 | title: new Text('Options A'), 93 | subtitle: new Text('Click Me And Dismissed'), 94 | leading: Icon( 95 | Icons.check_box, 96 | color: Colors.grey, 97 | size: 20, 98 | ), 99 | trailing: Icon( 100 | Icons.explore, 101 | color: Colors.grey, 102 | size: 20, 103 | ), 104 | )); 105 | } 106 | 107 | _widgets() { 108 | List widgets = [ 109 | _longPressDraggable(), 110 | _gestureDetector(), 111 | _dismissibel() 112 | ]; 113 | return widgets; 114 | } 115 | 116 | return Scaffold( 117 | appBar: AppBar( 118 | key: scaffoldState, 119 | title: Text('Flutter InterActives', style: TextStyle(fontSize: 20.0)), 120 | ), 121 | body: Container( 122 | child: Column( 123 | crossAxisAlignment: CrossAxisAlignment.center, 124 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 125 | children: _widgets(), 126 | )), 127 | ); 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /lib/route/flutter_listen_music.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../models/ListenModel.dart'; 3 | import 'flutter_listen_music_detail.dart'; 4 | import '../models/MusicDetailModel.dart'; 5 | import '../models/musicDatas.dart'; 6 | import 'flutter_music_detail.dart'; 7 | 8 | class ListenMusicPage extends StatefulWidget { 9 | @override 10 | _ListenMusicPageState createState() => _ListenMusicPageState(); 11 | } 12 | 13 | class _ListenMusicPageState extends State 14 | with SingleTickerProviderStateMixin { 15 | List listenModels = new List(); 16 | final _scaffoldKey = GlobalKey(); 17 | 18 | _requestMusic() async { 19 | List models = await ListenModel.getMusics(); 20 | if (models.length > 0) { 21 | setState(() => _loadModels(models)); 22 | } 23 | } 24 | 25 | _loadModels(List models){ 26 | models.map((model) { 27 | listenModels.add(model); 28 | }).toList(); 29 | } 30 | 31 | @override 32 | void initState() { 33 | super.initState(); 34 | _requestMusic(); 35 | } 36 | 37 | @override 38 | void dispose() { 39 | super.dispose(); 40 | } 41 | _playMusic(ContentModel model) async { 42 | MusicXQModel xqModel = await MusicXQModel.getMusics( 43 | model.song_id); 44 | if (xqModel.songList.length > 0) { 45 | SongListModel songModel = xqModel.songList[0]; 46 | MusicModel model = new MusicModel( 47 | songModel.albumName, 48 | '', 49 | songModel.songPicBig, 50 | '', 51 | songModel.albumName, 52 | songModel.lrcLink, 53 | '', 54 | songModel.songLink); 55 | 56 | Navigator.of(context).push(new MaterialPageRoute(builder: (context) { 57 | return new MusicDetailPage(model); 58 | })); 59 | } 60 | } 61 | 62 | _playIndex(int index) { 63 | String type = listenModels[index].type; 64 | String name = listenModels[index].name; 65 | print(name); 66 | Navigator.of(context).push(new MaterialPageRoute(builder: (context) { 67 | return new ListenMusicDetailPage(type, name); 68 | })); 69 | } 70 | 71 | List _gridViewChilds(int index) { 72 | List models = listenModels[index].content; 73 | List widgets = new List(); 74 | for (int i = 0; i < models.length; i++) { 75 | widgets.add( 76 | GestureDetector( 77 | onTap: ()=>_playMusic(models[i]), 78 | child: Container( 79 | // height: 180, 80 | // aspectRatio: 1.0, 81 | child: Column( 82 | mainAxisAlignment: MainAxisAlignment.center, 83 | crossAxisAlignment: CrossAxisAlignment.start, 84 | children: [ 85 | Container( 86 | // color: Colors.red, 87 | width: (MediaQuery.of(context).size.width - 10) / 2.0, 88 | height: 110, 89 | child: ClipRRect( 90 | child: Image.network( 91 | models[i].pic_big, 92 | fit: BoxFit.cover, 93 | ), 94 | borderRadius: BorderRadius.all(Radius.circular(10)), 95 | ), 96 | ), 97 | SizedBox( 98 | height: 5, 99 | ), 100 | Text( 101 | models[i].author, 102 | maxLines: 1, 103 | overflow: TextOverflow.ellipsis, 104 | style: TextStyle(fontSize: 13), 105 | ), 106 | SizedBox( 107 | height: 5, 108 | ), 109 | Text( 110 | models[i].album_title, 111 | maxLines: 1, 112 | overflow: TextOverflow.ellipsis, 113 | style: TextStyle(fontSize: 12.0, color: Colors.grey[600]), 114 | ), 115 | ], 116 | ), 117 | ), 118 | ) 119 | ); 120 | } 121 | return widgets; 122 | } 123 | 124 | Widget _musicWidget(BuildContext context, int index) { 125 | return Container( 126 | padding: EdgeInsets.symmetric(horizontal: 10), 127 | child: Container( 128 | child: Column( 129 | mainAxisAlignment: MainAxisAlignment.center, 130 | crossAxisAlignment: CrossAxisAlignment.start, 131 | children: [ 132 | SizedBox( 133 | height: 10, 134 | ), 135 | ListTile( 136 | contentPadding: EdgeInsets.only( 137 | left: 0, 138 | ), 139 | leading: ClipRRect( 140 | child: Image.network( 141 | listenModels[index].pic_s260, 142 | width: 50, 143 | height: 50, 144 | ), 145 | borderRadius: BorderRadius.all(Radius.circular(25)), 146 | ), 147 | trailing: FlatButton( 148 | onPressed: ()=>_playIndex(index), 149 | child: Text( 150 | '查看更多>', 151 | textAlign: TextAlign.right, 152 | style: TextStyle(color: Colors.grey, fontSize: 14), 153 | )), 154 | title: Text( 155 | listenModels[index].name, 156 | textAlign: TextAlign.left, 157 | style: TextStyle( 158 | color: Colors.black, 159 | fontSize: 18, 160 | fontWeight: FontWeight.bold), 161 | ), 162 | subtitle: Text( 163 | listenModels[index].comment, 164 | textAlign: TextAlign.left, 165 | maxLines: 1, 166 | overflow: TextOverflow.ellipsis, 167 | style: TextStyle( 168 | color: Colors.grey, 169 | fontSize: 14, 170 | fontWeight: FontWeight.normal), 171 | ), 172 | ), 173 | AspectRatio( 174 | aspectRatio: 1, 175 | child: GridView.count( 176 | physics: NeverScrollableScrollPhysics(), 177 | primary: false, 178 | // padding: const EdgeInsets.all(5.0), 179 | crossAxisSpacing: 10.0, 180 | crossAxisCount: 2, 181 | children: _gridViewChilds(index), 182 | ), 183 | ), 184 | Divider(color: Colors.black26,), 185 | ], 186 | ), 187 | ), 188 | ); 189 | } 190 | 191 | @override 192 | Widget build(BuildContext context) { 193 | return Scaffold( 194 | key: _scaffoldKey, 195 | appBar: AppBar( 196 | title: Text('一起来听歌'), 197 | ), 198 | body: ListView.builder( 199 | itemBuilder: _musicWidget, 200 | itemCount: listenModels.length, 201 | ), 202 | ); 203 | } 204 | } 205 | -------------------------------------------------------------------------------- /lib/route/flutter_listen_music_detail.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../models/MusicDetailModel.dart'; 3 | import '../models/musicDatas.dart'; 4 | import 'flutter_music_detail.dart'; 5 | 6 | class ListenMusicDetailPage extends StatefulWidget { 7 | String type; 8 | String rankName; 9 | 10 | ListenMusicDetailPage(this.type, this.rankName); 11 | 12 | @override 13 | _ListenMusicDetailPageState createState() => _ListenMusicDetailPageState(); 14 | } 15 | 16 | class _ListenMusicDetailPageState extends State 17 | with SingleTickerProviderStateMixin { 18 | List listenModels = new List(); 19 | 20 | _requestModels() async { 21 | List models = 22 | await MusicDetailModel.getMusics(widget.type); 23 | if (models.length > 0) { 24 | setState(() { 25 | models.map((model) { 26 | listenModels.add(model); 27 | }).toList(); 28 | }); 29 | } 30 | } 31 | 32 | @override 33 | void initState() { 34 | super.initState(); 35 | _requestModels(); 36 | } 37 | 38 | @override 39 | void dispose() { 40 | super.dispose(); 41 | } 42 | 43 | _playIndex(int index) async{ 44 | 45 | MusicXQModel xqModel = await MusicXQModel.getMusics(listenModels[index].song_id); 46 | if (xqModel.songList.length > 0) { 47 | SongListModel songModel = xqModel.songList[0]; 48 | MusicModel model = new MusicModel( 49 | songModel.albumName, 50 | '', 51 | songModel.songPicBig, 52 | '', 53 | songModel.albumName, 54 | songModel.lrcLink, 55 | '', 56 | songModel.songLink); 57 | 58 | Navigator.of(context).push(new MaterialPageRoute(builder: (context) { 59 | return new MusicDetailPage(model); 60 | })); 61 | } 62 | 63 | } 64 | 65 | Widget _listItem(BuildContext context, int index) { 66 | return ListTile( 67 | leading: Image.network( 68 | listenModels[index].pic_big, 69 | width: 50, 70 | ), 71 | title: Text(listenModels[index].title), 72 | subtitle: Text(listenModels[index].author), 73 | onTap: ()=>_playIndex(index), 74 | ); 75 | } 76 | 77 | @override 78 | Widget build(BuildContext context) { 79 | return Scaffold( 80 | appBar: AppBar( 81 | title: Text(widget.rankName), 82 | ), 83 | body: ListView.builder( 84 | itemBuilder: _listItem, 85 | itemCount: listenModels.length 86 | ), 87 | ); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /lib/route/flutter_music_detail.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../models/musicDatas.dart'; 3 | import 'dart:ui' as ui show ImageFilter; 4 | import '../widgets/needle_anim.dart'; 5 | import '../widgets/record_anim.dart'; 6 | import 'package:audioplayer/audioplayer.dart'; 7 | 8 | class MusicDetailPage extends StatefulWidget { 9 | MusicDetailPage(this.model); 10 | 11 | MusicModel model; 12 | 13 | @override 14 | _MusicDetailPageState createState() => _MusicDetailPageState(); 15 | } 16 | 17 | class _MusicDetailPageState extends State 18 | with TickerProviderStateMixin { 19 | AudioPlayer audioPlayer = new AudioPlayer(); 20 | AnimationController controller_needle; 21 | Animation animation_needle; 22 | AnimationController controller_record; 23 | Animation animation_record; 24 | final _commonTween = new Tween(begin: 0.0, end: 1.0); 25 | final _rotateTween = new Tween(begin: -0.15, end: 0.0); 26 | 27 | bool isPlaying = false; 28 | 29 | @override 30 | void initState() { 31 | super.initState(); 32 | print('😂----😄:${widget.model.pic}'); 33 | controller_record = new AnimationController( 34 | duration: const Duration(milliseconds: 15000), vsync: this); 35 | animation_record = 36 | new CurvedAnimation(parent: controller_record, curve: Curves.linear); 37 | 38 | controller_needle = new AnimationController( 39 | duration: const Duration(milliseconds: 500), 40 | vsync: this, 41 | ); 42 | animation_needle = 43 | new CurvedAnimation(parent: controller_needle, curve: Curves.linear); 44 | 45 | animation_record.addStatusListener((status) { 46 | if (status == AnimationStatus.completed) { 47 | controller_record.repeat(); 48 | } else if (status == AnimationStatus.dismissed) { 49 | controller_record.forward(); 50 | } 51 | }); 52 | 53 | _playMusic(); 54 | } 55 | 56 | Future _playMusic() async { 57 | if (isPlaying == true) { 58 | await audioPlayer.pause(); 59 | controller_record.stop(canceled: false); 60 | controller_needle.reverse(); 61 | setState(() { 62 | isPlaying = false; 63 | }); 64 | } else { 65 | await audioPlayer.play(widget.model.url); 66 | controller_record.forward(); 67 | controller_needle.forward(); 68 | setState(() { 69 | isPlaying = true; 70 | }); 71 | } 72 | } 73 | 74 | @override 75 | void dispose() { 76 | audioPlayer.stop(); 77 | controller_needle.dispose(); 78 | controller_record.dispose(); 79 | super.dispose(); 80 | } 81 | 82 | _centerCirclePic() { 83 | return Container( 84 | alignment: Alignment.center, 85 | child: ClipRRect( 86 | borderRadius: BorderRadius.all(Radius.circular(150)), 87 | child: Image.network( 88 | widget.model.pic, 89 | width: 300, 90 | height: 300, 91 | fit: BoxFit.cover, 92 | ), 93 | ), 94 | ); 95 | } 96 | 97 | _picAni() { 98 | return new Container( 99 | child: RotateRecord( 100 | animation: _commonTween.animate(controller_record), 101 | imageUrl: widget.model.pic, 102 | ), 103 | margin: EdgeInsets.only(top: 100.0), 104 | 105 | ); 106 | } 107 | 108 | _picAnimated() { 109 | final _rotateTween = new Tween(begin: 0, end: 0.0); 110 | return new Container( 111 | child: new PivotTransition( 112 | turns: _rotateTween.animate(controller_needle), 113 | alignment: FractionalOffset.topLeft, 114 | child: _centerCirclePic()), 115 | ); 116 | } 117 | 118 | _stack() { 119 | return new Stack( 120 | alignment: const FractionalOffset(0.7, 0.1), 121 | children: [ 122 | new Container( 123 | child: 124 | RotateRecord(animation: _commonTween.animate(controller_record)), 125 | margin: EdgeInsets.only(top: 100.0), 126 | ), 127 | new Container( 128 | child: new PivotTransition( 129 | turns: _rotateTween.animate(controller_needle), 130 | alignment: FractionalOffset.topLeft, 131 | child: new Container( 132 | width: 100.0, 133 | child: new Image.asset("images/play_needle.png"), 134 | ), 135 | ), 136 | ), 137 | ], 138 | ); 139 | } 140 | 141 | _bgFlur() { 142 | List widgets = [ 143 | Image.network( 144 | widget.model.pic, 145 | width: MediaQuery.of(context).size.width, 146 | height: MediaQuery.of(context).size.height, 147 | fit: BoxFit.cover, 148 | ), 149 | BackdropFilter( 150 | filter: ui.ImageFilter.blur(sigmaX: 10, sigmaY: 10), 151 | child: Container( 152 | color: Colors.black.withOpacity(0), 153 | ), 154 | ), 155 | Column( 156 | crossAxisAlignment: CrossAxisAlignment.center, 157 | mainAxisAlignment: MainAxisAlignment.center, 158 | children: [ 159 | _picAni(), 160 | IconButton( 161 | iconSize: 40, 162 | color: Colors.black87, 163 | icon: Icon(isPlaying ? Icons.pause : Icons.play_arrow), 164 | onPressed: () { 165 | _playMusic(); 166 | }), 167 | ], 168 | ), 169 | ]; 170 | return widgets; 171 | } 172 | 173 | _body() { 174 | return Center( 175 | child: Stack( 176 | alignment: const FractionalOffset(0.5, 0.0), 177 | children: _bgFlur(), 178 | ), 179 | ); 180 | } 181 | 182 | @override 183 | Widget build(BuildContext context) { 184 | return Scaffold( 185 | body: _body(), 186 | floatingActionButton: FloatingActionButton( 187 | onPressed: () { 188 | Navigator.pop(context); 189 | }, 190 | backgroundColor: Theme.of(context).primaryColor, 191 | child: Icon(Icons.arrow_back), 192 | ), 193 | ); 194 | } 195 | } 196 | -------------------------------------------------------------------------------- /lib/route/flutter_musics.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../models/musicDatas.dart'; 3 | import 'flutter_music_detail.dart'; 4 | 5 | class MusicPage extends StatefulWidget { 6 | @override 7 | _MusicPageState createState() => _MusicPageState(); 8 | } 9 | 10 | class _MusicPageState extends State 11 | with SingleTickerProviderStateMixin { 12 | 13 | List musicDatas = new List(); 14 | int playIndex = 0; 15 | 16 | @override 17 | void initState() { 18 | super.initState(); 19 | _requestMusics('杨宗纬'); 20 | } 21 | 22 | Future _requestMusics(String searchText) async { 23 | List responses = await MusicModel.getMusicData(searchText); 24 | if (responses.length == 0) { 25 | return; 26 | } 27 | setState(() { 28 | musicDatas = responses; 29 | }); 30 | } 31 | @override 32 | void dispose() { 33 | super.dispose(); 34 | 35 | } 36 | 37 | _textEdit(){ 38 | var _textEditController = TextEditingController(); 39 | return Container( 40 | // color: Colors.white, 41 | padding: EdgeInsets.all(10), 42 | // height: 55.0, 43 | alignment: Alignment.center, 44 | child: Container( 45 | decoration: BoxDecoration( 46 | borderRadius: BorderRadius.all(Radius.circular(25.0)), 47 | color: Colors.white, 48 | ), 49 | height: 50.0, 50 | child: TextField( 51 | onSubmitted: (inputText){ 52 | _requestMusics(inputText); 53 | }, 54 | controller: _textEditController, 55 | style: TextStyle( 56 | decorationColor: Colors.black, 57 | color: Colors.black, 58 | ), 59 | decoration: InputDecoration( 60 | fillColor: Colors.black26, 61 | prefixStyle: TextStyle(color: Colors.white), 62 | border: InputBorder.none, 63 | //去掉下划线 64 | contentPadding: const EdgeInsets.symmetric(vertical: 8.0), 65 | hintText: '歌曲名、专辑名称、歌手', 66 | hintStyle: TextStyle(color: Colors.black26), 67 | // labelText: '左上角', 68 | prefixIcon: Icon( 69 | Icons.search, 70 | color: Colors.black26, 71 | ), 72 | ), 73 | ), 74 | )); 75 | } 76 | 77 | _appBar() { 78 | return _textEdit(); 79 | } 80 | 81 | Future _playMusic(int index) async{ 82 | 83 | Navigator.of(context).push( 84 | new MaterialPageRoute(builder: (context) { 85 | 86 | return MusicDetailPage(musicDatas[index]); 87 | 88 | })); 89 | // return; 90 | // if(isPlaying==true && playIndex ==index){ 91 | // await audioPlayer.pause(); 92 | // setState(() { 93 | // isPlaying = false; 94 | // }); 95 | // }else { 96 | // await audioPlayer.play(musicDatas[index].url); 97 | // setState(() { 98 | // isPlaying = true; 99 | // playIndex = index; 100 | // }); 101 | // } 102 | 103 | } 104 | 105 | Widget _itemBuilder(BuildContext context, int index) { 106 | 107 | return ListTile( 108 | onTap: (){ 109 | _playMusic(index); 110 | }, 111 | trailing: Icon(Icons.play_circle_filled), 112 | leading: ClipRRect( 113 | borderRadius: BorderRadius.all(Radius.circular(30)), 114 | child: Image.network(musicDatas[index].pic,width: 60,height: 60,), 115 | ), 116 | title: Text(musicDatas[index].title), 117 | subtitle: Text(musicDatas[index].author), 118 | ); 119 | } 120 | 121 | _body() { 122 | return ListView.builder( 123 | itemBuilder: _itemBuilder, 124 | itemCount: musicDatas.length, 125 | ); 126 | } 127 | 128 | @override 129 | Widget build(BuildContext context) { 130 | return Scaffold( 131 | appBar: AppBar( 132 | title: _appBar(), 133 | ), 134 | body: _body(), 135 | ); 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /lib/route/flutter_others.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:toast/toast.dart'; 3 | 4 | class FlutterOthers extends StatefulWidget { 5 | @override 6 | _FlutterOthersState createState() => _FlutterOthersState(); 7 | } 8 | 9 | //'Slider', 10 | //'Switch', 11 | //'SwitchListTile', 12 | //'DatePicker', 13 | //'TimePicker', 14 | //'Radio', 15 | //'RadioListTile', 16 | //'CheckBox', 17 | //'CheckBoxListTile', 18 | class _FlutterOthersState extends State 19 | with SingleTickerProviderStateMixin { 20 | double sliderValue = 10; 21 | bool switched = false; 22 | List switchTiles = [false, false]; 23 | List checkBoxTiles = [false, false]; 24 | var groupIndex = 3; 25 | bool checkBox = false; 26 | 27 | _slider() { 28 | return Container( 29 | padding: EdgeInsets.only(top: 60), 30 | child: Slider( 31 | value: sliderValue, 32 | activeColor: Colors.blue[900], 33 | inactiveColor: Colors.blue[900].withOpacity(0.3), 34 | divisions: 10, 35 | label: '${sliderValue.toInt()}', 36 | onChanged: (value) { 37 | setState(() { 38 | sliderValue = value; 39 | }); 40 | }, 41 | max: 100, 42 | min: 0, 43 | ), 44 | ); 45 | } 46 | 47 | _label() { 48 | return Text('SliderValue:${sliderValue.toInt()}'); 49 | } 50 | 51 | _switch() { 52 | return Switch( 53 | value: switched, 54 | onChanged: (isSwitch) { 55 | setState(() { 56 | switched = isSwitch; 57 | }); 58 | }); 59 | } 60 | 61 | _switchListTile() { 62 | List switchLists = new List(); 63 | List titles = ['ShangHai', 'BeiJing', 'ShenZheng']; 64 | for (int i = 0; i < switchTiles.length; i++) { 65 | switchLists.add(SwitchListTile( 66 | activeColor: Colors.green[600], 67 | inactiveTrackColor: Colors.red, 68 | inactiveThumbColor: Colors.white, 69 | title: Text(titles[i]), 70 | subtitle: Text(switchTiles[i] ? "Cloudy" : "Sunny"), 71 | value: switchTiles[i], 72 | selected: switchTiles[i], 73 | secondary: Icon(switchTiles[i] ? Icons.cloud : Icons.wb_sunny), 74 | onChanged: (isSwitched) { 75 | setState(() { 76 | switchTiles[i] = isSwitched; 77 | }); 78 | })); 79 | switchLists.add(Divider( 80 | height: 6, 81 | color: Colors.grey, 82 | )); 83 | } 84 | return switchLists; 85 | } 86 | 87 | _showDatePicker() async { 88 | final DateTime time = await showDatePicker( 89 | context: context, 90 | initialDate: DateTime.now(), 91 | firstDate: DateTime(2000), 92 | lastDate: DateTime(2030)); 93 | 94 | if (time == null) { 95 | return; 96 | } 97 | 98 | Toast.show(time.toLocal().toString(), context); 99 | } 100 | 101 | _showTimePicker() async { 102 | final TimeOfDay day = await showTimePicker( 103 | context: context, 104 | initialTime: TimeOfDay(hour: 10, minute: 58), 105 | ); 106 | 107 | if (day == null) { 108 | return; 109 | } 110 | 111 | Toast.show(day.hour.toString() + ':' + day.minute.toString(), context); 112 | } 113 | 114 | _datePicker() { 115 | return FlatButton( 116 | color: Colors.green, 117 | onPressed: _showDatePicker, 118 | child: Icon( 119 | Icons.date_range, 120 | color: Colors.white, 121 | )); 122 | } 123 | 124 | _timePicker() { 125 | return FlatButton( 126 | color: Colors.green, 127 | onPressed: _showTimePicker, 128 | child: Icon( 129 | Icons.access_time, 130 | color: Colors.white, 131 | )); 132 | } 133 | 134 | _radio() { 135 | return Radio(value: 1, groupValue: 10, onChanged: (value) {}); 136 | } 137 | 138 | _radioListTiles() { 139 | List tiles = new List(); 140 | for (int i = 0; i < 2; i++) { 141 | tiles.add(RadioListTile( 142 | value: i, 143 | groupValue: groupIndex, 144 | onChanged: (value) { 145 | setState(() { 146 | groupIndex = value; 147 | }); 148 | }, 149 | title: Text(i == 0 ? 'Options A' : 'Options B'), 150 | subtitle: Text('Description'), 151 | secondary: Icon(i == 0 ? Icons.filter_1 : Icons.filter_2), 152 | selected: groupIndex == i, 153 | )); 154 | } 155 | return tiles; 156 | } 157 | 158 | _checkBox() { 159 | return Checkbox( 160 | activeColor: Colors.black, 161 | value: checkBox, 162 | onChanged: (value) { 163 | setState(() { 164 | checkBox = value; 165 | }); 166 | }, 167 | ); 168 | } 169 | 170 | _checkBoxListTile() { 171 | List checks = new List(); 172 | for (int i = 0; i < checkBoxTiles.length; i++) { 173 | checks.add(CheckboxListTile( 174 | activeColor: Colors.orange, 175 | title: Text(i == 0 ? 'CheckBox A' : 'CheckBox B'), 176 | subtitle: Text(i == 0 ? 'Description A' : 'Description B'), 177 | secondary: Icon(Icons.wb_sunny), 178 | selected: checkBoxTiles[i], 179 | value: checkBoxTiles[i], 180 | onChanged: (value) { 181 | setState(() { 182 | checkBoxTiles[i] = value; 183 | }); 184 | })); 185 | } 186 | return checks; 187 | } 188 | 189 | _sizeBox() { 190 | return SizedBox( 191 | height: 20, 192 | ); 193 | } 194 | 195 | Widget _expansionPanel(BuildContext context, bool value) { 196 | return Container( 197 | color: Colors.pink, 198 | padding: EdgeInsets.all(15), 199 | alignment: Alignment.centerLeft, 200 | child: Text( 201 | 'ARE YOU OK?', 202 | style: TextStyle(color: Colors.white,fontSize: 20), 203 | ), 204 | ); 205 | } 206 | 207 | Widget _rowContent(BuildContext context, int index) { 208 | return Text( 209 | '我很OK啊!😄', 210 | style: TextStyle(color: Colors.black,fontSize: 16), 211 | ); 212 | } 213 | 214 | _listBody() { 215 | return Container( 216 | height: 150, 217 | color: Colors.yellow, 218 | padding: EdgeInsets.only(left: 15,right: 15,bottom: 15), 219 | child: ListView.builder( 220 | itemBuilder: _rowContent, 221 | itemCount: 5, 222 | physics: NeverScrollableScrollPhysics(), 223 | )); 224 | } 225 | 226 | List isExpands = [false, false, false]; 227 | 228 | _expansions() { 229 | List exPansions = new List(); 230 | 231 | for (int i = 0; i < isExpands.length; i++) { 232 | exPansions.add(ExpansionPanel( 233 | isExpanded: isExpands[i], 234 | headerBuilder: _expansionPanel, 235 | body: _listBody())); 236 | } 237 | return exPansions; 238 | } 239 | 240 | _expandList() { 241 | return ExpansionPanelList( 242 | animationDuration: kThemeAnimationDuration, 243 | children: _expansions(), 244 | expansionCallback: (int index, bool isExpand) { 245 | print('点击了第$index,isExpand:$isExpand'); 246 | setState(() { 247 | isExpands[index] = !isExpands[index]; 248 | }); 249 | }, 250 | ); 251 | } 252 | 253 | _widgets() { 254 | List widgets = new List(); 255 | widgets.add(_slider()); 256 | widgets.add(_label()); 257 | widgets.add(_sizeBox()); 258 | widgets.add(_switch()); 259 | widgets.add(_sizeBox()); 260 | _switchListTile().map((item) { 261 | widgets.add(item); 262 | }).toList(); 263 | 264 | widgets.add(_datePicker()); 265 | widgets.add(_timePicker()); 266 | 267 | widgets.add(_radio()); 268 | _radioListTiles().map((item) { 269 | widgets.add(item); 270 | }).toList(); 271 | 272 | widgets.add(_checkBox()); 273 | 274 | _checkBoxListTile().map((item) { 275 | widgets.add(item); 276 | }).toList(); 277 | 278 | widgets.add(_expandList()); 279 | 280 | return widgets; 281 | } 282 | 283 | @override 284 | Widget build(BuildContext context) { 285 | return Scaffold( 286 | appBar: AppBar( 287 | title: Text('Flutter Others', style: TextStyle(fontSize: 20.0)), 288 | ), 289 | body: Container( 290 | // padding: EdgeInsets.only(top: 70), 291 | color: Colors.grey.withOpacity(0.04), 292 | child: ListView( 293 | children: [ 294 | Column( 295 | crossAxisAlignment: CrossAxisAlignment.center, 296 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 297 | children: _widgets(), 298 | ) 299 | ], 300 | )), 301 | ); 302 | } 303 | } 304 | -------------------------------------------------------------------------------- /lib/route/flutter_tuijians.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../models/HotModel.dart'; 3 | 4 | class TuiJianDemo extends StatefulWidget { 5 | bool isHome; 6 | 7 | TuiJianDemo(this.isHome); 8 | 9 | @override 10 | _TuiJianDemoState createState() => _TuiJianDemoState(); 11 | } 12 | 13 | class _TuiJianDemoState extends State 14 | with SingleTickerProviderStateMixin { 15 | List hotModels = new List(); 16 | 17 | _requestModels() async { 18 | List models = await HotModel.getHotModels(); 19 | if (models.length > 0) { 20 | setState(() { 21 | models.forEach((f) { 22 | hotModels.add(f); 23 | }); 24 | }); 25 | } 26 | 27 | print('输出一下:${hotModels.length}'); 28 | } 29 | 30 | @override 31 | void initState() { 32 | super.initState(); 33 | _requestModels(); 34 | } 35 | 36 | @override 37 | void dispose() { 38 | super.dispose(); 39 | } 40 | 41 | _textEdit() { 42 | var _textEditController = TextEditingController(); 43 | return Container( 44 | // color: Colors.white, 45 | width: MediaQuery.of(context).size.width / 1.1, 46 | padding: EdgeInsets.all(10), 47 | // height: 55.0, 48 | alignment: Alignment.center, 49 | child: Container( 50 | decoration: BoxDecoration( 51 | borderRadius: BorderRadius.all(Radius.circular(25.0)), 52 | color: Colors.white, 53 | ), 54 | height: 50.0, 55 | child: TextField( 56 | onSubmitted: (inputText) { 57 | // _requestMusics(inputText); 58 | }, 59 | controller: _textEditController, 60 | style: TextStyle( 61 | decorationColor: Colors.black, 62 | color: Colors.black, 63 | ), 64 | decoration: InputDecoration( 65 | fillColor: Colors.black26, 66 | prefixStyle: TextStyle(color: Colors.white), 67 | border: InputBorder.none, 68 | //去掉下划线 69 | contentPadding: const EdgeInsets.symmetric(vertical: 8.0), 70 | hintText: '歌曲名、专辑名称、歌手', 71 | hintStyle: TextStyle(color: Colors.black26), 72 | // labelText: '左上角', 73 | prefixIcon: Icon( 74 | Icons.search, 75 | color: Colors.black26, 76 | ), 77 | ), 78 | ), 79 | )); 80 | } 81 | 82 | _textBox(int index) { 83 | return Container( 84 | padding: EdgeInsets.symmetric(horizontal: 10), 85 | child: Column( 86 | children: [ 87 | ListTile( 88 | leading: Image.network( 89 | hotModels[index].header, 90 | fit: BoxFit.cover, 91 | width: 50, 92 | height: 50, 93 | ), 94 | title: Text(hotModels[index].username), 95 | subtitle: Text(hotModels[index].text), 96 | ), 97 | Text( 98 | hotModels[index].text, 99 | style: TextStyle(fontSize: 17), 100 | ), 101 | Divider() 102 | ], 103 | )); 104 | } 105 | 106 | _imageBox(int index) { 107 | return Container( 108 | padding: EdgeInsets.symmetric(horizontal: 10), 109 | child: Column( 110 | children: [ 111 | ListTile( 112 | leading: Image.network( 113 | hotModels[index].header, 114 | fit: BoxFit.cover, 115 | width: 50, 116 | height: 50, 117 | ), 118 | title: Text(hotModels[index].username), 119 | subtitle: Text(hotModels[index].text), 120 | ), 121 | Image.network( 122 | hotModels[index].thumbnail, 123 | fit: BoxFit.cover, 124 | ), 125 | Divider() 126 | ], 127 | )); 128 | } 129 | 130 | _gifBox(int index) { 131 | return Container( 132 | padding: EdgeInsets.symmetric(horizontal: 10), 133 | child: Column( 134 | children: [ 135 | ListTile( 136 | leading: Image.network( 137 | hotModels[index].header, 138 | fit: BoxFit.cover, 139 | width: 50, 140 | height: 50, 141 | ), 142 | title: Text(hotModels[index].username), 143 | subtitle: Text(hotModels[index].text), 144 | ), 145 | Image.network( 146 | hotModels[index].gif, 147 | fit: BoxFit.cover, 148 | ), 149 | Divider() 150 | ], 151 | )); 152 | } 153 | 154 | _videoBox(int index) { 155 | return Container( 156 | padding: EdgeInsets.symmetric(horizontal: 10), 157 | child: Column( 158 | children: [ 159 | ListTile( 160 | leading: Image.network( 161 | hotModels[index].header, 162 | fit: BoxFit.cover, 163 | width: 50, 164 | height: 50, 165 | ), 166 | title: Text(hotModels[index].username), 167 | subtitle: Text(hotModels[index].text), 168 | ), 169 | Image.network( 170 | hotModels[index].thumbnail, 171 | fit: BoxFit.cover, 172 | ), 173 | Divider() 174 | ], 175 | )); 176 | } 177 | 178 | Widget _listMusics(BuildContext context, int index) { 179 | HotModel model = hotModels[index]; 180 | if (model.type.toLowerCase() == 'video') { 181 | return _videoBox(index); 182 | } else if (model.type.toLowerCase() == 'image') { 183 | return _imageBox(index); 184 | } else if (model.type.toLowerCase() == 'gif') { 185 | return _gifBox(index); 186 | } else { 187 | return _textBox(index); 188 | } 189 | } 190 | 191 | @override 192 | Widget build(BuildContext context) { 193 | if (widget.isHome) { 194 | return Container( 195 | // color: Colors.black, 196 | height: MediaQuery.of(context).size.height - 127, 197 | child: ListView.builder( 198 | itemBuilder: _listMusics, 199 | itemCount: hotModels.length, 200 | ), 201 | ); 202 | 203 | } else { 204 | return Scaffold( 205 | appBar: AppBar( 206 | title: _textEdit(), 207 | ), 208 | body: ListView.builder( 209 | itemBuilder: _listMusics, 210 | itemCount: hotModels.length, 211 | ), 212 | ); 213 | } 214 | } 215 | } 216 | -------------------------------------------------------------------------------- /lib/route/flutter_videos.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../models/dioDatas.dart'; 3 | import 'package:video_player/video_player.dart'; 4 | 5 | 6 | class VideoPage extends StatefulWidget { 7 | @override 8 | _VideoPageState createState() => _VideoPageState(); 9 | } 10 | 11 | class _VideoPageState extends State 12 | with SingleTickerProviderStateMixin { 13 | VideoPlayerController controller; 14 | bool initialized = false; 15 | int pageNumber = 0; 16 | bool isPlaying = false; 17 | int currentIndex = 0; 18 | List videoModels = new List(); 19 | 20 | Future _requetModels() async { 21 | pageNumber++; 22 | List responses = await DioData.getDioData( 23 | 'https://api.apiopen.top/getJoke?page=$pageNumber&count=10&type=video'); 24 | if (responses.length == 0) { 25 | return; 26 | } 27 | setState(() { 28 | responses.map((f) { 29 | videoModels.add(f); 30 | }).toList(); 31 | }); 32 | if(initialized == false){ 33 | _initVideoPlayer(0); 34 | } 35 | } 36 | 37 | @override 38 | void initState() { 39 | super.initState(); 40 | _requetModels(); 41 | } 42 | 43 | _initVideoPlayer(int index){ 44 | setState(() { 45 | currentIndex = index; 46 | }); 47 | if(isPlaying==true){ 48 | controller.pause(); 49 | setState(() { 50 | isPlaying = false; 51 | }); 52 | } 53 | //初始化播放控件 54 | controller = VideoPlayerController.network(videoModels[index].video) 55 | // 播放状态 56 | ..addListener(() { 57 | final bool playing = controller.value.isPlaying; 58 | setState(() { 59 | isPlaying = playing; 60 | }); 61 | }); 62 | //视频初始化 63 | controller.initialize().then((value) { 64 | initialized = true; 65 | //刷新页面显示播放器 66 | setState(() { 67 | controller.play(); 68 | isPlaying = true; 69 | }); 70 | }); 71 | } 72 | 73 | @override 74 | void dispose() { 75 | controller.dispose(); 76 | super.dispose(); 77 | } 78 | 79 | Widget _pageBuilder(BuildContext context, int index) { 80 | 81 | return Container( 82 | color: Colors.black.withOpacity(0.3), 83 | width: MediaQuery 84 | .of(context) 85 | .size 86 | .width, 87 | height: MediaQuery 88 | .of(context) 89 | .size 90 | .height, 91 | child: _stack(index), 92 | ); 93 | } 94 | 95 | _bgImage(int index){ 96 | 97 | return Image.network( 98 | videoModels[index].thumbnail, 99 | fit: BoxFit.cover, 100 | width: MediaQuery 101 | .of(context) 102 | .size 103 | .width, 104 | height: MediaQuery 105 | .of(context) 106 | .size 107 | .height, 108 | ); 109 | } 110 | _video(int index){ 111 | return Container( 112 | width: MediaQuery.of(context).size.width, 113 | height: MediaQuery.of(context).size.height, 114 | alignment: Alignment.center, 115 | child: SizedBox( 116 | child: AspectRatio( 117 | aspectRatio: MediaQuery.of(context).size.width / MediaQuery.of(context).size.height, 118 | child: VideoPlayer(controller), 119 | )), 120 | ); 121 | } 122 | 123 | _stack(int index){ 124 | 125 | return Stack( 126 | children: [ 127 | // _bgImage(index), 128 | isPlaying && index==currentIndex?_video(index):_bgImage(index), 129 | ], 130 | ); 131 | 132 | } 133 | 134 | @override 135 | Widget build(BuildContext context) { 136 | return Scaffold( 137 | floatingActionButton: FloatingActionButton( 138 | backgroundColor: Colors.green, 139 | child: Icon(Icons.arrow_back,size: 30,), 140 | onPressed: () { 141 | Navigator.pop(context); 142 | }), 143 | body: PageView.builder( 144 | onPageChanged: (int index){ 145 | _initVideoPlayer(index); 146 | }, 147 | scrollDirection: Axis.vertical, 148 | itemBuilder: _pageBuilder, 149 | itemCount: videoModels.length, 150 | ), 151 | ); 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /lib/route/flutter_wynews.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../models/WYNewsModel.dart'; 3 | import 'flutter_wynews_detail.dart'; 4 | 5 | class WYNewsPage extends StatefulWidget { 6 | @override 7 | _WYNewsPageState createState() => _WYNewsPageState(); 8 | } 9 | 10 | class _WYNewsPageState extends State 11 | with SingleTickerProviderStateMixin { 12 | 13 | List newsModels = new List(); 14 | 15 | _request() async { 16 | Listmodels = await WYNewsModel.getWYNews(); 17 | if (models.length > 0) { 18 | setState(() { 19 | models.map((f) { 20 | newsModels.add(f); 21 | }).toList(); 22 | }); 23 | } 24 | } 25 | 26 | @override 27 | void initState() { 28 | super.initState(); 29 | _request(); 30 | } 31 | 32 | @override 33 | void dispose() { 34 | super.dispose(); 35 | } 36 | 37 | _picWidgets(WYNewsModel model) { 38 | Listwidgets = new List(); 39 | widgets.add(Text(model.title, 40 | style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),)); 41 | for (int i = 0; i < model.picInfo.length; i++) { 42 | widgets.add( 43 | Image.network( 44 | model.picInfo[i].url, fit: BoxFit.cover, width: MediaQuery 45 | .of(context) 46 | .size 47 | .width,) 48 | ); 49 | } 50 | widgets.add(Text(model.digest)); 51 | widgets.add(Text(model.unlikeReason)); 52 | widgets.add(Text(model.ptime)); 53 | widgets.add(Divider(color: Colors.black26,)); 54 | 55 | return widgets; 56 | } 57 | 58 | _newsDetail(WYNewsModel model) { 59 | Navigator.of(context) 60 | .push(new MaterialPageRoute(builder: (context) 61 | { 62 | return new WYNewsDetailPage(model); 63 | })); 64 | } 65 | 66 | Widget _itemBuilder(BuildContext context, int index) { 67 | WYNewsModel model = newsModels[index]; 68 | return GestureDetector( 69 | onTap: () => _newsDetail(model), 70 | child: Column( 71 | crossAxisAlignment: CrossAxisAlignment.start, 72 | mainAxisAlignment: MainAxisAlignment.start, 73 | children: _picWidgets(model), 74 | ), 75 | ); 76 | } 77 | 78 | @override 79 | Widget build(BuildContext context) { 80 | return Container( 81 | margin: EdgeInsets.all(5), 82 | width: MediaQuery 83 | .of(context) 84 | .size 85 | .width, 86 | height: MediaQuery 87 | .of(context) 88 | .size 89 | .height - 120, 90 | child: ListView.builder( 91 | itemBuilder: _itemBuilder, itemCount: newsModels.length,), 92 | ); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /lib/route/flutter_wynews_detail.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:flutter/material.dart'; 3 | import '../models/WYNewsModel.dart'; 4 | import 'package:flutter_webview_plugin/flutter_webview_plugin.dart'; 5 | 6 | class WYNewsDetailPage extends StatefulWidget { 7 | WYNewsModel model; 8 | WYNewsDetailPage(this.model); 9 | @override 10 | _WYNewsDetailPageState createState() => _WYNewsDetailPageState(); 11 | } 12 | 13 | class _WYNewsDetailPageState extends State with SingleTickerProviderStateMixin { 14 | 15 | @override 16 | void initState() { 17 | super.initState(); 18 | } 19 | 20 | @override 21 | void dispose() { 22 | super.dispose(); 23 | } 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | return WebviewScaffold( 28 | url: widget.model.link, 29 | appBar: AppBar( 30 | title: Text(widget.model.title), 31 | ), 32 | ); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/tools/DioTool.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | 3 | class DioTool { 4 | static Future get(String url) async { 5 | Dio dio = new Dio(); 6 | Response response = await dio.get(url); 7 | // print('=============😊=============='); 8 | // print(response.data); 9 | // print('=============😊=============='); 10 | 11 | return response.data; 12 | } 13 | 14 | static Future post(String url) async { 15 | Dio dio = new Dio(); 16 | 17 | // 配置dio实例 18 | Response response = await dio.get( 19 | 'https://www.apiopen.top/satinApi?type=1&page=1', 20 | ); 21 | 22 | print('😄--------:${response.data}'); 23 | 24 | return response.data; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/widgets/MainColor.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:flutter/material.dart'; 3 | // 4 | //class MaterialColor extends ColorSwatch{ 5 | // 6 | // 7 | //} 8 | 9 | -------------------------------------------------------------------------------- /lib/widgets/needle_anim.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/animation.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'dart:math'; 4 | 5 | class PivotTransition extends AnimatedWidget { 6 | /// 创建旋转变换 7 | /// turns不能为空. 8 | PivotTransition({ 9 | Key key, 10 | this.alignment: FractionalOffset.topCenter, 11 | @required Animation turns, 12 | this.child, 13 | }) : super(key: key, listenable: turns); 14 | 15 | /// The animation that controls the rotation of the child. 16 | /// If the current value of the turns animation is v, the child will be 17 | /// rotated v * 2 * pi radians before being painted. 18 | Animation get turns => listenable; 19 | 20 | /// The pivot point to rotate around. 21 | final FractionalOffset alignment; 22 | 23 | /// The widget below this widget in the tree. 24 | final Widget child; 25 | 26 | @override 27 | Widget build(BuildContext context) { 28 | final double turnsValue = turns.value; 29 | final Matrix4 transform = new Matrix4.rotationZ(turnsValue * pi * 2.0); 30 | return new Transform( 31 | transform: transform, 32 | alignment: alignment, 33 | child: child, 34 | ); 35 | } 36 | } 37 | 38 | class AnimatedNeedle extends AnimatedWidget { 39 | AnimatedNeedle({Key key, Animation animation}) 40 | : super(key: key, listenable: animation); 41 | 42 | Widget build(BuildContext context) { 43 | final Animation animation = listenable; 44 | return new Container( 45 | height: 300.0, 46 | width: 100.0, 47 | child: new PivotTransition( 48 | turns: animation, 49 | alignment: FractionalOffset.topCenter, 50 | child: new Container( 51 | decoration: BoxDecoration( 52 | shape: BoxShape.circle, 53 | image: DecorationImage( 54 | image: AssetImage("images/play_needle.png"), 55 | ), 56 | ), 57 | )), 58 | ); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /lib/widgets/record_anim.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/animation.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class RotateRecord extends AnimatedWidget { 5 | 6 | String imageUrl; 7 | RotateRecord({Key key,this.imageUrl, Animation animation}) 8 | : super(key: key, listenable: animation); 9 | 10 | Widget build(BuildContext context) { 11 | final Animation animation = listenable; 12 | return new Container( 13 | margin: new EdgeInsets.symmetric(vertical: 10.0), 14 | height: 250.0, 15 | width: 250.0, 16 | child: new RotationTransition( 17 | turns: animation, 18 | child: new Container( 19 | decoration: BoxDecoration( 20 | shape: BoxShape.circle, 21 | image: DecorationImage( 22 | image: NetworkImage( 23 | imageUrl), 24 | ), 25 | ), 26 | )), 27 | ); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://www.dartlang.org/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.0.8" 11 | audioplayer: 12 | dependency: "direct main" 13 | description: 14 | name: audioplayer 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "0.5.2" 18 | boolean_selector: 19 | dependency: transitive 20 | description: 21 | name: boolean_selector 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.0.4" 25 | charcode: 26 | dependency: transitive 27 | description: 28 | name: charcode 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.1.2" 32 | collection: 33 | dependency: transitive 34 | description: 35 | name: collection 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.14.11" 39 | cookie_jar: 40 | dependency: transitive 41 | description: 42 | name: cookie_jar 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.0.0" 46 | cupertino_icons: 47 | dependency: "direct main" 48 | description: 49 | name: cupertino_icons 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "0.1.2" 53 | dio: 54 | dependency: "direct main" 55 | description: 56 | name: dio 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "2.1.0" 60 | flutter: 61 | dependency: "direct main" 62 | description: flutter 63 | source: sdk 64 | version: "0.0.0" 65 | flutter_test: 66 | dependency: "direct dev" 67 | description: flutter 68 | source: sdk 69 | version: "0.0.0" 70 | flutter_walkthrough: 71 | dependency: "direct main" 72 | description: 73 | name: flutter_walkthrough 74 | url: "https://pub.dartlang.org" 75 | source: hosted 76 | version: "0.0.1" 77 | flutter_webview_plugin: 78 | dependency: "direct main" 79 | description: 80 | name: flutter_webview_plugin 81 | url: "https://pub.dartlang.org" 82 | source: hosted 83 | version: "0.3.3" 84 | fluttertoast: 85 | dependency: "direct main" 86 | description: 87 | name: fluttertoast 88 | url: "https://pub.dartlang.org" 89 | source: hosted 90 | version: "3.0.3" 91 | http: 92 | dependency: "direct main" 93 | description: 94 | name: http 95 | url: "https://pub.dartlang.org" 96 | source: hosted 97 | version: "0.12.0+1" 98 | http_parser: 99 | dependency: transitive 100 | description: 101 | name: http_parser 102 | url: "https://pub.dartlang.org" 103 | source: hosted 104 | version: "3.1.3" 105 | matcher: 106 | dependency: transitive 107 | description: 108 | name: matcher 109 | url: "https://pub.dartlang.org" 110 | source: hosted 111 | version: "0.12.3+1" 112 | meta: 113 | dependency: transitive 114 | description: 115 | name: meta 116 | url: "https://pub.dartlang.org" 117 | source: hosted 118 | version: "1.1.6" 119 | path: 120 | dependency: transitive 121 | description: 122 | name: path 123 | url: "https://pub.dartlang.org" 124 | source: hosted 125 | version: "1.6.2" 126 | pedantic: 127 | dependency: transitive 128 | description: 129 | name: pedantic 130 | url: "https://pub.dartlang.org" 131 | source: hosted 132 | version: "1.5.0" 133 | pulltorefresh_flutter: 134 | dependency: "direct main" 135 | description: 136 | name: pulltorefresh_flutter 137 | url: "https://pub.dartlang.org" 138 | source: hosted 139 | version: "0.1.9" 140 | quiver: 141 | dependency: transitive 142 | description: 143 | name: quiver 144 | url: "https://pub.dartlang.org" 145 | source: hosted 146 | version: "2.0.1" 147 | sky_engine: 148 | dependency: transitive 149 | description: flutter 150 | source: sdk 151 | version: "0.0.99" 152 | source_span: 153 | dependency: transitive 154 | description: 155 | name: source_span 156 | url: "https://pub.dartlang.org" 157 | source: hosted 158 | version: "1.5.5" 159 | stack_trace: 160 | dependency: transitive 161 | description: 162 | name: stack_trace 163 | url: "https://pub.dartlang.org" 164 | source: hosted 165 | version: "1.9.3" 166 | stream_channel: 167 | dependency: transitive 168 | description: 169 | name: stream_channel 170 | url: "https://pub.dartlang.org" 171 | source: hosted 172 | version: "1.6.8" 173 | string_scanner: 174 | dependency: transitive 175 | description: 176 | name: string_scanner 177 | url: "https://pub.dartlang.org" 178 | source: hosted 179 | version: "1.0.4" 180 | term_glyph: 181 | dependency: transitive 182 | description: 183 | name: term_glyph 184 | url: "https://pub.dartlang.org" 185 | source: hosted 186 | version: "1.1.0" 187 | test_api: 188 | dependency: transitive 189 | description: 190 | name: test_api 191 | url: "https://pub.dartlang.org" 192 | source: hosted 193 | version: "0.2.2" 194 | toast: 195 | dependency: "direct main" 196 | description: 197 | name: toast 198 | url: "https://pub.dartlang.org" 199 | source: hosted 200 | version: "0.1.3" 201 | typed_data: 202 | dependency: transitive 203 | description: 204 | name: typed_data 205 | url: "https://pub.dartlang.org" 206 | source: hosted 207 | version: "1.1.6" 208 | vector_math: 209 | dependency: transitive 210 | description: 211 | name: vector_math 212 | url: "https://pub.dartlang.org" 213 | source: hosted 214 | version: "2.0.8" 215 | video_player: 216 | dependency: "direct main" 217 | description: 218 | name: video_player 219 | url: "https://pub.dartlang.org" 220 | source: hosted 221 | version: "0.10.0+4" 222 | sdks: 223 | dart: ">=2.2.0 <3.0.0" 224 | flutter: ">=0.2.5 <2.0.0" 225 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_widgets 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.1.0 <3.0.0" 18 | 19 | dependencies: 20 | flutter: 21 | sdk: flutter 22 | fluttertoast: ^3.0.1 23 | video_player: ^0.10.0+2 24 | audioplayer: ^0.5.2 25 | toast: 26 | http: 27 | dio: 28 | flutter_walkthrough: 29 | flutter_webview_plugin: 30 | 31 | # flutter_radial_menu: 32 | 33 | # The following adds the Cupertino Icons font to your application. 34 | # Use with the CupertinoIcons class for iOS style icons. 35 | cupertino_icons: ^0.1.2 36 | pulltorefresh_flutter: "^0.1.9" 37 | 38 | dev_dependencies: 39 | flutter_test: 40 | sdk: flutter 41 | 42 | 43 | # For information on the generic Dart part of this file, see the 44 | # following page: https://www.dartlang.org/tools/pub/pubspec 45 | 46 | # The following section is specific to Flutter. 47 | flutter: 48 | 49 | # The following line ensures that the Material Icons font is 50 | # included with your application, so that you can use the icons in 51 | # the material Icons class. 52 | uses-material-design: true 53 | 54 | # To add assets to your application, add an assets section, like this: 55 | # assets: 56 | # - images/a_dot_burr.jpeg 57 | # - images/a_dot_ham.jpeg 58 | 59 | # An image asset can refer to one or more resolution-specific "variants", see 60 | # https://flutter.io/assets-and-images/#resolution-aware. 61 | 62 | # For details regarding adding assets from package dependencies, see 63 | # https://flutter.io/assets-and-images/#from-packages 64 | 65 | # To add custom fonts to your application, add a fonts section here, 66 | # in this "flutter" section. Each entry in this list should have a 67 | # "family" key with the font family name, and a "fonts" key with a 68 | # list giving the asset and other descriptors for the font. For 69 | # example: 70 | # fonts: 71 | # - family: Schyler 72 | # fonts: 73 | # - asset: fonts/Schyler-Regular.ttf 74 | # - asset: fonts/Schyler-Italic.ttf 75 | # style: italic 76 | # - family: Trajan Pro 77 | # fonts: 78 | # - asset: fonts/TrajanPro.ttf 79 | # - asset: fonts/TrajanPro_Bold.ttf 80 | # weight: 700 81 | # 82 | # For details regarding fonts from package dependencies, 83 | # see https://flutter.io/custom-fonts/#from-packages 84 | -------------------------------------------------------------------------------- /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:flutter_widgets/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 | --------------------------------------------------------------------------------