├── plugin
└── flutter_calc_plugin
│ ├── ios
│ ├── Assets
│ │ └── .gitkeep
│ ├── Classes
│ │ ├── FlutterCalcPlugin.h
│ │ ├── FlutterCalcPlugin.m
│ │ └── SwiftFlutterCalcPlugin.swift
│ ├── .gitignore
│ └── flutter_calc_plugin.podspec
│ ├── LICENSE
│ ├── CHANGELOG.md
│ ├── android
│ ├── settings.gradle
│ ├── gradle.properties
│ ├── .gitignore
│ ├── gradle
│ │ └── wrapper
│ │ │ └── gradle-wrapper.properties
│ ├── src
│ │ └── main
│ │ │ ├── AndroidManifest.xml
│ │ │ └── kotlin
│ │ │ └── com
│ │ │ └── example
│ │ │ └── flutter_calc_plugin
│ │ │ ├── MyPlugin.kt
│ │ │ └── FlutterCalcPlugin.kt
│ └── build.gradle
│ ├── example
│ ├── ios
│ │ ├── Runner
│ │ │ ├── Runner-Bridging-Header.h
│ │ │ ├── Assets.xcassets
│ │ │ │ ├── LaunchImage.imageset
│ │ │ │ │ ├── LaunchImage.png
│ │ │ │ │ ├── LaunchImage@2x.png
│ │ │ │ │ ├── LaunchImage@3x.png
│ │ │ │ │ ├── README.md
│ │ │ │ │ └── Contents.json
│ │ │ │ └── AppIcon.appiconset
│ │ │ │ │ ├── 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-1024x1024@1x.png
│ │ │ │ │ └── Icon-App-83.5x83.5@2x.png
│ │ │ ├── AppDelegate.swift
│ │ │ ├── Base.lproj
│ │ │ │ └── Main.storyboard
│ │ │ └── Info.plist
│ │ ├── Flutter
│ │ │ ├── Debug.xcconfig
│ │ │ ├── Release.xcconfig
│ │ │ └── AppFrameworkInfo.plist
│ │ ├── Runner.xcworkspace
│ │ │ └── contents.xcworkspacedata
│ │ └── Runner.xcodeproj
│ │ │ └── project.xcworkspace
│ │ │ └── contents.xcworkspacedata
│ ├── android
│ │ ├── gradle.properties
│ │ ├── app
│ │ │ ├── src
│ │ │ │ ├── main
│ │ │ │ │ ├── res
│ │ │ │ │ │ ├── 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
│ │ │ │ │ │ ├── drawable
│ │ │ │ │ │ │ └── launch_background.xml
│ │ │ │ │ │ └── values
│ │ │ │ │ │ │ └── styles.xml
│ │ │ │ │ └── kotlin
│ │ │ │ │ │ └── com
│ │ │ │ │ │ └── example
│ │ │ │ │ │ └── flutter_calc_plugin_example
│ │ │ │ │ │ └── MainActivity.kt
│ │ │ │ ├── debug
│ │ │ │ │ └── AndroidManifest.xml
│ │ │ │ └── profile
│ │ │ │ │ └── AndroidManifest.xml
│ │ │ └── build.gradle
│ │ ├── gradle
│ │ │ └── wrapper
│ │ │ │ └── gradle-wrapper.properties
│ │ ├── settings.gradle
│ │ └── build.gradle
│ ├── .metadata
│ ├── .flutter-plugins-dependencies
│ ├── README.md
│ ├── test
│ │ └── widget_test.dart
│ └── .gitignore
│ ├── .gitignore
│ ├── .idea
│ ├── vcs.xml
│ ├── libraries
│ │ ├── Flutter_Plugins.xml
│ │ ├── Flutter_for_Android.xml
│ │ └── Dart_SDK.xml
│ ├── misc.xml
│ ├── runConfigurations
│ │ └── example_lib_main_dart.xml
│ └── modules.xml
│ ├── .metadata
│ ├── README.md
│ ├── test
│ └── flutter_calc_plugin_test.dart
│ ├── lib
│ └── flutter_calc_plugin.dart
│ └── flutter_calc_plugin.iml
├── android
├── app
│ └── src
│ │ └── main
│ │ ├── res
│ │ ├── values
│ │ │ ├── strings.xml
│ │ │ └── styles.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
│ │ ├── layout
│ │ │ ├── activity_main.xml
│ │ │ └── activity_second.xml
│ │ └── drawable
│ │ │ └── launch_background.xml
│ │ └── java
│ │ └── com
│ │ └── zhuandian
│ │ └── flutterapp
│ │ └── SecondActivity.java
├── .idea
│ ├── dictionaries
│ │ └── cns.xml
│ ├── caches
│ │ ├── gradle_models.ser
│ │ └── build_file_checksums.ser
│ ├── compiler.xml
│ ├── kotlinc.xml
│ ├── vcs.xml
│ ├── gradle.xml
│ └── jarRepositories.xml
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradle.properties
├── .gitignore
├── settings.gradle
└── build.gradle
├── images
├── a.png
├── aaa.png
├── wechat.jpg
├── qq_group.png
├── syllabus.gif
├── code_scroll.gif
└── flutter_widget.gif
├── lib
├── pages
│ ├── stateManage
│ │ ├── redux
│ │ │ ├── action.dart
│ │ │ ├── redux_state.dart
│ │ │ └── redux_first_page.dart
│ │ ├── BLoC
│ │ │ └── bloc_state_page.dart
│ │ ├── callback
│ │ │ ├── call_back_second_page.dart
│ │ │ └── call_back_page.dart
│ │ └── state_manage.dart
│ ├── simpleWidget
│ │ ├── sliverWidget
│ │ │ ├── SliverBoxPage.dart
│ │ │ └── SliverPage.dart
│ │ ├── layout
│ │ │ ├── CenterPage.dart
│ │ │ ├── SizedBoxPage.dart
│ │ │ ├── PaddingLayoutPage.dart
│ │ │ ├── AspecRadioLayoutPage.dart
│ │ │ ├── AlignLayoutPage.dart
│ │ │ ├── OpacityPage.dart
│ │ │ └── StackLayoutPage.dart
│ │ ├── navigator
│ │ │ ├── StaticNavigatorPageWithParams.dart
│ │ │ ├── DynamicNavigationPage.dart
│ │ │ └── StaticNavigatorPage.dart
│ │ ├── PlatformPage.dart
│ │ ├── ImagePage.dart
│ │ └── GestureDetectorPage.dart
│ ├── custom_widget
│ │ ├── widget
│ │ │ └── SpaceWidget.dart
│ │ ├── pages
│ │ │ └── verification_code_page.dart
│ │ └── custom_widget_page.dart
│ ├── key
│ │ ├── key_demo.dart
│ │ ├── globalKey
│ │ │ ├── globalKey_demo.dart
│ │ │ └── switcher_widget.dart
│ │ └── box.dart
│ ├── platform
│ │ └── platform_page.dart
│ └── storage
│ │ ├── StoragePage.dart
│ │ └── SharedPerferenceStorage.dart
├── demo
│ ├── storage
│ │ └── FileDemo.dart
│ ├── navigation
│ │ ├── HomePage.dart
│ │ ├── NavigationView3.dart
│ │ └── NavigationView.dart
│ ├── route
│ │ ├── SecondPageWithParams2.dart
│ │ ├── login
│ │ │ └── LoginSuccessPage.dart
│ │ ├── SecondPageWithParams.dart
│ │ ├── SecondPageWithResult.dart
│ │ └── SecondPage.dart
│ ├── widgets
│ │ ├── image
│ │ │ └── ImageDemo.dart
│ │ ├── textAndImage
│ │ │ ├── IconDemo.dart
│ │ │ ├── ImageDemo1.dart
│ │ │ ├── ImageDemo.dart
│ │ │ ├── TextDemo2.dart
│ │ │ └── TextDemo.dart
│ │ ├── Scaffold
│ │ │ ├── Scaffold.dart
│ │ │ ├── PersistentFooterButtons.dart
│ │ │ ├── AppBar.dart
│ │ │ ├── FloatingActionButton.dart
│ │ │ ├── BottomNavigationBar.dart
│ │ │ ├── Drawer.dart
│ │ │ └── SimpleTabBarDemo.dart
│ │ ├── container
│ │ │ ├── ContainerDemo.dart
│ │ │ └── Container1.dart
│ │ ├── layout
│ │ │ ├── IndexStackLayout.dart
│ │ │ ├── RowAndColumDemo.dart
│ │ │ ├── StackLayoutDemo.dart
│ │ │ ├── SimpleExpansionDemo.dart
│ │ │ ├── RowAndColumList2.dart
│ │ │ ├── TableDemo.dart
│ │ │ └── SimpleExpansionPanelListDemo.dart
│ │ ├── TextInputAndChose
│ │ │ ├── CheckBoxDemo.dart
│ │ │ ├── SwitchDemo.dart
│ │ │ ├── TextFieldDemo2.dart
│ │ │ ├── SliderDemo.dart
│ │ │ ├── LinearProgressIndicatorDemo.dart
│ │ │ ├── CicularProgressIndicatorDemo.dart
│ │ │ └── RadioGroupDemo.dart
│ │ ├── ToastAndDialog
│ │ │ ├── AboutDialog.dart
│ │ │ ├── SimpleTooltipDemo.dart
│ │ │ ├── SnackBarDemo.dart
│ │ │ ├── AlertDialog.dart
│ │ │ ├── BottomSheetDemo.dart
│ │ │ └── ModalBottomSheet.dart
│ │ ├── ListAndGridView
│ │ │ ├── GridList.dart
│ │ │ ├── LongList.dart
│ │ │ ├── ListViewDemo2.dart
│ │ │ ├── ListViewDemo3.dart
│ │ │ ├── GridViewDemo2.dart
│ │ │ └── SimpleListViewDemo.dart
│ │ ├── statefulwidget
│ │ │ ├── NumberCount.dart
│ │ │ ├── StatefulWidget.dart
│ │ │ └── ChangeIcon.dart
│ │ ├── view
│ │ │ └── MyView3.dart
│ │ └── button
│ │ │ └── MyButton.dart
│ ├── network
│ │ ├── User.dart
│ │ └── SimpleGet.dart
│ ├── theme
│ │ ├── ThemeDemo2.dart
│ │ └── ThemeDemo.dart
│ ├── networkAndAsync
│ │ └── async.dart
│ ├── platform
│ │ └── platform.dart
│ └── Animation
│ │ ├── SimpleHeroAnimationDemo.dart
│ │ ├── AnimatedOpacity.dart
│ │ ├── AnimatedContainer.dart
│ │ ├── AnimatedCrossFade.dart
│ │ └── HeroLoginSuccessPage.dart
├── view
│ ├── customview
│ │ ├── LabelAlignment.dart
│ │ ├── label_view_top_right.dart
│ │ ├── label_view_bottom_left.dart
│ │ ├── label_view_bottom_right.dart
│ │ └── label_view_top_left.dart
│ ├── margin_widget.dart
│ └── MyRaisedButton.dart
└── generated_plugin_registrant.dart
├── ios
├── Flutter
│ ├── Debug.xcconfig
│ ├── Release.xcconfig
│ ├── flutter_export_environment.sh
│ └── AppFrameworkInfo.plist
├── Runner
│ ├── AppDelegate.h
│ ├── Assets.xcassets
│ │ ├── LaunchImage.imageset
│ │ │ ├── LaunchImage.png
│ │ │ ├── LaunchImage@2x.png
│ │ │ ├── LaunchImage@3x.png
│ │ │ ├── README.md
│ │ │ └── Contents.json
│ │ └── AppIcon.appiconset
│ │ │ ├── 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-1024x1024@1x.png
│ │ │ └── Icon-App-83.5x83.5@2x.png
│ ├── main.m
│ ├── AppDelegate.m
│ ├── Info.plist
│ └── Base.lproj
│ │ └── Main.storyboard
├── Runner.xcworkspace
│ └── contents.xcworkspacedata
├── Runner.xcodeproj
│ └── project.xcworkspace
│ │ └── contents.xcworkspacedata
├── .gitignore
└── Podfile
├── .idea
├── markdown-navigator
│ └── profiles_settings.xml
├── vcs.xml
├── libraries
│ ├── Flutter_for_Android.xml
│ ├── Flutter_Plugins.xml
│ └── Dart_SDK.xml
├── runConfigurations
│ └── main_dart.xml
├── modules.xml
└── misc.xml
├── .gitignore
├── .metadata
├── upgrade.md
└── flutter_app_android.iml
/plugin/flutter_calc_plugin/ios/Assets/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/LICENSE:
--------------------------------------------------------------------------------
1 | TODO: Add your license here.
2 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/images/a.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/images/a.png
--------------------------------------------------------------------------------
/images/aaa.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/images/aaa.png
--------------------------------------------------------------------------------
/images/wechat.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/images/wechat.jpg
--------------------------------------------------------------------------------
/lib/pages/stateManage/redux/action.dart:
--------------------------------------------------------------------------------
1 | /// 定义action
2 | enum Action { decrease, increase }
--------------------------------------------------------------------------------
/images/qq_group.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/images/qq_group.png
--------------------------------------------------------------------------------
/images/syllabus.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/images/syllabus.gif
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 0.0.1
2 |
3 | * TODO: Describe initial release.
4 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'flutter_calc_plugin'
2 |
--------------------------------------------------------------------------------
/images/code_scroll.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/images/code_scroll.gif
--------------------------------------------------------------------------------
/images/flutter_widget.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/images/flutter_widget.gif
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .dart_tool/
3 |
4 | .packages
5 | .pub/
6 |
7 | build/
8 |
--------------------------------------------------------------------------------
/android/.idea/dictionaries/cns.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/lib/demo/storage/FileDemo.dart:
--------------------------------------------------------------------------------
1 | //http://flutter.link/2018/04/13/Flutter%E4%B8%AD%E7%9A%84%E6%9C%AC%E5%9C%B0%E5%AD%98%E5%82%A8/
--------------------------------------------------------------------------------
/android/.idea/caches/gradle_models.ser:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/android/.idea/caches/gradle_models.ser
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/android/.idea/caches/build_file_checksums.ser:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/android/.idea/caches/build_file_checksums.ser
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.enableR8=true
3 | android.useAndroidX=true
4 | android.enableJetifier=true
5 |
--------------------------------------------------------------------------------
/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/ios/Runner/AppDelegate.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | @interface AppDelegate : FlutterAppDelegate
5 |
6 | @end
7 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/android/gradle.properties:
--------------------------------------------------------------------------------
1 | android.enableJetifier=true
2 | android.useAndroidX=true
3 | org.gradle.jvmargs=-Xmx1536M
4 |
5 |
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | android.enableJetifier=true
2 | android.useAndroidX=true
3 | org.gradle.jvmargs=-Xmx1536M
4 |
5 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/ios/Classes/FlutterCalcPlugin.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface FlutterCalcPlugin : NSObject
4 | @end
5 |
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/android/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/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/xiedong11/flutter_app/HEAD/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/xiedong11/flutter_app/HEAD/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/xiedong11/flutter_app/HEAD/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/xiedong11/flutter_app/HEAD/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/xiedong11/flutter_app/HEAD/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/xiedong11/flutter_app/HEAD/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/xiedong11/flutter_app/HEAD/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/xiedong11/flutter_app/HEAD/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/xiedong11/flutter_app/HEAD/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/xiedong11/flutter_app/HEAD/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/xiedong11/flutter_app/HEAD/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/xiedong11/flutter_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/.idea/markdown-navigator/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | *.class
3 | .gradle
4 | /local.properties
5 | /.idea/workspace.xml
6 | /.idea/libraries
7 | .DS_Store
8 | /build
9 | /captures
10 | GeneratedPluginRegistrant.java
11 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .dart_tool/
3 |
4 | .packages
5 | .pub/
6 |
7 | build/
8 |
9 | .flutter-plugins
10 | /.idea/codeStyles/
11 | /.idea/libraries/
12 | /.idea/workspace.xml
13 | /.idea/codeStyles/
14 |
--------------------------------------------------------------------------------
/android/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/android/.idea/kotlinc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/android/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/plugin/flutter_calc_plugin/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/plugin/flutter_calc_plugin/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/plugin/flutter_calc_plugin/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/plugin/flutter_calc_plugin/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/plugin/flutter_calc_plugin/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
6 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiedong11/flutter_app/HEAD/plugin/flutter_calc_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
6 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/.idea/libraries/Flutter_Plugins.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.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: 66091f969653fd3535b265ddcd87436901858a1d
8 | channel: dev
9 |
--------------------------------------------------------------------------------
/.idea/libraries/Flutter_for_Android.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/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 |
--------------------------------------------------------------------------------
/lib/view/customview/LabelAlignment.dart:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * 定义标签显示位置
4 | */
5 | class LabelAlignment {
6 | int labelAlignment;
7 |
8 | LabelAlignment({required this.labelAlignment});
9 |
10 | static const topLeft = 0;
11 | static const topRight = 1;
12 | static const bottomLeft = 2;
13 | static const bottomRight = 3;
14 | }
--------------------------------------------------------------------------------
/.idea/runConfigurations/main_dart.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/ios/Classes/FlutterCalcPlugin.m:
--------------------------------------------------------------------------------
1 | #import "FlutterCalcPlugin.h"
2 | #import
3 |
4 | @implementation FlutterCalcPlugin
5 | + (void)registerWithRegistrar:(NSObject*)registrar {
6 | [SwiftFlutterCalcPlugin registerWithRegistrar:registrar];
7 | }
8 | @end
9 |
--------------------------------------------------------------------------------
/lib/demo/navigation/HomePage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | class Classify extends StatelessWidget {
3 |
4 |
5 | @override
6 | Widget build(BuildContext context) {
7 | // TODO: implement build
8 |
9 | return new Scaffold(
10 | body: new Center(
11 | child:
12 | new Text("分类"),
13 | ),
14 | );
15 | }
16 | }
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/.idea/libraries/Flutter_for_Android.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/lib/pages/simpleWidget/sliverWidget/SliverBoxPage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class SliverBoxPage extends StatelessWidget {
4 | @override
5 | Widget build(BuildContext context) {
6 | return Scaffold(
7 | appBar: AppBar(
8 | title: Text("SliverBox"),
9 | ),
10 | body: CustomScrollView(),
11 | );
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/.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: 68587a0916366e9512a78df22c44163d041dd5f3
8 | channel: stable
9 |
10 | project_type: plugin
11 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/.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: 68587a0916366e9512a78df22c44163d041dd5f3
8 | channel: stable
9 |
10 | project_type: app
11 |
--------------------------------------------------------------------------------
/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.
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/.idea/runConfigurations/example_lib_main_dart.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/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.
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
10 |
--------------------------------------------------------------------------------
/lib/view/margin_widget.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/cupertino.dart';
2 |
3 | /**
4 | * @desc 公用margin组件
5 | * @author xiedong
6 | * @date 2020-02-24.
7 | */
8 |
9 | class Margin extends StatelessWidget {
10 | double width, height;
11 |
12 | Margin({this.width = 0, this.height = 0});
13 |
14 | @override
15 | Widget build(BuildContext context) {
16 | return SizedBox(
17 | height: height,
18 | width: width,
19 | );
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/lib/generated_plugin_registrant.dart:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // ignore_for_file: lines_longer_than_80_chars
6 |
7 | import 'package:shared_preferences_web/shared_preferences_web.dart';
8 |
9 | import 'package:flutter_web_plugins/flutter_web_plugins.dart';
10 |
11 | // ignore: public_member_api_docs
12 | void registerPlugins(Registrar registrar) {
13 | SharedPreferencesPlugin.registerWith(registrar);
14 | registrar.registerMessageHandler();
15 | }
16 |
--------------------------------------------------------------------------------
/lib/demo/route/SecondPageWithParams2.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class SecondPageWithParams2 extends StatelessWidget {
4 | String title;
5 |
6 | SecondPageWithParams2(this.title);
7 |
8 | @override
9 | Widget build(BuildContext context) {
10 | return new Scaffold(
11 | appBar: new AppBar(
12 | title: new Text(title),
13 | ),
14 | body: new Center(
15 | child: new Text(title),
16 | ),
17 | );
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/lib/demo/route/login/LoginSuccessPage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class LoginSuccessPage extends StatelessWidget {
4 | final userName;
5 |
6 | LoginSuccessPage(this.userName);
7 |
8 | @override
9 | Widget build(BuildContext context) {
10 | return new Scaffold(
11 | appBar: new AppBar(
12 | title: new Text("DynamicPage"),
13 | ),
14 | body: new Center(
15 | child: new Text("登录成功,欢迎新用户:$userName")),
16 | );
17 | }
18 | }
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/lib/pages/stateManage/BLoC/bloc_state_page.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class BLoCStatePage extends StatefulWidget {
4 | @override
5 | State createState() => PageState();
6 | }
7 |
8 | class PageState extends State {
9 | @override
10 | Widget build(BuildContext context) {
11 | return Scaffold(
12 | appBar: AppBar(
13 | title: Text("BLoC状态管理"),
14 | centerTitle: true,
15 | ),
16 | );
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/lib/demo/route/SecondPageWithParams.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class SecondPageWithParams extends StatelessWidget {
4 | final title;
5 | final String content;
6 |
7 | SecondPageWithParams(this.title, this.content);
8 |
9 | @override
10 | Widget build(BuildContext context) {
11 | return new Scaffold(
12 | appBar: new AppBar(title: new Text(title)),
13 | body: new Center(
14 | child: new Text(content),
15 | ),
16 | );
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 |
4 | @UIApplicationMain
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/lib/pages/simpleWidget/layout/CenterPage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | //Center既中心定位控件,能够将子控件放在其内部中心。
4 | class CenterLayoutPage extends StatelessWidget {
5 | @override
6 | Widget build(BuildContext context) {
7 | return new Scaffold(
8 | appBar: new AppBar(
9 | title: new Text('中心布局'),
10 | ),
11 | body: new Center(
12 | child: new Text('Center布局使用比较简单,场景也比较单一,一般用于协助其他子widget布局,包裹其child widget显示在上层布局的中心位置'),
13 | ),
14 | );
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/lib/pages/stateManage/redux/redux_state.dart:
--------------------------------------------------------------------------------
1 |
2 |
3 | import 'package:flutter_app/pages/stateManage/redux/action.dart';
4 |
5 | /// 定义一个state
6 | class ReduxState {
7 | int count;
8 |
9 | ReduxState.initState() : count = 0;
10 | }
11 |
12 |
13 |
14 | /// 定义reducer
15 | ReduxState getReduce(ReduxState state, action) {
16 | if (action == Action.decrease) {
17 | state.count = state.count -1;
18 | } else if (action == Action.increase) {
19 | state.count = state.count + 1;
20 | }
21 |
22 | return state;
23 | }
24 |
--------------------------------------------------------------------------------
/upgrade.md:
--------------------------------------------------------------------------------
1 | ### 版本升级md
2 |
3 |
4 | > 升级到flutter3之后,需要修改的组建和属性说明
5 |
6 | Text,Button等widget
7 | //高版本sdk无下方属性
8 | // color: Colors.blue,
9 | // highlightColor: Colors.lightBlueAccent,
10 | // disabledColor: Colors.lightBlueAccent,
11 |
12 |
13 |
14 | **Old Widget change to New Widget
15 | FlatButton => TextButton
16 | RaisedButton => ElevatedButton
17 | OutlineButton => OutlinedButton
18 | Scaffold.of(context).showSnackBar => ScaffoldMessenger.of(context).showSnackBar**
19 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/README.md:
--------------------------------------------------------------------------------
1 | # flutter_calc_plugin
2 |
3 | A new Flutter plugin.
4 |
5 | ## Getting Started
6 |
7 | This project is a starting point for a Flutter
8 | [plug-in package](https://flutter.dev/developing-packages/),
9 | a specialized package that includes platform-specific implementation code for
10 | Android and/or iOS.
11 |
12 | For help getting started with Flutter, view our
13 | [online documentation](https://flutter.dev/docs), which offers tutorials,
14 | samples, guidance on mobile development, and a full API reference.
15 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/.flutter-plugins-dependencies:
--------------------------------------------------------------------------------
1 | {"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_calc_plugin","path":"/Users/qw/demo/flutter_app/plugin/flutter_calc_plugin/","dependencies":[]}],"android":[{"name":"flutter_calc_plugin","path":"/Users/qw/demo/flutter_app/plugin/flutter_calc_plugin/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"flutter_calc_plugin","dependencies":[]}],"date_created":"2021-09-15 16:41:27.858257","version":"2.5.0"}
--------------------------------------------------------------------------------
/lib/pages/simpleWidget/layout/SizedBoxPage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 |
4 | class SizedBoxPage extends StatelessWidget {
5 | @override
6 | Widget build(BuildContext context) {
7 | return new Scaffold(
8 | appBar: new AppBar(
9 | title: new Text('SizedBox布局'),
10 | ),
11 | body: new SizedBox(
12 | width: 200.0,
13 | height: 200.0,
14 | child: new Container(
15 | decoration: new BoxDecoration(color: Colors.red),
16 | ),
17 | ),
18 | );
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/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 |
--------------------------------------------------------------------------------
/lib/demo/widgets/image/ImageDemo.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/cupertino.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | /**
5 | * desc:
6 | * author: xiedong
7 | * date: 2/9/21
8 | **/
9 |
10 | void main() {
11 | runApp(MaterialApp(
12 | home: ImageDemo(),
13 | ));
14 | }
15 |
16 | class ImageDemo extends StatelessWidget {
17 | @override
18 | Widget build(BuildContext context) {
19 | return Scaffold(
20 | appBar: AppBar(
21 | title: Text("ImageDemo"),
22 | ),
23 | body: Image.asset("images/aaa.png")
24 | );
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/lib/pages/custom_widget/widget/SpaceWidget.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | /**
4 | * @desc 分割线
5 | * @author xiedong
6 | * @date 2020-02-24.
7 | */
8 |
9 | class SpaceWidget extends StatelessWidget {
10 | double height, width;
11 |
12 | SpaceWidget({
13 | this.height = 1,
14 | this.width = 1,
15 | }) : super();
16 |
17 | @override
18 | Widget build(BuildContext context) {
19 | return
20 | Container(
21 |
22 | height: height,
23 | width: width,
24 | color: Colors.transparent,
25 | );
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/android/src/main/kotlin/com/example/flutter_calc_plugin/MyPlugin.kt:
--------------------------------------------------------------------------------
1 | package com.example.flutter_calc_plugin
2 |
3 | import android.annotation.TargetApi
4 | import android.os.Build
5 | import java.lang.invoke.MethodHandle
6 | import io.flutter.plugin.common.MethodCall
7 | import io.flutter.plugin.common.MethodChannel
8 |
9 | /**
10 | * @author xiedong
11 | * @date 2019-12-23.
12 | * @desc
13 | */
14 | class MyPlugin : MethodChannel.MethodCallHandler {
15 | override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) {
16 |
17 | }
18 | }
--------------------------------------------------------------------------------
/lib/pages/simpleWidget/layout/PaddingLayoutPage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | //Padding控件即填充控件,能给子控件插入给定的填充。
4 | class PaddingLayoutPage extends StatelessWidget {
5 | @override
6 | Widget build(BuildContext context) {
7 | return new Scaffold(
8 | appBar: new AppBar(
9 | title: new Text('Padding布局'),
10 | ),
11 | body: new Padding(
12 | // padding: const EdgeInsets.only(top: 30.0),
13 | padding: const EdgeInsets.all(80.0),
14 | child: new Text('Padding控件即填充控件,能给子控件插入给定的填充'),
15 | ),
16 | );
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/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 |
--------------------------------------------------------------------------------
/android/app/src/main/res/layout/activity_second.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/ios/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/
2 | .vagrant/
3 | .sconsign.dblite
4 | .svn/
5 |
6 | .DS_Store
7 | *.swp
8 | profile
9 |
10 | DerivedData/
11 | build/
12 | GeneratedPluginRegistrant.h
13 | GeneratedPluginRegistrant.m
14 |
15 | .generated/
16 |
17 | *.pbxuser
18 | *.mode1v3
19 | *.mode2v3
20 | *.perspectivev3
21 |
22 | !default.pbxuser
23 | !default.mode1v3
24 | !default.mode2v3
25 | !default.perspectivev3
26 |
27 | xcuserdata
28 |
29 | *.moved-aside
30 |
31 | *.pyc
32 | *sync/
33 | Icon?
34 | .tags*
35 |
36 | /Flutter/Generated.xcconfig
37 | /Flutter/flutter_export_environment.sh
--------------------------------------------------------------------------------
/lib/demo/network/User.dart:
--------------------------------------------------------------------------------
1 | /**
2 | * 用户信息实体类
3 | */
4 | class User {
5 | final String name;
6 | final String location;
7 | final String blog;
8 | final String avatar_url;
9 | final String html_url;
10 |
11 | User({this.name="", this.location="", this.blog="", this.avatar_url="", this.html_url=""});
12 |
13 | factory User.fromJson(Map json) {
14 | return new User(
15 | name: json['name'],
16 | location: json['location'],
17 | blog: json['blog'],
18 | avatar_url: json['avatar_url'],
19 | html_url: json['html_url'],
20 | );
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/lib/demo/widgets/textAndImage/IconDemo.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(title: 'd', home: new MyApp()));
5 | }
6 |
7 | class MyApp extends StatelessWidget {
8 | @override
9 | Widget build(BuildContext context) {
10 | return new Scaffold(
11 | appBar: new AppBar(
12 | title: new Text("title"),
13 | ),
14 | body: new Center(
15 | child: new Icon(Icons.android, size: 100.0, color: Colors.red),
16 | ));
17 |
18 | // http://flutter.link/2018/03/09/Icons/ //TODO ICON暂时不写
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/.idea/libraries/Flutter_Plugins.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
10 |
13 |
14 |
--------------------------------------------------------------------------------
/lib/pages/simpleWidget/navigator/StaticNavigatorPageWithParams.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class StaticNavigatorPageWithResult extends StatelessWidget {
4 | @override
5 | Widget build(BuildContext context) {
6 | return new Scaffold(
7 | appBar: new AppBar(
8 | title: new Text("静态路由带返回参数"),
9 | ),
10 | body: new Center(
11 | child: new OutlinedButton(
12 | onPressed: () {
13 | Navigator.of(context).pop("上个页面结束后返回的数据");
14 | },
15 | child: Text("点我返回上个页面结束后返回的数据"),
16 | ),
17 | ),
18 | );
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/lib/pages/key/key_demo.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/cupertino.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:flutter_app/pages/key/box.dart';
4 |
5 | /**
6 | * desc:
7 | * author: xiedong
8 | * date: 2021/11/30
9 | **/
10 | class KeyDemo extends StatelessWidget {
11 | @override
12 | Widget build(BuildContext context) {
13 | return Scaffold(
14 | appBar: AppBar(title: Text("Key Demo")),
15 | body: Column(
16 | children: [
17 | Box(Colors.red,key: ValueKey(1)),
18 | Box(Colors.black,key: ValueKey(2)),
19 | ]
20 | ),
21 | );
22 | }
23 | }
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/ios/Classes/SwiftFlutterCalcPlugin.swift:
--------------------------------------------------------------------------------
1 | import Flutter
2 | import UIKit
3 |
4 | public class SwiftFlutterCalcPlugin: NSObject, FlutterPlugin {
5 | public static func register(with registrar: FlutterPluginRegistrar) {
6 | let channel = FlutterMethodChannel(name: "flutter_calc_plugin", binaryMessenger: registrar.messenger())
7 | let instance = SwiftFlutterCalcPlugin()
8 | registrar.addMethodCallDelegate(instance, channel: channel)
9 | }
10 |
11 | public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
12 | result("iOS " + UIDevice.current.systemVersion)
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/ios/Flutter/flutter_export_environment.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # This is a generated file; do not edit or check into version control.
3 | export "FLUTTER_ROOT=/Users/dong/dev-tool/flutter_sdk/flutter"
4 | export "FLUTTER_APPLICATION_PATH=/Users/dong/AndroidStudioProjects/FlutterProject/flutter_app"
5 | export "COCOAPODS_PARALLEL_CODE_SIGN=true"
6 | export "FLUTTER_TARGET=lib/main.dart"
7 | export "FLUTTER_BUILD_DIR=build"
8 | export "FLUTTER_BUILD_NAME=1.0.0"
9 | export "FLUTTER_BUILD_NUMBER=1"
10 | export "DART_OBFUSCATION=false"
11 | export "TRACK_WIDGET_CREATION=true"
12 | export "TREE_SHAKE_ICONS=false"
13 | export "PACKAGE_CONFIG=.dart_tool/package_config.json"
14 |
--------------------------------------------------------------------------------
/lib/demo/widgets/textAndImage/ImageDemo1.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(
5 | title: '图片',
6 | home: new ImageDemo(),
7 | ));
8 | }
9 |
10 | class ImageDemo extends StatelessWidget {
11 | @override
12 | Widget build(BuildContext context) {
13 | return new Scaffold(
14 | appBar: new AppBar(
15 | title: new Text('从网络获取图片'),
16 | ),
17 | body: new Center(
18 | child: new Image.network(
19 | 'http://pic.baike.soso.com/p/20130828/20130828161137-1346445960.jpg',
20 | scale: 3.0,
21 | ),
22 | ));
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/test/flutter_calc_plugin_test.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/services.dart';
2 | import 'package:flutter_test/flutter_test.dart';
3 | import 'package:flutter_calc_plugin/flutter_calc_plugin.dart';
4 |
5 | void main() {
6 | const MethodChannel channel = MethodChannel('flutter_calc_plugin');
7 |
8 | setUp(() {
9 | channel.setMockMethodCallHandler((MethodCall methodCall) async {
10 | return '42';
11 | });
12 | });
13 |
14 | tearDown(() {
15 | channel.setMockMethodCallHandler(null);
16 | });
17 |
18 | test('getPlatformVersion', () async {
19 | expect(await FlutterCalcPlugin.platformVersion, '42');
20 | });
21 | }
22 |
--------------------------------------------------------------------------------
/lib/view/customview/label_view_top_right.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | /**
4 | * 在屏幕右上角绘制label
5 | */
6 | class LabelViewTopRight extends CustomPainter {
7 | Paint _paint = Paint()
8 | ..color = Colors.orange
9 | ..strokeWidth = 3.0
10 | ..style = PaintingStyle.fill;
11 |
12 | @override
13 | void paint(Canvas canvas, Size size) {
14 | Path path = Path();
15 | path.lineTo(200, 0);
16 | path.lineTo(200, 100);
17 | path.lineTo(100, 0);
18 | path.close();
19 | canvas.drawPath(path, _paint);
20 | }
21 |
22 | @override
23 | bool shouldRepaint(CustomPainter oldDelegate) {
24 | return false;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/lib/demo/widgets/Scaffold/Scaffold.dart:
--------------------------------------------------------------------------------
1 | //test.widgets.Scaffold
2 | //从前面的文章中我们知道,Scaffold的中文意思是脚手架,顾名思义就是帮助我们快速构建APP,那么我们还是来看下Scaffold能把我们做哪些把。
3 | //
4 | //Scaffold构造方法
5 | //
6 | //const test.widgets.Scaffold({
7 | //Key key,
8 | //this.appBar,//标题栏
9 | //this.body,//内容
10 | //this.floatingActionButton,//悬浮按钮
11 | //this.persistentFooterButtons,底部持久化现实按钮
12 | //this.drawer,//侧滑菜单左
13 | //this.endDrawer,//侧滑菜单右
14 | //this.bottomNavigationBar,//底部导航
15 | //this.backgroundColor,//背景颜色
16 | //this.resizeToAvoidBottomPadding: true,//自动适应底部padding
17 | //this.primary: true,试用使用primary主色
18 | //})
19 | //从构造方法我们可以看到,Scaffold可以帮助我们事先类似于Android中toolbar、悬浮按钮、汉堡菜单、底部导航效果
20 | //接下来我们来分别看看每一个参数的用法。
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/README.md:
--------------------------------------------------------------------------------
1 | # flutter_calc_plugin_example
2 |
3 | Demonstrates how to use the flutter_calc_plugin plugin.
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 |
--------------------------------------------------------------------------------
/lib/pages/simpleWidget/sliverWidget/SliverPage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_app/pages/simpleWidget/sliverWidget/SliverAppBarPage.dart';
3 | import 'package:flutter_app/view/MyRaisedButton.dart';
4 |
5 | class SliverPage extends StatelessWidget {
6 | @override
7 | Widget build(BuildContext context) {
8 | return Scaffold(
9 | appBar: new AppBar(
10 | title: new Text("基础组件"),
11 | ),
12 | body: new Center(
13 | child: new ListView(
14 | children: [
15 | MyRaisedButton(new SliverAppBarPage(), "SliverAppBarPage"),
16 | ],
17 | ),
18 | ),
19 | );
20 | ;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/lib/view/customview/label_view_bottom_left.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | /**
4 | * 在左下角绘制label
5 | */
6 | class LabelViewBottomLeft extends CustomPainter{
7 | Paint _paint = Paint()
8 | ..color =Colors.lightBlue
9 | ..strokeWidth = 5.0
10 | ..style=PaintingStyle.fill;
11 | @override
12 | void paint(Canvas canvas, Size size) {
13 | Path path = Path();
14 | // path.moveTo(0, 100); //把起始点移动到某个固定位置,开始画path
15 | path.lineTo(0, 200);
16 | path.lineTo(100, 200);
17 | path.lineTo(0,100);
18 | path.close();
19 | canvas.drawPath(path, _paint);
20 | }
21 |
22 | @override
23 | bool shouldRepaint(CustomPainter oldDelegate) {
24 | return false;
25 | }
26 |
27 | }
--------------------------------------------------------------------------------
/ios/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/
2 | .vagrant/
3 | .sconsign.dblite
4 | .svn/
5 |
6 | .DS_Store
7 | *.swp
8 | profile
9 |
10 | DerivedData/
11 | build/
12 | GeneratedPluginRegistrant.h
13 | GeneratedPluginRegistrant.m
14 |
15 | .generated/
16 |
17 | *.pbxuser
18 | *.mode1v3
19 | *.mode2v3
20 | *.perspectivev3
21 |
22 | !default.pbxuser
23 | !default.mode1v3
24 | !default.mode2v3
25 | !default.perspectivev3
26 |
27 | xcuserdata
28 |
29 | *.moved-aside
30 |
31 | *.pyc
32 | *sync/
33 | Icon?
34 | .tags*
35 |
36 | /Flutter/app.flx
37 | /Flutter/app.zip
38 | /Flutter/flutter_assets/
39 | /Flutter/App.framework
40 | /Flutter/Flutter.framework
41 | /Flutter/Generated.xcconfig
42 | /ServiceDefinitions.json
43 |
44 | Pods/
45 | .symlinks/
46 |
--------------------------------------------------------------------------------
/android/app/src/main/java/com/zhuandian/flutterapp/SecondActivity.java:
--------------------------------------------------------------------------------
1 | package com.zhuandian.flutterapp;
2 |
3 | import android.app.Activity;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.view.View;
7 |
8 |
9 | public class SecondActivity extends Activity {
10 |
11 | @Override
12 | protected void onCreate(Bundle savedInstanceState) {
13 | super.onCreate(savedInstanceState);
14 | setContentView(R.layout.activity_second);
15 |
16 | findViewById(R.id.btn_flutter).setOnClickListener(new View.OnClickListener() {
17 | @Override
18 | public void onClick(View v) {
19 | finish();
20 | }
21 | });
22 |
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/lib/flutter_calc_plugin.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:flutter/services.dart';
4 |
5 | class FlutterCalcPlugin {
6 | static const MethodChannel _channel =
7 | const MethodChannel('flutter_calc_plugin');
8 |
9 | static Future get platformVersion async {
10 | final String version = await _channel.invokeMethod('getPlatformVersion');
11 | return version;
12 | }
13 |
14 | /**
15 | *计算两个数的和
16 | */
17 | static Future getResult(int a, int b) async {
18 | Map map = {"a": a, "b": b};
19 | String result = await _channel.invokeMethod("getResult", map);
20 | print(result+"----------aa--");
21 | return result;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/lib/view/customview/label_view_bottom_right.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class LabelViewBottomRight extends CustomPainter {
4 | late Paint _paint;
5 |
6 | LabelViewBottomRight() {
7 | _paint = Paint()
8 | ..color = Colors.black
9 | ..style = PaintingStyle.fill
10 | ..strokeWidth = 5.0;
11 | }
12 |
13 | @override
14 | void paint(Canvas canvas, Size size) {
15 | Path path = Path();
16 | path.lineTo(100, 200);
17 | path.lineTo(200, 200);
18 | path.lineTo(200, 100);
19 | path.lineTo(100, 200);
20 | path.close();
21 | canvas.drawPath(path, _paint);
22 | }
23 |
24 | @override
25 | bool shouldRepaint(CustomPainter oldDelegate) {
26 | return false;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/lib/pages/simpleWidget/PlatformPage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/services.dart';
3 |
4 | class PaltformPage extends StatelessWidget {
5 | static const platform = const MethodChannel("com.zhuandian.flutter/android");
6 |
7 | void _goAndroidPage() async {
8 | await platform.invokeMethod("new_page");
9 | }
10 |
11 | @override
12 | Widget build(BuildContext context) {
13 | return new Scaffold(
14 | appBar: new AppBar(
15 | title: new Text("交互原生"),
16 | ),
17 | body: new Center(
18 | child: new MaterialButton(
19 | onPressed: () {
20 | _goAndroidPage();
21 | },
22 | child: new Text("调到原生页面"),
23 | )),
24 | );
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.2.71'
3 | repositories {
4 | google()
5 | jcenter()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:3.2.1'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | jcenter()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | }
25 | subprojects {
26 | project.evaluationDependsOn(':app')
27 | }
28 |
29 | task clean(type: Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/ios/flutter_calc_plugin.podspec:
--------------------------------------------------------------------------------
1 | #
2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
3 | #
4 | Pod::Spec.new do |s|
5 | s.name = 'flutter_calc_plugin'
6 | s.version = '0.0.1'
7 | s.summary = 'A new Flutter plugin.'
8 | s.description = <<-DESC
9 | A new Flutter plugin.
10 | DESC
11 | s.homepage = 'http://example.com'
12 | s.license = { :file => '../LICENSE' }
13 | s.author = { 'Your Company' => 'email@example.com' }
14 | s.source = { :path => '.' }
15 | s.source_files = 'Classes/**/*'
16 | s.public_header_files = 'Classes/**/*.h'
17 | s.dependency 'Flutter'
18 |
19 | s.ios.deployment_target = '8.0'
20 | end
21 |
22 |
--------------------------------------------------------------------------------
/lib/pages/simpleWidget/layout/AspecRadioLayoutPage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | //AspectRatio控件能强制子小部件的宽度和高度具有给定的宽高比,以宽度与高度的比例表示。
4 | class AspectRadioLayoutPage extends StatelessWidget {
5 | @override
6 | Widget build(BuildContext context) {
7 | return new Scaffold(
8 | appBar: new AppBar(
9 | title: new Text('AspectRadio布局'),
10 | ),
11 | body: new AspectRatio(
12 | aspectRatio: 4.0 / 3.0,
13 | child: new Container(
14 | child: new Text(
15 | "AspectRatio控件能强制子小部件的宽度和高度具有给定的宽高比,以宽度与高度的比例表示",
16 | style: new TextStyle(fontSize: 20.0, color: Colors.white),
17 | ),
18 | decoration: new BoxDecoration(color: Colors.lightBlue),
19 | ),
20 | ),
21 | );
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/lib/pages/stateManage/callback/call_back_second_page.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_app/pages/base/common_widget.dart';
3 |
4 | class CallBackSecondPage extends StatelessWidget {
5 | @override
6 | Widget build(BuildContext context) {
7 | return Scaffold(
8 | appBar: AppBar(
9 | title: Text("方法回调2"),
10 | centerTitle: true,
11 | ),
12 | body: CommonWidget(Center(
13 | child: Text("dddd"),
14 | )).onClick(onTap: () {
15 | print("------------click-------");
16 | }, onLongPress: () {
17 | print("long click---------------");
18 | }).build(),
19 | );
20 | }
21 | }
22 |
23 | class MyText extends Text {
24 | MyText(String data) : super(data, style: TextStyle(color: Colors.redAccent));
25 | }
26 |
--------------------------------------------------------------------------------
/lib/pages/platform/platform_page.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_app/pages/platform/android_platform_page.dart';
3 | import 'package:flutter_app/pages/platform/calc_plugin_page.dart';
4 | import 'package:flutter_app/view/MyRaisedButton.dart';
5 |
6 | class PlatformPage extends StatelessWidget {
7 | @override
8 | Widget build(BuildContext context) {
9 | return Scaffold(
10 | appBar: AppBar(title: Text("平台交互"), centerTitle: true),
11 | body: Column(
12 | mainAxisAlignment: MainAxisAlignment.center,
13 | crossAxisAlignment: CrossAxisAlignment.stretch,
14 | children: [
15 | MyRaisedButton(AndroidPlatformPage(), "直接插件调用平台代码"),
16 | MyRaisedButton(CalcPluginPage(), "利用插件调用平台代码"),
17 | ],
18 | ),
19 | );
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/lib/view/customview/label_view_top_left.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | /*
4 | 在屏幕左上角绘制一个label
5 | */
6 | class LabelViewTopLeft extends CustomPainter {
7 | var _paint;
8 |
9 | LabelViewTopLeft() {
10 | _paint = Paint()
11 | ..color = Colors.pinkAccent
12 | ..strokeCap = StrokeCap.round //笔触样式
13 | ..isAntiAlias = true
14 | ..style = PaintingStyle.fill //填充满
15 | // ..style = PaintingStyle.stroke //空芯
16 | ..strokeWidth = 5.0;
17 | }
18 |
19 | @override
20 | void paint(Canvas canvas, Size size) {
21 | Path path = Path();
22 | path.lineTo(100, 0);
23 | path.lineTo(0, 100);
24 | path.close();
25 | canvas.drawPath(path, _paint);
26 | }
27 |
28 | @override
29 | bool shouldRepaint(CustomPainter oldDelegate) {
30 | return false;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/android/app/src/main/kotlin/com/example/flutter_calc_plugin_example/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.flutter_calc_plugin_example
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 | import io.flutter.embedding.engine.FlutterEngine
5 | import io.flutter.plugins.GeneratedPluginRegistrant
6 |
7 |
8 | class MainActivity: FlutterActivity() {
9 | // override fun onCreate(savedInstanceState: Bundle?) {
10 | // super.onCreate(savedInstanceState)
11 | // GeneratedPluginRegistrant.registerWith(this)
12 | // }
13 |
14 | override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
15 | // super.configureFlutterEngine(flutterEngine);
16 |
17 | super.configureFlutterEngine(flutterEngine);
18 | GeneratedPluginRegistrant.registerWith(flutterEngine)
19 |
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/lib/demo/theme/ThemeDemo2.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(home:new MyApp(),theme:
5 | new ThemeData(primaryColor: Colors.red, ),
6 | ));
7 | }
8 |
9 | class MyApp extends StatelessWidget {
10 | @override
11 | Widget build(BuildContext context) {
12 | return new Scaffold(appBar:
13 | new AppBar(title: new Text("Hello Flutter")),
14 | floatingActionButton: new FloatingActionButton(
15 | onPressed: null,
16 | backgroundColor: Colors.blueAccent,
17 | child: new Text("点我",style: new TextStyle(color: Colors.white),)
18 | ),
19 | endDrawer: new Drawer(child: new Center(child: new Text("我是菜单"),),),
20 | body: new Center(
21 | child: new Text("Hello Flutter")
22 | )
23 | );
24 | }
25 | }
--------------------------------------------------------------------------------
/lib/demo/networkAndAsync/async.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | void main() {
4 | print(enterRestaurant());
5 | Future waitForDinnerFuture = new Future(waitForDinner);
6 |
7 | Future waitForDinnerFuture2 = waitForDinnerFuture;
8 | waitForDinnerFuture2.then((str){
9 | print(str);
10 | });
11 |
12 | waitForDinnerFuture.then((onValue) {
13 | print(onValue);
14 | });
15 | print(startChat());
16 | print(playPhone());
17 | }
18 |
19 | String enterRestaurant() {
20 | return "和朋友进入了一家餐馆";
21 | }
22 |
23 | String waitForDinner() {
24 | return "我们的菜来了,我要开始吃饭了";
25 | }
26 |
27 | String startChat() {
28 | return "我们朋友聊起家常";
29 | }
30 |
31 | String playPhone() {
32 | return "等了好好久了,我还是玩会手机吧";
33 | }
34 |
35 | //http://flutter.link/2018/04/12/Dart%E4%B8%AD%E7%9A%84%E5%BC%82%E6%AD%A5%E6%93%8D%E4%BD%9C/
36 | //没完全理解
--------------------------------------------------------------------------------
/lib/demo/widgets/container/ContainerDemo.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(
5 | title: "布局",
6 | home: new ContainerDemo(),
7 | ));
8 | }
9 |
10 | class ContainerDemo extends StatelessWidget {
11 | @override
12 | Widget build(BuildContext context) {
13 | return new Center(
14 | child: new Container(
15 | width: 200.0,
16 | height: 400.0,
17 | decoration: new BoxDecoration(
18 | color: Colors.lightBlueAccent,
19 | border: new Border.all(
20 | color: Colors.redAccent,
21 | width: 5.0,
22 | ),
23 | ),
24 | child: new Text('容器内部文字',
25 | style: new TextStyle(
26 | fontSize: 25.0,
27 | ),
28 | ),
29 | ),
30 | );
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/lib/demo/widgets/textAndImage/ImageDemo.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(title: 'd', home: new MyApp()));
5 | }
6 |
7 | class MyApp extends StatelessWidget {
8 | @override
9 | Widget build(BuildContext context) {
10 | return new Scaffold(
11 | appBar: new AppBar(
12 | title: new Text("title"),
13 | ),
14 | body: new Stack(
15 | children: [
16 | new Align(
17 | alignment: new FractionalOffset(0.5, 0.5),
18 | // child: new Image.network(
19 | // 'http://pic.baike.soso.com/p/20130828/20130828161137-1346445960.jpg',
20 | // scale: 3.0,
21 | // ),
22 | child: new Image.asset('images/aaa.png'), //引入本地资源图片记得在yaml中导入资源,且注意空格对齐方式
23 | )
24 | ],
25 | ),
26 | );
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/lib/pages/simpleWidget/layout/AlignLayoutPage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class AlignLayoutPage extends StatelessWidget {
4 | @override
5 | Widget build(BuildContext context) {
6 | return new Scaffold(
7 | appBar: new AppBar(
8 | title: new Text('Align布局'),
9 | ),
10 | body: new Stack(
11 | children: [
12 | new Align(
13 | alignment: new FractionalOffset(0.0, 0.5),
14 | child: new Text(
15 | '我在左边缘中心',
16 | style: new TextStyle(fontSize: 35.0),
17 | ),
18 | ),
19 | new Align(
20 | alignment: new FractionalOffset(1.0, 1.0),
21 | child: new Text(
22 | '我在右下角',
23 | style: new TextStyle(fontSize: 30.0),
24 | ),
25 | )
26 | ],
27 | ),
28 | );
29 | }
30 | }
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/lib/pages/custom_widget/pages/verification_code_page.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/cupertino.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:flutter_app/pages/custom_widget/widget/timer_count_down_widget.dart';
4 |
5 | /**
6 | * @desc
7 | * @author xiedong
8 | * @date 2020-02-28.
9 | */
10 |
11 | class VerficationCodePage extends StatefulWidget {
12 | @override
13 | State createState() => VerficationCodePageState();
14 | }
15 |
16 | class VerficationCodePageState extends State {
17 | @override
18 | Widget build(BuildContext context) {
19 | return Scaffold(
20 | appBar: AppBar(
21 | title: Text("验证码倒计时"),
22 | centerTitle: true,
23 | ),
24 | body: Center(
25 | child: TimerCountDownWidget(onTimerFinish: (){
26 | print("倒计时结束--------");
27 | },),
28 | ),
29 | );
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/lib/demo/route/SecondPageWithResult.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class SecondPageWithResult extends StatelessWidget {
4 | @override
5 | Widget build(BuildContext context) {
6 | return new Scaffold(
7 | appBar: new AppBar(
8 | title: new Text("Page2"),
9 | ),
10 | body: new Center(
11 | child: new Column(
12 | children: [
13 | new Text(
14 | "Page2",
15 | style: new TextStyle(fontSize: 25.0),
16 | ),
17 | new ElevatedButton(
18 | child: new Text("点我返回"),
19 | onPressed: () {
20 | Navigator.of(context).pop("我是第二个页面返回的数据"); //页面出栈携带返回值
21 | },
22 | // color: Colors.blue,
23 | // highlightColor: Colors.lightBlue,
24 | ),
25 | ],
26 | ),
27 | ),
28 | );
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/lib/demo/widgets/layout/IndexStackLayout.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(title: 'd', home: new MyApp()));
5 | }
6 |
7 | class MyApp extends StatelessWidget {
8 | @override
9 | Widget build(BuildContext context) {
10 | return new Scaffold(
11 | appBar: new AppBar(
12 | title: new Text("title"),
13 | ),
14 | body:new IndexedStack(
15 | index: 1, //不指定默认显示第一个,只显示index对应的wigdet,index默认从角标0开始
16 | children: [
17 | new Icon(Icons.ac_unit,size: 100.0,),
18 | new Icon(Icons.android)
19 | ],
20 | alignment: Alignment.bottomRight,
21 | )
22 | );
23 | }
24 | }
25 |
26 |
27 | //在上面我们看了下Stack,基本上知道了Stack的用法,其实IndexedStack的用法和Stack一样,
28 | //只不过IndexedStack只显示指定index位置的Widget,其他的位置的Widget不会显示。
29 | //其实这个IndexedStack还是很有用的,比如说你的应用现实的额多个状态(加载中、加载完成、网络错误)可以使用这个组件来很好的完成控制。
--------------------------------------------------------------------------------
/lib/demo/widgets/layout/RowAndColumDemo.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(title: 'd', home: new MyApp()));
5 | }
6 |
7 | class MyApp extends StatelessWidget {
8 | @override
9 | Widget build(BuildContext context) {
10 | return new Scaffold(
11 | appBar: new AppBar(
12 | title: new Text("title"),
13 | ),
14 | body: new Row(
15 | children: [
16 | new Expanded(child:new Text("sd发的撒啊啊啊啊啊啊啊啊fa",textAlign: TextAlign.center,) ,flex: 1,), //参数flex可以调整布局所占的比重
17 | new Expanded(child:new Text("sdfa") ),
18 | new Expanded(child:new Text("sdfa") ),
19 |
20 |
21 | //当布局为Row排列是,如果内容过多,可能会被挤出屏幕,借助于Expanded Widget可以实现Text自动换行,并且可以实现子Widget宽(高)按比例布局
22 | // new Text("sdfa"),
23 | // new Text("sdfa")
24 | ],
25 | ));
26 | }
27 | }
28 |
29 | // Column使用与Row类似,不再赘述
30 |
31 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | def flutterSdkPath = {
3 | def properties = new Properties()
4 | file("local.properties").withInputStream { properties.load(it) }
5 | def flutterSdkPath = properties.getProperty("flutter.sdk")
6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
7 | return flutterSdkPath
8 | }
9 | settings.ext.flutterSdkPath = flutterSdkPath()
10 |
11 | includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
12 |
13 | repositories {
14 | google()
15 | mavenCentral()
16 | gradlePluginPortal()
17 | }
18 |
19 | plugins {
20 | id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false
21 | }
22 | }
23 |
24 | plugins {
25 | id "dev.flutter.flutter-plugin-loader" version "1.0.0"
26 | id "com.android.application" version "7.3.0" apply false
27 | }
28 |
29 | include ":app"
30 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/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 |
--------------------------------------------------------------------------------
/lib/pages/key/globalKey/globalKey_demo.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/cupertino.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:flutter_app/pages/key/globalKey/switcher_widget.dart';
4 |
5 | /**
6 | * desc:
7 | * author: xiedong
8 | * date: 2021/11/26
9 | **/
10 | class GlobalKeyPage extends StatefulWidget {
11 | @override
12 | State createState() {
13 | return _pageState();
14 | }
15 | }
16 | // https://www.jianshu.com/p/d37f97a926a8
17 | class _pageState extends State {
18 | final GlobalKey key = GlobalKey();
19 | @override
20 | Widget build(BuildContext context) {
21 | return Scaffold(
22 | body: SwitcherWidget(
23 | key: key,
24 | ),
25 | floatingActionButton: FloatingActionButton(
26 | onPressed: () {
27 | key.currentState?.changeState();
28 | },
29 | child: Text('切换'),
30 | ),
31 | );
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/lib/pages/simpleWidget/layout/OpacityPage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | //Opacity控件能调整子控件的不透明度,使子控件部分透明,不透明度的量从0.0到1.1之间,0.0表示完全透明,1.1表示完全不透明。
4 | class OpacityLayoutDemo extends StatelessWidget {
5 | @override
6 | Widget build(BuildContext context) {
7 | return new Scaffold(
8 | backgroundColor: Colors.white,
9 | appBar: new AppBar(
10 | title: new Text('Opacity'),
11 | ),
12 | body: new Center(
13 | child: new Stack(
14 | alignment: AlignmentDirectional.center,
15 | children: [
16 | new Text("我在透明区域下方"),
17 | new Opacity(
18 | opacity: 0.5,
19 | child: new Container(
20 | width: 200.0,
21 | height: 220.0,
22 | decoration: new BoxDecoration(color: Colors.redAccent),
23 | ),
24 | ),
25 | ],
26 | ),
27 | ),
28 | );
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/lib/demo/platform/platform.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/services.dart';
3 |
4 | void main() {
5 | runApp(new MaterialApp(home: new PlatFormDemo()));
6 | }
7 |
8 | class PlatFormDemo extends StatelessWidget {
9 | static const platform = const MethodChannel("com.zhuandian.flutter/android");
10 | showToast(String msg) async {
11 | try {
12 | await platform.invokeMethod("showToast",{"msg":msg});
13 | } on PlatformException catch (e) {
14 | print(e.toString());
15 | }
16 |
17 | }
18 | @override
19 | Widget build(BuildContext context) {
20 | return Scaffold(appBar: AppBar(title: Text("platformChannels"),),body: Center(
21 | child: ElevatedButton(
22 | child: Text("点我提示"),
23 | onPressed: () {
24 | showToast("我是android系统的toast");
25 | },
26 | ),
27 | ),);
28 | }
29 | }
30 | //http://flutter.link/2018/04/20/Flutter%E8%B0%83%E7%94%A8%E5%B9%B3%E5%8F%B0%E4%BB%A3%E7%A0%81/
31 |
--------------------------------------------------------------------------------
/lib/pages/stateManage/state_manage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_app/pages/stateManage/callback/call_back_page.dart';
3 | import 'package:flutter_app/pages/stateManage/redux/redux_first_page.dart';
4 | import 'package:flutter_app/view/MyRaisedButton.dart';
5 | import 'BLoC/bloc_state_page.dart';
6 |
7 | class StateManage extends StatelessWidget {
8 | @override
9 | Widget build(BuildContext context) {
10 | return Scaffold(
11 | appBar: AppBar(
12 | title: Text("状态管理"),
13 | centerTitle: true,
14 | ),
15 | body: Column(
16 | mainAxisAlignment: MainAxisAlignment.center,
17 | crossAxisAlignment: CrossAxisAlignment.stretch,
18 | children: [
19 | MyRaisedButton(new CallBackPage(), "方法回调"),
20 | MyRaisedButton(new ReduxFirstPage(), "FlutterRedux"),
21 | MyRaisedButton(new BLoCStatePage(), "BLoC状态管理"),
22 | ],
23 | ),
24 | );
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/lib/pages/key/globalKey/switcher_widget.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/cupertino.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | /**
5 | * desc:
6 | * author: xiedong
7 | * date: 2021/11/26
8 | **/
9 | class SwitcherWidget extends StatefulWidget {
10 | SwitcherWidget({Key? key}):super(key:key);
11 | @override
12 | State createState() => SwitcherWidgetPageState();
13 | }
14 |
15 | class SwitcherWidgetPageState extends State {
16 | bool isActive = false;
17 | @override
18 | Widget build(BuildContext context) {
19 | return Scaffold(
20 | body: Center(
21 | child: Switch.adaptive(
22 | value: isActive,
23 | activeColor: Colors.blueAccent,
24 | onChanged: (bool currentStatus) {
25 | isActive = currentStatus;
26 | setState(() {});
27 | }),
28 | ),
29 | );
30 | }
31 |
32 | changeState() {
33 | isActive = !isActive;
34 | setState(() {});
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/lib/demo/widgets/Scaffold/PersistentFooterButtons.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(title: 'd', home: new MyApp()));
5 | }
6 |
7 | class MyApp extends StatelessWidget {
8 | @override
9 | Widget build(BuildContext context) {
10 | return new Scaffold(
11 | appBar: new AppBar(
12 | leading: new Icon(Icons.android),
13 | automaticallyImplyLeading: true,
14 | centerTitle: true,
15 | //标题居中
16 | elevation: 10.0,
17 | //底部阴影
18 | backgroundColor: Colors.red,
19 | title: new Text("title"),
20 | ),
21 |
22 | //persistentFooterButtons底部持久化显示按钮,说的是按钮,实际上你传什么Widget都是可以的,只不过作用不是很大
23 | persistentFooterButtons: [
24 | new Icon(Icons.android),
25 | new Icon(Icons.book),
26 | new Icon(Icons.hourglass_empty),
27 | new Icon(Icons.headset),
28 | new Icon(Icons.home),
29 | new Text("Flutter")
30 | ],
31 | );
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/lib/pages/simpleWidget/navigator/DynamicNavigationPage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class DynamicNaviattionPage extends StatelessWidget {
4 | var username;
5 | var password;
6 |
7 | DynamicNaviattionPage({Key? key, this.username, this.password})
8 | : super(key: key);
9 |
10 | @override
11 | Widget build(BuildContext context) {
12 | return new Scaffold(
13 | appBar: new AppBar(
14 | title: new Text("动态路由"),
15 | ),
16 | body: new Center(
17 | child: new Column(
18 | children: [
19 | new MaterialButton(
20 | onPressed: () {
21 | Navigator.pop(context, "DynamicNaviattionPage 动态路由跳转页面返回值");
22 | },
23 | child: new Text("点我返回"),
24 | color: Colors.lightGreen,
25 | ),
26 | new Text("上页传递过来的username $username"),
27 | new Text("上页传递过来的password $password"),
28 | ],
29 | ),
30 | ),
31 | );
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/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 | import '../lib/main.dart';
11 |
12 | void main() {
13 | testWidgets('Verify Platform version', (WidgetTester tester) async {
14 | // Build our app and trigger a frame.
15 | await tester.pumpWidget(MyApp());
16 |
17 | // Verify that platform version is retrieved.
18 | expect(
19 | find.byWidgetPredicate(
20 | (Widget widget) => widget is Text &&
21 | widget.data!.startsWith('Running on:'),
22 | ),
23 | findsOneWidget,
24 | );
25 | });
26 | }
27 |
--------------------------------------------------------------------------------
/lib/pages/storage/StoragePage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_app/view/MyRaisedButton.dart';
3 | import 'package:flutter_app/pages/storage/FileStorage.dart';
4 | import 'package:flutter_app/pages/storage/SharedPerferenceStorage.dart';
5 | import 'package:flutter_app/pages/storage/SqfliteStorage.dart';
6 |
7 | class StoragePage extends StatelessWidget {
8 | @override
9 | Widget build(BuildContext context) {
10 | return new Scaffold(
11 | appBar: new AppBar(
12 | title: new Text("数据存储"),
13 | ),
14 | body: new Center(
15 | child: new Column(
16 | crossAxisAlignment: CrossAxisAlignment.center,
17 | mainAxisAlignment: MainAxisAlignment.center,
18 | children: [
19 | MyRaisedButton(new FileStorage(), "文件存储"),
20 | MyRaisedButton(new SharedPerferenceStorage(), "shared_preferences存储"),
21 | MyRaisedButton(new SqfliteStorage(), "Sqflite数据库存储"),
22 |
23 | ],
24 | ),
25 | ),
26 | );
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/lib/demo/widgets/layout/StackLayoutDemo.dart:
--------------------------------------------------------------------------------
1 |
2 | import 'package:flutter/material.dart';
3 |
4 | void main() {
5 | runApp(new MaterialApp(title: 'd', home: new MyApp()));
6 | }
7 |
8 | class MyApp extends StatelessWidget {
9 | @override
10 | Widget build(BuildContext context) {
11 | return new Scaffold(
12 | appBar: new AppBar(
13 | title: new Text("title"),
14 | ),
15 | body:new Stack(
16 | children: [
17 | new Icon(Icons.title,size: 100.0,),
18 | new Icon(Icons.title)
19 | ],
20 | alignment: Alignment.bottomRight,
21 | )
22 | );
23 | }
24 | }
25 |
26 |
27 | //按照翻译来讲的话是栈布局的意思,其实也很贴切,最先放入的必然在最下面显示。
28 | //也就是说,栈布局,默认后面放入的Widget会覆盖在前面放入的Widget上面显示。
29 | //当然这个跟android上面的帧布局是比较相似,在布局中还是有很多实用场景的。
30 |
31 | //Stack({
32 | //Key key,
33 | //this.alignment: AlignmentDirectional.topStart,//对齐方式
34 | //this.textDirection,
35 | //this.fit: StackFit.loose,//是否按照父类宽高处理自己大小
36 | //this.overflow: Overflow.clip,//溢出处理方式
37 | //List children: const [],
38 | //})
--------------------------------------------------------------------------------
/lib/pages/key/box.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/cupertino.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | /**
5 | * desc:
6 | * author: xiedong
7 | * date: 2021/11/30
8 | **/
9 | class Box extends StatefulWidget {
10 | Color color;
11 |
12 | Box(this.color, {Key? key}) : super(key: key);
13 |
14 | @override
15 | State createState() => _BoxState();
16 | }
17 |
18 | class _BoxState extends State {
19 | int count = 0;
20 | @override
21 | Widget build(BuildContext context) {
22 | return Container(
23 | width: 100,
24 | height: 100,
25 | color: widget.color,
26 | child: Column(
27 | mainAxisAlignment: MainAxisAlignment.center,
28 | children: [
29 | Text('$count', style: TextStyle(color: Colors.white)),
30 | IconButton(
31 | onPressed: () {
32 | setState(() {
33 | count++;
34 | });
35 | },
36 | icon: Icon(Icons.add),
37 | )
38 | ],
39 | ));
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/lib/pages/custom_widget/custom_widget_page.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/cupertino.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:flutter_app/pages/custom_widget/pages/phone_country_code_page.dart';
4 | import 'package:flutter_app/pages/custom_widget/pages/syllabus_page.dart';
5 | import 'package:flutter_app/pages/custom_widget/pages/verification_code_page.dart';
6 | import 'package:flutter_app/view/MyRaisedButton.dart';
7 |
8 | /**
9 | * @desc
10 | * @author xiedong
11 | * @date 2020-02-28.
12 | */
13 |
14 | class CustomWidgetPage extends StatelessWidget{
15 | @override
16 | Widget build(BuildContext context) {
17 | return Scaffold(appBar: AppBar(title: Text("组件封装"),
18 | centerTitle: true,),body: Column(
19 | crossAxisAlignment: CrossAxisAlignment.stretch,
20 | mainAxisAlignment: MainAxisAlignment.center,
21 | children: [
22 | MyRaisedButton(new VerficationCodePage(), "验证码倒计时Widget"),
23 | MyRaisedButton(new PhoneCountryCodePage(), "城市地区选择页"),
24 | MyRaisedButton(new SyllabusPage(), "课程表View")
25 | ],
26 | ),);
27 | }
28 |
29 | }
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/android/build.gradle:
--------------------------------------------------------------------------------
1 | group 'com.example.flutter_calc_plugin'
2 | version '1.0-SNAPSHOT'
3 |
4 | buildscript {
5 | ext.kotlin_version = '1.7.10'
6 | repositories {
7 | google()
8 | jcenter()
9 | }
10 |
11 | dependencies {
12 | classpath 'com.android.tools.build:gradle:3.2.1'
13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14 | }
15 | }
16 |
17 | rootProject.allprojects {
18 | repositories {
19 | google()
20 | jcenter()
21 | mavenCentral()
22 | }
23 | }
24 |
25 | apply plugin: 'com.android.library'
26 | apply plugin: 'kotlin-android'
27 |
28 | android {
29 | compileSdkVersion 30
30 |
31 | kotlinOptions {
32 | jvmTarget = '1.8'
33 | }
34 | sourceSets {
35 | main.java.srcDirs += 'src/main/kotlin'
36 | }
37 | defaultConfig {
38 | minSdkVersion 16
39 | }
40 | lintOptions {
41 | disable 'InvalidPackage'
42 | }
43 | }
44 |
45 | dependencies {
46 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
47 | }
48 |
--------------------------------------------------------------------------------
/lib/demo/widgets/TextInputAndChose/CheckBoxDemo.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(home: new MyApp()));
5 | }
6 |
7 | class MyApp extends StatefulWidget {
8 | @override
9 | State createState() => new MyAppState();
10 | }
11 |
12 | class MyAppState extends State {
13 | var _isChecked = true;
14 |
15 | void onCheckChange(bool? isChecked) {
16 | setState(() {
17 | _isChecked = isChecked!;
18 | print(_isChecked.toString()+'----');
19 | });
20 | }
21 |
22 | @override
23 | Widget build(BuildContext context) {
24 | return new Scaffold(
25 | appBar: new AppBar(
26 | title: new Text("选择控件"),
27 | ),
28 | body: new Center(
29 | child: new Column(
30 | children: [new Checkbox(value: _isChecked, onChanged: onCheckChange,activeColor: Colors.red,),
31 | ],
32 |
33 | ),
34 | ),
35 | );
36 | }
37 | }
38 | //const Checkbox({
39 | //Key key,
40 | //@required this.value,//当前值,是否选中
41 | //@required this.onChanged,//选中变更监听
42 | //this.activeColor,//选中时的颜色
43 | //})
--------------------------------------------------------------------------------
/lib/demo/widgets/textAndImage/TextDemo2.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/cupertino.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:flutter/rendering.dart';
4 |
5 | void main() {
6 | runApp(MaterialApp(
7 | home: MyApp(),
8 | theme: ThemeData(
9 | primaryColor: Colors.red,
10 | ),
11 | ));
12 | }
13 |
14 | class MyApp extends StatelessWidget {
15 | @override
16 | Widget build(BuildContext context) {
17 | return Scaffold(
18 | appBar: AppBar(title: Text("Text")),
19 | body: Text(
20 | "Hello Flutter,Hello Flutter,Hello Flutter,"
21 | "Hello Flutter,Hello Flutter,"
22 | "Hello Flutter,Hello Flutter,"
23 | "Hello Flutter,Hello Flutter,"
24 | "Hello Flutter,Hello Flutter,",
25 | style: TextStyle(
26 | color: Colors.blue,
27 | // backgroundColor: Colors.black
28 | fontSize: 19,
29 | fontWeight: FontWeight.bold,
30 | // fontStyle: FontStyle.italic,
31 | letterSpacing: 2.0,
32 | wordSpacing: 10.0,
33 | ),
34 | ));
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/lib/demo/route/SecondPage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class SecondPage extends StatelessWidget {
4 | @override
5 | Widget build(BuildContext context) {
6 | return new Scaffold(
7 | appBar: new AppBar(
8 | title: new Text("Page2"),
9 | ),
10 | body: new Center(
11 | child: new Column(
12 | children: [
13 | new Text(
14 | "Page2",
15 | style: new TextStyle(fontSize: 25.0),
16 | ),
17 | new ElevatedButton(
18 | child: new Text("点我返回"),
19 | onPressed: () {
20 | Navigator.of(context).pop();
21 |
22 | // 页面出栈-----》不带返回值
23 | // 在Flutter中我们可以使用Navigator.of(context).pop()进行出栈操作,
24 | // 但是值得注意的时如果页面上有Dialog、BottomSheet、popMenu类似的Widget使用pop()方法会优先进行这些Widget的关闭操作。
25 | //
26 | // 还是上面的代码,我们把第二个页面的Text改成一个按钮,每当点击这个按钮就关闭掉这个页面
27 | },
28 | // color: Colors.blue,
29 | // highlightColor: Colors.lightBlue,
30 | ),
31 | ],
32 | ),
33 | ),
34 | );
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/android/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
22 |
23 |
--------------------------------------------------------------------------------
/lib/demo/widgets/TextInputAndChose/SwitchDemo.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(home: new MyApp()));
5 | }
6 |
7 | class MyApp extends StatefulWidget {
8 | @override
9 | State createState() => new MyAppState();
10 | }
11 |
12 | class MyAppState extends State {
13 | bool _isChecked = false;
14 |
15 | void _onSwitchStateChanged(bool value) {
16 | setState(() {
17 | _isChecked = value;
18 | print(_isChecked.toString() + '-------------------');
19 | });
20 | }
21 |
22 | @override
23 | Widget build(BuildContext context) {
24 | return new Scaffold(
25 | appBar: new AppBar(
26 | title: new Text("选择控件"),
27 | ),
28 | body: new Center(
29 | child: new Switch(value: false, onChanged: _onSwitchStateChanged),
30 | ),
31 | );
32 | }
33 | }
34 |
35 | //
36 | //const Switch({
37 | //Key key,
38 | //@required this.value,
39 | //@required this.onChanged,
40 | //this.activeColor,
41 | //this.activeTrackColor,
42 | //this.inactiveThumbColor,
43 | //this.inactiveTrackColor,
44 | //this.activeThumbImage,
45 | //this.inactiveThumbImage
46 | //})
47 |
--------------------------------------------------------------------------------
/lib/pages/simpleWidget/ImagePage.dart:
--------------------------------------------------------------------------------
1 | import 'package:cached_network_image/cached_network_image.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | class ImagePage extends StatelessWidget {
5 | @override
6 | Widget build(BuildContext context) {
7 | return new Scaffold(
8 | appBar: new AppBar(title: new Text("ImagePage")),
9 | body: ListView(
10 | children: [
11 | new Text("从网络加载图片"),
12 | CachedNetworkImage(
13 | imageUrl: 'https://scpic.chinaz.net/files/default/imgs/2023-07-12/40fd0b90e02f7fd4.jpg',
14 | placeholder: (context,url) => const CircularProgressIndicator(),
15 | errorWidget: (context, url, error) => const Icon(Icons.error),
16 | ),
17 | new Image.network(
18 | "https://p1.ssl.qhmsg.com/dr/220__/t01d5ccfbf9d4500c75.jpg",
19 | width: 500,
20 | height: 500,
21 | ),
22 | new Text('从本地加载图片'),
23 | new Image.asset(
24 | 'images/aaa.png',
25 | width: 500,
26 | height: 500,
27 | )
28 | ],
29 | ));
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/lib/demo/widgets/TextInputAndChose/TextFieldDemo2.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/services.dart';
3 |
4 | void main() {
5 | runApp(MaterialApp(
6 | home: TextFieldDemo(),
7 | ));
8 | }
9 |
10 | class TextFieldDemo extends StatefulWidget {
11 | @override
12 | State createState() {
13 | return PageState();
14 | }
15 | }
16 |
17 | class PageState extends State {
18 | var _textFieldEditController = TextEditingController(text: "138");
19 |
20 | @override
21 | void initState() {
22 | super.initState();
23 | _textFieldEditController.addListener(() {
24 | print("当前输入框内的值为:" + _textFieldEditController.text);
25 | });
26 | }
27 |
28 | @override
29 | Widget build(BuildContext context) {
30 | return Scaffold(
31 | appBar: AppBar(
32 | title: Text("TextField"),
33 | ),
34 | body: Padding(
35 | padding: EdgeInsets.all(20),
36 | child: TextField(
37 | controller: _textFieldEditController,
38 | decoration: InputDecoration(
39 | hintText: "请输入手机号...",
40 | ),
41 | ),
42 | ),
43 | );
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/lib/demo/widgets/ToastAndDialog/AboutDialog.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(home: new MyApp()));
5 | }
6 |
7 | class MyApp extends StatelessWidget {
8 | @override
9 | Widget build(BuildContext context) {
10 | return new Scaffold(
11 | appBar: new AppBar(
12 | title: new Text("SnackBar"),
13 | ),
14 | body: new Center(
15 | child: new Builder(builder: (BuildContext context) {
16 | return new ElevatedButton(
17 | onPressed: () {
18 | showDialog(
19 | context: context,
20 | builder: (context) {
21 | return new AboutDialog(
22 | applicationIcon: new Icon(Icons.android),
23 | applicationName: "Flutter",
24 | applicationVersion: "3.1.1",
25 | children: [new Text("更新摘要\n新增飞天遁地功能\n优化用户体验")],
26 | );
27 | });
28 | },
29 | // color: Colors.lightBlueAccent,
30 | child: new Icon(Icons.phone),
31 | );
32 | }),
33 | ),
34 | );
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/flutter_calc_plugin.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/lib/demo/widgets/ListAndGridView/GridList.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(
5 | title: "ds",
6 | home: new MyApp(),
7 | ));
8 | }
9 |
10 | class MyApp extends StatelessWidget {
11 | @override
12 | Widget build(BuildContext context) {
13 | return new MaterialApp(
14 | home: new Scaffold(
15 | appBar: new AppBar(
16 | title: new Text("fsdadsa"),
17 | ),
18 | body: new GridView.count(
19 | // Create a grid with 2 columns. If you change the scrollDirection to
20 | // horizontal, this would produce 2 rows.
21 | crossAxisCount: 3,
22 | // scrollDirection: Axis.horizontal,
23 | // Generate 100 Widgets that display their index in the List
24 | children: new List.generate(100, (index) {
25 | return new Container(
26 | alignment: Alignment.center,
27 | // color: Colors.red,
28 | child: new Text(
29 | 'Item $index',
30 | style: Theme.of(context).textTheme.headline1,
31 | ),
32 | );
33 | }),
34 | ),
35 | ),
36 | );
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/.idea/libraries/Dart_SDK.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/lib/demo/widgets/Scaffold/AppBar.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(title: 'd', home: new MyApp()));
5 | }
6 |
7 | class MyApp extends StatelessWidget {
8 | @override
9 | Widget build(BuildContext context) {
10 | return new Scaffold(
11 | appBar: new AppBar(
12 | leading: new Icon(Icons.android),
13 | automaticallyImplyLeading: true,
14 | centerTitle: true,
15 | //标题居中
16 | elevation: 10.0,
17 | //底部阴影
18 | backgroundColor: Colors.red,
19 | title: new Text("title"),
20 | ),
21 | );
22 | }
23 | }
24 |
25 | //AppBar({
26 | //Key key,
27 | //this.leading,主导Widget
28 | //this.automaticallyImplyLeading: true,
29 | //this.title,
30 | //this.actions,其他附加最贱右上角
31 | //this.flexibleSpace,//伸缩空间,显示在title上面
32 | //this.bottom,//显示在title下面
33 | //this.elevation: 4.0,//阴影高度
34 | //this.backgroundColor,
35 | //this.brightness,明暗模式
36 | //this.iconTheme,
37 | //this.textTheme,
38 | //this.primary: true,是否是用primary
39 | //this.centerTitle,//标题是否居中
40 | //this.titleSpacing: NavigationToolbar.kMiddleSpacing,//title与leading的间隔
41 | //this.toolbarOpacity: 1.0,//title级文字透明度
42 | //this.bottomOpacity: 1.0,//底部文字透明度
43 | //})
44 |
--------------------------------------------------------------------------------
/lib/demo/widgets/statefulwidget/NumberCount.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(title: 'd', home: new MyApp("标题")));
5 | }
6 |
7 | class MyApp extends StatefulWidget {
8 | MyApp(this.title);
9 |
10 | // MyHomePage({Key key, this.title}) : super(key: key); //构造方法的第二种写法
11 |
12 | String title;
13 |
14 | @override
15 | _MyHomePageState createState() {
16 | return new _MyHomePageState();
17 | }
18 | }
19 |
20 | class _MyHomePageState extends State {
21 | int _count = 0;
22 |
23 | void _incrementCounter() {
24 | setState(() {
25 | _count++;
26 | });
27 | }
28 |
29 | @override
30 | Widget build(BuildContext context) {
31 | return new Scaffold(
32 | appBar: new AppBar(
33 | title: new Text(
34 | widget.title,
35 | style: new TextStyle(fontSize: 10.0 + _count),
36 | ),
37 | ),
38 | body: new Center(
39 | // child: new Text('$_count')), 字符串也可以使用占位符的方式
40 | child: new Text(_count.toString()),
41 | ),
42 | floatingActionButton: new FloatingActionButton(
43 | onPressed: _incrementCounter,
44 | child: new Icon(Icons.add),
45 | ),
46 | );
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/lib/view/MyRaisedButton.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | /**
4 | * 定义自带路由跳转button
5 | */
6 | class MyRaisedButton extends StatelessWidget {
7 | var _shapeBorder = new RoundedRectangleBorder(
8 | borderRadius: BorderRadius.all(Radius.circular(20.0)));
9 | var _textStyle = new TextStyle(color: Colors.white, fontSize: 16.0);
10 | var _btnTitle;
11 | var _pageNavigator;
12 |
13 | MyRaisedButton(this._pageNavigator, this._btnTitle);
14 |
15 | @override
16 | Widget build(BuildContext context) {
17 | return ElevatedButton(
18 | onPressed: () {
19 | //第一种写法
20 | Navigator.push(context,
21 | new MaterialPageRoute(builder: (context) => _pageNavigator));
22 | //第二张路由写法
23 | // Navigator.of(context)
24 | // .push(new MaterialPageRoute(builder: (context) => _pageNavigator));
25 | },
26 | child: Text(
27 | _btnTitle,
28 | style: _textStyle,
29 | ),
30 | style: ButtonStyle(
31 | backgroundColor: MaterialStateProperty.all(Colors.lightGreen),
32 | ),
33 | //高版本sdk,无此属性
34 | // color: Colors.lightGreen,
35 | // highlightColor: Colors.green,
36 | // shape: _shapeBorder,
37 | );
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/lib/demo/widgets/view/MyView3.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/rendering.dart';
3 |
4 | class MyView3 extends SingleChildRenderObjectWidget {
5 | @override
6 | RenderObject createRenderObject(BuildContext context) {
7 | return new CircleViewRenderBox();
8 | }
9 | }
10 |
11 | class CircleViewRenderBox extends RenderConstrainedBox {
12 |
13 | CircleViewRenderBox():super(additionalConstraints:const BoxConstraints.expand());
14 | //hitTestSelf 相应事件是否是当前View,用来处理事件的分发
15 | @override
16 | bool hitTestSelf(Offset position) {
17 | return true;
18 | }
19 |
20 | //handleEvent用来处理用户触摸事件
21 |
22 | @override
23 | void handleEvent(PointerEvent event, HitTestEntry entry) {
24 | super.handleEvent(event, entry as BoxHitTestEntry );
25 | }
26 |
27 | //paint 用来对Vidget进行绘制
28 | @override
29 | void paint(PaintingContext context, Offset offset) {
30 | // super.paint(context, offset);
31 |
32 | Paint _paint = new Paint()
33 | ..color = Colors.red
34 | ..strokeCap = StrokeCap.round
35 | ..isAntiAlias = true
36 | ..style = PaintingStyle.stroke
37 | ..strokeWidth = 5.0;
38 |
39 | context.canvas.drawCircle(Offset(105, 100), 80.0, _paint);
40 | }
41 | }
42 |
43 |
44 |
--------------------------------------------------------------------------------
/lib/demo/widgets/ListAndGridView/LongList.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(
5 | title: "dsf",
6 | home: new MyApp(
7 | items: new List.generate(10000, (i) => "Item $i")),
8 | ));
9 | }
10 |
11 | class MyApp extends StatelessWidget {
12 | List items;
13 |
14 | MyApp({Key? key, required this.items}) : super(key: key);
15 |
16 | @override
17 | Widget build(BuildContext context) {
18 | return new Scaffold(
19 | appBar: new AppBar(
20 | title: new Text("list"),
21 | ),
22 | body: new ListView.builder(
23 | itemCount: items.length,
24 | itemBuilder: (context, index) {
25 | return new ListTile(
26 | title: new Container(
27 | height: 120.0,
28 | color: Colors.deepPurple,
29 | alignment: Alignment.center, //内容居中
30 | child: new Text('Item${items[index]}',
31 | style: new TextStyle(
32 | fontSize: 25.0,
33 | color: Colors.white,
34 | ),
35 | ),
36 | ),
37 | );
38 | }));
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/lib/demo/widgets/Scaffold/FloatingActionButton.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(title: 'd', home: new MyApp()));
5 | }
6 |
7 | class MyApp extends StatelessWidget {
8 | @override
9 | Widget build(BuildContext context) {
10 | return new Scaffold(
11 | appBar: new AppBar(
12 | leading: new Icon(Icons.android),
13 | automaticallyImplyLeading: true,
14 | centerTitle: true,
15 | //标题居中
16 | elevation: 10.0,
17 | //底部阴影
18 | backgroundColor: Colors.red,
19 | title: new Text("title"),
20 | ),
21 | floatingActionButton: new FloatingActionButton(
22 | onPressed: null,
23 | child: new Icon(Icons.android),
24 | backgroundColor: Colors.red,
25 | highlightElevation: 10.0,
26 | elevation: 20.0,
27 | // mini: true, //是否启用小图标
28 | ),
29 | );
30 | }
31 | }
32 |
33 | //const FloatingActionButton({
34 | //Key key,
35 | //this.child,
36 | //this.tooltip,//提示,长按按钮提示文字
37 | //this.backgroundColor,//背景颜色
38 | //this.heroTag: const _DefaultHeroTag(),//页面切换动画Tag
39 | //this.elevation: 6.0,//阴影
40 | //this.highlightElevation: 12.0,//高亮阴影
41 | //@required this.onPressed,//点击事件
42 | //this.mini: false//是否使用小图标
43 | //})
44 |
--------------------------------------------------------------------------------
/lib/demo/network/SimpleGet.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:http/http.dart'as http;
3 |
4 | void main() {
5 | runApp(new MaterialApp(home: new MyNetWork()));
6 | }
7 |
8 | class MyNetWork extends StatelessWidget {
9 | void doGet() {
10 | print("--------------------"+"开始请求");
11 | http.get(Uri.parse("https://api.github.com/users/xiedong11")).then((response){
12 | print("--------------------"+response.body);
13 | }).catchError((error){
14 | print("--------------------"+error);
15 | }).whenComplete((){
16 | print("--------------------"+"请求完成");
17 | });
18 | }
19 |
20 | @override
21 | Widget build(BuildContext context) {
22 | return Scaffold(
23 | appBar: new AppBar(
24 | title: Text("网络请求DEMO"),
25 | ),
26 | body: new TextButton(
27 | onPressed: () {
28 | doGet();
29 | },
30 | child: Text("开始请求"),
31 | //高版本sdk无此属性
32 | // color: Colors.brown,
33 | ),
34 | );
35 | }
36 | }
37 | //Flutter中的网络操作
38 | //跟前面讲到的本地存储操作一样,Flutter给我们提供了第三发库的支持,同样的下面三个操作
39 | //
40 | //打开项目的pubspec.yaml配置我文件在dependencies:节点下新增如下配置
41 | //http: ^0.11.3+16
42 | //
43 | //点击开发工具提示的packages get按钮或者在命令行输入flutter packages get来同步第三方插件
44 | //
45 | //在自己的Dart文件中引入插件即可正常使用了
46 | //import ‘package:http/http.dart’ as http
--------------------------------------------------------------------------------
/lib/demo/widgets/ToastAndDialog/SimpleTooltipDemo.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(home: new TooltipDemo()));
5 | }
6 |
7 | class TooltipDemo extends StatelessWidget {
8 | @override
9 | Widget build(BuildContext context) {
10 | return new Scaffold(
11 | appBar: new AppBar(
12 | title: new Text("Tooltip轻量级提示"),
13 | ),
14 | body: new Center(
15 | child: new Tooltip(
16 | message: "Tooltip轻量级提示",
17 | child: new Icon(
18 | Icons.access_alarm,
19 | size: 80.0,
20 | ),
21 | verticalOffset: 80.0,
22 | //具体内部child Widget竖直方向的距离
23 | preferBelow: false,
24 | //是否显示在下面
25 | height: 100.0,
26 | //Tooltip的高度
27 | padding: EdgeInsets.symmetric(vertical: 50.0, horizontal: 50.0)),
28 | ),
29 | );
30 | }
31 | }
32 |
33 | //Tooltip({
34 | //Key key,
35 | //@required this.message,//提示的内容
36 | //this.height = 32.0,//Tooltip的高度
37 | //this.padding = const EdgeInsets.symmetric(horizontal: 16.0),//padding
38 | //this.verticalOffset = 24.0,//具体内部child Widget竖直方向的距离
39 | //this.preferBelow = true,//是否显示在下面
40 | //this.excludeFromSemantics = false,
41 | //this.child,
42 | //})
43 |
44 | //height只能改变tip的高度,改变不了宽度,可以使用padding同时改变宽度跟高度
45 |
--------------------------------------------------------------------------------
/lib/demo/Animation/SimpleHeroAnimationDemo.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(home: new HeroAnimatedDemo()));
5 | }
6 |
7 | class HeroAnimatedDemo extends StatelessWidget {
8 | @override
9 | Widget build(BuildContext context) {
10 | return Scaffold(
11 | appBar: new AppBar(
12 | title: new Text("HeroDemo"),
13 | ),
14 | body: new InkWell(
15 | child: new Hero(tag: "hero", child: new Image.asset("images/a.png")),
16 | onTap: () {
17 | Navigator.of(context)
18 | .push(new MaterialPageRoute(builder: (BuildContext context) {
19 | return new Scaffold(
20 | appBar: new AppBar(
21 | title: new Text("Second Page"),
22 | ),
23 | body: new Container(
24 | padding: const EdgeInsets.all(10.0),
25 | alignment: Alignment.topCenter,
26 | child: new Hero(
27 | tag: "hero",
28 | child: new SizedBox(
29 | width: 100.0,
30 | child: new Image.asset("images/a.png"),
31 | )),
32 | ),
33 | );
34 | }));
35 | },
36 | ),
37 | );
38 | }
39 | }
40 |
41 | //http://flutter.link/2018/05/11/Flutter%E5%8A%A8%E7%94%BB%E3%80%901%E3%80%91/
42 |
--------------------------------------------------------------------------------
/lib/demo/widgets/ToastAndDialog/SnackBarDemo.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(home: new MyApp()));
5 | }
6 |
7 | class MyApp extends StatelessWidget {
8 | @override
9 | Widget build(BuildContext context) {
10 | return new Scaffold(
11 | appBar: new AppBar(
12 | title: new Text("SnackBar"),
13 | ),
14 | body: new Center(
15 | child: new Builder(builder: (BuildContext context) {
16 | return new ElevatedButton(
17 | onPressed: () {
18 | ScaffoldMessenger.of(context).showSnackBar(new SnackBar(
19 | content: new Text("SanckBar is Showing "),
20 | action: new SnackBarAction(
21 | label: "撤销",
22 | onPressed: () {
23 | print("点击撤回---------------");
24 | }),
25 | ));
26 | },
27 | child: new Text("SnackBar提示"),
28 | // color: Colors.cyan,
29 | // highlightColor: Colors.lightBlueAccent,
30 | // disabledColor: Colors.lightBlueAccent,
31 | );
32 | }),
33 | ),
34 | );
35 | }
36 | }
37 |
38 | //const SnackBar({
39 | //Key key,
40 | //@required this.content,//内容
41 | //this.backgroundColor,//背景
42 | //this.action,//其他操作
43 | //this.duration: _kSnackBarDisplayDuration,//显示时长
44 | //this.animation,//进出动画
45 | //})
46 |
--------------------------------------------------------------------------------
/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | # platform :ios, '9.0'
3 |
4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6 |
7 | project 'Runner', {
8 | 'Debug' => :debug,
9 | 'Profile' => :release,
10 | 'Release' => :release,
11 | }
12 |
13 | def flutter_root
14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15 | unless File.exist?(generated_xcode_build_settings_path)
16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17 | end
18 |
19 | File.foreach(generated_xcode_build_settings_path) do |line|
20 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
21 | return matches[1].strip if matches
22 | end
23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24 | end
25 |
26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27 |
28 | flutter_ios_podfile_setup
29 |
30 | target 'Runner' do
31 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
32 | end
33 |
34 | post_install do |installer|
35 | installer.pods_project.targets.each do |target|
36 | flutter_additional_ios_build_settings(target)
37 | end
38 | end
39 |
--------------------------------------------------------------------------------
/lib/demo/widgets/TextInputAndChose/SliderDemo.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(home: new MyApp()));
5 | }
6 |
7 | class MyApp extends StatefulWidget {
8 | @override
9 | State createState() => new MyAppState();
10 | }
11 |
12 | class MyAppState extends State {
13 | double _currentIndex = 0.0;
14 |
15 | void _onSliderStateChanged(double value) {
16 | setState(() {
17 | _currentIndex = value;
18 | print(_currentIndex.toString() + '-------------------');
19 | });
20 | }
21 |
22 | @override
23 | Widget build(BuildContext context) {
24 | return new Scaffold(
25 | appBar: new AppBar(
26 | title: new Text("选择控件"),
27 | ),
28 | body: new Center(
29 | child: new Column(
30 | children: [
31 | new Slider(
32 | value: _currentIndex,
33 | min: 0.0,
34 | max: 7.0,
35 | label: "星期$_currentIndex",
36 | onChanged: _onSliderStateChanged),
37 | new Text("星期$_currentIndex")
38 | ],
39 | ),
40 | ),
41 | );
42 | }
43 | }
44 |
45 | //const Slider({
46 | //Key key,
47 | //@required this.value,
48 | //@required this.onChanged,
49 | //this.min: 0.0,//最小值
50 | //this.max: 1.0,//最小值
51 | //this.divisions,
52 | //this.label,//标志
53 | //this.activeColor,
54 | //this.inactiveColor,
55 | //this.thumbOpenAtMin: false,
56 | //})
57 |
--------------------------------------------------------------------------------
/lib/demo/widgets/container/Container1.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(title: 'd', home: new MyApp()));
5 | }
6 |
7 | class MyApp extends StatelessWidget {
8 | @override
9 | Widget build(BuildContext context) {
10 | return new Scaffold(
11 | appBar: new AppBar(
12 | title: new Text("title"),
13 | ),
14 | body: new Container(
15 | height: 300.0,
16 | width: 300.0,
17 | alignment: Alignment.bottomRight,
18 | color: Colors.blue,
19 | child: new Container(
20 | height: 100.0,
21 | width: 100.0,
22 | color: Colors.deepPurple,
23 | child: new Icon(
24 | Icons.android,
25 | size: 50.0,
26 | color: Colors.redAccent,
27 | ),
28 | alignment: Alignment.bottomRight,
29 | ),
30 | ));
31 | }
32 | }
33 |
34 | //alignment: 内部Widget对齐方式,左上对齐topLeft、垂直顶部对齐,水平居中对齐topCenter、右上topRight、垂直居中水平左对齐centerLeft、居中对齐center、垂直居中水平又对齐centerRight、底部左对齐bottomLeft、底部居中对齐bottomCenter、底部右对齐bottomRight
35 | //
36 | //padding: 内间距,子Widget距Container的距离。
37 | //
38 | //color: 背景颜色
39 | //
40 | //decoration: 背景装饰
41 | //
42 | //foregroundDecoration: 前景装饰
43 | //
44 | //width:容器的宽
45 | //
46 | //height:容器的高
47 | //
48 | //constraints:容器宽高的约束,容器最终的宽高最终都要受到约束中定义的宽高影响
49 | //
50 | //margin:容器外部的间隔
51 | //
52 | //transform: Matrix4变换
53 |
54 | //child:内部子Widget
55 |
--------------------------------------------------------------------------------
/lib/demo/widgets/layout/SimpleExpansionDemo.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(home: new ExPansionTileDemo()));
5 | }
6 |
7 | class ExPansionTileDemo extends StatelessWidget {
8 | void _isExpansion(bool isExpand) {
9 | if (isExpand) {
10 | print("--------------打开");
11 | } else {
12 | print("--------------关闭");
13 | }
14 | }
15 |
16 | @override
17 | Widget build(BuildContext context) {
18 | return new Scaffold(
19 | appBar: new AppBar(
20 | title: new Text("ExpansionTileDemo"),
21 | ),
22 | body: new ListView(
23 | children: [
24 | new ExpansionTile(
25 | title: new Text("更多精彩"), //和ListTitle类似,文字
26 | leading: new Icon(Icons.ac_unit), //和ListTitle类似,在文字前面的Widget
27 | children: [
28 | new Text("Item 1"),
29 | new Text("Item 1"),
30 | new Text("Item 1"),
31 | ],
32 | onExpansionChanged: (bool) {
33 | _isExpansion(bool);
34 | },
35 | )
36 | ],
37 | ),
38 | );
39 | }
40 | }
41 | //ExpansionTile({
42 | //Key key,
43 | //this.leading,//和ListTitle类似,在文字前面的Widget
44 | //@required this.title,//和ListTitle类似,文字
45 | //this.backgroundColor,//背景
46 | //this.onExpansionChanged,//展开或者关闭的监听
47 | //this.children = const [],//内部孩子
48 | //this.trailing,//和ListTitle类似,右侧图标
49 | //this.initiallyExpanded = false,//默认是否展开
50 | //})
--------------------------------------------------------------------------------
/lib/demo/Animation/AnimatedOpacity.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(home: new MyAnimatedOpacity()));
5 | }
6 |
7 | /**
8 | * 改变透明度的动画Widget,可以child根据设置的时间和动画范围改变透明度
9 |
10 | 同样的AnimatedOpacity也继承于ImplicitlyAnimatedWidget,需要填入Curve和Duration参数。
11 | */
12 | class MyAnimatedOpacity extends StatefulWidget {
13 | @override
14 | State createState() => MyState();
15 | }
16 |
17 | class MyState extends State {
18 | var _opacityLevel=0.0;
19 |
20 | _changeOpacityLevel() {
21 | setState(() {
22 | _opacityLevel = _opacityLevel == 0 ? 1.0 : 0.0;
23 | });
24 | }
25 |
26 | @override
27 | Widget build(BuildContext context) {
28 | return new Scaffold(
29 | appBar: new AppBar(
30 | title: new Text("AnimatedOpacity"),
31 | ),
32 | body: new Center(
33 | child: new Column(
34 | children: [
35 | new AnimatedOpacity(
36 | opacity: _opacityLevel,
37 | duration: Duration(seconds: 3),
38 | child: new FlutterLogo(
39 | size: 100.0,
40 | ),
41 | curve: Curves.linear,
42 | ),
43 | new SizedBox(height: 30.0),
44 | new ElevatedButton(
45 | onPressed: _changeOpacityLevel,
46 | child: new Text("改变透明度"),
47 | )
48 | ],
49 | ),
50 | ),
51 | );
52 | }
53 | }
54 | //http://flutter.link/2018/05/11/Flutter%E5%8A%A8%E7%94%BB%E3%80%901%E3%80%91/
55 |
--------------------------------------------------------------------------------
/lib/demo/widgets/ToastAndDialog/AlertDialog.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(home: new MyApp()));
5 | }
6 |
7 | class MyApp extends StatelessWidget {
8 | @override
9 | Widget build(BuildContext context) {
10 | return new Scaffold(
11 | appBar: new AppBar(
12 | title: new Text("SnackBar"),
13 | ),
14 | body: new Center(
15 | child: new Builder(builder: (BuildContext context) {
16 | return new ElevatedButton(
17 | onPressed: () {
18 | showDialog(
19 | context: context,
20 | builder:(context){
21 | return new AlertDialog(
22 | title: new Text("标题"),
23 | content: new Text("内容区域"),
24 | actions: [
25 | new TextButton(
26 | onPressed: () {
27 | Navigator.of(context);
28 | },
29 | child: new Text("确定")),
30 | new TextButton(
31 | onPressed: () {
32 | print("点击取消------");
33 | },
34 | child: new Text("取消")),
35 | ],
36 | );
37 | } );
38 | },
39 | // color: Colors.lightBlueAccent,
40 | child: new Icon(Icons.phone),
41 | );
42 | }),
43 | ),
44 | );
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/lib/demo/widgets/layout/RowAndColumList2.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(title: 'd', home: new MyApp()));
5 | }
6 |
7 | class MyApp extends StatelessWidget {
8 | @override
9 | Widget build(BuildContext context) {
10 | return new Scaffold(
11 | appBar: new AppBar(
12 | title: new Text("title"),
13 | ),
14 | body: new Column(
15 | children: [
16 | new MyListItem(Icons.chat, "消息记录"),
17 | new MyListItem(Icons.stars, "我的收藏"),
18 | new MyListItem(Icons.lock, "我的账户"),
19 | new MyListItem(Icons.send, "意见反馈"),
20 | new MyListItem(Icons.settings, "系统设置"),
21 | ],
22 | ));
23 | }
24 | }
25 |
26 | /**
27 | * 封装列表数据
28 | */
29 | class MyListItem extends StatelessWidget {
30 | IconData myIcon;
31 | String title;
32 |
33 | MyListItem(this.myIcon, this.title);
34 |
35 | @override
36 | Widget build(BuildContext context) {
37 | return new Container(
38 | padding: const EdgeInsets.all(10.0),
39 | decoration: new BoxDecoration(
40 | border: new Border(bottom: new BorderSide(color: Colors.grey))),
41 | child: new Row(
42 | children: [
43 | new Icon(
44 | myIcon,
45 | color: Colors.lightBlueAccent,
46 | ),
47 | new Expanded(
48 | child: new Text(
49 | title,
50 | textAlign: TextAlign.right,
51 | ))
52 | ],
53 | ));
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/lib/demo/widgets/statefulwidget/StatefulWidget.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(title: 'd', home: new MyApp("标题")));
5 | }
6 |
7 | class MyApp extends StatefulWidget {
8 | MyApp(this.title);
9 |
10 | // MyHomePage({Key key, this.title}) : super(key: key); //构造方法的第二种写法
11 |
12 | String title;
13 |
14 | @override
15 | _MyHomePageState createState() {
16 | return new _MyHomePageState();
17 | }
18 | }
19 |
20 | class _MyHomePageState extends State {
21 | int _currentIndex = 0;
22 | List _icons = [
23 | Icons.cloud_download,
24 | Icons.android,
25 | Icons.ac_unit,
26 | Icons.dashboard,
27 | Icons.dehaze
28 | ];
29 |
30 | void _setCurretnIndex() {
31 | setState(() {
32 | _currentIndex++;
33 | if (_currentIndex >= 5) {
34 | _currentIndex = 0;
35 | }
36 | });
37 | }
38 |
39 | @override
40 | Widget build(BuildContext context) {
41 | return new Scaffold(
42 | appBar: new AppBar(
43 | title: new Text(widget.title),
44 | ),
45 | body: new Center(
46 | // child: new Text('$_count')), 字符串也可以使用占位符的方式
47 | child: IndexedStack(
48 | index: 0,
49 | children: [
50 | new Icon(
51 | _icons[_currentIndex],
52 | size: 40.0 * _currentIndex,
53 | ),
54 | ],
55 | ),
56 | ),
57 | floatingActionButton: new FloatingActionButton(
58 | onPressed: _setCurretnIndex,
59 | child: new Icon(Icons.add),
60 | ),
61 | );
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/android/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/flutter_app_android.iml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/lib/demo/widgets/TextInputAndChose/LinearProgressIndicatorDemo.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(home: new LinearProgressIndicatorDemo()));
5 | }
6 |
7 | class LinearProgressIndicatorDemo extends StatefulWidget {
8 | @override
9 | State createState() => new MyProgressIndicatorState();
10 | }
11 |
12 | class MyProgressIndicatorState extends State {
13 | double _currentIndex = 0.1;
14 |
15 | /**
16 | * 更新进度条当前值
17 | */
18 | void changeCurrentIdex() {
19 | setState(() {
20 | _currentIndex += 0.1;
21 | if (_currentIndex >= 1.0) {
22 | _currentIndex = 0.1;
23 | }
24 | });
25 | }
26 |
27 | @override
28 | Widget build(BuildContext context) {
29 | return new Scaffold(
30 | appBar: new AppBar(
31 | title: new Text("条形进度条"),
32 | ),
33 | body: new Column(
34 | children: [
35 | new LinearProgressIndicator(
36 | backgroundColor: Colors.white,
37 | value: _currentIndex, //(在不指定value的情况下,进度条一直滚动)
38 | ),
39 | new Padding(
40 | padding: const EdgeInsets.all(20.0),
41 | child: new ElevatedButton(
42 | onPressed: changeCurrentIdex,
43 | child: new Text("改变进度"),
44 | ),
45 | )
46 | ],
47 | ));
48 | }
49 | }
50 |
51 | //const LinearProgressIndicator({
52 | //Key key,
53 | //double value,//当前进度0-1之间 (在不指定value的情况下,进度条一直滚动)
54 | //Color backgroundColor,//背景颜色
55 | //test.Animation valueColor,//选中颜色,需要用到动画的知识,以后讲
56 | //})
57 |
--------------------------------------------------------------------------------
/lib/demo/widgets/TextInputAndChose/CicularProgressIndicatorDemo.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(home: new LinearProgressIndicatorDemo()));
5 | }
6 |
7 | class LinearProgressIndicatorDemo extends StatefulWidget {
8 | @override
9 | State createState() => new MyProgressIndicatorState();
10 | }
11 |
12 | class MyProgressIndicatorState extends State {
13 | double _currentIndex = 0.1;
14 |
15 | /**
16 | * 更新进度条当前值
17 | */
18 | void changeCurrentIdex() {
19 | setState(() {
20 | _currentIndex += 0.1;
21 | if (_currentIndex >= 1.0) {
22 | _currentIndex = 0.1;
23 | }
24 | });
25 | }
26 |
27 | @override
28 | Widget build(BuildContext context) {
29 | return new Scaffold(
30 | appBar: new AppBar(
31 | title: new Text("条形进度条"),
32 | ),
33 | body: new Column(
34 | children: [
35 | new CircularProgressIndicator(
36 | backgroundColor: Colors.white,
37 | value: _currentIndex, //(在不指定value的情况下,进度条一直滚动)
38 | strokeWidth: 10.0,
39 | ),
40 | new Padding(
41 | padding: const EdgeInsets.all(20.0),
42 | child: new ElevatedButton(
43 | onPressed: changeCurrentIdex,
44 | child: new Text("改变进度"),
45 | ),
46 | )
47 | ],
48 | ));
49 | }
50 | }
51 |
52 | //const CircularProgressIndicator({
53 | //Key key,
54 | //double value,
55 | //Color backgroundColor,
56 | //test.Animation valueColor,
57 | //this.strokeWidth: 4.0,
58 | //})
59 |
--------------------------------------------------------------------------------
/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | flutter_app
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | $(FLUTTER_BUILD_NAME)
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UISupportedInterfaceOrientations
30 |
31 | UIInterfaceOrientationPortrait
32 | UIInterfaceOrientationLandscapeLeft
33 | UIInterfaceOrientationLandscapeRight
34 |
35 | UISupportedInterfaceOrientations~ipad
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationPortraitUpsideDown
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 | UIViewControllerBasedStatusBarAppearance
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/lib/demo/widgets/button/MyButton.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(
5 | title: 'GestureDetector',
6 | home: new MyButton(),
7 | ));
8 | }
9 |
10 |
11 | class MyButton extends StatelessWidget {
12 | @override
13 | Widget build(BuildContext context) {
14 | return new GestureDetector(
15 | onTap: () {
16 | print("Button is click。。。。");
17 | },
18 | child: new Container(
19 | height: 36.0,
20 | padding: const EdgeInsets.only(left: 80.0),
21 | margin: const EdgeInsets.symmetric(horizontal: 8.0),
22 | decoration: new BoxDecoration(
23 | borderRadius: new BorderRadius.circular(10.0),
24 | color: Colors.lightBlue,
25 | ),
26 | ),
27 | );
28 | }
29 | }
30 |
31 | /**
32 | * 手势监听
33 | */
34 | class MyButton1 extends StatelessWidget {
35 | @override
36 | Widget build(BuildContext context) {
37 | return new GestureDetector(
38 | onTap: () {
39 | print("Button is click。。。。");
40 | },
41 | onDoubleTap: () {
42 | print("Button is double click。。。。");
43 | },
44 | onLongPress: () {
45 | print("Button is long press。。。。");
46 | },
47 | child: new Container(
48 | height: 36.0,
49 | padding: const EdgeInsets.all(80.0),
50 | margin: const EdgeInsets.symmetric(vertical: 8.0),
51 | decoration: new BoxDecoration(
52 | borderRadius: new BorderRadius.circular(10.0),
53 | color: Colors.lightBlue,
54 | ),
55 | child: new Center(
56 | child: new Text('点击监听'),
57 | ),
58 | ),
59 | );
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/lib/demo/Animation/AnimatedContainer.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(home: new MyAnimatedContainer()));
5 | }
6 |
7 | /**
8 | * AnimatedContainer看名字不难知道它是Container的动画版本,使用AnimatedContainer就不需要再创建Animation了。
9 |
10 | AnimatedContainer继承于ImplicitlyAnimatedWidget,相应的我们需要传入动画的播放时间(必须填写)和插值器类型(有默认值)
11 |
12 | 然后,我们就可以让AnimatedContainer根据我们的值来做动画效果并且作用到相应的属性上。
13 |
14 |
15 | */
16 | class MyAnimatedContainer extends StatefulWidget {
17 | @override
18 | State createState() => MyState();
19 | }
20 |
21 | class MyState extends State {
22 | double animValue = 100.0;
23 |
24 | _changeValue() {
25 | setState(() => animValue = animValue == 0 ? 100.0 : 0.0);
26 | }
27 |
28 | @override
29 | Widget build(BuildContext context) {
30 | return Scaffold(
31 | appBar: new AppBar(
32 | title: new Text("AnimatedContainer"),
33 | ),
34 | body: new Column(
35 | mainAxisAlignment: MainAxisAlignment.center,
36 | children: [
37 | new AnimatedContainer(
38 | curve: Curves.bounceOut, //插值器类型
39 | duration: new Duration(seconds: 2),
40 | child: new FlutterLogo(
41 | size: 100.0,
42 | ),
43 | padding: EdgeInsets.only(bottom: animValue),
44 | ),
45 | SizedBox(
46 | height: 30.0,
47 | ),
48 | new ElevatedButton(
49 | child: new Text('GO'),
50 | onPressed: _changeValue,
51 | ),
52 | ],
53 | ),
54 | );
55 | }
56 | }
57 | //http://flutter.link/2018/05/11/Flutter%E5%8A%A8%E7%94%BB%E3%80%901%E3%80%91/
58 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/lib/demo/Animation/AnimatedCrossFade.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(home: new MyAnimatedCrossFade()));
5 | }
6 |
7 | /**
8 | AnimatedCrossFade允许一个Widget到另为一个Widget使用渐变的改变。
9 | 与 AnimatedOpacity和AnimatedContainer不同,AnimatedCrossFade直接继承于StatefulWidget,
10 | 构造方法必须要传入两个不同的Widget,当然你也可以指定每个widget的动画差值器。
11 | */
12 | class MyAnimatedCrossFade extends StatefulWidget {
13 | @override
14 | State createState() => MyState();
15 | }
16 |
17 | class MyState extends State {
18 | bool _first = true;
19 |
20 | _changeOpacity() {
21 | setState(() => _first = _first == false ? true : false);
22 | }
23 |
24 | @override
25 | Widget build(BuildContext context) {
26 | return new Scaffold(
27 | appBar: new AppBar(
28 | title: new Text("AnimatedOpacity"),
29 | ),
30 | body: new Center(
31 | child: new Column(
32 | children: [
33 | new AnimatedCrossFade(
34 | firstChild: new Text("哈哈哈哈哈哈"),
35 | secondChild: new Icon(
36 | Icons.forward,
37 | size: 100.0,
38 | ),
39 | crossFadeState: _first
40 | ? CrossFadeState.showFirst
41 | : CrossFadeState.showSecond,
42 | duration: Duration(seconds: 2)),
43 | new SizedBox(height: 30.0),
44 | new ElevatedButton(
45 | onPressed: _changeOpacity,
46 | child: new Text("过渡动画"),
47 | )
48 | ],
49 | ),
50 | ),
51 | );
52 | }
53 | }
54 | //http://flutter.link/2018/05/11/Flutter%E5%8A%A8%E7%94%BB%E3%80%901%E3%80%91/
55 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.7.10'
3 | repositories {
4 | maven { url 'https://maven.aliyun.com/repository/central' }
5 | maven { url 'https://maven.aliyun.com/repository/jcenter' }
6 | maven { url 'https://maven.aliyun.com/repository/google' }
7 | maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
8 | maven { url 'https://maven.aliyun.com/repository/public' }
9 | maven { url 'https://jitpack.io' }
10 | google()
11 | jcenter()
12 | }
13 |
14 | dependencies {
15 | //引入fat-aar支持
16 | classpath 'com.kezong:fat-aar:1.1.7'
17 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
18 | }
19 | // dependencies {
20 | // classpath 'com.android.tools.build:gradle:3.4.1'
21 | // //引入fat-aar支持
22 | // classpath 'com.kezong:fat-aar:1.1.7'
23 | // }
24 | }
25 |
26 | allprojects {
27 | repositories {
28 | maven { url 'https://maven.aliyun.com/repository/central' }
29 | maven { url 'https://maven.aliyun.com/repository/jcenter' }
30 | maven { url 'https://maven.aliyun.com/repository/google' }
31 | maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
32 | maven { url 'https://maven.aliyun.com/repository/public' }
33 | maven { url 'https://jitpack.io' }
34 | google()
35 | jcenter()
36 | }
37 | }
38 |
39 | rootProject.buildDir = '../build'
40 | subprojects {
41 | project.buildDir = "${rootProject.buildDir}/${project.name}"
42 | }
43 | subprojects {
44 | project.evaluationDependsOn(':app')
45 | }
46 |
47 | tasks.register("clean", Delete) {
48 | delete rootProject.buildDir
49 | }
50 |
--------------------------------------------------------------------------------
/lib/pages/stateManage/callback/call_back_page.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_app/pages/stateManage/callback/call_back_second_page.dart';
3 | import 'package:flutter_app/pages/stateManage/state_manage.dart';
4 |
5 | class CallBackPage extends StatefulWidget {
6 | @override
7 | State createState() => PageState();
8 | }
9 |
10 | class PageState extends State {
11 | var _stateInfo = "初始值";
12 |
13 | @override
14 | Widget build(BuildContext context) {
15 | return Scaffold(
16 | appBar: AppBar(
17 | title: Text("方法回调"),
18 | centerTitle: true,
19 | ),
20 | body: Column(
21 | mainAxisAlignment: MainAxisAlignment.center,
22 | crossAxisAlignment: CrossAxisAlignment.stretch,
23 | children: [Text(_stateInfo), ButtonWithCallBack("跳转下一页", updataInfo)],
24 | ),
25 | );
26 | }
27 |
28 |
29 | /**
30 | * 利用callback的思想类似方法回调,要处理一件事的时机是另外一件事处理完成之后触发。
31 | */
32 | void updataInfo() {
33 | setState(() {
34 | _stateInfo="被修改之后的值";
35 | });
36 | print("------------");
37 | }
38 | }
39 |
40 | class ButtonWithCallBack extends StatelessWidget {
41 | Function _funCallBack;
42 | var _title;
43 |
44 | ButtonWithCallBack(this._title, this._funCallBack);
45 |
46 | @override
47 | Widget build(BuildContext context) {
48 | return TextButton(
49 | child: Text(_title),
50 | onPressed: () {
51 | Navigator.of(context)
52 | .push(new MaterialPageRoute(builder: (context) => CallBackSecondPage()))
53 | .then((res) {
54 | _funCallBack();
55 | });
56 | },
57 | // color: Colors.black12,
58 | );
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/lib/demo/widgets/layout/TableDemo.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(title: 'd', home: new MyApp()));
5 | }
6 |
7 | class MyApp extends StatelessWidget {
8 | @override
9 | Widget build(BuildContext context) {
10 | return new Scaffold(
11 | appBar: new AppBar(
12 | title: new Text("title"),
13 | ),
14 | body: new Table(
15 | border: new TableBorder.all(color: Colors.red), //边界线
16 | children: [
17 | new TableRow(
18 | children: [new Text("姓名",textAlign: TextAlign.center), new Text("职位",textAlign: TextAlign.center), new Text("部门",textAlign: TextAlign.center)]),
19 | new TableRow(children: [
20 | new Text("小红"),
21 | new Text("android开发"),
22 | new Text("研发")
23 | ]),
24 | new TableRow(children: [
25 | //此处泛型加不加都行
26 | new Text("小红"),
27 | new Text("android开发"),
28 | new Text("研发")
29 | ]),
30 | new TableRow(children: [
31 | new Text("小红"),
32 | new Text("android开发"),
33 | new Text("研发")
34 | ]),
35 | new TableRow(
36 | children: [new Text("小龙"), new Text("UI"), new Text("美工")]),
37 | ],
38 | ));
39 | }
40 | }
41 |
42 |
43 | //Table({
44 | //Key key,
45 | //this.children: const [],
46 | //this.columnWidths,//列宽
47 | //this.defaultColumnWidth: const FlexColumnWidth(1.0),
48 | //this.textDirection,//文字方向
49 | //this.border,//边框
50 | //this.defaultVerticalAlignment: TableCellVerticalAlignment.top,//对齐方式
51 | //this.textBaseline//基线
52 | //})
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/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 |
--------------------------------------------------------------------------------
/lib/demo/widgets/ListAndGridView/ListViewDemo2.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(home: new MyApp()));
5 | }
6 |
7 | //利用listview.Builder简单生成20条数据
8 | class MyApp extends StatelessWidget {
9 | @override
10 | Widget build(BuildContext context) {
11 | return new Scaffold(
12 | appBar: new AppBar(
13 | title: new Text("SnackBar"),
14 | ),
15 | body: new ListView.builder(
16 | //相比于new ListView()只不过多出了两个参数而已,一个是itemCount指定item的数量,一个是itemBuilder,用来构建Item。
17 | itemBuilder: (BuildContext context, int index) {
18 | return new ListTile(
19 | title: new Text("$index"),
20 | leading: new Icon(
21 | Icons.nature_people,
22 | color: Colors.red,
23 | ),
24 | );
25 | },
26 | itemCount: 20,
27 | ),
28 | );
29 | }
30 | }
31 | //由于数据量过少它现在是不能滑动的。大家可以在下面多加几个Widget试试效果。
32 | //
33 | //在Flutter中有三种构建ListView的方式,刚才介绍的是最简单的一种,但是却不是最常用的,
34 | //因为它仅仅适用于已知数量或者较少数量的Item的情况。如果有未知数量或者无限个Item的情况,再使用上述的方法将不再适用。
35 | //
36 | //那么,我们可以尝试下ListView.builder()和ListView.custom()。
37 | //
38 | //ListView.builder()和ListView.custom()的用法基本相同,只不过custom可以根据自己的需要控制Item显示方式,如Item显示大小。
39 | //
40 | //我们今天来看下ListView.builder()
41 | //ListView.builder({
42 | //Key key,
43 | //Axis scrollDirection: Axis.vertical,
44 | //bool reverse: false,
45 | //ScrollController controller,
46 | //bool primary,
47 | //ScrollPhysics physics,
48 | //bool shrinkWrap: false,
49 | //EdgeInsetsGeometry padding,
50 | //this.itemExtent,
51 | //@required IndexedWidgetBuilder itemBuilder,//item构建者
52 | //int itemCount,//item数量
53 | //bool addAutomaticKeepAlives: true,
54 | //bool addRepaintBoundaries: true,
55 | //})
56 |
--------------------------------------------------------------------------------
/lib/demo/widgets/ListAndGridView/ListViewDemo3.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | /**
4 | * 封装MyListItem,提高Listview 条目的公用性
5 | */
6 | void main() {
7 | runApp(new MaterialApp(home: new MyApp()));
8 | }
9 |
10 | class MyApp extends StatefulWidget {
11 | @override
12 | State createState() {
13 | return new MyAppState();
14 | }
15 | }
16 |
17 | class MyAppState extends State {
18 | final List listData = [];
19 |
20 | @override
21 | void initState() {
22 | super.initState();
23 | for (int i = 0; i < 20; i++) {
24 | listData.add(new ListItem("条目$i", Icons.accessibility));
25 | }
26 | }
27 |
28 | @override
29 | Widget build(BuildContext context) {
30 | return new Scaffold(
31 | appBar: new AppBar(
32 | title: new Text("listview"),
33 | ),
34 | body: new ListView.builder(
35 | itemBuilder: (BuildContext context, int index) {
36 | return new MyListItem(listData[index]);
37 | },
38 | itemCount: listData.length,
39 | ),
40 | );
41 | }
42 | }
43 |
44 | /**
45 | * 构建ListItem实体
46 | */
47 | class ListItem {
48 | final String title;
49 | final IconData iconData;
50 |
51 | ListItem(this.title, this.iconData);
52 | }
53 |
54 | class MyListItem extends StatelessWidget {
55 | final ListItem listItem;
56 |
57 | MyListItem(this.listItem);
58 |
59 | @override
60 | Widget build(BuildContext context) {
61 | return new Column(children: [
62 | new ListTile(
63 | title: new Text(listItem.title),
64 | leading: new Icon(listItem.iconData),
65 | ),
66 | new Divider(
67 | height: 1.0,
68 | indent: 15.0,
69 | )
70 | ]);
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/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 | flutter_calc_plugin_example
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | $(FLUTTER_BUILD_NAME)
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UISupportedInterfaceOrientations
30 |
31 | UIInterfaceOrientationPortrait
32 | UIInterfaceOrientationLandscapeLeft
33 | UIInterfaceOrientationLandscapeRight
34 |
35 | UISupportedInterfaceOrientations~ipad
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationPortraitUpsideDown
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 | UIViewControllerBasedStatusBarAppearance
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/lib/demo/widgets/ListAndGridView/GridViewDemo2.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(home: new MyApp()));
5 | }
6 |
7 | class MyApp extends StatefulWidget {
8 | @override
9 | State createState() {
10 | return new MyState();
11 | }
12 | }
13 |
14 | class MyState extends State {
15 | List gridDate = [];
16 |
17 | @override
18 | void initState() {
19 | // TODO: implement initState
20 | super.initState();
21 | for (int i = 0; i < 30; i++) {
22 | gridDate.add(i);
23 | }
24 | }
25 |
26 | @override
27 | Widget build(BuildContext context) {
28 | return new Scaffold(
29 | appBar: new AppBar(
30 | title: new Text("GridView"),
31 | ),
32 | body: new GridView.builder(
33 | gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(
34 | crossAxisCount: 3, //设置每行的个数
35 | mainAxisSpacing: 10.0, //设置上下item间隔
36 | crossAxisSpacing: 10.0, //设置左右item间隔
37 | childAspectRatio: 1.0),
38 | itemBuilder: (BuildContext context, int index) {
39 | return new MyItemWidget(gridDate[index]);
40 | },
41 | itemCount: gridDate.length,
42 | ),
43 | );
44 | }
45 | }
46 |
47 | class MyItemWidget extends StatelessWidget {
48 | final int index;
49 |
50 | MyItemWidget(this.index);
51 |
52 | @override
53 | Widget build(BuildContext context) {
54 | return new Column(
55 | children: [
56 | new Container(
57 | child: new Icon(
58 | Icons.cake,
59 | size: 50.0,
60 | ),
61 | color: Colors.blue,
62 | ),
63 | new Text("条目$index")
64 | ],
65 | );
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/lib/pages/simpleWidget/GestureDetectorPage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class GestureDetectorPage extends StatefulWidget {
4 | @override
5 | State createState() => new MyState();
6 | }
7 |
8 | class MyState extends State {
9 | var _infoMessage="";
10 |
11 | void _printMessage(String message) {
12 | setState(() {
13 | _infoMessage = message;
14 | });
15 | }
16 |
17 | @override
18 | Widget build(BuildContext context) {
19 | return new Scaffold(
20 | appBar: new AppBar(
21 | title: new Text("Gestures"),
22 | ),
23 | body: new Column(
24 | children: [
25 | new SizedBox(height: 100.0,),
26 | new Center(
27 | child: new GestureDetector(
28 | child: new Text(
29 | "我被赋予了点击触摸能力...",
30 | style: new TextStyle(fontSize: 20.0),
31 | ),
32 | onTap: () {
33 | _printMessage("------onTap");
34 | },
35 | onDoubleTap: () {
36 | _printMessage("------onDoubleTap");
37 | },
38 | onLongPress: () {
39 | _printMessage("-----onLongPress");
40 | },
41 | onVerticalDragStart: (details) {
42 | _printMessage("在垂直方向开始位置:" + details.globalPosition.toString());
43 | },
44 | onVerticalDragEnd: (details) {
45 | _printMessage("在垂直方向结束位置:" + details.primaryVelocity.toString());
46 | },
47 | )),
48 | new SizedBox(height: 200.0,),
49 | new Text(_infoMessage,style: new TextStyle(color: Colors.red,fontSize: 18.0),)
50 | ],
51 | ));
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/android/src/main/kotlin/com/example/flutter_calc_plugin/FlutterCalcPlugin.kt:
--------------------------------------------------------------------------------
1 | package com.example.flutter_calc_plugin
2 |
3 | import androidx.annotation.NonNull
4 |
5 | import io.flutter.embedding.engine.plugins.FlutterPlugin
6 | import io.flutter.plugin.common.MethodCall
7 | import io.flutter.plugin.common.MethodChannel
8 | import io.flutter.plugin.common.MethodChannel.MethodCallHandler
9 | import io.flutter.plugin.common.MethodChannel.Result
10 |
11 | class FlutterCalcPlugin : FlutterPlugin, MethodCallHandler {
12 | private lateinit var channel : MethodChannel
13 | // companion object {
14 | // @JvmStatic
15 | // fun registerWith(registrar: Registrar) {
16 | // val channel = MethodChannel(registrar.messenger(), "flutter_calc_plugin")
17 | // channel.setMethodCallHandler(FlutterCalcPlugin())
18 | // }
19 | // }
20 |
21 | override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {
22 | channel = MethodChannel(flutterPluginBinding.binaryMessenger, "flutter_calc_plugin")
23 | channel.setMethodCallHandler(this)
24 | }
25 |
26 | override fun onMethodCall(call: MethodCall, result: Result) {
27 | if (call.method == "getPlatformVersion") {
28 | result.success("Android ${android.os.Build.VERSION.RELEASE}")
29 | } else if (call.method == "getResult") {
30 | var a = call.argument("a")
31 | var b = call.argument("b")
32 | result.success((a!! + b!!).toString())
33 | } else {
34 | result.notImplemented()
35 | }
36 | }
37 |
38 | override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) {
39 | channel.setMethodCallHandler(null)
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/.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/Flutter/flutter_export_environment.sh
65 | **/ios/ServiceDefinitions.json
66 | **/ios/Runner/GeneratedPluginRegistrant.*
67 |
68 | # Exceptions to above rules.
69 | !**/ios/**/default.mode1v3
70 | !**/ios/**/default.mode2v3
71 | !**/ios/**/default.pbxuser
72 | !**/ios/**/default.perspectivev3
73 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
74 |
--------------------------------------------------------------------------------
/lib/demo/navigation/NavigationView3.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'dart:async';
3 |
4 |
5 | //https://blog.csdn.net/u011045726/article/details/79583423
6 | //https://blog.csdn.net/hekaiyou/article/details/72853738
7 | void main() {
8 | runApp(new MyApp());
9 | }
10 |
11 | class MyApp extends StatelessWidget {
12 | @override
13 | Widget build(BuildContext context) {
14 | return new MaterialApp(
15 | title: 'Flutter Demo',
16 | home: new MyHomePage(title: '应用程序首页'),
17 | );
18 | }
19 | }
20 |
21 | class MyHomePage extends StatefulWidget {
22 | MyHomePage({Key? key, required this.title}) : super(key: key);
23 |
24 | final String title;
25 |
26 | @override
27 | _MyHomePageState createState() => new _MyHomePageState();
28 | }
29 |
30 | class _MyHomePageState extends State {
31 | bool _result = false;
32 |
33 | Future _openNewPage() async {
34 | bool? value = await Navigator.of(context).push(new MaterialPageRoute(
35 | builder: (BuildContext context) {
36 | return new Center(
37 | child: new GestureDetector(
38 | child: new Text("确定"),
39 | onTap: () { Navigator.of(context).pop(true); },
40 | ),
41 | );
42 | }
43 | ));
44 |
45 | setState(() {
46 | _result = value!;
47 | });
48 | }
49 |
50 | @override
51 | Widget build(BuildContext context) {
52 | return new Scaffold(
53 | appBar: new AppBar(
54 | title: new Text(widget.title),
55 | ),
56 | body: new Center(
57 | child: new Text(
58 | '用户当前选择为 $_result',
59 | ),
60 | ),
61 | floatingActionButton: new FloatingActionButton(
62 | onPressed: _openNewPage,
63 | child: new Icon(Icons.open_in_new),
64 | ),
65 | );
66 | }
67 | }
--------------------------------------------------------------------------------
/lib/demo/widgets/Scaffold/BottomNavigationBar.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(title: 'd', home: new MyApp()));
5 | }
6 |
7 | class MyApp extends StatelessWidget {
8 | @override
9 | Widget build(BuildContext context) {
10 | return new Scaffold(
11 | appBar: new AppBar(
12 | // leading: new Icon(Icons.android),//由于Drawer会自动给appber加上leading,所以我们在这里需要把我们前面设置的leading给去掉
13 | centerTitle: true,
14 | //标题居中
15 | elevation: 10.0,
16 | //底部阴影
17 | title: new Text("title"),
18 | ),
19 |
20 | // endDrawer: new Drawer(), //右侧抽屉
21 |
22 | bottomNavigationBar: new BottomNavigationBar(
23 | items: [
24 | new BottomNavigationBarItem(
25 | icon: new Icon(Icons.shopping_cart), label: "购物车"),
26 | new BottomNavigationBarItem(
27 | icon: new Icon(Icons.message), label: "会话"),
28 | new BottomNavigationBarItem(
29 | icon: new Icon(Icons.person), label: "我的")
30 | ],
31 | fixedColor: Colors.cyan,
32 | iconSize: 20.0,
33 | currentIndex: 2,
34 | ),
35 | );
36 | }
37 | }
38 |
39 |
40 | //BottomNavigationBar金支持0-4个之间个底部按钮数量,超出4个系统将会报异常
41 | //默认0-3个底部按钮数量时,BottomNavigationBar采用fixed的模式摆放底部按钮,当超过4个时默认使用shifting模式摆放底部按钮
42 | //BottomNavigationBar({
43 | //Key key,
44 | //@required this.items,//List
45 | //this.onTap,//tap事件
46 | //this.currentIndex: 0,//当前位置
47 | //BottomNavigationBarType type,//底部item类型,fixed自适应,shifting选择放大
48 | //this.fixedColor,选中颜色
49 | //this.iconSize: 24.0,//图标大小
50 | //})
51 |
52 | //
53 | //构造方法很简单,大家自己看参数备注,默认需要传入BList参数,我们还是来看下BottomNavigationBarItem
54 | //
55 | //const BottomNavigationBarItem({
56 | //@required this.icon,
57 | //@required this.title,
58 | //this.backgroundColor,
59 | //})
60 |
--------------------------------------------------------------------------------
/lib/demo/widgets/TextInputAndChose/RadioGroupDemo.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(home: new MyApp()));
5 | }
6 |
7 | class MyApp extends StatefulWidget {
8 | @override
9 | State createState() => new MyAppState();
10 | }
11 |
12 | class MyAppState extends State {
13 | int _radioValue = 0;
14 |
15 | void handleRadioValueChanged(int? value) {
16 | setState(() {
17 | _radioValue = value!;
18 | print(_radioValue.toString() + '-------------------');
19 | });
20 | }
21 |
22 | @override
23 | Widget build(BuildContext context) {
24 | return new Scaffold(
25 | appBar: new AppBar(
26 | title: new Text("选择控件"),
27 | ),
28 | body: new Center(
29 | child: new Column(
30 | children: [
31 | new Radio(
32 | value: 0,
33 | groupValue: _radioValue,
34 | onChanged: handleRadioValueChanged),
35 | new Radio(
36 | value: 1,
37 | groupValue: _radioValue,
38 | activeColor: Colors.red,
39 | onChanged: handleRadioValueChanged),
40 | new Radio(
41 | value: 2,
42 | groupValue: _radioValue,
43 | onChanged: handleRadioValueChanged),
44 | new Radio(
45 | value: 3,
46 | groupValue: _radioValue,
47 | onChanged: handleRadioValueChanged),
48 | ],
49 | ),
50 | ),
51 | );
52 | }
53 | }
54 |
55 |
56 | //当value和groupValue一致的时候则选中
57 | //const Radio({
58 | //Key key,
59 | //@required this.value, //单选的值。
60 | //@required this.groupValue, //选择组的值。
61 | //@required this.onChanged, //改变时触发。
62 | //this.activeColor, //激活时的颜色
63 | //this.materialTapTargetSize,
64 | //})
--------------------------------------------------------------------------------
/lib/demo/widgets/layout/SimpleExpansionPanelListDemo.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(home: new ExpansionPanelListDemo()));
5 | }
6 |
7 | class ExpansionPanelListDemo extends StatefulWidget {
8 | @override
9 | State createState() => new MyState();
10 | }
11 |
12 | class MyState extends State {
13 | var isExpanded = true;
14 |
15 | _expansionCallback(index, isExpanded) {
16 | setState(() {
17 | if (this.isExpanded == isExpanded) {
18 | this.isExpanded = !this.isExpanded;
19 | }
20 | });
21 | }
22 |
23 | @override
24 | Widget build(BuildContext context) {
25 | return new Scaffold(
26 | appBar: new AppBar(
27 | title: new Text("可折叠列表"),
28 | ),
29 | body: new SingleChildScrollView(
30 | child: new ExpansionPanelList(
31 | children: [
32 | ExpansionPanel(
33 | headerBuilder: (index, opened) {
34 | return ListTile(
35 | title: new Text("更多内容"),
36 | );
37 | },
38 | body: new Padding(
39 | padding: EdgeInsets.all(20.0),
40 | child: Container(
41 | height: 100.0,
42 | color: Colors.blue,
43 | alignment: Alignment.center,
44 | child: Icon(
45 | Icons.security,
46 | size: 35.0,
47 | ),
48 | ),
49 | ),
50 | isExpanded: isExpanded, //默认是不展开,利用判断,点击是否展开
51 | )
52 | ],
53 | expansionCallback: (index, isExpanded) {
54 | _expansionCallback(index, isExpanded);
55 | },
56 | ),
57 | ));
58 | }
59 | }
60 | //http://flutter.link/2018/10/10/ExpansionPanelList/
61 |
--------------------------------------------------------------------------------
/lib/pages/storage/SharedPerferenceStorage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:shared_preferences/shared_preferences.dart';
3 |
4 | class SharedPerferenceStorage extends StatefulWidget {
5 | @override
6 | State createState() => StorageState();
7 | }
8 |
9 | class StorageState extends State {
10 | var _textFieldController = new TextEditingController();
11 | var _storageString = '';
12 | final STORAGE_KEY = 'storage_key';
13 |
14 | /**
15 | * 利用SharedPreferences存储数据
16 | */
17 | Future saveString() async {
18 | SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
19 | sharedPreferences.setString(
20 | STORAGE_KEY, _textFieldController.value.text.toString());
21 | }
22 |
23 | /**
24 | * 获取存在SharedPreferences中的数据
25 | */
26 | Future getString() async {
27 | SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
28 | setState(() {
29 | _storageString = sharedPreferences.get(STORAGE_KEY) as String;
30 | });
31 | }
32 |
33 | @override
34 | Widget build(BuildContext context) {
35 | return new Scaffold(
36 | appBar: new AppBar(
37 | title: new Text('shared_preferences存储'),
38 | ),
39 | body: new Column(
40 | children: [
41 | Text("shared_preferences存储", textAlign: TextAlign.center),
42 | TextField(
43 | controller: _textFieldController,
44 | ),
45 | MaterialButton(
46 | onPressed: saveString,
47 | child: new Text("存储"),
48 | color: Colors.pink,
49 | ),
50 | MaterialButton(
51 | onPressed: getString,
52 | child: new Text("获取"),
53 | color: Colors.lightGreen,
54 | ),
55 | Text('shared_preferences存储的值为 $_storageString'),
56 |
57 |
58 | ],
59 | ),
60 | );
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/lib/demo/widgets/statefulwidget/ChangeIcon.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(title: 'd', home: new MyApp("标题")));
5 | }
6 |
7 | class MyApp extends StatefulWidget {
8 | MyApp(this.title);
9 |
10 | // MyHomePage({Key key, this.title}) : super(key: key); //构造方法的第二种写法
11 |
12 | String title;
13 |
14 | @override
15 | _MyHomePageState createState() {
16 | return new _MyHomePageState();
17 | }
18 | }
19 |
20 | class _MyHomePageState extends State {
21 | int _currentIndex = 0;
22 |
23 | void _setCurretnIndex() {
24 | setState(() {
25 | _currentIndex++;
26 | if (_currentIndex >= 3) {
27 | _currentIndex = 0;
28 | }
29 | });
30 | }
31 |
32 | @override
33 | Widget build(BuildContext context) {
34 | return new Scaffold(
35 | appBar: new AppBar(
36 | title: new Text(widget.title),
37 | ),
38 | body: new Center(
39 | // child: new Text('$_count')), 字符串也可以使用占位符的方式
40 | child: IndexedStack(
41 | index: _currentIndex,
42 | children: [
43 | new Icon(
44 | Icons.cloud_download,
45 | size: 100.0,
46 | color: Colors.blue,
47 | ),
48 | new Icon(
49 | Icons.error_outline,
50 | size: 100.0,
51 | color: Colors.red,
52 | ),
53 | new Icon(
54 | Icons.check_circle,
55 | size: 100.0,
56 | color: Colors.green,
57 | ),
58 | new Icon(
59 | Icons.help,
60 | size: 100.0,
61 | color: Colors.yellowAccent,
62 | )
63 | ],
64 | ),
65 | ),
66 | floatingActionButton: new FloatingActionButton(
67 | onPressed: _setCurretnIndex,
68 | child: new Icon(Icons.add),
69 | ),
70 | );
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/lib/demo/theme/ThemeDemo.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(
5 | new MaterialApp(
6 | title: 'd',
7 | home: new MyApp(),
8 | theme: new ThemeData(primaryColor: Colors.red),
9 | ),
10 | );
11 | }
12 |
13 | class MyApp extends StatelessWidget {
14 | @override
15 | Widget build(BuildContext context) {
16 | return new Scaffold(
17 | appBar: new AppBar(
18 | // leading: new IconButton(
19 | // icon: new Icon(Icons.ac_unit), tooltip: "dfsaf", onPressed: null),
20 | title: new Text("title"),
21 | actions: [
22 | new IconButton(
23 | icon: new Icon(Icons.title), tooltip: "fsdafsa", onPressed: null)
24 | ],
25 | ),
26 | drawer: new Drawer(
27 | child: new Center(
28 | child: new Text("我是菜单"),
29 | ),
30 | ),
31 | body: new Stack(
32 | children: [
33 | new Align(
34 | alignment: new FractionalOffset(0.5, 0.5),
35 | child: new MyButton(),
36 | )
37 | ],
38 | ),
39 | );
40 | }
41 | }
42 |
43 | class MyButton extends StatelessWidget {
44 | @override
45 | Widget build(BuildContext context) {
46 | return new GestureDetector(
47 | onTap: () {
48 | print("test.widgets.button is click ...");
49 | },
50 | child: new Container(
51 | height: 36.0,
52 | padding: const EdgeInsets.all(8.0),
53 | margin: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 20.0),
54 | decoration: new BoxDecoration(
55 | borderRadius: new BorderRadius.circular(15.0),
56 | color: Colors.lightGreen[500],
57 | ),
58 | child: new Center(
59 | child: new Text(
60 | 'Flutter',
61 | style: new TextStyle(color: Colors.white),
62 | ),
63 | ),
64 | ),
65 | );
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/lib/demo/widgets/Scaffold/Drawer.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(title: 'd', home: new MyApp()));
5 | }
6 |
7 | class MyApp extends StatelessWidget {
8 | @override
9 | Widget build(BuildContext context) {
10 | return new Scaffold(
11 | appBar: new AppBar(
12 | // leading: new Icon(Icons.android),//由于Drawer会自动给appber加上leading,所以我们在这里需要把我们前面设置的leading给去掉
13 | centerTitle: true,
14 | //标题居中
15 | elevation: 10.0,
16 | //底部阴影
17 | title: new Text("title"),
18 | ),
19 |
20 | // endDrawer: new Drawer(), //右侧抽屉
21 | drawer: new Drawer(
22 | child: new Column(
23 | children: [
24 | new UserAccountsDrawerHeader(
25 | decoration:new BoxDecoration(image: new DecorationImage(image:new NetworkImage("http://t2.hddhhn.com/uploads/tu/201612/98/st93.png") )),
26 | accountName: new Text("flutter"),
27 | accountEmail: new Text("flutter@hahah.com"),
28 | currentAccountPicture: new CircleAvatar(//CircleAvatar组件,是圆形头像
29 | backgroundImage: new NetworkImage(
30 | "http://tva2.sinaimg.cn/crop.0.3.707.707.180/a2f7c645jw8f6qvlbp1g7j20js0jrgrz.jpg"),)
31 | ),
32 | new ListTile(leading: new Icon(Icons.refresh),title: new Text("刷新"),),
33 | new ListTile(leading: new Icon(Icons.help),title: new Text("帮助"),),
34 | new ListTile(leading: new Icon(Icons.chat),title: new Text("会话"),),
35 | new ListTile(leading: new Icon(Icons.settings),title: new Text("设置"),),
36 | ],
37 | ),
38 | ),
39 | );
40 | }
41 | }
42 |
43 | //在Flutter当中,默认我我们预置了很多好用的Widget,比如UserAccountsDrawerHeader和ListTile 。借助于这些Widget我们可以快速的构建出一个漂亮的菜单页面
44 |
45 | //elevation设置阴影宽度,child就是菜单区域
46 | //const Drawer({
47 | //Key key,
48 | //this.elevation: 16.0,
49 | //this.child,
50 | //})
51 |
--------------------------------------------------------------------------------
/lib/pages/stateManage/redux/redux_first_page.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_app/pages/stateManage/redux/redux_second_page.dart';
3 | import 'package:flutter_app/pages/stateManage/redux/redux_state.dart';
4 |
5 | import 'package:flutter_redux/flutter_redux.dart';
6 |
7 | import 'package:redux/redux.dart';
8 |
9 | class ReduxFirstPage extends StatefulWidget {
10 | @override
11 | State createState() => PageState();
12 | }
13 |
14 | class PageState extends State {
15 | @override
16 | Widget build(BuildContext context) {
17 | return StoreBuilder(
18 | builder: (BuildContext context, Store store) {
19 | return Scaffold(
20 | appBar: AppBar(
21 | title: Text('模拟点赞数'),
22 | centerTitle: true,
23 | ),
24 | body: Column(
25 | crossAxisAlignment: CrossAxisAlignment.stretch,
26 | mainAxisAlignment: MainAxisAlignment.center,
27 | children: [
28 | Row(
29 | mainAxisAlignment: MainAxisAlignment.center,
30 | children: [
31 | Icon(
32 | Icons.favorite,
33 | color: Colors.redAccent,
34 | size: 32,
35 | ),
36 | SizedBox(width: 5),
37 | Text("${store.state.count}",
38 | style: TextStyle(fontSize: 15, color: Colors.grey))
39 | ],
40 | ),
41 | SizedBox(height: 50),
42 | ElevatedButton(
43 | child: Text("点击进入下一页"),
44 | onPressed: () {
45 | Navigator.of(context).push(MaterialPageRoute(
46 | builder: (buildContext) => ReduxSecondPage()));
47 | },
48 | )
49 | ],
50 | ),
51 | );
52 | },
53 | );
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/lib/demo/widgets/Scaffold/SimpleTabBarDemo.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/services.dart';
3 |
4 | void main() {
5 | runApp(new MaterialApp(home: new TabBarDemo()));
6 | }
7 |
8 | class TabBarDemo extends StatelessWidget {
9 | List list = [
10 | new Text("页面1"),
11 | new Text("页面2"),
12 | new Text("页面3"),
13 | new Text("页面4"),
14 | ];
15 |
16 | @override
17 | Widget build(BuildContext context) {
18 | return new MaterialApp(
19 | home: new DefaultTabController(
20 | length: list.length,
21 | child: new Scaffold(
22 | appBar: new AppBar(
23 | title: new Text("TabBar"),
24 | bottom: new TabBar(
25 | tabs: list,
26 | indicatorColor: Colors.brown,
27 | unselectedLabelColor: Colors.yellowAccent,
28 | labelColor: Colors.red,
29 | ),
30 | ),
31 | body: new TabBarView(children: list),
32 | )),
33 | );
34 | }
35 | }
36 | //TabBar
37 | //还是首先来你看下构造方法吧
38 | //const TabBar({
39 | //Key key,
40 | //@required this.tabs,//WidgetList,一般使用系统提供的Tab作为Widget哦
41 | //this.controller,//控制器
42 | //this.isScrollable: false,//总内容超出自动宽展区域并可以滚动
43 | //this.indicatorColor,//指示器颜色
44 | //this.indicatorWeight: 2.0,指示器宽度
45 | //this.indicatorPadding: EdgeInsets.zero,//指示器padding
46 | //this.indicator,//自定义指示器
47 | //this.indicatorSize,//指示器大小
48 | //this.labelColor,//文字颜色
49 | //this.labelStyle,//文字style
50 | //this.unselectedLabelColor,//未选中文字颜色
51 | //this.unselectedLabelStyle,//未选中文字style
52 | //})
53 | //其中只有tabs参数势必须的,其他的参数都会根据你app的主题曲自动设置相应的参数。
54 | //
55 | //那么这个Tab又是什么东西呢?我们还是再来看下Tab的构造方法吧
56 | //const Tab({
57 | //Key key,
58 | //this.text,
59 | //this.icon,
60 | //this.child,
61 | //})
62 | //相比于TabBar,Tab这个WIdget就显得非常简单,他就是一个最基本的组件,我们 可以选择性的填入text,icon或者子Widget
63 | //
64 | //我们仅仅使用这两个组件就可以显示一个TabBar可以了,但是如果想要做到TabBar与下面内容区域的关联还需要用到TabView这个Widget哦。
65 | //
66 | //TabView实际上就是用来关联Tab与内容区域的一个中间件。
--------------------------------------------------------------------------------
/lib/demo/navigation/NavigationView.dart:
--------------------------------------------------------------------------------
1 |
2 | import 'package:flutter/material.dart';
3 |
4 | void main() {
5 | runApp(new MyApp());
6 | }
7 |
8 | class MyApp extends StatelessWidget {
9 | @override
10 | Widget build(BuildContext context) {
11 | return new MaterialApp(
12 | title: '导航',
13 | theme: new ThemeData(primarySwatch: Colors.red),
14 | home: new MyHomePage(
15 | title: "导航页",
16 | ),
17 | );
18 | }
19 | }
20 |
21 | class MyHomePage extends StatefulWidget {
22 | MyHomePage({Key? key, required this.title}) : super(key: key);
23 | final String title;
24 |
25 | @override
26 | _MyHomePageState createState() => new _MyHomePageState();
27 | }
28 |
29 | class _MyHomePageState extends State {
30 | @override
31 | Widget build(BuildContext context) {
32 | return new Scaffold(
33 | appBar: new AppBar(
34 | title: new Text(widget.title),
35 | ),
36 | body: new Center(
37 | child: new Text('点击浮动按钮打开新的页面'),
38 | ),
39 | floatingActionButton: new FloatingActionButton(
40 | backgroundColor: Colors.lightBlue,
41 | foregroundColor: Colors.amberAccent,
42 | onPressed: _openNewPage,
43 | child: new Icon(Icons.ac_unit),
44 | ),
45 | );
46 | }
47 |
48 | void _openNewPage() {
49 | setState(() {
50 | Navigator.of(context).push(new MaterialPageRoute(
51 | builder: (BuildContext context) {
52 | return new Scaffold(
53 | appBar: new AppBar(
54 | title: new Text('新的页面'),
55 | ),
56 | body: new Center(
57 | child: new Text("点击按钮返回首页"),
58 | ),
59 | floatingActionButton: new FloatingActionButton(
60 | onPressed: () {
61 | Navigator.of(context).pop();
62 | },
63 | child: new Icon(Icons.accessible),
64 | ),
65 |
66 | );
67 | }
68 | ));
69 | });
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/lib/demo/Animation/HeroLoginSuccessPage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(home: new LoginSuccessPage()));
5 | }
6 |
7 | class LoginSuccessPage extends StatelessWidget {
8 | @override
9 | Widget build(BuildContext context) {
10 | return new Scaffold(
11 | appBar: new AppBar(
12 | title: new Text("登录成功"),
13 | ),
14 | body:HomePage()
15 | );
16 | }
17 | }
18 | class HomePage extends StatelessWidget {
19 |
20 | @override
21 | Widget build(BuildContext context) {
22 | final logo = Hero(
23 | tag: 'hero',
24 | child: Padding(
25 | padding: EdgeInsets.all(16.0),
26 | child: CircleAvatar(
27 | radius: 72.0,
28 | backgroundColor: Colors.transparent,
29 | backgroundImage: AssetImage('images/a.png'),
30 | ),
31 | ),
32 | );
33 |
34 | final welcome = Padding(
35 | padding: EdgeInsets.all(8.0),
36 | child: Text(
37 | 'Welcome Flutter',
38 | style: TextStyle(fontSize: 28.0, color: Colors.white),
39 | ),
40 | );
41 |
42 | final text = Padding(
43 | padding: EdgeInsets.all(8.0),
44 | child: Text(
45 | 'Flutter is Google’s mobile app SDK for crafting high-quality native interfaces on iOS and Android in record time. Flutter works with existing code, is used by developers and organizations around the world, and is free and open source.',
46 | style: TextStyle(fontSize: 16.0, color: Colors.white),
47 | ),
48 | );
49 |
50 | final body = Container(
51 | width: MediaQuery.of(context).size.width,
52 | padding: EdgeInsets.all(28.0),
53 | decoration: BoxDecoration(
54 | gradient: LinearGradient(colors: [
55 | Colors.blue,
56 | Colors.lightBlueAccent,
57 | ]),
58 | ),
59 | child: Column(
60 | children: [logo, welcome, text],
61 | ),
62 | );
63 |
64 | return Scaffold(
65 | body: body,
66 | );
67 | }
68 | }
--------------------------------------------------------------------------------
/lib/demo/widgets/ToastAndDialog/BottomSheetDemo.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(home: new MyApp()));
5 | }
6 |
7 | class MyApp extends StatelessWidget {
8 | @override
9 | Widget build(BuildContext context) {
10 | return new Scaffold(
11 | appBar: new AppBar(
12 | title: new Text("SnackBar"),
13 | ),
14 | body: new Center(
15 | child: new Builder(builder: (BuildContext context) {
16 | return new ElevatedButton(
17 | onPressed: () {
18 | showBottomSheet(
19 | context: context,
20 | builder: (BuildContext context) {
21 | return new Container(
22 | child: new Padding(
23 | padding: const EdgeInsets.all(10.0),
24 | child: new Column(
25 | children: [
26 | new ListTile(
27 | leading: new Icon(Icons.chat),
28 | title: new Text("对话框列表1"),
29 | ),
30 | new ListTile(
31 | leading: new Icon(Icons.help),
32 | title: new Text("对话框列表2"),
33 | ),
34 | new ListTile(
35 | leading: new Icon(Icons.settings),
36 | title: new Text("对话框列表3"),
37 | ),
38 | new ListTile(
39 | leading: new Icon(Icons.more),
40 | title: new Text("对话框列表4"),
41 | ),
42 | ],
43 | ),
44 | ),
45 | );
46 | });
47 | },
48 | child: new Text("BottomSheet"),
49 | );
50 | }),
51 | ),
52 | );
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/lib/demo/widgets/ListAndGridView/SimpleListViewDemo.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(home: new MyApp()));
5 | }
6 |
7 | class MyApp extends StatelessWidget {
8 | @override
9 | Widget build(BuildContext context) {
10 | return new Scaffold(
11 | appBar: new AppBar(
12 | title: new Text("SnackBar"),
13 | ),
14 | body: new ListView(
15 | children: [
16 | new ListTile(
17 | leading: new Icon(
18 | Icons.print,
19 | size: 30.0,
20 | color: Colors.lightBlueAccent,
21 | ),
22 | title: new Text("标题1"),
23 | subtitle: Icon(Icons.message),
24 | ),
25 | new Divider(
26 | height: 1.0,
27 | indent: 10.0,
28 | ),
29 | new ListTile(
30 | leading: new Icon(
31 | Icons.apps,
32 | ),
33 | title: new Text("我是标题"),
34 | ),
35 | new Divider(
36 | height: 1.0,
37 | indent: 10.0,
38 | ),
39 | new ListTile(
40 | leading: new Icon(
41 | Icons.apps,
42 | ),
43 | title: new Text("我是标题"),
44 | ),
45 | new Divider(
46 | height: 1.0,
47 | indent: 10.0,
48 | ),
49 | new ListTile(
50 | leading: new Icon(
51 | Icons.apps,
52 | ),
53 | title: new Text("我是标题"),
54 | ),
55 | ],
56 | ),
57 | );
58 | }
59 | }
60 | //ListView({
61 | //Key key,
62 | //Axis scrollDirection: Axis.vertical,//滚动方向
63 | //bool reverse: false,//十分反向显示数据
64 | //ScrollController controller,
65 | //bool primary,
66 | //ScrollPhysics physics,//物理滚动
67 | //bool shrinkWrap: false,
68 | //EdgeInsetsGeometry padding,
69 | //this.itemExtent,//item有效范围
70 | //bool addAutomaticKeepAlives: true,//自动保存视图缓存
71 | //bool addRepaintBoundaries: true,//添加重绘边界
72 | //List children: const [],
73 | //})
--------------------------------------------------------------------------------
/lib/demo/widgets/ToastAndDialog/ModalBottomSheet.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(home: new MyApp()));
5 | }
6 | //showModalBottomSheet与BottomSheet的区别是 BottomSheet充满屏幕,ModalBottomSheet半屏
7 | class MyApp extends StatelessWidget {
8 | @override
9 | Widget build(BuildContext context) {
10 | return new Scaffold(
11 | appBar: new AppBar(
12 | title: new Text("SnackBar"),
13 | ),
14 | body: new Center(
15 | child: new Builder(builder: (BuildContext context) {
16 | return new ElevatedButton(
17 | onPressed: () {
18 | showModalBottomSheet(
19 | context: context,
20 | builder: (BuildContext context) {
21 | return new Container(
22 | child: new Padding(
23 | padding: const EdgeInsets.all(10.0),
24 | child: new Column(
25 | children: [
26 | new ListTile(
27 | leading: new Icon(Icons.chat),
28 | title: new Text("对话框列表1"),
29 | ),
30 | new ListTile(
31 | leading: new Icon(Icons.help),
32 | title: new Text("对话框列表2"),
33 | ),
34 | new ListTile(
35 | leading: new Icon(Icons.settings),
36 | title: new Text("对话框列表3"),
37 | ),
38 | new ListTile(
39 | leading: new Icon(Icons.more),
40 | title: new Text("对话框列表4"),
41 | ),
42 | ],
43 | ),
44 | ),
45 | );
46 | });
47 | },
48 | child: new Text("BottomSheet"),
49 | );
50 | }),
51 | ),
52 | );
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/lib/demo/widgets/textAndImage/TextDemo.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | void main() {
4 | runApp(new MaterialApp(home:new MyApp(),theme:
5 | new ThemeData(primaryColor: Colors.red, ),
6 | ));
7 | }
8 |
9 | class MyApp extends StatelessWidget {
10 | @override
11 | Widget build(BuildContext context) {
12 | return new Scaffold(appBar:
13 | new AppBar(title: new Text("Hello Flutter")),
14 | floatingActionButton: new FloatingActionButton(
15 | onPressed: null,
16 | backgroundColor: Colors.blueAccent,
17 | child: new Text("点我",style: new TextStyle(color: Colors.white),)
18 | ),
19 | endDrawer: new Drawer(child: new Center(child: new Text("我是菜单"),),),
20 | body: new Center(
21 | child: new Text("Hello Flutter")
22 | )
23 | );
24 | }
25 | }
26 | //
27 | //const Text(this.data//内容, {
28 | //Key key,
29 | //this.style//样式
30 | //this.textAlign//对齐方式,
31 | //this.textDirection//文本方向,
32 | //this.softWrap//是否换行显示,
33 | //this.overflow//超出文本的处理方式,
34 | //this.textScaleFactor//每个逻辑像素的字体像素数,控制字体大小,
35 | //this.maxLines//最大行数,
36 | //})
37 | //当然,每次非必填参数基本都有一个默认值,具体默认值是什么大家可以点击进去源码看下哦。
38 | //
39 | //Text构造方法需要传入一个必须的参数data,也就是String类型的内容。
40 | //
41 | //style需要传入需要传入一个TextStyle对象,决定Text的颜色、字体、字体大小、行间距、字体样式等。
42 | //
43 | //TextStyle的构造方法如下:
44 | //
45 | //const TextStyle({
46 | //this.inherit: true,
47 | //this.color//颜色,
48 | //this.fontSize//大小,默认10像素,
49 | //this.fontWeight,
50 | //this.fontStyle,
51 | //this.letterSpacing//字间距,
52 | //this.wordSpacing//字符间距,
53 | //this.textBaseline,
54 | //this.height,
55 | //this.decoration,
56 | //this.decorationColor,
57 | //this.decorationStyle,
58 | //this.debugLabel,
59 | //String fontFamily//字体,
60 | //String package,
61 | //})
62 | //textAlign文本的对齐方式,【left:左对齐】、【right:右对齐】、【center:居中对齐】、【justify:自适应】、【start:文本开头,和textDirection有关】、【end:文本结尾,,和textDirection有关】
63 | //
64 | //textDirection文本方向,【rtl:right to left 从右向左】、【ltr:left to right 从左向右】
65 | //
66 | //overflow超出屏幕,是否换行显示 bool,传入true则换行,传入false这不换行
67 | //
68 | //textScaleFactor传入double值,值越大字体大小越大,默认为1.0
69 | //
70 | //maxLines最大显示行数
--------------------------------------------------------------------------------
/.idea/libraries/Dart_SDK.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/lib/pages/simpleWidget/navigator/StaticNavigatorPage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class StaticNavigatorPage extends StatelessWidget {
4 | @override
5 | Widget build(BuildContext context) {
6 | return new Scaffold(
7 | appBar: new AppBar(
8 | title: new Text("静态路由页"),
9 | ),
10 | floatingActionButton: new FloatingActionButton(
11 | tooltip: "长按时显示的提示语",
12 | shape: CircleBorder(),
13 | backgroundColor: Colors.blue,
14 | foregroundColor: Colors.white,
15 | // mini: 默认 false,默认按钮为 56 * 56,当mini 为 true 时,默认大小为 40 * 40,边框padding 各为 4,所以布局大小为 48 * 48
16 | mini: false,
17 | onPressed: () {
18 | Navigator.of(context).pop();
19 | },
20 | child: new Text("返回"),
21 | ),
22 | body: new Center(
23 | child: Text("静态路由可以传入一个routes参数来定义路由。但是这里定义的路由是静态的,"
24 | "它不可以向下一个页面传递参数,利用push到一个新页面,pushNamed方法是有一个Future的返回值的"
25 | ",所以静态路由也是可以接收下一个页面的返回值的。但是不能向下一个页面传递参数"),
26 | ),
27 | );
28 | }
29 | }
30 |
31 | //floatingActionButton 属性说明
32 |
33 | // tooltip:长按时显示的提示语
34 | // foregroundColor:Icon 与 Text 颜色
35 | // backgroundColor:背景色
36 | // focusColor:聚焦色
37 | // hoverColor:悬浮色
38 | // splashColor:点击时的颜色
39 | // heroTag:标记
40 | // elevation:阴影高度
41 | // focusElevation:聚焦时阴影高度
42 | // hoverElevation:悬浮时阴影高度
43 | // highlightElevation:高亮时阴影高度
44 | // disabledElevation:不可用时阴影高度
45 | // onPressed:点击事件
46 | // mouseCursor:鼠标悬停
47 | // mini: 默认 false,默认按钮为 56 * 56,当mini 为 true 时,默认大小为 40 * 40,边框padding 各为 4,所以布局大小为 48 * 48
48 | // shape:自定义形状 BeveledRectangleBorder矩形,Border边框颜色和厚度,CircleBorder圆形,ContinuousRectangleBorder连续圆角,StadiumBorder 体育场边界 ,药丸形状,OutlineInputBorder外边框可以定制圆角
49 | // clipBehavior:边缘裁剪方式,默认为 Clip.none
50 | // focusNode:焦点节点,例如监听 focusNode 可以实现输入框的开始、结束输入
51 | // autofocus:自动聚焦,默认为 false
52 | // materialTapTargetSize:点击区域大小,MaterialTapTargetSize.padded时最小点击区域为48*48,MaterialTapTargetSize.shrinkWrap 时为子组件的实际大小。
53 | // isExtended:默认为 false,当使用 extended 方法时为 true
54 | // extended.icon:设置 Icon(该属性为扩展属性)
55 | // extended.label:设置 label(@requirded,该属性为扩展属性)
56 | // child:子控件,通常为 Icon
57 |
--------------------------------------------------------------------------------
/lib/pages/simpleWidget/layout/StackLayoutPage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class StackLayoutPage extends StatelessWidget {
4 | @override
5 | Widget build(BuildContext context) {
6 | return new Scaffold(
7 | appBar: new AppBar(
8 | title: new Text('层叠布局'),
9 | ),
10 | body: Column(
11 | children: [
12 | new Text(
13 | "Stack即层叠布局,跟原生Android里面的FrameLayout如出一辙,能够将子widget层叠排列。"
14 | "如果不指定显示位置,默认布局在左上角,如果希望子空间显示在具体的位置,"
15 | "我们可以通过Positioned控件包裹子widget,然后根据定位的子控件的top、right、bottom、left属性来将它们放置在Stack的合适位置上",
16 | style: new TextStyle(
17 | fontSize: 18.0,
18 | ),
19 | textAlign: TextAlign.center,
20 | ),
21 | new Center(
22 | child: new Stack(
23 | children: [
24 | new Image.network(
25 | 'https://avatar.csdn.net/6/0/6/1_xieluoxixi.jpg',
26 | scale: 0.5,
27 | ),
28 | new Positioned(
29 | left: 35.0,
30 | right: 35.0,
31 | top: 45.0,
32 | child: new Text(
33 | '第二层内容区域',
34 | style: new TextStyle(
35 | fontSize: 20.0,
36 | fontFamily: 'serif',
37 | ),
38 | )),
39 | new Positioned(
40 | left: 55.0,
41 | right: 55.0,
42 | top: 55.0,
43 | child: new Text(
44 | '第三层 this is the third child',
45 | style: new TextStyle(
46 | fontSize: 20.0,
47 | color: Colors.blue,
48 | fontFamily: 'serif',
49 | ),
50 | ))
51 | ],
52 | ),
53 | )
54 | ],
55 | ));
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/plugin/flutter_calc_plugin/example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply plugin: 'kotlin-android'
26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27 |
28 | android {
29 | compileSdkVersion 30
30 |
31 | sourceSets {
32 | main.java.srcDirs += 'src/main/kotlin'
33 | }
34 |
35 | kotlinOptions {
36 | jvmTarget = '1.8'
37 | }
38 |
39 | lintOptions {
40 | disable 'InvalidPackage'
41 | }
42 |
43 | defaultConfig {
44 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
45 | applicationId "com.example.flutter_calc_plugin_example"
46 | minSdkVersion 16
47 | targetSdkVersion 30
48 | versionCode flutterVersionCode.toInteger()
49 | versionName flutterVersionName
50 | }
51 |
52 | buildTypes {
53 | release {
54 | // TODO: Add your own signing config for the release build.
55 | // Signing with the debug keys for now, so `flutter run --release` works.
56 | signingConfig signingConfigs.debug
57 | }
58 | }
59 | }
60 |
61 | flutter {
62 | source '../..'
63 | }
64 |
65 | dependencies {
66 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
67 | }
68 |
--------------------------------------------------------------------------------