├── demo1
├── .gitignore
├── .metadata
├── README.md
├── android
│ ├── app
│ │ ├── build.gradle
│ │ └── src
│ │ │ ├── debug
│ │ │ └── AndroidManifest.xml
│ │ │ ├── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java
│ │ │ │ └── com
│ │ │ │ │ └── example
│ │ │ │ │ └── demo1
│ │ │ │ │ └── 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
│ ├── 2.0x
│ │ └── demo.png
│ ├── 3.0X
│ │ └── demo.png
│ ├── demo.png
│ └── loading.gif
├── 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
│ └── 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
│ ├── bak
│ │ ├── main.1.dart
│ │ ├── main.10-动态渲染ListView.dart
│ │ ├── main.11-ListView-builder().dart
│ │ ├── main.12-ListView分隔符.dart
│ │ ├── main.13-GridView.dart
│ │ ├── main.14-GridView.builder&双列流.dart
│ │ ├── main.15-Padding.dart
│ │ ├── main.16-Row.dart
│ │ ├── main.17-Row Expanded.dart
│ │ ├── main.18-Column 和 Row组合布局.dart
│ │ ├── main.19-Stack Align 组件.dart
│ │ ├── main.2.dart
│ │ ├── main.20-Stack Positioned.dart
│ │ ├── main.21-AspectRatio.dart
│ │ ├── main.22-Card 实现列表.dart
│ │ ├── main.23-Wrap 实现流式布局.dart
│ │ ├── main.24-StatefulWidget 实现计数器.dart
│ │ ├── main.25-StatefulWidget&ListView.dart
│ │ ├── main.26-BottomNavigationBar顶部导航.dart
│ │ ├── main.27-基础路由&基础路由传值.dart
│ │ ├── main.28命名路由-routes表和onGenerateRoute.dart
│ │ ├── main.29-替换路由&返回根.dart
│ │ ├── main.3-EchoWidegt.dart
│ │ ├── main.30-自定义AppBar.dart
│ │ ├── main.31-TabBar.dart
│ │ ├── main.32-TabController 实现Tab.dart
│ │ ├── main.33-Drawer DrawerHeader.dart
│ │ ├── main.34-UserAccountsDrawerHeader.dart
│ │ ├── main.35-RasiedButton.dart
│ │ ├── main.36-FlatButton-IconButton-自定义按钮.dart
│ │ ├── main.37-FloatingActionButton&闲鱼.dart
│ │ ├── main.38-表单样式.dart
│ │ ├── main.39-获取设置表单值.dart
│ │ ├── main.4-Route.dart
│ │ ├── main.40-checkbox&CheckboxListTile.dart
│ │ ├── main.41-Radio&RadioListTile.dart
│ │ ├── main.42-Switch.dart
│ │ ├── main.43.2-表单验证.dart
│ │ ├── main.43.3-FocusNode-表单聚焦.dart
│ │ ├── main.43.表单模拟.dart
│ │ ├── main.44日期选择&国际化.dart
│ │ ├── main.45-2-渐变关注按钮.dart
│ │ ├── main.45-颜色渐变-follow组件.dart
│ │ ├── main.46-AnimatedContainer.dart
│ │ ├── main.46.2.AnimatedOpacity & AnimatedContainer.dart
│ │ ├── main.47-SnackBar及列表应用.dart
│ │ ├── main.48-Dimissable-滑动删除.dart
│ │ ├── main.49-CustomSrollView.dart
│ │ ├── main.5-RouteArguments.dart
│ │ ├── main.50-Sentry-错误上报.dart
│ │ ├── main.51-Hero组件转场动画.dart
│ │ ├── main.52-Isolates-compute.dart
│ │ ├── main.53-WebSocket.dart
│ │ ├── main.54-SharedPreference-键值存储.dart
│ │ ├── main.55-io 文件读写.dart
│ │ ├── main.56-Camera.dart
│ │ ├── main.57-VideoPlayer.dart
│ │ ├── main.6-container和Text Wdget.dart
│ │ ├── main.7-Image.dart
│ │ ├── main.8-ListView.dart
│ │ ├── main.9-横向列表和列表嵌套.dart
│ │ └── main.dart
│ ├── main.dart
│ ├── mock
│ │ └── list.dart
│ └── widegts
│ │ └── EchoWidegt.dart
├── pubspec.lock
├── pubspec.yaml
└── test
│ └── widget_test.dart
└── demo2
├── .gitignore
├── .metadata
├── README.md
├── android
├── app
│ ├── build.gradle
│ └── src
│ │ ├── debug
│ │ └── AndroidManifest.xml
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── demo2
│ │ │ │ └── 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
├── ios
├── Flutter
│ ├── AppFrameworkInfo.plist
│ ├── Debug.xcconfig
│ └── Release.xcconfig
├── Runner.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ └── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ └── contents.xcworkspacedata
└── 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
├── main.dart
├── mock
│ └── products.dart
├── pages
│ ├── Login.dart
│ └── Products.dart
├── supplemental
│ ├── asymmetric_view.dart
│ ├── cut_corners_border.dart
│ ├── product_card.dart
│ └── product_columns.dart
└── themes
│ ├── colors.dart
│ └── light.dart
├── pubspec.lock
├── pubspec.yaml
└── test
└── widget_test.dart
/demo1/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
18 | # The .vscode folder contains launch configuration and tasks you configure in
19 | # VS Code which you may wish to be included in version control, so this line
20 | # is commented out by default.
21 | #.vscode/
22 |
23 | # Flutter/Dart/Pub related
24 | **/doc/api/
25 | .dart_tool/
26 | .flutter-plugins
27 | .packages
28 | .pub-cache/
29 | .pub/
30 | /build/
31 |
32 | # Android related
33 | **/android/**/gradle-wrapper.jar
34 | **/android/.gradle
35 | **/android/captures/
36 | **/android/gradlew
37 | **/android/gradlew.bat
38 | **/android/local.properties
39 | **/android/**/GeneratedPluginRegistrant.java
40 |
41 | # iOS/XCode related
42 | **/ios/**/*.mode1v3
43 | **/ios/**/*.mode2v3
44 | **/ios/**/*.moved-aside
45 | **/ios/**/*.pbxuser
46 | **/ios/**/*.perspectivev3
47 | **/ios/**/*sync/
48 | **/ios/**/.sconsign.dblite
49 | **/ios/**/.tags*
50 | **/ios/**/.vagrant/
51 | **/ios/**/DerivedData/
52 | **/ios/**/Icon?
53 | **/ios/**/Pods/
54 | **/ios/**/.symlinks/
55 | **/ios/**/profile
56 | **/ios/**/xcuserdata
57 | **/ios/.generated/
58 | **/ios/Flutter/App.framework
59 | **/ios/Flutter/Flutter.framework
60 | **/ios/Flutter/Generated.xcconfig
61 | **/ios/Flutter/app.flx
62 | **/ios/Flutter/app.zip
63 | **/ios/Flutter/flutter_assets/
64 | **/ios/ServiceDefinitions.json
65 | **/ios/Runner/GeneratedPluginRegistrant.*
66 |
67 | # Exceptions to above rules.
68 | !**/ios/**/default.mode1v3
69 | !**/ios/**/default.mode2v3
70 | !**/ios/**/default.pbxuser
71 | !**/ios/**/default.perspectivev3
72 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
73 |
--------------------------------------------------------------------------------
/demo1/.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: 91213e2ed6b2aaab14ab40e03b3ba984b9a8bab4
8 | channel: master
9 |
10 | project_type: app
11 |
--------------------------------------------------------------------------------
/demo1/README.md:
--------------------------------------------------------------------------------
1 | # demo1
2 |
3 | A new Flutter project.
4 |
5 | ## Getting Started
6 |
7 | This project is a starting point for a Flutter application.
8 |
9 | A few resources to get you started if this is your first Flutter project:
10 |
11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
13 |
14 | For help getting started with Flutter, view our
15 | [online documentation](https://flutter.dev/docs), which offers tutorials,
16 | samples, guidance on mobile development, and a full API reference.
17 |
--------------------------------------------------------------------------------
/demo1/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.demo1"
37 | minSdkVersion 21
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 |
--------------------------------------------------------------------------------
/demo1/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/demo1/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
9 |
13 |
20 |
24 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/demo1/android/app/src/main/java/com/example/demo1/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.demo1;
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 |
--------------------------------------------------------------------------------
/demo1/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/demo1/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/postbird/FlutterHelloWorld/56674dc34a2b2a32159daab0551594057e3a547e/demo1/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/demo1/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/postbird/FlutterHelloWorld/56674dc34a2b2a32159daab0551594057e3a547e/demo1/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/demo1/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/postbird/FlutterHelloWorld/56674dc34a2b2a32159daab0551594057e3a547e/demo1/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/demo1/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/postbird/FlutterHelloWorld/56674dc34a2b2a32159daab0551594057e3a547e/demo1/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/demo1/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/postbird/FlutterHelloWorld/56674dc34a2b2a32159daab0551594057e3a547e/demo1/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/demo1/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
--------------------------------------------------------------------------------
/demo1/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/demo1/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 |
--------------------------------------------------------------------------------
/demo1/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 |
3 |
--------------------------------------------------------------------------------
/demo1/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 |
--------------------------------------------------------------------------------
/demo1/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 |
--------------------------------------------------------------------------------
/demo1/images/2.0x/demo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/postbird/FlutterHelloWorld/56674dc34a2b2a32159daab0551594057e3a547e/demo1/images/2.0x/demo.png
--------------------------------------------------------------------------------
/demo1/images/3.0X/demo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/postbird/FlutterHelloWorld/56674dc34a2b2a32159daab0551594057e3a547e/demo1/images/3.0X/demo.png
--------------------------------------------------------------------------------
/demo1/images/demo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/postbird/FlutterHelloWorld/56674dc34a2b2a32159daab0551594057e3a547e/demo1/images/demo.png
--------------------------------------------------------------------------------
/demo1/images/loading.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/postbird/FlutterHelloWorld/56674dc34a2b2a32159daab0551594057e3a547e/demo1/images/loading.gif
--------------------------------------------------------------------------------
/demo1/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 8.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/demo1/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/demo1/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/demo1/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 pub 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 | # Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
64 | install! 'cocoapods', :disable_input_output_paths => true
65 |
66 | post_install do |installer|
67 | installer.pods_project.targets.each do |target|
68 | target.build_configurations.each do |config|
69 | config.build_settings['ENABLE_BITCODE'] = 'NO'
70 | end
71 | end
72 | end
73 |
--------------------------------------------------------------------------------
/demo1/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - camera (0.0.1):
3 | - Flutter
4 | - Flutter (1.0.0)
5 | - FMDB (2.7.5):
6 | - FMDB/standard (= 2.7.5)
7 | - FMDB/standard (2.7.5)
8 | - path_provider (0.0.1):
9 | - Flutter
10 | - shared_preferences (0.0.1):
11 | - Flutter
12 | - sqflite (0.0.1):
13 | - Flutter
14 | - FMDB (~> 2.7.2)
15 | - video_player (0.0.1):
16 | - Flutter
17 |
18 | DEPENDENCIES:
19 | - camera (from `.symlinks/plugins/camera/ios`)
20 | - Flutter (from `.symlinks/flutter/ios`)
21 | - path_provider (from `.symlinks/plugins/path_provider/ios`)
22 | - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
23 | - sqflite (from `.symlinks/plugins/sqflite/ios`)
24 | - video_player (from `.symlinks/plugins/video_player/ios`)
25 |
26 | SPEC REPOS:
27 | https://github.com/cocoapods/specs.git:
28 | - FMDB
29 |
30 | EXTERNAL SOURCES:
31 | camera:
32 | :path: ".symlinks/plugins/camera/ios"
33 | Flutter:
34 | :path: ".symlinks/flutter/ios"
35 | path_provider:
36 | :path: ".symlinks/plugins/path_provider/ios"
37 | shared_preferences:
38 | :path: ".symlinks/plugins/shared_preferences/ios"
39 | sqflite:
40 | :path: ".symlinks/plugins/sqflite/ios"
41 | video_player:
42 | :path: ".symlinks/plugins/video_player/ios"
43 |
44 | SPEC CHECKSUMS:
45 | camera: d56ad165545ae5a0ffb892376033760a969c68c8
46 | Flutter: 58dd7d1b27887414a370fcccb9e645c08ffd7a6a
47 | FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
48 | path_provider: f96fff6166a8867510d2c25fdcc346327cc4b259
49 | shared_preferences: 1feebfa37bb57264736e16865e7ffae7fc99b523
50 | sqflite: ff1d9da63c06588cc8d1faf7256d741f16989d5a
51 | video_player: 3964090a33353060ed7f58aa6427c7b4b208ec21
52 |
53 | PODFILE CHECKSUM: 7fb83752f59ead6285236625b82473f90b1cb932
54 |
55 | COCOAPODS: 1.7.2
56 |
--------------------------------------------------------------------------------
/demo1/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/demo1/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/demo1/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/demo1/ios/Runner/AppDelegate.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | @interface AppDelegate : FlutterAppDelegate
5 |
6 | @end
7 |
--------------------------------------------------------------------------------
/demo1/ios/Runner/AppDelegate.m:
--------------------------------------------------------------------------------
1 | #include "AppDelegate.h"
2 | #include "GeneratedPluginRegistrant.h"
3 |
4 | @implementation AppDelegate
5 |
6 | - (BOOL)application:(UIApplication *)application
7 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
8 | [GeneratedPluginRegistrant registerWithRegistry:self];
9 | // Override point for customization after application launch.
10 | return [super application:application didFinishLaunchingWithOptions:launchOptions];
11 | }
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/demo1/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 |
--------------------------------------------------------------------------------
/demo1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/postbird/FlutterHelloWorld/56674dc34a2b2a32159daab0551594057e3a547e/demo1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/demo1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/postbird/FlutterHelloWorld/56674dc34a2b2a32159daab0551594057e3a547e/demo1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/demo1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/postbird/FlutterHelloWorld/56674dc34a2b2a32159daab0551594057e3a547e/demo1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/demo1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/postbird/FlutterHelloWorld/56674dc34a2b2a32159daab0551594057e3a547e/demo1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/demo1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/postbird/FlutterHelloWorld/56674dc34a2b2a32159daab0551594057e3a547e/demo1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/demo1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/postbird/FlutterHelloWorld/56674dc34a2b2a32159daab0551594057e3a547e/demo1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/demo1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/postbird/FlutterHelloWorld/56674dc34a2b2a32159daab0551594057e3a547e/demo1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/demo1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/postbird/FlutterHelloWorld/56674dc34a2b2a32159daab0551594057e3a547e/demo1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/demo1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/postbird/FlutterHelloWorld/56674dc34a2b2a32159daab0551594057e3a547e/demo1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/demo1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/postbird/FlutterHelloWorld/56674dc34a2b2a32159daab0551594057e3a547e/demo1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/demo1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/postbird/FlutterHelloWorld/56674dc34a2b2a32159daab0551594057e3a547e/demo1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/demo1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/postbird/FlutterHelloWorld/56674dc34a2b2a32159daab0551594057e3a547e/demo1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/demo1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/postbird/FlutterHelloWorld/56674dc34a2b2a32159daab0551594057e3a547e/demo1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/demo1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/postbird/FlutterHelloWorld/56674dc34a2b2a32159daab0551594057e3a547e/demo1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/demo1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/postbird/FlutterHelloWorld/56674dc34a2b2a32159daab0551594057e3a547e/demo1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/demo1/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 |
--------------------------------------------------------------------------------
/demo1/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/postbird/FlutterHelloWorld/56674dc34a2b2a32159daab0551594057e3a547e/demo1/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/demo1/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/postbird/FlutterHelloWorld/56674dc34a2b2a32159daab0551594057e3a547e/demo1/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/demo1/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/postbird/FlutterHelloWorld/56674dc34a2b2a32159daab0551594057e3a547e/demo1/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/demo1/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.
--------------------------------------------------------------------------------
/demo1/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 |
--------------------------------------------------------------------------------
/demo1/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 |
--------------------------------------------------------------------------------
/demo1/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | demo1
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | $(FLUTTER_BUILD_NAME)
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSRequiresIPhoneOS
24 |
25 | NSCameraUsageDescription
26 | Can I use the camera please?
27 | NSMicrophoneUsageDescription
28 | Can I use the mic please?
29 | UILaunchStoryboardName
30 | LaunchScreen
31 | UIMainStoryboardFile
32 | Main
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 | UIViewControllerBasedStatusBarAppearance
47 |
48 | NSAppTransportSecurity
49 |
50 | NSAllowsArbitraryLoads
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/demo1/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 |
--------------------------------------------------------------------------------
/demo1/lib/bak/main.1.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(MyApp());
5 | }
6 |
7 | // 自定义组件
8 | class MyApp extends StatelessWidget {
9 | @override
10 | Widget build(BuildContext context) {
11 | return HomeContent();
12 | }
13 | }
14 |
15 | class HomeContent extends StatelessWidget {
16 | @override
17 | Widget build(BuildContext context) {
18 | return Center(
19 | child: Text(
20 | 'Postbird 自定义 Widget!',
21 | textDirection: TextDirection.ltr,
22 | style: TextStyle(fontSize: 40, color: Colors.yellow),
23 | ));
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/demo1/lib/bak/main.10-动态渲染ListView.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'mock/list.dart' as newsList;
3 |
4 | const TITLE = '标题标题标题标题标题标题标题';
5 | const SUB_TITLE = '二级标题二级标题二级标题二级标题二级标题二级标题二级标题二级标题二';
6 | const IMAGE_SRC =
7 | 'https://cdn.pixabay.com/photo/2019/05/20/13/22/portugal-4216645_1280.jpg';
8 |
9 | void main() {
10 | runApp(MyApp());
11 | }
12 |
13 | class MyApp extends StatelessWidget {
14 | @override
15 | Widget build(BuildContext context) {
16 | return MaterialApp(
17 | home: Scaffold(
18 | appBar: AppBar(
19 | title: Text('ListView Widget'),
20 | backgroundColor: Colors.pink,
21 | ),
22 | body: HomeContent(),
23 | ),
24 | );
25 | }
26 | }
27 |
28 | class HomeContent extends StatelessWidget {
29 | @override
30 | Widget build(BuildContext context) {
31 | return Center(
32 | child: ListViewDemo(),
33 | );
34 | }
35 | }
36 |
37 | class ListViewDemo extends StatelessWidget {
38 | // 生成列表
39 | List _getData([int count = 20]) {
40 | List list = new List();
41 | for (int i = 0; i < count; i++) {
42 | list.add(ListItem(
43 | title: '${TITLE}_${i}',
44 | subTitle: '${SUB_TITLE}_${i}',
45 | ));
46 | }
47 | return list;
48 | }
49 |
50 | // 读取文件 mock 数据
51 | List _getNewsList() {
52 | return newsList.news.map((item) {
53 | return ListItem(
54 | title: '${item['title']}',
55 | subTitle: '${item['time']}',
56 | cover: '${item['imgurl']}',
57 | );
58 | }).toList();
59 | }
60 |
61 | @override
62 | Widget build(BuildContext context) {
63 | return ListView(
64 | // children: this._getData(20),
65 | children: this._getNewsList(),
66 | );
67 | }
68 | }
69 |
70 | class ListItem extends StatelessWidget {
71 | ListItem({this.title, this.subTitle, this.cover});
72 |
73 | final String title;
74 | final String subTitle;
75 | final String cover;
76 |
77 | @override
78 | Widget build(BuildContext context) {
79 | return ListTile(
80 | leading: Container(
81 | child: Image.network(this.cover, fit: BoxFit.cover),
82 | width: 60,
83 | height: 60,
84 | color: Colors.grey),
85 | trailing: Icon(Icons.chevron_right),
86 | title: Text(this.title),
87 | subtitle: Text(this.subTitle),
88 | );
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/demo1/lib/bak/main.11-ListView-builder().dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'mock/list.dart' as newsList;
3 |
4 | const TITLE = '标题标题标题标题标题标题标题';
5 | const SUB_TITLE = '二级标题二级标题二级标题二级标题二级标题二级标题二级标题二级标题二';
6 | const IMAGE_SRC =
7 | 'https://cdn.pixabay.com/photo/2019/05/20/13/22/portugal-4216645_1280.jpg';
8 |
9 | void main() {
10 | runApp(MyApp());
11 | }
12 |
13 | class MyApp extends StatelessWidget {
14 | @override
15 | Widget build(BuildContext context) {
16 | return MaterialApp(
17 | home: Scaffold(
18 | appBar: AppBar(
19 | title: Text('ListView Widget'),
20 | backgroundColor: Colors.pink,
21 | ),
22 | body: HomeContent(),
23 | ),
24 | );
25 | }
26 | }
27 |
28 | class HomeContent extends StatelessWidget {
29 |
30 | // item build 方法
31 | Widget _buildListItem(BuildContext context, int index) {
32 | Map newsItem = newsList.news[index];
33 | return ListItem(
34 | title: newsItem['title'],
35 | subTitle: newsItem['time'],
36 | );
37 | }
38 |
39 | @override
40 | Widget build(BuildContext context) {
41 | return ListView.builder(
42 | itemCount: newsList.news.length,
43 | itemBuilder: this._buildListItem); // 接收的两个参数
44 | }
45 | }
46 |
47 | class ListItem extends StatelessWidget {
48 | ListItem({this.title, this.subTitle, this.cover});
49 |
50 | final String title;
51 | final String subTitle;
52 | final String cover;
53 |
54 | @override
55 | Widget build(BuildContext context) {
56 | return ListTile(
57 | trailing: Icon(Icons.chevron_right),
58 | title: Text(this.title),
59 | subtitle: Text(this.subTitle),
60 | );
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/demo1/lib/bak/main.12-ListView分隔符.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'mock/list.dart' as newsList;
3 |
4 | const TITLE = '标题标题标题标题标题标题标题';
5 | const SUB_TITLE = '二级标题二级标题二级标题二级标题二级标题二级标题二级标题二级标题二';
6 | const IMAGE_SRC =
7 | 'https://cdn.pixabay.com/photo/2019/05/20/13/22/portugal-4216645_1280.jpg';
8 |
9 | void main() {
10 | runApp(MyApp());
11 | }
12 |
13 | class MyApp extends StatelessWidget {
14 | @override
15 | Widget build(BuildContext context) {
16 | return MaterialApp(
17 | home: Scaffold(
18 | appBar: AppBar(
19 | title: Text('ListView Widget'),
20 | backgroundColor: Colors.pink,
21 | ),
22 | body: HomeContent(),
23 | ),
24 | );
25 | }
26 | }
27 |
28 | class HomeContent extends StatelessWidget {
29 | // item build 方法
30 | Widget _buildListItem(BuildContext context, int index) {
31 | Map newsItem = newsList.news[index];
32 | return ListItem(
33 | title: newsItem['title'],
34 | subTitle: newsItem['time'],
35 | cover: newsItem['imgurl']);
36 | }
37 |
38 | // 无分割线的列表
39 | // @override
40 | // Widget build(BuildContext context) {
41 | // return ListView.builder(
42 | // itemCount: newsList.news.length,
43 | // itemBuilder: this._buildListItem); // 接收的两个参数
44 |
45 | // }
46 |
47 | // 能够生成下划线的列表
48 | @override
49 | Widget build(BuildContext context) {
50 | return ListView.separated(
51 | itemCount: newsList.news.length,
52 | itemBuilder: this._buildListItem,
53 | separatorBuilder: (BuildContext context, int index) {
54 | return Divider(
55 | color: Colors.grey[350],
56 | );
57 | },
58 | ); // 接收的两个参数
59 | }
60 | }
61 |
62 | class ListItem extends StatelessWidget {
63 | ListItem({this.title, this.subTitle, this.cover});
64 |
65 | final String title;
66 | final String subTitle;
67 | final String cover;
68 |
69 | @override
70 | Widget build(BuildContext context) {
71 | return ListTile(
72 | leading: Container(
73 | child: Image.network(cover),
74 | color: Colors.grey,
75 | width: 80,
76 | height: 80,
77 | ),
78 | trailing: Icon(Icons.chevron_right),
79 | title: Text(this.title),
80 | subtitle: Text(this.subTitle),
81 | );
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/demo1/lib/bak/main.13-GridView.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'mock/list.dart' as newsList;
3 |
4 | const TITLE = '标题标题标题标题标题标题标题';
5 | const SUB_TITLE = '二级标题二级标题二级标题二级标题二级标题二级标题二级标题二级标题二';
6 | const IMAGE_SRC =
7 | 'https://cdn.pixabay.com/photo/2019/05/20/13/22/portugal-4216645_1280.jpg';
8 |
9 | void main() {
10 | runApp(MyApp());
11 | }
12 |
13 | class MyApp extends StatelessWidget {
14 | @override
15 | Widget build(BuildContext context) {
16 | return MaterialApp(
17 | home: Scaffold(
18 | appBar: AppBar(
19 | title: Text('GridView Widget'),
20 | backgroundColor: Colors.pink,
21 | ),
22 | body: HomeContent(),
23 | ),
24 | );
25 | }
26 | }
27 |
28 | class HomeContent extends StatelessWidget {
29 | // 生成一个列表
30 | List _getGridList() {
31 | return newsList.news.map((item) {
32 | return GridViewItem();
33 | }).toList();
34 | }
35 |
36 | @override
37 | Widget build(BuildContext context) {
38 | return GridView.count(
39 | children: _getGridList(),
40 | crossAxisCount: 3,
41 | padding: EdgeInsets.all(10),
42 | crossAxisSpacing: 20, // 水平距离
43 | mainAxisSpacing: 20, // 垂直距离
44 | childAspectRatio: 1.3, // 宽高比例
45 | );
46 | }
47 | }
48 |
49 | class GridViewItem extends StatelessWidget {
50 | @override
51 | Widget build(BuildContext context) {
52 | return Container(
53 | child: Text('文本'),
54 | color: Colors.pink[200],
55 | );
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/demo1/lib/bak/main.15-Padding.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'mock/list.dart' as newsList;
3 |
4 | const TITLE = '标题标题标题标题标题标题标题';
5 | const SUB_TITLE = '二级标题二级标题二级标题二级标题二级标题二级标题二级标题二级标题二';
6 | const IMAGE_SRC =
7 | 'http://cms-bucket.ws.126.net/2019/06/20/68fa7f186ffe4479ab27efabd4d94246.png';
8 |
9 | void main() {
10 | runApp(MyApp());
11 | }
12 |
13 | class MyApp extends StatelessWidget {
14 | @override
15 | Widget build(BuildContext context) {
16 | return MaterialApp(
17 | home: Scaffold(
18 | appBar: AppBar(
19 | title: Text('Padding Widget'),
20 | backgroundColor: Colors.pink,
21 | ),
22 | body: HomeContent(),
23 | ),
24 | );
25 | }
26 | }
27 |
28 | class HomeContent extends StatelessWidget {
29 | // 生成一个列表
30 | List _getGridList() {
31 | return newsList.news.map((item) {
32 | return GridViewItem();
33 | }).toList();
34 | }
35 |
36 | // builder
37 | Widget _itemBuilderFunc(BuildContext context, int index) {
38 | final Map news = newsList.news[index];
39 | return GridViewItem();
40 | }
41 |
42 | // GridView.builder
43 | @override
44 | Widget build(BuildContext context) {
45 | return GridView.builder(
46 | itemCount: newsList.news.length,
47 | itemBuilder: this._itemBuilderFunc,
48 | // padding: EdgeInsets.fromLTRB(12, 12, 12, 0),
49 | gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
50 | crossAxisCount: 2,
51 | // crossAxisSpacing: 10,
52 | // mainAxisSpacing: 10,
53 | childAspectRatio: 1.4),
54 | );
55 | }
56 | }
57 |
58 | class GridViewItem extends StatelessWidget {
59 | @override
60 | Widget build(BuildContext context) {
61 | return Padding(
62 | child: Image.network(
63 | IMAGE_SRC,
64 | fit: BoxFit.cover,
65 | ),
66 | padding: EdgeInsets.fromLTRB(5, 5, 5, 0));
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/demo1/lib/bak/main.16-Row.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | const TITLE = '标题标题标题标题标题标题标题';
4 | const SUB_TITLE = '二级标题二级标题二级标题二级标题二级标题二级标题二级标题二级标题二';
5 | const IMAGE_SRC =
6 | 'http://cms-bucket.ws.126.net/2019/06/20/68fa7f186ffe4479ab27efabd4d94246.png';
7 |
8 | void main() {
9 | runApp(MyApp());
10 | }
11 |
12 | class MyApp extends StatelessWidget {
13 | @override
14 | Widget build(BuildContext context) {
15 | return MaterialApp(
16 | home: Scaffold(
17 | appBar: AppBar(
18 | title: Text('Row Widget'),
19 | backgroundColor: Colors.pink,
20 | ),
21 | body: HomeContent(),
22 | ),
23 | );
24 | }
25 | }
26 |
27 | class HomeContent extends StatelessWidget {
28 | @override
29 | Widget build(BuildContext context) {
30 | return RowDemo();
31 | }
32 | }
33 |
34 | class RowDemo extends StatelessWidget {
35 | @override
36 | Widget build(BuildContext context) {
37 | return Container(
38 | child: Row(
39 | children: [
40 | IconContainer(color: Colors.white, icon: Icons.home),
41 | IconContainer(color: Colors.blue, icon: Icons.search),
42 | IconContainer(color: Colors.yellow, icon: Icons.settings),
43 | IconContainer(color: Colors.white, icon: Icons.track_changes),
44 | ],
45 | // mainAxisAlignment: MainAxisAlignment.center,
46 | mainAxisAlignment: MainAxisAlignment.spaceAround,
47 | // mainAxisAlignment: MainAxisAlignment.center,
48 | crossAxisAlignment: CrossAxisAlignment.center,
49 | ),
50 | width: 600,
51 | height: 800,
52 | color: Colors.grey);
53 | }
54 | }
55 |
56 | class IconContainer extends StatelessWidget {
57 | IconContainer({
58 | @required this.icon,
59 | this.color = Colors.white,
60 | this.size = 32,
61 | });
62 |
63 | final IconData icon;
64 | final double size;
65 | final Color color;
66 |
67 | @override
68 | Widget build(BuildContext context) {
69 | return Container(
70 | child: Center(
71 | child: Icon(this.icon, size: this.size, color: this.color),
72 | ),
73 | width: 50,
74 | height: 50,
75 | color: Colors.red,
76 | );
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/demo1/lib/bak/main.17-Row Expanded.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | const TITLE = '标题标题标题标题标题标题标题';
4 | const SUB_TITLE = '二级标题二级标题二级标题二级标题二级标题二级标题二级标题二级标题二';
5 | const IMAGE_SRC =
6 | 'http://cms-bucket.ws.126.net/2019/06/20/68fa7f186ffe4479ab27efabd4d94246.png';
7 |
8 | void main() {
9 | runApp(MyApp());
10 | }
11 |
12 | class MyApp extends StatelessWidget {
13 | @override
14 | Widget build(BuildContext context) {
15 | return MaterialApp(
16 | home: Scaffold(
17 | appBar: AppBar(
18 | title: Text('Row Widget'),
19 | backgroundColor: Colors.pink,
20 | ),
21 | body: HomeContent(),
22 | ),
23 | );
24 | }
25 | }
26 |
27 | class HomeContent extends StatelessWidget {
28 | @override
29 | Widget build(BuildContext context) {
30 | return Column(
31 | children: [
32 | RowDemo(),
33 | RowDemo1(),
34 | ],
35 | );
36 | }
37 | }
38 |
39 | class RowDemo extends StatelessWidget {
40 | @override
41 | Widget build(BuildContext context) {
42 | return Row(
43 | children: [
44 | Expanded(flex: 1, child: IconContainer(icon: Icons.home)),
45 | Expanded(
46 | flex: 2,
47 | child: IconContainer(icon: Icons.settings, bgColor: Colors.blue)),
48 | Expanded(flex: 1, child: IconContainer(icon: Icons.search)),
49 | ],
50 | );
51 | }
52 | }
53 |
54 | class RowDemo1 extends StatelessWidget {
55 | @override
56 | Widget build(BuildContext context) {
57 | return Row(
58 | children: [
59 | Expanded(
60 | flex: 1,
61 | child: IconContainer(icon: Icons.home, bgColor: Colors.pink),
62 | ),
63 | IconContainer(icon: Icons.settings, bgColor: Colors.blue),
64 | ],
65 | );
66 | }
67 | }
68 |
69 | class IconContainer extends StatelessWidget {
70 | IconContainer(
71 | {@required this.icon,
72 | this.color = Colors.white,
73 | this.size = 32,
74 | this.bgColor = Colors.yellow});
75 |
76 | final IconData icon;
77 | final double size;
78 | final Color color;
79 | final Color bgColor;
80 |
81 | @override
82 | Widget build(BuildContext context) {
83 | return Container(
84 | child: Center(
85 | child: Icon(this.icon, size: this.size, color: this.color),
86 | ),
87 | width: 50,
88 | height: 50,
89 | color: this.bgColor,
90 | );
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/demo1/lib/bak/main.18-Column 和 Row组合布局.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | const TITLE = '标题标题标题标题标题标题标题';
4 | const SUB_TITLE = '二级标题二级标题二级标题二级标题二级标题二级标题二级标题二级标题二';
5 | const IMAGE_SRC =
6 | 'http://cms-bucket.ws.126.net/2019/06/20/68fa7f186ffe4479ab27efabd4d94246.png';
7 |
8 | void main() {
9 | runApp(MyApp());
10 | }
11 |
12 | class MyApp extends StatelessWidget {
13 | @override
14 | Widget build(BuildContext context) {
15 | return MaterialApp(
16 | home: Scaffold(
17 | appBar: AppBar(
18 | title: Text('Row Widget'),
19 | backgroundColor: Colors.pink,
20 | ),
21 | body: HomeContent(),
22 | ),
23 | );
24 | }
25 | }
26 |
27 | class HomeContent extends StatelessWidget {
28 | @override
29 | Widget build(BuildContext context) {
30 | return Column(
31 | children: [ColumnDemo()],
32 | );
33 | }
34 | }
35 |
36 | class ColumnDemo extends StatelessWidget {
37 | @override
38 | Widget build(BuildContext context) {
39 | return Column(
40 | children: [
41 | Container(
42 | color: Colors.grey[350],
43 | height: 150,
44 | ),
45 | SizedBox(height: 5),
46 | Row(
47 | children: [
48 | Expanded(
49 | flex: 2,
50 | child: ImageContainer(imgSrc: IMAGE_SRC, height: 150),
51 | ),
52 | SizedBox(width: 5),
53 | Expanded(
54 | child: Column(
55 | children: [
56 | ImageContainer(imgSrc: IMAGE_SRC, height: 72.5),
57 | SizedBox(height: 5),
58 | ImageContainer(imgSrc: IMAGE_SRC, height: 72.5)
59 | ],
60 | )),
61 | ],
62 | )
63 | ],
64 | );
65 | }
66 | }
67 |
68 | class ImageContainer extends StatelessWidget {
69 | final double height;
70 | final String imgSrc;
71 | ImageContainer({@required this.imgSrc, this.height = 100});
72 | @override
73 | Widget build(BuildContext context) {
74 | return Container(
75 | child: Image.network(this.imgSrc, fit: BoxFit.cover),
76 | height: this.height,
77 | color: Colors.grey[350],
78 | );
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/demo1/lib/bak/main.19-Stack Align 组件.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | const TITLE = '标题标题标题标题标题标题标题';
4 | const SUB_TITLE = '二级标题二级标题二级标题二级标题二级标题二级标题二级标题二级标题二';
5 | const IMAGE_SRC =
6 | 'http://cms-bucket.ws.126.net/2019/06/20/68fa7f186ffe4479ab27efabd4d94246.png';
7 |
8 | void main() {
9 | runApp(MyApp());
10 | }
11 |
12 | class MyApp extends StatelessWidget {
13 | @override
14 | Widget build(BuildContext context) {
15 | return MaterialApp(
16 | home: Scaffold(
17 | appBar: AppBar(
18 | title: Text('Stack Align Widget'),
19 | backgroundColor: Colors.pink,
20 | ),
21 | body: HomeContent(),
22 | ),
23 | );
24 | }
25 | }
26 |
27 | class HomeContent extends StatelessWidget {
28 | @override
29 | Widget build(BuildContext context) {
30 | return Center(
31 | child: Container(
32 | child: Stack(
33 | children: [
34 | Align(
35 | child: Icon(Icons.home, size: 40, color: Colors.white),
36 | alignment: Alignment.topCenter),
37 | Align(
38 | child: Icon(Icons.search, size: 40, color: Colors.pink),
39 | alignment: Alignment.bottomLeft),
40 | Icon(Icons.settings, size: 40, color: Colors.blue),
41 | ],
42 | alignment: Alignment.center,
43 | ),
44 | height: 400,
45 | width: 300,
46 | color: Colors.yellow,
47 | ),
48 | );
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/demo1/lib/bak/main.2.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(MyApp());
5 | }
6 |
7 |
8 | class MyApp extends StatelessWidget {
9 | @override
10 | Widget build(BuildContext context) {
11 | return MaterialApp(
12 | home: Scaffold(
13 | appBar: AppBar(
14 | title: Text('Postbird Flutter')
15 | ),
16 | body: HomeContent(),
17 | ),
18 | // theme: ThemeData.dark(),
19 | theme: ThemeData(
20 | primaryColor: Colors.yellow
21 | )
22 | );
23 | }
24 | }
25 |
26 | class HomeContent extends StatelessWidget {
27 | @override
28 | Widget build(BuildContext context) {
29 | return Center(
30 | child: Text(
31 | 'Postbird 自定义 Widget!',
32 | textDirection: TextDirection.ltr,
33 | style: TextStyle(fontSize: 40, color: Colors.blue),
34 | ));
35 | }
36 | }
--------------------------------------------------------------------------------
/demo1/lib/bak/main.20-Stack Positioned.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | const TITLE = '标题标题标题标题标题标题标题';
4 | const SUB_TITLE = '二级标题二级标题二级标题二级标题二级标题二级标题二级标题二级标题二';
5 | const IMAGE_SRC =
6 | 'http://cms-bucket.ws.126.net/2019/06/20/68fa7f186ffe4479ab27efabd4d94246.png';
7 |
8 | void main() {
9 | runApp(MyApp());
10 | }
11 |
12 | class MyApp extends StatelessWidget {
13 | @override
14 | Widget build(BuildContext context) {
15 | return MaterialApp(
16 | home: Scaffold(
17 | appBar: AppBar(
18 | title: Text('Stack Positioned Widget'),
19 | backgroundColor: Colors.pink,
20 | ),
21 | body: HomeContent(),
22 | ),
23 | );
24 | }
25 | }
26 |
27 | class HomeContent extends StatelessWidget {
28 | @override
29 | Widget build(BuildContext context) {
30 | return Center(
31 | child: Container(
32 | child: Stack(
33 | children: [
34 | Positioned(
35 | child: Icon(Icons.home, size: 40, color: Colors.white),
36 | left: 0,
37 | top: 0),
38 | Positioned(
39 | child: Icon(Icons.search, size: 40, color: Colors.pink),
40 | left: 0.4),
41 | Positioned(
42 | child: Icon(Icons.settings, size: 40, color: Colors.blue),
43 | bottom: 1),
44 | ],
45 | alignment: Alignment.center,
46 | ),
47 | height: 400,
48 | width: 300,
49 | color: Colors.yellow,
50 | ),
51 | );
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/demo1/lib/bak/main.21-AspectRatio.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | const TITLE = '标题标题标题标题标题标题标题';
4 | const SUB_TITLE = '二级标题二级标题二级标题二级标题二级标题二级标题二级标题二级标题二';
5 | const IMAGE_SRC =
6 | 'http://cms-bucket.ws.126.net/2019/06/20/68fa7f186ffe4479ab27efabd4d94246.png';
7 |
8 | void main() {
9 | runApp(MyApp());
10 | }
11 |
12 | class MyApp extends StatelessWidget {
13 | @override
14 | Widget build(BuildContext context) {
15 | return MaterialApp(
16 | home: Scaffold(
17 | appBar: AppBar(
18 | title: Text('AspectRatio Widget'),
19 | backgroundColor: Colors.pink,
20 | ),
21 | body: HomeContent(),
22 | ),
23 | );
24 | }
25 | }
26 |
27 | class HomeContent extends StatelessWidget {
28 | @override
29 | Widget build(BuildContext context) {
30 | return Center(
31 | child: AspectRatio(
32 | aspectRatio: 4 / 3,
33 | child: Container(
34 | color: Colors.pink,
35 | ),
36 | ),
37 | );
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/demo1/lib/bak/main.22-Card 实现列表.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'mock/list.dart' as newsList;
3 |
4 | const TITLE = '标题标题标题标题标题标题标题';
5 | const SUB_TITLE = '二级标题二级标题二级标题二级标题二级标题二级标题二级标题二级标题二';
6 | const IMAGE_SRC =
7 | 'http://cms-bucket.ws.126.net/2019/06/20/68fa7f186ffe4479ab27efabd4d94246.png';
8 |
9 | void main() {
10 | runApp(MyApp());
11 | }
12 |
13 | class MyApp extends StatelessWidget {
14 | @override
15 | Widget build(BuildContext context) {
16 | return MaterialApp(
17 | home: Scaffold(
18 | appBar: AppBar(
19 | title: Text('Card Widget'),
20 | backgroundColor: Colors.pink,
21 | ),
22 | body: HomeContent(),
23 | ),
24 | );
25 | }
26 | }
27 |
28 | class HomeContent extends StatelessWidget {
29 | Widget buildItem(BuildContext context, int index) {
30 | Map news = newsList.news[index];
31 | return CardItem2(
32 | title: news['title'],
33 | subTitle: news['docurl'],
34 | cover: news['imgurl'],
35 | );
36 | }
37 |
38 | @override
39 | Widget build(BuildContext context) {
40 | return ListView.builder(
41 | itemCount: newsList.news.length,
42 | itemBuilder: buildItem,
43 | );
44 | // return ListView(
45 | // children: [
46 | // CardItem(),
47 | // CardItem2(),
48 | // CardItem2(),
49 | // ],
50 | // padding: EdgeInsets.only(top: 20),
51 | // );
52 | }
53 | }
54 |
55 | class CardItem extends StatelessWidget {
56 | @override
57 | Widget build(BuildContext context) {
58 | return Card(
59 | child: Column(
60 | children: [
61 | ListTile(
62 | title: Text(TITLE),
63 | subtitle: Text(SUB_TITLE),
64 | ),
65 | ListTile(
66 | title: Text('地址:上海市'),
67 | ),
68 | ListTile(
69 | title: Text('电话:12345678901'),
70 | )
71 | ],
72 | ),
73 | );
74 | }
75 | }
76 |
77 | class CardItem2 extends StatelessWidget {
78 | CardItem2({
79 | this.title,
80 | this.subTitle,
81 | this.cover,
82 | });
83 | final String title;
84 | final String subTitle;
85 | final String cover;
86 | @override
87 | Widget build(BuildContext context) {
88 | return Card(
89 | child: Column(
90 | children: [
91 | AspectRatio(
92 | child: Container(
93 | decoration: BoxDecoration(
94 | image: DecorationImage(
95 | image: NetworkImage(this.cover),
96 | fit: BoxFit.cover,
97 | ),
98 | borderRadius: BorderRadius.vertical(
99 | top: Radius.circular(4),
100 | ),
101 | ),
102 | ),
103 | aspectRatio: 16 / 9,
104 | ),
105 | ListTile(
106 | title:
107 | Text(this.title, maxLines: 1, overflow: TextOverflow.ellipsis),
108 | subtitle: Text(this.subTitle,
109 | maxLines: 1, overflow: TextOverflow.ellipsis),
110 | leading: ClipOval(
111 | child: CircleAvatar(backgroundImage: NetworkImage(this.cover)),
112 | ),
113 | )
114 | ],
115 | ),
116 | margin: EdgeInsets.all(10),
117 | );
118 | }
119 | }
120 |
--------------------------------------------------------------------------------
/demo1/lib/bak/main.23-Wrap 实现流式布局.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'mock/list.dart' as newsList;
3 |
4 | const TITLE = '标题标题标题标题标题标题标题';
5 | const SUB_TITLE = '二级标题二级标题二级标题二级标题二级标题二级标题二级标题二级标题二';
6 | const IMAGE_SRC =
7 | 'http://cms-bucket.ws.126.net/2019/06/20/68fa7f186ffe4479ab27efabd4d94246.png';
8 |
9 | void main() {
10 | runApp(MyApp());
11 | }
12 |
13 | class MyApp extends StatelessWidget {
14 | @override
15 | Widget build(BuildContext context) {
16 | return MaterialApp(
17 | home: Scaffold(
18 | appBar: AppBar(
19 | title: Text('Wrap RaisedButton Widget'),
20 | backgroundColor: Colors.pink,
21 | ),
22 | body: HomeContent(),
23 | ),
24 | );
25 | }
26 | }
27 |
28 | class HomeContent extends StatelessWidget {
29 | @override
30 | Widget build(BuildContext context) {
31 | return Padding(
32 | child: Wrap(
33 | children: [
34 | ButtonItem(text: '盗墓笔记'),
35 | ButtonItem(text: '鬼吹灯'),
36 | ButtonItem(text: '这个书名是凑的'),
37 | ButtonItem(text: '藏海花'),
38 | ButtonItem(text: '沙海'),
39 | ButtonItem(text: '鬼吹灯'),
40 | ButtonItem(text: '这个书名是凑的'),
41 | ButtonItem(text: '沙海'),
42 | ButtonItem(text: '鬼吹灯'),
43 | ButtonItem(text: '这个书名是凑的'),
44 | ButtonItem(text: '藏海花'),
45 | ButtonItem(text: '沙海'),
46 | ButtonItem(text: '藏海花'),
47 | ButtonItem(text: '沙海'),
48 | ],
49 | spacing: 12,
50 | runSpacing: 13,
51 | alignment: WrapAlignment.start,
52 | runAlignment: WrapAlignment.end,
53 | ),
54 | padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
55 | );
56 | }
57 | }
58 |
59 | class ButtonItem extends StatelessWidget {
60 | ButtonItem({
61 | Key key,
62 | @required this.text,
63 | }) : super(key: key);
64 |
65 | final String text;
66 |
67 | @override
68 | Widget build(BuildContext context) {
69 | return RaisedButton(
70 | child: Text(this.text),
71 | color: Theme.of(context).buttonColor,
72 | onPressed: () {},
73 | );
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/demo1/lib/bak/main.24-StatefulWidget 实现计数器.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'mock/list.dart' as newsList;
3 |
4 | const TITLE = '标题标题标题标题标题标题标题';
5 | const SUB_TITLE = '二级标题二级标题二级标题二级标题二级标题二级标题二级标题二级标题二';
6 | const IMAGE_SRC =
7 | 'http://cms-bucket.ws.126.net/2019/06/20/68fa7f186ffe4479ab27efabd4d94246.png';
8 |
9 | void main() {
10 | runApp(MyApp());
11 | }
12 |
13 | class MyApp extends StatelessWidget {
14 | @override
15 | Widget build(BuildContext context) {
16 | return MaterialApp(
17 | home: Scaffold(
18 | appBar: AppBar(
19 | title: Text('StatefulWidget'),
20 | backgroundColor: Colors.pink,
21 | ),
22 | body: HomeContent(),
23 | ),
24 | );
25 | }
26 | }
27 |
28 | class HomeContent extends StatelessWidget {
29 | @override
30 | Widget build(BuildContext context) {
31 | return NumberCounter();
32 | }
33 | }
34 |
35 | class NumberCounter extends StatefulWidget {
36 | @override
37 | _NumberCounterState createState() => _NumberCounterState();
38 | }
39 |
40 | class _NumberCounterState extends State {
41 | int num = 0;
42 | // num set state
43 | numSetState([bool flag = true]) {
44 | return () => setState(() {
45 | flag ? this.num++ : this.num--;
46 | });
47 | }
48 |
49 | @override
50 | Widget build(BuildContext context) {
51 | return Center(
52 | child: Column(
53 | children: [
54 | SizedBox(height: 20),
55 | Text(
56 | this.num.toString(),
57 | style: TextStyle(
58 | color: Colors.pink,
59 | fontSize: 40,
60 | ),
61 | ),
62 | SizedBox(height: 20),
63 | Row(
64 | children: [
65 | FlatButton(
66 | child: Text('+'),
67 | onPressed: numSetState(true),
68 | color: Theme.of(context).buttonColor,
69 | ),
70 | SizedBox(width: 10),
71 | FlatButton(
72 | child: Text('-'),
73 | onPressed: numSetState(false),
74 | color: Theme.of(context).buttonColor,
75 | )
76 | ],
77 | mainAxisAlignment: MainAxisAlignment.center,
78 | )
79 | ],
80 | ),
81 | );
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/demo1/lib/bak/main.25-StatefulWidget&ListView.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'mock/list.dart' as newsList;
3 |
4 | const TITLE = '标题标题标题标题标题标题标题';
5 | const SUB_TITLE = '二级标题二级标题二级标题二级标题二级标题二级标题二级标题二级标题二';
6 | const IMAGE_SRC =
7 | 'http://cms-bucket.ws.126.net/2019/06/20/68fa7f186ffe4479ab27efabd4d94246.png';
8 |
9 | void main() {
10 | runApp(MyApp());
11 | }
12 |
13 | class MyApp extends StatelessWidget {
14 | @override
15 | Widget build(BuildContext context) {
16 | return MaterialApp(
17 | home: Scaffold(
18 | appBar: AppBar(
19 | title: Text('StatefulWidget'),
20 | backgroundColor: Colors.pink,
21 | ),
22 | body: HomeContent(),
23 | ),
24 | );
25 | }
26 | }
27 |
28 | class HomeContent extends StatelessWidget {
29 | @override
30 | Widget build(BuildContext context) {
31 | return NewsList();
32 | }
33 | }
34 |
35 | class NewsList extends StatefulWidget {
36 | NewsList({Key key}) : super(key: key);
37 |
38 | _NewsListState createState() => _NewsListState();
39 | }
40 |
41 | class _NewsListState extends State {
42 | List