├── .gitignore ├── .metadata ├── README.md ├── android ├── .gitignore ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── studyyoun │ │ │ │ └── flutterbook │ │ │ │ └── flutter_test_app │ │ │ │ └── MainActivity.java │ │ └── res │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties └── settings.gradle ├── assets ├── animation │ └── button-animation.flr ├── fonts │ ├── AfternooninStereo.ttf │ ├── CircularAir-Light.ttf │ ├── CircularStd-Bold.ttf │ ├── CircularStd-Medium.ttf │ ├── OpenSans-Bold.ttf │ ├── OpenSans-ExtraBold.ttf │ ├── OpenSans-Light.ttf │ ├── OpenSans-Regular.ttf │ ├── OpenSans.ttf │ ├── TikTokIcons.ttf │ └── cm_sans_serif_2012.ttf ├── images │ ├── Bitmap.png │ ├── Item_1.png │ ├── Item_2.png │ ├── Item_3.png │ ├── app_icon.png │ ├── audio_waveform.png │ ├── back.svg │ ├── banner1.webp │ ├── banner2.webp │ ├── banner3.webp │ ├── banner4.webp │ ├── banner5.jpeg │ ├── banner6.jpeg │ ├── bg.png │ ├── bg_kyzg_login2.png │ ├── bg_snow.png │ ├── book-1.png │ ├── book-2.png │ ├── book-3.png │ ├── cart_with_item.svg │ ├── chat.svg │ ├── main_page_bg.png │ ├── man.png │ ├── maomi1.jpg │ ├── maomi2.jpg │ ├── maomi3.jpg │ ├── mastercardlogo.png │ ├── notification.svg │ ├── one.png │ ├── password.png │ ├── qq.png │ ├── search.svg │ ├── shopping-bag.svg │ ├── tianyi.png │ ├── welcome_bg.jpeg │ ├── woman.png │ ├── wx.png │ └── xingkong.png └── logos │ ├── facebook.jpg │ └── google.jpg ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Podfile ├── Podfile.lock ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings └── Runner │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-App-1024x1024@1x.png │ │ ├── Icon-App-20x20@1x.png │ │ ├── Icon-App-20x20@2x.png │ │ ├── Icon-App-20x20@3x.png │ │ ├── Icon-App-29x29@1x.png │ │ ├── Icon-App-29x29@2x.png │ │ ├── Icon-App-29x29@3x.png │ │ ├── Icon-App-40x40@1x.png │ │ ├── Icon-App-40x40@2x.png │ │ ├── Icon-App-40x40@3x.png │ │ ├── Icon-App-60x60@2x.png │ │ ├── Icon-App-60x60@3x.png │ │ ├── Icon-App-76x76@1x.png │ │ ├── Icon-App-76x76@2x.png │ │ └── Icon-App-83.5x83.5@2x.png │ └── LaunchImage.imageset │ │ ├── Contents.json │ │ ├── LaunchImage.png │ │ ├── LaunchImage@2x.png │ │ ├── LaunchImage@3x.png │ │ └── README.md │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── main.m ├── lib ├── animation │ ├── example_clip_path_wave_login.dart │ ├── example_number_PageTransitionSwitcher.dart │ ├── example_number_PageTransitionSwitcher2.dart │ ├── example_pie2_animagtion_page.dart │ ├── example_pie_animagtion_page.dart │ ├── flash │ │ ├── child │ │ │ └── list_placeholder.dart │ │ ├── flash_animation_controller.dart │ │ ├── flash_animation_widget.dart │ │ └── gradient │ │ │ └── default_linear_gradient.dart │ ├── test.dart │ ├── test2.dart │ ├── test__animation.dart │ └── test_rect_path_animation.dart ├── async │ ├── main_async.dart │ ├── test_AB_page.dart │ ├── test_f_page.dart │ ├── test_progress_time_and_flash_page.dart │ ├── test_progress_time_page.dart │ ├── test_sing_stream_page.dart │ ├── test_stream_builder2_page.dart │ ├── test_stream_builder_page.dart │ ├── test_stream_page.dart │ ├── test_user_notifier_page.dart │ ├── test_value_notifier_page.dart │ └── test_widget.dart ├── bloc │ ├── demo1 │ │ ├── bloc_time.dart │ │ ├── main_bloc.dart │ │ └── test_bloc_time_page.dart │ └── demo2 │ │ ├── bloc_number.dart │ │ ├── main_mul_bloc.dart │ │ └── test_mul_bloc_time_page.dart ├── canvas │ ├── Spinner.dart │ ├── art.dart │ ├── cpi_audio_waveform.dart │ ├── examle_snow_page.dart │ ├── flutter_bnb_v2 │ │ └── lib │ │ │ └── main.dart │ ├── image │ │ ├── main.dart │ │ ├── my-canvas.dart │ │ └── my-painter.dart │ ├── percentage_indicator_sm.dart │ ├── rain │ │ ├── main.dart │ │ ├── my_rain_canvas.dart │ │ ├── my_weather_canvas.dart │ │ ├── particle.dart │ │ ├── rain_widget.dart │ │ └── weather_widget.dart │ ├── test.dart │ ├── testWidget2.dart │ ├── test_BluePainter.dart │ ├── test_bubble_login_page.dart │ ├── test_page.dart │ └── tiltable_stack.dart ├── clip │ ├── clip_main.dart │ ├── test_clip_oval_page.dart │ └── test_clip_react_page.dart ├── customDrawer │ ├── CustomDrawer.dart │ ├── FirstLayer.dart │ ├── HomePage.dart │ ├── SecondLayer.dart │ ├── ThirdLayer.dart │ └── main.dart ├── custom_tabbar.dart ├── hero │ ├── test_hero_page.dart │ ├── test_hero_show_imgpage.dart │ └── test_widget.dart ├── icon │ ├── round_corner_icon.dart │ └── test_round_icon_page.dart ├── key │ └── test_key.dart ├── listview │ └── test_list_part_page.dart ├── logindemo │ ├── login_demo1.dart │ ├── main.dart │ ├── screens │ │ └── login_screen.dart │ └── utilities │ │ └── constants.dart ├── main.dart ├── net │ └── http │ │ ├── DioUtils.dart │ │ └── test_http_page.dart ├── path │ └── demo1 │ │ └── dash_board_page.dart ├── progress │ ├── test_CircularProgressIndicator_page.dart │ ├── test_CupertinoActivityIndicator_page.dart │ ├── test_CupertinoSliverIndicator_page.dart │ ├── test_LinearProgressIndicator_page.dart │ ├── test_RefreshIndicator_page.dart │ └── test_SmartRefresher1_page.dart ├── provider │ ├── demo1 │ │ ├── main_provider.dart │ │ ├── test_provider_consumer_time_page.dart │ │ ├── test_provider_time_page.dart │ │ └── time_model.dart │ └── demo2 │ │ ├── number_model.dart │ │ └── test_provider_abc_page.dart ├── scroll │ ├── customscroll_demo2_page.dart │ ├── customscroll_demo_page.dart │ ├── customscroll_home_page.dart │ ├── example_507_NestScrollView.dart │ ├── main_scroll.dart │ ├── netscroll_home_page.dart │ └── scroll_home_page.dart ├── shake │ ├── test_shak_bottom_middle_button_page.dart │ └── test_shak_right_float_button_page.dart ├── slid_banner_page.dart ├── test_A_B_page.dart ├── test_OpenContainer_GridView_page.dart ├── test_OpenContainer_page.dart ├── test_bottom_nvigationbar.dart ├── test_button_page.dart ├── test_clock_app.dart ├── test_common_login_page.dart ├── test_comon_login_page.dart ├── test_custom_button.dart ├── test_custom_camera_widget.dart ├── test_drag_and_drop_gridview_widget.dart ├── test_float_hero_page.dart ├── test_html2_widget.dart ├── test_html_widget.dart ├── test_login_page.dart ├── test_orientation_widget.dart ├── test_progress_home_page.dart ├── test_right_float_button_page.dart ├── test_shake_login_page.dart ├── test_slid_banner_page.dart ├── test_slider_home_page.dart ├── test_splash_widget.dart ├── test_tabbar_home_page.dart ├── test_warrp_widget.dart ├── test_webview_widget.dart ├── test_widget_live_widget.dart ├── text_animations_showModal_page.dart ├── text_bottom_dialog_page.dart ├── text_goods_details_page.dart ├── tk │ ├── demo1 │ │ ├── constants.dart │ │ ├── data.dart │ │ ├── detail_page.dart │ │ ├── home_page.dart │ │ └── main.dart │ ├── demo2 │ │ ├── flare_demo.dart │ │ ├── main.dart │ │ └── smart_flare_animation.dart │ ├── demo3 │ │ ├── components │ │ │ └── search_box.dart │ │ ├── constants.dart │ │ ├── main.dart │ │ ├── models │ │ │ └── product.dart │ │ └── screens │ │ │ ├── details │ │ │ ├── components │ │ │ │ ├── body.dart │ │ │ │ ├── chat_and_add_to_cart.dart │ │ │ │ ├── color_dots.dart │ │ │ │ ├── list_of_colors.dart │ │ │ │ └── product_image.dart │ │ │ └── details_screen.dart │ │ │ └── product │ │ │ ├── components │ │ │ ├── body.dart │ │ │ ├── category_list.dart │ │ │ └── product_card.dart │ │ │ └── products_screen.dart │ ├── demo4 │ │ ├── main.dart │ │ ├── style.dart │ │ └── widgets │ │ │ └── iconbutton.dart │ ├── demo5 │ │ ├── consttants.dart │ │ ├── main.dart │ │ ├── screens │ │ │ ├── details_screen.dart │ │ │ ├── home_screen.dart │ │ │ └── notes_screen.dart │ │ └── widgets │ │ │ ├── book_rating.dart │ │ │ ├── reading_card_list.dart │ │ │ ├── rounded_button.dart │ │ │ └── two_side_rounded_button.dart │ ├── demo6 │ │ ├── cardwidget.dart │ │ ├── components │ │ │ ├── appbar.dart │ │ │ ├── arrowbutton.dart │ │ │ └── card.dart │ │ ├── config │ │ │ ├── colors.dart │ │ │ ├── size.dart │ │ │ └── strings.dart │ │ ├── dashboard.dart │ │ ├── expenseswidget.dart │ │ ├── main.dart │ │ └── piechart │ │ │ ├── piechart.dart │ │ │ └── piechartcustompainter.dart │ └── demo7 │ │ ├── Animations │ │ └── FadeAnimation.dart │ │ ├── LoginPage.dart │ │ └── main.dart └── utils │ └── DateUtils.dart ├── pubimages └── flutter_inspector.gif ├── pubspec.lock ├── pubspec.yaml └── test └── widget_test.dart /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Exceptions to above rules. 44 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 45 | -------------------------------------------------------------------------------- /.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: 84c84fb24914e098667649be04614f6ea19d689c 8 | channel: dev 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # flutter_test_app 2 | 3 | 4 | [Flutter CustomScrollView实现的一个经典滑动折叠头部图片的效果](https://github.com/zhaolongs/flutter_demo_app/blob/master/lib/scroll/customscroll_demo_page.dart) 5 | 6 | [Flutter NestedScrollView实现的一个经典滑动折叠头部图片的效果](https://github.com/zhaolongs/flutter_demo_app/blob/master/lib/scroll/netscroll_home_page.dart) 7 | 8 | 9 | *** 10 | 11 | * 仿今日头条底部的一个登录弹框 12 | 13 | [源码在这里](https://github.com/zhaolongs/flutter_demo_app/blob/master/lib/text_bottom_dialog_page.dart) 14 | 15 | [知乎视频在这里](https://www.zhihu.com/zvideo/1306194115948789760) 16 | 17 | [头条/西瓜视频在这里](https://www.ixigua.com/6889993164409700876/) 18 | 19 | [B站](https://www.bilibili.com/video/BV1TT4y1c7Bu/) 20 | 21 | 22 | * 向上弹出的一个动画菜单 23 | 24 | [源码在这里](https://github.com/zhaolongs/flutter_demo_app/blob/master/lib/test_right_float_button_page.dart) 25 | 26 | [知乎视频在这里](https://www.zhihu.com/zvideo/1308724791466467328) 27 | 28 | [头条/西瓜视频在这里](https://www.ixigua.com/6892581580443746823/) 29 | 30 | [B站](https://www.bilibili.com/video/BV1Dt4y1e7Va/) 31 | 32 | 33 | * Flutter 一个优美的用户体验的登录页面 抖动提示 文本提示 34 | 35 | 36 | [源码在这里](https://github.com/zhaolongs/flutter_demo_app/blob/master/lib/test_shake_login_page.dart) 37 | 38 | [知乎视频在这里](https://www.zhihu.com/zvideo/1308873518554267648) 39 | 40 | [头条/西瓜视频在这里](https://www.ixigua.com/6892732997343281675/) 41 | 42 | [B站](https://www.bilibili.com/video/BV1my4y1z75r/) 43 | 44 | 45 | * Flutter Path动画 让你的画布动起来 造就高级动画 46 | 47 | [源码在这里](https://github.com/zhaolongs/flutter_demo_app/blob/master/lib/animation/test_rect_path_animation.dart) 48 | 49 | [知乎视频在这里](https://www.zhihu.com/zvideo/1311742576261955584) 50 | 51 | [头条/西瓜视频在这里](https://www.ixigua.com/6895672096479773188/) 52 | 53 | [B站](https://www.bilibili.com/video/BV1s5411V7ge/) 54 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 26 | 27 | android { 28 | compileSdkVersion 28 29 | 30 | lintOptions { 31 | disable 'InvalidPackage' 32 | } 33 | 34 | defaultConfig { 35 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 36 | applicationId "com.studyyoun.flutterbook.flutter_test_app" 37 | minSdkVersion 16 38 | targetSdkVersion 28 39 | versionCode flutterVersionCode.toInteger() 40 | versionName flutterVersionName 41 | } 42 | 43 | buildTypes { 44 | release { 45 | // TODO: Add your own signing config for the release build. 46 | // Signing with the debug keys for now, so `flutter run --release` works. 47 | signingConfig signingConfigs.debug 48 | } 49 | } 50 | } 51 | 52 | flutter { 53 | source '../..' 54 | } 55 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 12 | 19 | 23 | 27 | 32 | 36 | 37 | 38 | 39 | 40 | 41 | 43 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/studyyoun/flutterbook/flutter_test_app/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.studyyoun.flutterbook.flutter_test_app; 2 | 3 | import android.os.Bundle; 4 | import android.os.PersistableBundle; 5 | 6 | import androidx.annotation.Nullable; 7 | 8 | import io.flutter.embedding.android.FlutterActivity; 9 | 10 | public class MainActivity extends FlutterActivity { 11 | 12 | @Override 13 | protected void onCreate(@Nullable Bundle savedInstanceState) { 14 | super.onCreate(savedInstanceState); 15 | 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.5.0' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | google() 15 | jcenter() 16 | } 17 | } 18 | 19 | rootProject.buildDir = '../build' 20 | subprojects { 21 | project.buildDir = "${rootProject.buildDir}/${project.name}" 22 | } 23 | subprojects { 24 | project.evaluationDependsOn(':app') 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | include ':app' 6 | 7 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 8 | def properties = new Properties() 9 | 10 | assert localPropertiesFile.exists() 11 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 12 | 13 | def flutterSdkPath = properties.getProperty("flutter.sdk") 14 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 15 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 16 | -------------------------------------------------------------------------------- /assets/fonts/AfternooninStereo.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/fonts/AfternooninStereo.ttf -------------------------------------------------------------------------------- /assets/fonts/CircularAir-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/fonts/CircularAir-Light.ttf -------------------------------------------------------------------------------- /assets/fonts/CircularStd-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/fonts/CircularStd-Bold.ttf -------------------------------------------------------------------------------- /assets/fonts/CircularStd-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/fonts/CircularStd-Medium.ttf -------------------------------------------------------------------------------- /assets/fonts/OpenSans-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/fonts/OpenSans-Bold.ttf -------------------------------------------------------------------------------- /assets/fonts/OpenSans-ExtraBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/fonts/OpenSans-ExtraBold.ttf -------------------------------------------------------------------------------- /assets/fonts/OpenSans-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/fonts/OpenSans-Light.ttf -------------------------------------------------------------------------------- /assets/fonts/OpenSans-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/fonts/OpenSans-Regular.ttf -------------------------------------------------------------------------------- /assets/fonts/OpenSans.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/fonts/OpenSans.ttf -------------------------------------------------------------------------------- /assets/fonts/TikTokIcons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/fonts/TikTokIcons.ttf -------------------------------------------------------------------------------- /assets/fonts/cm_sans_serif_2012.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/fonts/cm_sans_serif_2012.ttf -------------------------------------------------------------------------------- /assets/images/Bitmap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/Bitmap.png -------------------------------------------------------------------------------- /assets/images/Item_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/Item_1.png -------------------------------------------------------------------------------- /assets/images/Item_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/Item_2.png -------------------------------------------------------------------------------- /assets/images/Item_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/Item_3.png -------------------------------------------------------------------------------- /assets/images/app_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/app_icon.png -------------------------------------------------------------------------------- /assets/images/audio_waveform.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/audio_waveform.png -------------------------------------------------------------------------------- /assets/images/back.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /assets/images/banner1.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/banner1.webp -------------------------------------------------------------------------------- /assets/images/banner2.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/banner2.webp -------------------------------------------------------------------------------- /assets/images/banner3.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/banner3.webp -------------------------------------------------------------------------------- /assets/images/banner4.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/banner4.webp -------------------------------------------------------------------------------- /assets/images/banner5.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/banner5.jpeg -------------------------------------------------------------------------------- /assets/images/banner6.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/banner6.jpeg -------------------------------------------------------------------------------- /assets/images/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/bg.png -------------------------------------------------------------------------------- /assets/images/bg_kyzg_login2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/bg_kyzg_login2.png -------------------------------------------------------------------------------- /assets/images/bg_snow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/bg_snow.png -------------------------------------------------------------------------------- /assets/images/book-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/book-1.png -------------------------------------------------------------------------------- /assets/images/book-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/book-2.png -------------------------------------------------------------------------------- /assets/images/book-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/book-3.png -------------------------------------------------------------------------------- /assets/images/cart_with_item.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /assets/images/chat.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /assets/images/main_page_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/main_page_bg.png -------------------------------------------------------------------------------- /assets/images/man.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/man.png -------------------------------------------------------------------------------- /assets/images/maomi1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/maomi1.jpg -------------------------------------------------------------------------------- /assets/images/maomi2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/maomi2.jpg -------------------------------------------------------------------------------- /assets/images/maomi3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/maomi3.jpg -------------------------------------------------------------------------------- /assets/images/mastercardlogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/mastercardlogo.png -------------------------------------------------------------------------------- /assets/images/notification.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /assets/images/one.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/one.png -------------------------------------------------------------------------------- /assets/images/password.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/password.png -------------------------------------------------------------------------------- /assets/images/qq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/qq.png -------------------------------------------------------------------------------- /assets/images/search.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /assets/images/shopping-bag.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /assets/images/tianyi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/tianyi.png -------------------------------------------------------------------------------- /assets/images/welcome_bg.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/welcome_bg.jpeg -------------------------------------------------------------------------------- /assets/images/woman.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/woman.png -------------------------------------------------------------------------------- /assets/images/wx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/wx.png -------------------------------------------------------------------------------- /assets/images/xingkong.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/images/xingkong.png -------------------------------------------------------------------------------- /assets/logos/facebook.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/logos/facebook.jpg -------------------------------------------------------------------------------- /assets/logos/google.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/assets/logos/google.jpg -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Flutter (1.0.0) 3 | - flutter_custom_camera_pugin (0.0.1): 4 | - Flutter 5 | - flutter_fai_webview (0.0.1): 6 | - Flutter 7 | - flutter_html_text_plugin (0.0.1): 8 | - Flutter 9 | - FMDB (2.7.5): 10 | - FMDB/standard (= 2.7.5) 11 | - FMDB/standard (2.7.5) 12 | - path_provider (0.0.1): 13 | - Flutter 14 | - path_provider_linux (0.0.1): 15 | - Flutter 16 | - path_provider_macos (0.0.1): 17 | - Flutter 18 | - path_provider_windows (0.0.1): 19 | - Flutter 20 | - sqflite (0.0.2): 21 | - Flutter 22 | - FMDB (>= 2.7.5) 23 | 24 | DEPENDENCIES: 25 | - Flutter (from `Flutter`) 26 | - flutter_custom_camera_pugin (from `.symlinks/plugins/flutter_custom_camera_pugin/ios`) 27 | - flutter_fai_webview (from `.symlinks/plugins/flutter_fai_webview/ios`) 28 | - flutter_html_text_plugin (from `.symlinks/plugins/flutter_html_text_plugin/ios`) 29 | - path_provider (from `.symlinks/plugins/path_provider/ios`) 30 | - path_provider_linux (from `.symlinks/plugins/path_provider_linux/ios`) 31 | - path_provider_macos (from `.symlinks/plugins/path_provider_macos/ios`) 32 | - path_provider_windows (from `.symlinks/plugins/path_provider_windows/ios`) 33 | - sqflite (from `.symlinks/plugins/sqflite/ios`) 34 | 35 | SPEC REPOS: 36 | trunk: 37 | - FMDB 38 | 39 | EXTERNAL SOURCES: 40 | Flutter: 41 | :path: Flutter 42 | flutter_custom_camera_pugin: 43 | :path: ".symlinks/plugins/flutter_custom_camera_pugin/ios" 44 | flutter_fai_webview: 45 | :path: ".symlinks/plugins/flutter_fai_webview/ios" 46 | flutter_html_text_plugin: 47 | :path: ".symlinks/plugins/flutter_html_text_plugin/ios" 48 | path_provider: 49 | :path: ".symlinks/plugins/path_provider/ios" 50 | path_provider_linux: 51 | :path: ".symlinks/plugins/path_provider_linux/ios" 52 | path_provider_macos: 53 | :path: ".symlinks/plugins/path_provider_macos/ios" 54 | path_provider_windows: 55 | :path: ".symlinks/plugins/path_provider_windows/ios" 56 | sqflite: 57 | :path: ".symlinks/plugins/sqflite/ios" 58 | 59 | SPEC CHECKSUMS: 60 | Flutter: 0e3d915762c693b495b44d77113d4970485de6ec 61 | flutter_custom_camera_pugin: 7566d6050ecc4e2b01ef892a0b1a36ee7a2da5d7 62 | flutter_fai_webview: 7ecaa35047fd557c12e86a698e05fba18f5b25eb 63 | flutter_html_text_plugin: 17905cfddc60b031f1070418983bb3338c750304 64 | FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a 65 | path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c 66 | path_provider_linux: 4d630dc393e1f20364f3e3b4a2ff41d9674a84e4 67 | path_provider_macos: f760a3c5b04357c380e2fddb6f9db6f3015897e0 68 | path_provider_windows: a2b81600c677ac1959367280991971cb9a1edb3b 69 | sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 70 | 71 | PODFILE CHECKSUM: 61f4c6fa41de8ddcb6ae400bc4a781688f4c5f96 72 | 73 | COCOAPODS: 1.9.3 74 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : FlutterAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | #import "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 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/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/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/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/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/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/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/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/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/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/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/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/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/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/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/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/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/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/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/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/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/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/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/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/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | flutter_test_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 | -------------------------------------------------------------------------------- /ios/Runner/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char* argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /lib/animation/flash/child/list_placeholder.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | /// 创建人: Created by zhaolong 5 | /// 创建时间:Created by on 2020/7/14. 6 | /// 7 | /// 可关注公众号:我的大前端生涯 获取最新技术分享 8 | /// 可关注网易云课堂:https://study.163.com/instructor/1021406098.htm 9 | /// 可关注博客:https://blog.csdn.net/zl18603543572 10 | class ListPlacholderWidget extends StatefulWidget { 11 | @override 12 | _TestPageState createState() => _TestPageState(); 13 | } 14 | 15 | //lib/code/main_data.dart 16 | class _TestPageState extends State { 17 | @override 18 | Widget build(BuildContext context) { 19 | return ListView.builder( 20 | physics: NeverScrollableScrollPhysics(), 21 | itemBuilder: (BuildContext context, int index) { 22 | return buildItemWidget(); 23 | }, 24 | ); 25 | } 26 | 27 | Widget buildItemWidget() { 28 | return Padding( 29 | padding: const EdgeInsets.only(bottom: 8.0), 30 | child: Row( 31 | crossAxisAlignment: CrossAxisAlignment.start, 32 | children: [ 33 | Container( 34 | width: 48.0, 35 | height: 48.0, 36 | color: Colors.white, 37 | ), 38 | const Padding( 39 | padding: EdgeInsets.symmetric(horizontal: 8.0), 40 | ), 41 | Expanded( 42 | child: Column( 43 | crossAxisAlignment: CrossAxisAlignment.start, 44 | children: [ 45 | Container( 46 | width: double.infinity, 47 | height: 8.0, 48 | color: Colors.white, 49 | ), 50 | const Padding( 51 | padding: EdgeInsets.symmetric(vertical: 2.0), 52 | ), 53 | Container( 54 | width: double.infinity, 55 | height: 8.0, 56 | color: Colors.white, 57 | ), 58 | const Padding( 59 | padding: EdgeInsets.symmetric(vertical: 2.0), 60 | ), 61 | Container( 62 | width: 40.0, 63 | height: 8.0, 64 | color: Colors.white, 65 | ), 66 | ], 67 | ), 68 | ) 69 | ], 70 | ), 71 | ); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /lib/animation/flash/flash_animation_controller.dart: -------------------------------------------------------------------------------- 1 | 2 | 3 | /** 4 | * 创建人: Created by zhaolong 5 | * 创建时间:Created by on 2020/7/19. 6 | * 7 | * 可关注公众号:我的大前端生涯 获取最新技术分享 8 | * 可关注网易云课堂:https://study.163.com/instructor/1021406098.htm 9 | * 可关注博客:https://blog.csdn.net/zl18603543572 10 | */ 11 | 12 | ///lib/demo/flash/flash_animation_controller.dart 13 | /// 14 | ///监听 15 | typedef FlashAnimationListener = void Function(bool value); 16 | 17 | ///控制器 18 | class FlashAnimationController { 19 | FlashAnimationListener _flashAnimationListener; 20 | ///开启动画 21 | void start() { 22 | if (_flashAnimationListener != null) { 23 | _flashAnimationListener(true); 24 | } 25 | } 26 | ///关闭动画 27 | void stop() { 28 | if (_flashAnimationListener != null) { 29 | _flashAnimationListener(false); 30 | } 31 | } 32 | ///绑定监听 33 | void setListener(FlashAnimationListener listener){ 34 | _flashAnimationListener = listener; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/animation/flash/gradient/default_linear_gradient.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | /** 5 | * 创建人: Created by zhaolong 6 | * 创建时间:Created by on 2020/7/19. 7 | * 8 | * 可关注公众号:我的大前端生涯 获取最新技术分享 9 | * 可关注网易云课堂:https://study.163.com/instructor/1021406098.htm 10 | * 可关注博客:https://blog.csdn.net/zl18603543572 11 | */ 12 | 13 | ///lib/demo/flash/gradient/default_linear_gradient.dart 14 | ///默认的线性渐变 15 | class DefaultLinearGradient extends LinearGradient { 16 | DefaultLinearGradient({ 17 | ///高亮颜色 18 | @required Color normalColor, 19 | ///高亮颜色 20 | @required Color highlightColor, 21 | }) : super( 22 | ///开始位置为左上角 23 | begin: Alignment.topLeft, 24 | ///结束的位置为右中间 25 | end: Alignment.centerRight, 26 | ///过渡的颜色组 27 | colors: [ 28 | normalColor, 29 | normalColor, 30 | highlightColor, 31 | normalColor, 32 | normalColor 33 | ], 34 | ///取范围为0.0到1.0 数值表示梯度方向上的分割比例 35 | ///如果stops是空的,那么stops里面默认存放一组均匀分布的点,并且第一个点是0.0,最后一个点是1.0。 36 | ///stops值列表中的数据必须是升序。如果stops值列表有一个数据小于前一个数据值,那么这个数据会被默认等于前面的数据值 37 | ///如果Stops不为空,那么它必须与colors中颜色个数保持一致,否则运行异常 38 | ///如果第一个数值不为0,此时会默认一个stop位置0.0,颜色和colors中第一个颜色相同。 39 | ///如果最后一个数值不为1.0,此时会默认一个stop位置1.0,颜色和colors中最后一个颜色相同 40 | stops: const [0.0, 0.35, 0.5, 0.65, 1.0], 41 | ); 42 | } 43 | -------------------------------------------------------------------------------- /lib/animation/test__animation.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:animations/animations.dart'; 4 | import 'package:flutter/cupertino.dart'; 5 | import 'package:flutter/gestures.dart'; 6 | import 'package:flutter/material.dart'; 7 | 8 | /// 创建人: Created by zhaolong 9 | /// 创建时间:Created by on 2020/10/31. 10 | /// 11 | /// 可关注公众号:我的大前端生涯 获取最新技术分享 12 | /// 可关注网易云课堂:https://study.163.com/instructor/1021406098.htm 13 | /// 可关注博客:https://blog.csdn.net/zl18603543572 14 | /// 15 | /// 代码清单 16 | 17 | void main() { 18 | runApp(MaterialApp( 19 | home: RootPage(), 20 | )); 21 | } 22 | 23 | 24 | class RootPage extends StatefulWidget { 25 | @override 26 | _TestingFadeThroughState createState() => _TestingFadeThroughState(); 27 | } 28 | 29 | class _TestingFadeThroughState extends State { 30 | int pageIndex = 0; 31 | List pageList = [ 32 | Container(key: UniqueKey(), color: Colors.red), 33 | Container(key: UniqueKey(), color: Colors.blue), 34 | Container(key: UniqueKey(), color: Colors.green) 35 | ]; 36 | 37 | @override 38 | Widget build(BuildContext context) { 39 | return Scaffold( 40 | appBar: AppBar(title: const Text('Testing Fade Through')), 41 | body: PageTransitionSwitcher( 42 | transitionBuilder: (Widget child, Animation animation, 43 | Animation secondaryAnimation) { 44 | return FadeThroughTransition( 45 | animation: animation, 46 | secondaryAnimation: secondaryAnimation, 47 | child: child, 48 | ); 49 | }, 50 | child: pageList[pageIndex], 51 | ), 52 | bottomNavigationBar: BottomNavigationBar( 53 | currentIndex: pageIndex, 54 | onTap: (int newValue) { 55 | setState(() { 56 | pageIndex = newValue; 57 | }); 58 | }, 59 | items: const [ 60 | BottomNavigationBarItem( 61 | icon: Icon(Icons.looks_one), 62 | title: Text('First Page'), 63 | ), 64 | BottomNavigationBarItem( 65 | icon: Icon(Icons.looks_two), 66 | title: Text('Second Page'), 67 | ), 68 | BottomNavigationBarItem( 69 | icon: Icon(Icons.looks_3), 70 | title: Text('Third Page'), 71 | ), 72 | ], 73 | ), 74 | ); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /lib/async/main_async.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_test_app/async/test_progress_time_page.dart'; 4 | import 'package:flutter_test_app/async/test_sing_stream_page.dart'; 5 | import 'package:flutter_test_app/async/test_stream_builder2_page.dart'; 6 | import 'package:flutter_test_app/async/test_stream_builder_page.dart'; 7 | import 'package:flutter_test_app/async/test_stream_page.dart'; 8 | import 'package:flutter_test_app/async/test_user_notifier_page.dart'; 9 | import 'package:flutter_test_app/async/test_value_notifier_page.dart'; 10 | 11 | ///flutter应用程序中的入口函数 12 | void main() => runApp(AsyncMainApp()); 13 | 14 | ///应用的根布局 15 | class AsyncMainApp extends StatelessWidget { 16 | @override 17 | Widget build(BuildContext context) { 18 | ///构建Materia Desin 风格的应用程序 19 | return MaterialApp( 20 | ///Android应用程序中任务栏中显示应用的名称 21 | title: " 配制", 22 | theme: ThemeData( 23 | accentColor: Colors.blue, 24 | 25 | ///默认是 Brightness.light 26 | brightness: Brightness.light, 27 | ), 28 | 29 | ///默认的首页面 30 | // home: TestValueNotifierPage(), 31 | // home: TestUserNotifierPage(), 32 | // home: TestStreamBaseUsePage(), 33 | // home: TestSingStreamBaseUsePage(), 34 | // home: TestStreamBuilderPage(), 35 | // home: TestTimer2BuilderPage(), 36 | home: TestStreamBuilderPage(), 37 | // home: TestTimeProgressIndicatorPage(), 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/async/test_AB_page.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:flutter/cupertino.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_test_app/test_widget_live_widget.dart'; 6 | 7 | class TestABPage extends StatefulWidget { 8 | @override 9 | State createState() { 10 | return _TestABPageState(); 11 | } 12 | } 13 | 14 | class _TestABPageState extends State { 15 | ///页面B返回的数据 16 | String _message = "--"; 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | ///页面主体脚手架 21 | return Scaffold( 22 | appBar: AppBar( 23 | title: Text("测试"), 24 | ), 25 | 26 | /// 处理滑动 27 | body: Column( 28 | children: [ 29 | SizedBox( 30 | height: 40, 31 | ), 32 | 33 | OutlineButton( 34 | child: Text("打开页面B"), 35 | onPressed: () { 36 | ///以动态路由的方式打开 37 | openPageFunction(context); 38 | }, 39 | ), 40 | SizedBox( 41 | height: 40, 42 | ), 43 | //ValueListenableBuilder是简易版的Provider 44 | Text("页面B返回的数据 : $_message") 45 | ], 46 | ), 47 | ); 48 | } 49 | ///代码清单 1-1 50 | void openPageFunction(BuildContext context) { 51 | ///以动态路由的方式打开 52 | Navigator.of(context).push( 53 | MaterialPageRoute( 54 | builder: (BuildContext context) { 55 | return TestBPage(); 56 | }, 57 | ), 58 | ///页面 TestBPage 关闭后会回调 then 函数 59 | ///其中参数 value 为回传的参数 60 | ).then((value) { 61 | if (value != null) { 62 | setState(() { 63 | _message = value; 64 | }); 65 | } 66 | }); 67 | } 68 | } 69 | 70 | class TestAPage extends StatefulWidget { 71 | @override 72 | State createState() { 73 | return _TestBPageState(); 74 | } 75 | } 76 | 77 | class _TestBPageState extends State { 78 | @override 79 | Widget build(BuildContext context) { 80 | return Scaffold( 81 | appBar: AppBar( 82 | title: Text("测试"), 83 | ), 84 | 85 | /// 处理滑动 86 | body: Column( 87 | children: [ 88 | SizedBox( 89 | height: 40, 90 | ), 91 | buildOutlineButton(context), 92 | ], 93 | ), 94 | ); 95 | } 96 | 97 | ///代码 清单 1-2 98 | OutlineButton buildOutlineButton(BuildContext context) { 99 | return OutlineButton( 100 | child: Text("返回页面 A "), 101 | onPressed: () { 102 | String result = "345"; 103 | Navigator.of(context).pop(result); 104 | }, 105 | ); 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /lib/async/test_f_page.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:flutter/cupertino.dart'; 4 | import 'package:flutter/material.dart'; 5 | 6 | class TestValueNotifierPage extends StatefulWidget { 7 | @override 8 | State createState() { 9 | return _ScrollHomePageState(); 10 | } 11 | } 12 | 13 | class _ScrollHomePageState extends State { 14 | ValueNotifier _testValueNotifier = ValueNotifier(''); 15 | 16 | ValueNotifier _testUserNotifier = ValueNotifier(null); 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | ///页面主体脚手架 21 | return Scaffold( 22 | appBar: AppBar( 23 | title: Text("测试"), 24 | ), 25 | 26 | /// 处理滑动 27 | body: Column( 28 | children: [ 29 | SizedBox( 30 | height: 40, 31 | ), 32 | OutlineButton( 33 | child: Text("测试数据"), 34 | onPressed: () { 35 | testFunction(); 36 | }, 37 | ), 38 | OutlineButton( 39 | child: Text("测试用户数据"), 40 | onPressed: () { 41 | testUserFunction(); 42 | }, 43 | ), 44 | SizedBox( 45 | height: 40, 46 | ), 47 | //ValueListenableBuilder是简易版的Provider 48 | 49 | ], 50 | ), 51 | ); 52 | } 53 | 54 | ValueListenableBuilder buildValueListenableBuilder() { 55 | return ValueListenableBuilder( 56 | ///数据发生变化时回调 57 | builder: (context, value, child) { 58 | return Text(value); 59 | }, 60 | ///监听的数据 61 | valueListenable: _testValueNotifier, 62 | child: Text( 63 | '未登录', 64 | style: TextStyle(color: Colors.red), 65 | ), 66 | ); 67 | } 68 | 69 | void testFunction() { 70 | _testValueNotifier.value = '传递的测试数据'; 71 | } 72 | 73 | void testUserFunction(){ 74 | UserInfo userInfo = new UserInfo(); 75 | userInfo.name='张三'; 76 | userInfo.age = 29 ; 77 | 78 | _testUserNotifier.value = userInfo; 79 | } 80 | } 81 | 82 | 83 | class UserInfo { 84 | String name; 85 | int age ; 86 | } -------------------------------------------------------------------------------- /lib/async/test_stream_builder2_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'dart:async'; 4 | import 'package:intl/intl.dart'; 5 | 6 | /// 对比使用 StreamBuilder 实现的计时性能分析 Demo 7 | class TestTimer2BuilderPage extends StatefulWidget { 8 | @override 9 | State createState() { 10 | return _TestABPageState(); 11 | } 12 | } 13 | 14 | class _TestABPageState extends State { 15 | ///测试数据 16 | String _message = "--"; 17 | ///计时器 18 | Timer _timer; 19 | 20 | @override 21 | void initState() { 22 | super.initState(); 23 | ///间隔1秒执行时间 24 | _timer = Timer.periodic(Duration(milliseconds: 1000), (timer) { 25 | ///获取当前的时间 26 | DateTime dateTime = DateTime.now(); 27 | ///格式化时间 28 | String formatTime = DateFormat("HH:mm:ss").format(dateTime); 29 | setState(() { 30 | _message = formatTime; 31 | }); 32 | }); 33 | } 34 | 35 | @override 36 | Widget build(BuildContext context) { 37 | ///页面主体脚手架 38 | return Scaffold( 39 | appBar: AppBar( 40 | title: Text("测试Stream $_message"), 41 | ), 42 | body: Text( 43 | '当前时间 $_message ', 44 | style: TextStyle(fontSize: 22, color: Colors.blue), 45 | ), 46 | ); 47 | } 48 | 49 | @override 50 | void dispose() { 51 | super.dispose(); 52 | 53 | ///取消计时器 54 | _timer.cancel(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /lib/async/test_stream_builder_page.dart: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | import 'package:flutter/cupertino.dart'; 5 | import 'package:flutter/material.dart'; 6 | 7 | 8 | import 'dart:async'; 9 | 10 | import 'package:intl/intl.dart'; 11 | 12 | ///多订阅流使用 Demo 13 | 14 | 15 | class TestStreamBuilderPage extends StatefulWidget { 16 | @override 17 | State createState() { 18 | return _TestABPageState(); 19 | } 20 | } 21 | 22 | class _TestABPageState extends State { 23 | ///测试数据 24 | String _message = "--"; 25 | ///使用单订阅流即可 26 | StreamController _streamController = StreamController(); 27 | ///计时器 28 | Timer _timer; 29 | 30 | @override 31 | void initState() { 32 | super.initState(); 33 | 34 | 35 | ///间隔1秒执行时间 36 | _timer= Timer.periodic(Duration(milliseconds: 1000), (timer) { 37 | ///获取当前的时间 38 | DateTime dateTime= DateTime.now(); 39 | ///格式化时间 40 | String formatTime = DateFormat("HH:mm:ss").format(dateTime); 41 | _message=formatTime; 42 | ///流数据更新 43 | _streamController.add("$formatTime"); 44 | }); 45 | 46 | 47 | } 48 | 49 | 50 | @override 51 | void dispose() { 52 | super.dispose(); 53 | ///关闭 54 | _streamController.close(); 55 | 56 | ///取消计时器 57 | _timer.cancel(); 58 | } 59 | @override 60 | Widget build(BuildContext context) { 61 | ///页面主体脚手架 62 | return Scaffold( 63 | appBar: AppBar( 64 | title: Text("测试Stream $_message"), 65 | ), 66 | 67 | body:buildStreamBuilder(), 68 | ); 69 | } 70 | 71 | ///代码清单1-1 72 | /// 监听Stream,每次值改变的时候,更新Text中的内容 73 | StreamBuilder buildStreamBuilder() { 74 | return StreamBuilder( 75 | ///绑定stream 76 | stream: _streamController.stream, 77 | ///默认的数据 78 | initialData: "00:00:00", 79 | ///构建绑定数据的UI 80 | builder: (BuildContext context, AsyncSnapshot snapshot) { 81 | ///snapshot.data 就是传递的数据对象 82 | return Text( 83 | '当前时间 ${snapshot.data} ', 84 | style: TextStyle(fontSize: 22, color: Colors.blue), 85 | ); 86 | }, 87 | ); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /lib/async/test_user_notifier_page.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:flutter/cupertino.dart'; 4 | import 'package:flutter/material.dart'; 5 | 6 | class TestUserNotifierPage extends StatefulWidget { 7 | @override 8 | State createState() { 9 | return _ScrollHomePageState(); 10 | } 11 | } 12 | 13 | class _ScrollHomePageState extends State { 14 | 15 | UserNotifier _testUserNotifier = UserNotifier(UserInfo(name: "", age: 0)); 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | ///页面主体脚手架 20 | return Scaffold( 21 | appBar: AppBar( 22 | title: Text("测试"), 23 | ), 24 | 25 | /// 处理滑动 26 | body: Column( 27 | children: [ 28 | SizedBox( 29 | height: 40, 30 | ), 31 | 32 | OutlineButton( 33 | child: Text("测试用户数据"), 34 | onPressed: () { 35 | testUserFunction(); 36 | }, 37 | ), 38 | SizedBox( 39 | height: 40, 40 | ), 41 | //ValueListenableBuilder是简易版的Provider 42 | buildUserListenableBuilder(), 43 | ], 44 | ), 45 | ); 46 | } 47 | 48 | ///第二步 定义 49 | Widget buildUserListenableBuilder() { 50 | return ValueListenableBuilder( 51 | ///数据发生变化时回调 52 | builder: (context, value, child) { 53 | String message = "--"; 54 | if (value != null) { 55 | message = "姓名是:${value.name} 年龄是: ${value.age}"; 56 | } 57 | return Text(message); 58 | }, 59 | 60 | ///监听的数据 61 | valueListenable: _testUserNotifier, 62 | ); 63 | } 64 | 65 | void testUserFunction() { 66 | _testUserNotifier.setName("李四"); 67 | } 68 | } 69 | 70 | class UserInfo { 71 | String name; 72 | int age; 73 | 74 | UserInfo({this.name, this.age}); 75 | } 76 | 77 | ///自定义 ValueNotifier 78 | /// UserInfo 为数据类型 79 | class UserNotifier extends ValueNotifier { 80 | UserNotifier(UserInfo userInfo) : super(userInfo); 81 | 82 | void setName(String name) { 83 | ///赋值 84 | value.name = name; 85 | 86 | ///通知更新 87 | notifyListeners(); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /lib/async/test_value_notifier_page.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:flutter/cupertino.dart'; 4 | import 'package:flutter/material.dart'; 5 | 6 | class TestValueNotifierPage extends StatefulWidget { 7 | @override 8 | State createState() { 9 | return _ScrollHomePageState(); 10 | } 11 | } 12 | 13 | class _ScrollHomePageState extends State { 14 | 15 | /// 第一步 定义 ValueNotifier 这里传递的数据类型为 String 16 | ValueNotifier _testValueNotifier = ValueNotifier(''); 17 | 18 | 19 | @override 20 | Widget build(BuildContext context) { 21 | ///页面主体脚手架 22 | return Scaffold( 23 | appBar: AppBar( 24 | title: Text("测试"), 25 | ), 26 | 27 | /// 处理滑动 28 | body: Column( 29 | children: [ 30 | SizedBox( 31 | height: 40, 32 | ), 33 | OutlineButton( 34 | child: Text("测试数据"), 35 | onPressed: () { 36 | testFunction(); 37 | }, 38 | ), 39 | 40 | SizedBox( 41 | height: 40, 42 | ), 43 | //ValueListenableBuilder是简易版的Provider 44 | buildValueListenableBuilder(), 45 | ], 46 | ), 47 | ); 48 | } 49 | 50 | ///第二步定义 数据变化后监听的 Widget 51 | Widget buildValueListenableBuilder() { 52 | return ValueListenableBuilder( 53 | ///数据发生变化时回调 54 | builder: (context, value, child) { 55 | return Text(value); 56 | }, 57 | ///监听的数据 58 | valueListenable: _testValueNotifier, 59 | child: Text( 60 | '未登录', 61 | style: TextStyle(color: Colors.red), 62 | ), 63 | ); 64 | } 65 | 66 | ///第三步就是数据变化后 67 | void testFunction() { 68 | ///赋值更新 69 | _testValueNotifier.value = '传递的测试数据'; 70 | } 71 | 72 | } 73 | 74 | -------------------------------------------------------------------------------- /lib/bloc/demo1/bloc_time.dart: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | /// 创建人: Created by zhaolong 6 | /// 创建时间:Created by on 2020/10/20. 7 | /// 8 | /// 可关注公众号:我的大前端生涯 获取最新技术分享 9 | /// 可关注网易云课堂:https://study.163.com/instructor/1021406098.htm 10 | /// 可关注博客:https://blog.csdn.net/zl18603543572 11 | /// 12 | /// 代码清单 13 | ///代码清单 14 | /// 15 | 16 | 17 | import 'package:flutter_bloc/flutter_bloc.dart'; 18 | import 'package:intl/intl.dart'; 19 | ///Bolc 的泛型数据类型 20 | ///在这里 int 代表输入的事件类型 21 | /// String 代表输出的数据结果 22 | class TimeCounterBloc extends Bloc { 23 | ///默认构造 24 | ///[initialState]默认的数据 25 | TimeCounterBloc(String initialState) : super(initialState); 26 | 27 | ///业务逻辑处理 [event] 事件标识 28 | @override 29 | Stream mapEventToState(int event) async* { 30 | ///获取当前的时间 31 | DateTime dateTime= DateTime.now(); 32 | ///格式化时间 import 'package:intl/intl.dart'; 33 | ///需要添加 intl 依赖 34 | String formatTime = DateFormat("HH:mm:ss").format(dateTime); 35 | ///发射更新数据 36 | yield formatTime; 37 | } 38 | } -------------------------------------------------------------------------------- /lib/bloc/demo1/main_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_bloc/flutter_bloc.dart'; 4 | import 'package:flutter_test_app/bloc/demo1/test_bloc_time_page.dart'; 5 | import 'bloc_time.dart'; 6 | 7 | ///flutter应用程序中的入口函数 8 | void main() => runApp(BlocMainApp()); 9 | 10 | ///应用的根布局 11 | class BlocMainApp extends StatelessWidget { 12 | @override 13 | Widget build(BuildContext context) { 14 | ///构建Materia Desin 风格的应用程序 15 | return BlocProvider( 16 | create: (context) => TimeCounterBloc(""), 17 | child: MaterialApp( 18 | ///Android应用程序中任务栏中显示应用的名称 19 | title: "配制", 20 | theme: ThemeData( 21 | accentColor: Colors.blue, 22 | ///默认是 Brightness.light 23 | brightness: Brightness.light, 24 | ), 25 | ///默认的首页面 26 | home: TestBlocTimePage(), 27 | ), 28 | ); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/bloc/demo1/test_bloc_time_page.dart: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | import 'package:flutter/cupertino.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:flutter_bloc/flutter_bloc.dart'; 7 | import 'dart:async'; 8 | import 'bloc_time.dart'; 9 | 10 | ///Bloc 初探 11 | class TestBlocTimePage extends StatefulWidget { 12 | @override 13 | State createState() { 14 | return _TestABPageState(); 15 | } 16 | } 17 | 18 | class _TestABPageState extends State { 19 | 20 | ///计时器 21 | Timer _timer; 22 | @override 23 | void initState() { 24 | super.initState(); 25 | ///间隔1秒执行时间 26 | _timer= Timer.periodic(Duration(milliseconds: 1000), (timer) { 27 | ///发送事件 28 | BlocProvider.of(context).add(0); 29 | }); 30 | } 31 | 32 | 33 | @override 34 | void dispose() { 35 | super.dispose(); 36 | ///取消计时器 37 | _timer.cancel(); 38 | } 39 | @override 40 | Widget build(BuildContext context) { 41 | ///页面主体脚手架 42 | return Scaffold( 43 | appBar: AppBar( 44 | title: Text("Bloc "), 45 | ), 46 | body:buildBlocBuilder(), 47 | ); 48 | } 49 | 50 | ///代码清单1-1 51 | /// 通过 BlocBuilder 来消费事件结果 52 | Widget buildBlocBuilder() { 53 | return BlocBuilder( 54 | ///条件判断是否更新视图 55 | /// 参数 previous 上一次的数据 56 | /// 参数 current 当前的数据 57 | buildWhen: (String previous,String current){ 58 | print("previous $previous current $current"); 59 | return true; 60 | }, 61 | ///入参 time 为BloC发射的数据 62 | builder: (context, time) { 63 | ///在这里 time 就是BloC回传的数据处理结果 64 | ///当然在这里是一个 String 类型 65 | return Container( 66 | ///外边距 67 | margin: EdgeInsets.only(left: 12,top: 12), 68 | child: Text( 69 | '$time', 70 | style: TextStyle(fontSize: 22.0, color: Colors.red), 71 | ), 72 | ); 73 | }, 74 | ); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /lib/bloc/demo2/bloc_number.dart: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | import 'dart:math'; 6 | 7 | /// 创建人: Created by zhaolong 8 | /// 创建时间:Created by on 2020/10/20. 9 | /// 10 | /// 可关注公众号:我的大前端生涯 获取最新技术分享 11 | /// 可关注网易云课堂:https://study.163.com/instructor/1021406098.htm 12 | /// 可关注博客:https://blog.csdn.net/zl18603543572 13 | /// 14 | /// 代码清单 15 | ///代码清单 16 | /// 17 | 18 | 19 | import 'package:flutter_bloc/flutter_bloc.dart'; 20 | 21 | ///Bolc 的泛型数据类型 22 | ///在这里 int 代表输入的事件类型 23 | /// String 代表输出的数据结果 24 | class NumberBloc extends Bloc { 25 | ///默认构造 26 | ///[initialState]默认的数据 27 | NumberBloc(int initialState) : super(initialState); 28 | 29 | ///业务逻辑处理 [event] 事件标识 30 | @override 31 | Stream mapEventToState(int event) async* { 32 | 33 | ///发射更新数据 34 | yield Random().nextInt(100); 35 | } 36 | } -------------------------------------------------------------------------------- /lib/bloc/demo2/main_mul_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_bloc/flutter_bloc.dart'; 4 | import 'package:flutter_test_app/bloc/demo1/bloc_time.dart'; 5 | import 'package:flutter_test_app/bloc/demo1/test_bloc_time_page.dart'; 6 | import 'package:flutter_test_app/bloc/demo2/test_mul_bloc_time_page.dart'; 7 | import 'bloc_number.dart'; 8 | 9 | 10 | ///flutter应用程序中的入口函数 11 | void main() => runApp(BlocMainApp()); 12 | 13 | ///应用的根布局 14 | class BlocMainApp extends StatelessWidget { 15 | @override 16 | Widget build(BuildContext context) { 17 | ///构建Materia Desin 风格的应用程序 18 | return MaterialApp( 19 | ///Android应用程序中任务栏中显示应用的名称 20 | title: "配制", 21 | theme: ThemeData( 22 | accentColor: Colors.blue, 23 | 24 | ///默认是 Brightness.light 25 | brightness: Brightness.light, 26 | ), 27 | 28 | ///默认的首页面 29 | home: buildHomePage(), 30 | ); 31 | } 32 | 33 | buildHomePage() { 34 | return MultiBlocProvider( 35 | providers: [ 36 | BlocProvider( 37 | create: (BuildContext context) => TimeCounterBloc("00:00:00"), 38 | ), 39 | BlocProvider( 40 | create: (BuildContext context) => NumberBloc(0), 41 | ), 42 | ], child: TestMulBlocTimePage(), 43 | ); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /lib/bloc/demo2/test_mul_bloc_time_page.dart: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | import 'package:flutter/cupertino.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:flutter_bloc/flutter_bloc.dart'; 7 | import 'dart:async'; 8 | 9 | import 'package:flutter_test_app/bloc/demo1/bloc_time.dart'; 10 | import 'package:flutter_test_app/bloc/demo2/bloc_number.dart'; 11 | 12 | ///Bloc 初探 13 | class TestMulBlocTimePage extends StatefulWidget { 14 | @override 15 | State createState() { 16 | return _TestABPageState(); 17 | } 18 | } 19 | 20 | class _TestABPageState extends State { 21 | 22 | ///计时器 23 | Timer _timer; 24 | @override 25 | void initState() { 26 | super.initState(); 27 | ///间隔1秒执行时间 28 | _timer= Timer.periodic(Duration(milliseconds: 1000), (timer) { 29 | ///发送事件 30 | BlocProvider.of(context).add(0); 31 | 32 | BlocProvider.of(context).add(0); 33 | }); 34 | } 35 | 36 | 37 | @override 38 | void dispose() { 39 | super.dispose(); 40 | ///取消计时器 41 | _timer.cancel(); 42 | } 43 | @override 44 | Widget build(BuildContext context) { 45 | ///页面主体脚手架 46 | return Scaffold( 47 | appBar: AppBar( 48 | title: Text("Bloc "), 49 | ), 50 | body:Column(children: [ 51 | buildBlocBuilder(), 52 | SizedBox(height: 22,), 53 | buildBlocBuilder2(), 54 | ],), 55 | ); 56 | } 57 | 58 | ///代码清单1-1 59 | /// 通过 BlocBuilder 来消费事件结果 60 | Widget buildBlocBuilder() { 61 | return BlocBuilder( 62 | ///条件判断是否更新视图 63 | /// 参数 previous 上一次的数据 64 | /// 参数 current 当前的数据 65 | buildWhen: (String previous,String current){ 66 | print("previous $previous current $current"); 67 | return true; 68 | }, 69 | ///入参 time 为BloC发射的数据 70 | builder: (context, time) { 71 | ///在这里 time 就是BloC回传的数据处理结果 72 | ///当然在这里是一个 String 类型 73 | return Container( 74 | ///外边距 75 | margin: EdgeInsets.only(left: 12,top: 12), 76 | child: Text( 77 | '$time', 78 | style: TextStyle(fontSize: 22.0, color: Colors.red), 79 | ), 80 | ); 81 | }, 82 | ); 83 | } 84 | 85 | Widget buildBlocBuilder2() { 86 | return BlocBuilder( 87 | ///入参 number 为BloC发射的数据 88 | builder: (context, number) { 89 | ///在这里 time 就是BloC回传的数据处理结果 90 | ///当然在这里是一个 String 类型 91 | return Container( 92 | ///外边距 93 | margin: EdgeInsets.only(left: 12,top: 12), 94 | child: Text( 95 | ' 随机数字 $number', 96 | style: TextStyle(fontSize: 22.0, color: Colors.red), 97 | ), 98 | ); 99 | }, 100 | ); 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /lib/canvas/cpi_audio_waveform.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | 5 | /// 创建人: Created by zhaolong 6 | /// 创建时间:Created by on 2020/11/20. 7 | /// 8 | /// 可关注公众号:我的大前端生涯 获取最新技术分享 9 | /// 可关注网易云课堂:https://study.163.com/instructor/1021406098.htm 10 | /// 可关注博客:https://blog.csdn.net/zl18603543572 11 | /// 12 | /// 代码清单 13 | ///代码清单 14 | void main() => runApp(MaterialApp(home: TestPage(),)); 15 | class TestPage extends StatefulWidget { 16 | @override 17 | _TestPageState createState() => _TestPageState(); 18 | } 19 | 20 | class _TestPageState extends State { 21 | 22 | @override 23 | Widget build(BuildContext context) { 24 | return Scaffold( 25 | appBar: AppBar( 26 | title: Text(""), 27 | ), 28 | backgroundColor: Colors.white, 29 | 30 | ///填充布局 31 | body: MyHomePage(), 32 | ); 33 | } 34 | 35 | } 36 | 37 | class MyHomePage extends StatelessWidget { 38 | @override 39 | Widget build(BuildContext context) { 40 | return Scaffold( 41 | body: Center( 42 | child: TweenAnimationBuilder( 43 | tween: Tween(begin: 0.0, end: 1.0), 44 | duration: Duration(seconds: 4), 45 | builder: (context, value, child) { 46 | return Container( 47 | width: 500, 48 | height: 100, 49 | child: Stack( 50 | children: [ 51 | ShaderMask( 52 | shaderCallback: (rect) { 53 | return LinearGradient( 54 | begin: Alignment.centerLeft, 55 | end: Alignment.centerRight, 56 | stops: [ 57 | value, 58 | value 59 | ], 60 | colors: [ 61 | Colors.blue, 62 | Colors.grey.withAlpha(100) 63 | ]).createShader(rect); 64 | }, 65 | child: Container( 66 | width: 500, 67 | height: 100, 68 | decoration: BoxDecoration( 69 | image: DecorationImage( 70 | image: Image.asset( 71 | "assets/images/audio_waveform.png") 72 | .image))), 73 | ), 74 | ], 75 | ), 76 | ); 77 | })), 78 | ); 79 | } 80 | } -------------------------------------------------------------------------------- /lib/canvas/image/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import 'my-painter.dart'; 4 | 5 | void main() { 6 | runApp(MyApp()); 7 | } 8 | 9 | //绘制图片 10 | class MyApp extends StatelessWidget { 11 | @override 12 | Widget build(BuildContext context) { 13 | return MaterialApp( 14 | title: 'Flutter Tutorials', 15 | debugShowCheckedModeBanner: false, 16 | theme: ThemeData( 17 | primarySwatch: Colors.blue, 18 | visualDensity: VisualDensity.adaptivePlatformDensity, 19 | ), 20 | home: MyPainter(), 21 | ); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/canvas/image/my-canvas.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'dart:ui' as ui; 3 | 4 | class MyCanvas extends CustomPainter { 5 | ui.Image bgImage; 6 | int imageCount = 0; 7 | int selectedIndex = 0; 8 | MyCanvas(this.bgImage, this.imageCount, this.selectedIndex); 9 | @override 10 | void paint(Canvas canvas, Size size) { 11 | var offset = Offset(size.width / 2, size.height / 2); 12 | drawImage(canvas, offset); 13 | drawFrame(canvas, offset); 14 | drawDots(canvas, offset); 15 | } 16 | 17 | @override 18 | bool shouldRepaint(covariant CustomPainter oldDelegate) { 19 | return true; 20 | } 21 | 22 | var W = 600.0; 23 | void drawFrame(Canvas canvas, Offset offset) { 24 | var rect = Rect.fromCenter(center: offset, width: W, height: W); 25 | var border = Paint() 26 | ..color = Colors.black 27 | ..strokeWidth = 10.0 28 | ..style = PaintingStyle.stroke; 29 | 30 | canvas.drawRect(rect, border); 31 | } 32 | 33 | void drawImage(Canvas canvas, Offset offset) { 34 | if (this.bgImage != null) { 35 | var rect = Rect.fromCenter(center: offset, width: W, height: W); 36 | // canvas.drawImage(this.bgImage, Offset(0, 0), Paint()); 37 | paintImage(this.bgImage, rect, canvas, Paint(), BoxFit.cover); 38 | } 39 | } 40 | 41 | void drawDots(Canvas canvas, Offset offset) { 42 | var pOff = Paint() 43 | ..strokeWidth = 2.0 44 | ..style = PaintingStyle.stroke 45 | ..color = Colors.grey; 46 | var pOn = Paint() 47 | ..style = PaintingStyle.fill 48 | ..color = Colors.grey; 49 | 50 | var radius = 10.0; 51 | var k = 2 * radius + 5.0; 52 | var c = Offset(-k * (imageCount - 1.0) / 2.0, W / 2 + 20); 53 | for (var i = 0; i < imageCount; i++) { 54 | if (i == this.selectedIndex % imageCount) { 55 | canvas.drawCircle(c + offset, radius, pOn); 56 | } else { 57 | canvas.drawCircle(c + offset, radius, pOff); 58 | } 59 | c += Offset(k, 0); 60 | } 61 | } 62 | 63 | void paintImage( 64 | ui.Image image, Rect outputRect, Canvas canvas, Paint paint, BoxFit fit) { 65 | final Size imageSize = 66 | Size(image.width.toDouble(), image.height.toDouble()); 67 | final FittedSizes sizes = applyBoxFit(fit, imageSize, outputRect.size); 68 | final Rect inputSubrect = 69 | Alignment.center.inscribe(sizes.source, Offset.zero & imageSize); 70 | final Rect outputSubrect = 71 | Alignment.center.inscribe(sizes.destination, outputRect); 72 | canvas.drawImageRect(image, inputSubrect, outputSubrect, paint); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /lib/canvas/image/my-painter.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/services.dart'; 3 | import 'dart:ui' as ui; 4 | import 'my-canvas.dart'; 5 | 6 | class MyPainter extends StatefulWidget { 7 | @override 8 | _MyPainterState createState() => _MyPainterState(); 9 | } 10 | 11 | class _MyPainterState extends State { 12 | @override 13 | void initState() { 14 | super.initState(); 15 | // Load the images from assets 16 | loadImages(); 17 | } 18 | 19 | @override 20 | Widget build(BuildContext context) { 21 | return Scaffold( 22 | body: GestureDetector( 23 | onTap: () { 24 | setState(() { 25 | this.selectedIndex++; 26 | this.selectedImage = this.images.length > 0 27 | ? this.images[this.selectedIndex % this.images.length] 28 | : null; 29 | print( 30 | "Selected image index = ${this.selectedIndex % this.images.length}"); 31 | }); 32 | }, 33 | child: CustomPaint( 34 | child: Container(), 35 | painter: MyCanvas( 36 | this.selectedImage, this.images.length, this.selectedIndex), 37 | ), 38 | ), 39 | ); 40 | } 41 | 42 | var images = new List(); 43 | ui.Image selectedImage; 44 | int selectedIndex = 0; 45 | void loadImages() { 46 | var names = ["3.webp", "1.webp", "2.webp"]; 47 | names.forEach((name) { 48 | rootBundle.load("assets/images/banner$name").then((bd) { 49 | decodeImageFromList(bd.buffer.asUint8List()).then((img) { 50 | setState(() { 51 | this.images.add(img); 52 | this.selectedImage = this.images.length > 0 ? this.images[0] : null; 53 | }); 54 | }); 55 | }); 56 | }); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /lib/canvas/rain/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import 'weather_widget.dart'; 4 | 5 | void main() { 6 | runApp(MyApp()); 7 | } 8 | 9 | ///下雨 10 | class MyApp extends StatelessWidget { 11 | @override 12 | Widget build(BuildContext context) { 13 | return MaterialApp( 14 | title: 'Flutter Demo', 15 | debugShowCheckedModeBanner: false, 16 | theme: ThemeData( 17 | primarySwatch: Colors.blue, 18 | visualDensity: VisualDensity.adaptivePlatformDensity, 19 | ), 20 | home: WeatherWidget(), 21 | ); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/canvas/rain/my_rain_canvas.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:flutter/material.dart'; 4 | 5 | import 'particle.dart'; 6 | 7 | class MyRainCanvas extends CustomPainter { 8 | final List particles; 9 | MyRainCanvas(this.particles); 10 | 11 | @override 12 | void paint(Canvas canvas, Size size) { 13 | var center = Offset(size.width / 2.0, size.height / 2.0); 14 | drawClouds(canvas, center); 15 | drawRain(canvas, center); 16 | } 17 | 18 | @override 19 | bool shouldRepaint(covariant CustomPainter oldDelegate) { 20 | return true; 21 | } 22 | 23 | void drawClouds(Canvas canvas, Offset center) { 24 | var c = Paint() 25 | ..color = Color(0xff8e9aaf) 26 | ..style = PaintingStyle.fill; 27 | 28 | var p1 = Offset(-50, -40) + center; 29 | var r1 = 90.0; 30 | canvas.drawCircle(p1, r1, c); 31 | 32 | var p2 = Offset(-10, -50) + center; 33 | var r2 = 100.0; 34 | canvas.drawCircle(p2, r2, c); 35 | 36 | var p3 = Offset(10, -10) + center; 37 | var r3 = 90.0; 38 | canvas.drawCircle(p3, r3, c); 39 | 40 | var p4 = Offset(50, -10) + center; 41 | var r4 = 110.0; 42 | canvas.drawCircle(p4, r4, c); 43 | 44 | var p5 = Offset(150, -10) + center; 45 | var r5 = 60.0; 46 | canvas.drawCircle(p5, r5, c); 47 | } 48 | 49 | var W = 600.0; 50 | void drawRain(Canvas canvas, Offset center) { 51 | var rain = Paint() 52 | ..color = Color(0xffdee2ff) //Colors.black 53 | ..strokeWidth = 10.0 54 | ..style = PaintingStyle.stroke; 55 | 56 | var rect = Rect.fromCenter(center: center, width: 500, height: 600); 57 | canvas.clipRect(rect); 58 | canvas.save(); 59 | canvas.translate(W - 250, -200); 60 | canvas.rotate(45.0 * pi / 180.0); 61 | 62 | particles.forEach((p) { 63 | var p2 = p.position + Offset(0, p.length); 64 | var dd = Offset(-50, 0); 65 | canvas.drawLine(p.position + center + dd, p2 + center + dd, rain); 66 | }); 67 | canvas.restore(); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /lib/canvas/rain/particle.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | class Particle { 4 | Offset position; 5 | Offset original; 6 | double length; 7 | double speed; 8 | } 9 | -------------------------------------------------------------------------------- /lib/canvas/rain/rain_widget.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:math'; 3 | 4 | import 'package:flutter/material.dart'; 5 | import 'my_rain_canvas.dart'; 6 | import 'particle.dart'; 7 | 8 | class RainWidget extends StatefulWidget { 9 | @override 10 | _RainWidgetState createState() => _RainWidgetState(); 11 | } 12 | 13 | var rng = Random(); 14 | 15 | class _RainWidgetState extends State { 16 | var particles = List(); 17 | Timer timer; 18 | @override 19 | void initState() { 20 | super.initState(); 21 | 22 | var xx = 0.0; 23 | // create particles 24 | for (var i = 0; i < 15; i++) { 25 | xx += rng.nextDouble() * 12.0 + 12.0; 26 | var dx = xx; 27 | var dy = -rng.nextDouble() * 150.0; 28 | // generate the length and speed 29 | var len = rng.nextDouble() * 30.0 + 30.0; 30 | var speed = rng.nextDouble() * 5.0 + 1.0; 31 | particles.add(Particle() 32 | ..position = Offset(dx, dy) 33 | ..original = Offset(dx, dy) 34 | ..speed = speed 35 | ..length = len); 36 | } 37 | 38 | // animation timer 39 | final fps = 50.0; 40 | var frameDuration = (1000 ~/ fps); 41 | timer = Timer.periodic(Duration(milliseconds: frameDuration), (timer) { 42 | setState(() { 43 | particles.forEach((p) { 44 | p.position += Offset(0, p.speed); 45 | if (p.position.dy > 200) { 46 | p.position = p.original; 47 | } 48 | }); 49 | }); 50 | }); 51 | } 52 | 53 | @override 54 | void dispose() { 55 | timer?.cancel(); 56 | super.dispose(); 57 | } 58 | 59 | @override 60 | Widget build(BuildContext context) { 61 | return Container( 62 | child: CustomPaint( 63 | child: Container(), 64 | painter: MyRainCanvas(particles), 65 | )); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /lib/canvas/rain/weather_widget.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'my_weather_canvas.dart'; 5 | import 'rain_widget.dart'; 6 | 7 | class WeatherWidget extends StatefulWidget { 8 | @override 9 | _WeatherWidgetState createState() => _WeatherWidgetState(); 10 | } 11 | 12 | class _WeatherWidgetState extends State { 13 | double t = 1.0; 14 | Timer timer; 15 | @override 16 | void initState() { 17 | super.initState(); 18 | final fps = 50.0; 19 | var frameDuration = (1000 ~/ fps); 20 | timer = Timer.periodic(Duration(milliseconds: frameDuration), (timer) { 21 | setState(() { 22 | t = rng.nextDouble() < 0.001 ? 0.0 : t; 23 | t += 0.1; 24 | t = t > 1.0 ? 1.0 : t; 25 | }); 26 | }); 27 | } 28 | 29 | @override 30 | Widget build(BuildContext context) { 31 | return Container( 32 | child: CustomPaint( 33 | // depending on the weather condition, set the correct widget 34 | // in this case it's the rain widget. You could also have 35 | // sunny widget, snowy widget, etc.. 36 | child: Center(child: Transform.scale(scale: 0.5, child: RainWidget())), 37 | painter: MyWeatherCanvas(t), 38 | ), 39 | ); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /lib/clip/clip_main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_test_app/clip/test_clip_oval_page.dart'; 4 | import 'package:flutter_test_app/clip/test_clip_react_page.dart'; 5 | 6 | 7 | /// 创建人: Created by zhaolong 8 | /// 创建时间:Created by on 2020/10/11. 9 | /// 10 | /// 可关注公众号:我的大前端生涯 获取最新技术分享 11 | /// 可关注网易云课堂:https://study.163.com/instructor/1021406098.htm 12 | /// 可关注博客:https://blog.csdn.net/zl18603543572 13 | /// 14 | /// 代码清单 15 | /// 16 | 17 | void main()=>runApp(TestClipMainPage()); 18 | ///应用的根布局 19 | class TestClipMainPage extends StatelessWidget{ 20 | @override 21 | Widget build(BuildContext context) { 22 | ///构建Materia Desin 风格的应用程序 23 | return MaterialApp( 24 | ///Android应用程序中任务栏中显示应用的名称 25 | title: " 配制", 26 | theme: ThemeData( 27 | accentColor: Colors.blue, 28 | ///默认是 Brightness.light 29 | brightness: Brightness.light, 30 | ), 31 | ///默认的首页面 32 | // home: ScrollHomePage(), 33 | home: TestClipReactPage(), 34 | // home: TestClipOvalPage(), 35 | // home: CustomScrollDemoPage(), 36 | ); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/clip/test_clip_oval_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class TestClipOvalPage extends StatefulWidget { 5 | @override 6 | State createState() { 7 | return _ClipOvalState(); 8 | } 9 | } 10 | 11 | class _ClipOvalState extends State { 12 | @override 13 | Widget build(BuildContext context) { 14 | return Scaffold( 15 | backgroundColor: Colors.grey, 16 | appBar: new AppBar(title: Text(" ClipOval "),), 17 | body: Container( 18 | width: 100, 19 | height: 100, 20 | ///裁剪组件 21 | child: ClipOval( 22 | ///一个图片 23 | child: new Image.network( 24 | imageUrl, //图片地址 25 | ///填充 26 | fit: BoxFit.fill), 27 | ), 28 | ), 29 | ); 30 | } 31 | 32 | String imageUrl = 33 | "https://timgsa.baidu.com/timg?demo.image&quality=80&size=b9999_10000&sec=1578583093&di=0bf687d9589dc5c6c0778de9576ee077&imgtype=jpg&er=1&src=http%3A%2F%2Ffile.mumayi.com%2Fforum%2F201403%2F28%2F111010vhgc45hkh41f1mfd.jpg"; 34 | } 35 | -------------------------------------------------------------------------------- /lib/clip/test_clip_react_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class TestClipReactPage extends StatefulWidget { 5 | @override 6 | State createState() { 7 | return _ClipOvalState(); 8 | } 9 | } 10 | 11 | class _ClipOvalState extends State { 12 | @override 13 | Widget build(BuildContext context) { 14 | return Scaffold( 15 | backgroundColor: Colors.grey, 16 | appBar: new AppBar(title: Text(" ClipOval "),), 17 | body: Container( 18 | width: 100, 19 | height: 100, 20 | ///裁剪组件 21 | child: ClipRect( 22 | ///一个图片 23 | child: new Image.network( 24 | imageUrl, //图片地址 25 | ///填充 26 | fit: BoxFit.fill), 27 | ), 28 | ), 29 | ); 30 | } 31 | 32 | String imageUrl = 33 | "https://timgsa.baidu.com/timg?demo.image&quality=80&size=b9999_10000&sec=1578583093&di=0bf687d9589dc5c6c0778de9576ee077&imgtype=jpg&er=1&src=http%3A%2F%2Ffile.mumayi.com%2Fforum%2F201403%2F28%2F111010vhgc45hkh41f1mfd.jpg"; 34 | } 35 | -------------------------------------------------------------------------------- /lib/customDrawer/CustomDrawer.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:flutter/material.dart'; 3 | 4 | import 'FirstLayer.dart'; 5 | import 'HomePage.dart'; 6 | import 'SecondLayer.dart'; 7 | import 'ThirdLayer.dart'; 8 | 9 | 10 | void main() { 11 | runApp(CustomDrawerApp()); 12 | } 13 | 14 | class CustomDrawerApp extends StatelessWidget { 15 | @override 16 | Widget build(BuildContext context) { 17 | return MaterialApp( 18 | home: CustomDrawer(), 19 | ); 20 | } 21 | } 22 | 23 | class CustomDrawer extends StatefulWidget { 24 | @override 25 | _CustomDrawerState createState() => _CustomDrawerState(); 26 | } 27 | 28 | class _CustomDrawerState extends State { 29 | @override 30 | Widget build(BuildContext context) { 31 | return Scaffold( 32 | body: Stack( 33 | children: [ 34 | FirstLayer(), 35 | SecondLayer(), 36 | ThirdLayer(), 37 | HomewPage(), 38 | ], 39 | ), 40 | ); 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /lib/customDrawer/FirstLayer.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class FirstLayer extends StatelessWidget { 4 | @override 5 | Widget build(BuildContext context) { 6 | return Container( 7 | height: MediaQuery.of(context).size.height, 8 | width: MediaQuery.of(context).size.width, 9 | decoration: BoxDecoration( 10 | gradient: 11 | LinearGradient(colors: [Color(0xFF4c41a3), Color(0xFF1f186f)])), 12 | ); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /lib/customDrawer/SecondLayer.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:matrix4_transform/matrix4_transform.dart'; 3 | 4 | SecondLayerState secondLayerState; 5 | 6 | class SecondLayer extends StatefulWidget { 7 | @override 8 | SecondLayerState createState() => SecondLayerState(); 9 | 10 | // openTab() => createState().openTab(); 11 | } 12 | 13 | class SecondLayerState extends State { 14 | double xoffSet = 0; 15 | double yoffSet = 0; 16 | double angle = 0; 17 | 18 | bool isOpen = false; 19 | 20 | @override 21 | Widget build(BuildContext context) { 22 | secondLayerState = this; 23 | return AnimatedContainer( 24 | transform: Matrix4Transform() 25 | .translate(x: xoffSet, y: yoffSet) 26 | .rotate(angle) 27 | .matrix4, 28 | duration: Duration(milliseconds: 550), 29 | decoration: BoxDecoration( 30 | borderRadius: BorderRadius.circular(10), color: Color(0xFF4c41a3)), 31 | child: Column( 32 | children: [ 33 | Row( 34 | children: [], 35 | ) 36 | ], 37 | )); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/customDrawer/main.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:flutter/material.dart'; 3 | 4 | import 'CustomDrawer.dart'; 5 | 6 | void main() { 7 | runApp(CustomDrawerApp()); 8 | } 9 | 10 | class CustomDrawerApp extends StatelessWidget { 11 | @override 12 | Widget build(BuildContext context) { 13 | return MaterialApp( 14 | home: CustomDrawer(), 15 | ); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /lib/custom_tabbar.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | 5 | /// 创建人: Created by zhaolong 6 | /// 创建时间:Created by on 2020/10/30. 7 | /// 8 | /// 可关注公众号:我的大前端生涯 获取最新技术分享 9 | /// 可关注网易云课堂:https://study.163.com/instructor/1021406098.htm 10 | /// 可关注博客:https://blog.csdn.net/zl18603543572 11 | /// 12 | /// 代码清单 13 | ///代码清单 14 | class CustomTabBar extends StatefulWidget { 15 | final TabController controller; 16 | 17 | CustomTabBar({@required this.controller,Key key}):super(key: key); 18 | 19 | @override 20 | _CustomTabBarState createState() => _CustomTabBarState(); 21 | } 22 | 23 | class _CustomTabBarState extends State { 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | return Theme( 28 | data: ThemeData( 29 | ///默认显示的背影颜色 30 | backgroundColor: Colors.blue[500], 31 | ///点击的高亮颜色 32 | highlightColor: Colors.blueGrey[600], 33 | ///水波纹颜色 34 | splashColor: Color.fromRGBO(0, 0, 0, 0), 35 | ), 36 | child: new TabBar( 37 | controller: widget.controller, 38 | tabs: [ 39 | new Tab(text: "首页", icon: new Icon(Icons.home)), 40 | new Tab(text: "发现", icon: new Icon(Icons.find_in_page)), 41 | new Tab(text: "动态", icon: new Icon(Icons.message)), 42 | new Tab(text: "我的", icon: new Icon(Icons.person)), 43 | ], 44 | indicatorWeight: 0.1, 45 | ), 46 | );; 47 | } 48 | 49 | } -------------------------------------------------------------------------------- /lib/icon/round_corner_icon.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | 4 | 5 | class RoundCornerIcon extends StatelessWidget { 6 | 7 | final IconData iconData; 8 | final Gradient gradient; 9 | 10 | const RoundCornerIcon({ 11 | Key key, 12 | @required this.gradient, 13 | @required this.iconData, 14 | }) : assert(iconData != null), 15 | assert(gradient != null), 16 | super(key: key); 17 | 18 | 19 | @override 20 | Widget build(BuildContext context) { 21 | ///圆角裁剪 22 | return ClipRRect( 23 | ///四个圆角的角度 24 | borderRadius: BorderRadius.circular(5), 25 | ///被裁剪的子Widget 26 | child:Container( 27 | ///渐变样式的背景装饰 28 | decoration: BoxDecoration( 29 | gradient: gradient 30 | ), 31 | ///圆角背景大小 32 | height: 23, 33 | width: 23, 34 | ///中间的小图标 35 | child: Icon( 36 | ///图标数据 37 | iconData, 38 | ///图标大小 39 | size: 18, 40 | ///图标的颜色 41 | color: Colors.white, 42 | ), 43 | ), 44 | ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/icon/test_round_icon_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_test_app/icon/round_corner_icon.dart'; 4 | 5 | /// 创建人: Created by zhaolong 6 | /// 创建时间:Created by on 2020/10/15. 7 | /// 8 | /// 可关注公众号:我的大前端生涯 获取最新技术分享 9 | /// 可关注网易云课堂:https://study.163.com/instructor/1021406098.htm 10 | /// 可关注博客:https://blog.csdn.net/zl18603543572 11 | /// 12 | /// 代码清单 13 | ///代码清单 14 | class TestRuondIconPage extends StatefulWidget { 15 | @override 16 | _TestRuondIconPageState createState() => _TestRuondIconPageState(); 17 | } 18 | 19 | class _TestRuondIconPageState extends State { 20 | @override 21 | Widget build(BuildContext context) { 22 | return Scaffold( 23 | appBar: AppBar( 24 | title: Text("圆角图标"), 25 | ), 26 | backgroundColor: Colors.white, 27 | 28 | ///填充布局 29 | body: Container( 30 | width: double.infinity, 31 | height: double.infinity, 32 | child: Column( 33 | children: [ 34 | 35 | SizedBox(height: 50,), 36 | buildDefaultIcon(), 37 | 38 | SizedBox(height: 50,), 39 | buildRoundCornerIcon(), 40 | ], 41 | )), 42 | ); 43 | } 44 | 45 | RoundCornerIcon buildRoundCornerIcon() { 46 | return RoundCornerIcon( 47 | ///电话小图标 48 | iconData: CupertinoIcons.phone_solid, 49 | ///线性渐变的背景 50 | gradient: LinearGradient( 51 | ///颜色过渡 52 | colors: [ 53 | Colors.redAccent, 54 | Colors.orange, 55 | ], 56 | ///颜色过渡的开始位置 左上角 57 | begin: Alignment.topLeft, 58 | ///颜色过渡的结束位置 右下角 59 | end: Alignment.bottomRight, 60 | ), 61 | ); 62 | } 63 | 64 | buildDefaultIcon() { 65 | return Icon( 66 | ///图标数据 67 | CupertinoIcons.phone_solid, 68 | ///图标大小 69 | size: 18, 70 | ); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /lib/logindemo/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_test_app/logindemo/screens/login_screen.dart'; 3 | 4 | void main() => runApp(MyApp()); 5 | 6 | class MyApp extends StatelessWidget { 7 | // This widget is the root of your application. 8 | @override 9 | Widget build(BuildContext context) { 10 | return MaterialApp( 11 | title: 'Flutter Login UI', 12 | debugShowCheckedModeBanner: false, 13 | home: LoginScreen(), 14 | ); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /lib/logindemo/utilities/constants.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | final kHintTextStyle = TextStyle( 4 | color: Colors.white54, 5 | fontFamily: 'OpenSans', 6 | ); 7 | 8 | final kLabelStyle = TextStyle( 9 | color: Colors.white, 10 | fontWeight: FontWeight.bold, 11 | fontFamily: 'OpenSans', 12 | ); 13 | 14 | final kBoxDecorationStyle = BoxDecoration( 15 | color: Color(0xFF6CA8F1), 16 | borderRadius: BorderRadius.circular(10.0), 17 | boxShadow: [ 18 | BoxShadow( 19 | color: Colors.black12, 20 | blurRadius: 6.0, 21 | offset: Offset(0, 2), 22 | ), 23 | ], 24 | ); -------------------------------------------------------------------------------- /lib/progress/test_CircularProgressIndicator_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:animations/animations.dart'; 2 | import 'package:flutter/cupertino.dart'; 3 | import 'package:flutter/gestures.dart'; 4 | import 'package:flutter/material.dart'; 5 | 6 | /// 创建人: Created by zhaolong 7 | /// 创建时间:Created by on 2020/10/31. 8 | /// 9 | /// 可关注公众号:我的大前端生涯 获取最新技术分享 10 | /// 可关注网易云课堂:https://study.163.com/instructor/1021406098.htm 11 | /// 可关注博客:https://blog.csdn.net/zl18603543572 12 | /// 13 | /// 代码清单 下拉刷新 RefreshIndicator 14 | 15 | void main() { 16 | runApp(RootPage()); 17 | } 18 | 19 | class RootPage extends StatelessWidget { 20 | @override 21 | Widget build(BuildContext context) { 22 | return MaterialApp( 23 | home: HomePageRefreshIndicator(), 24 | ); 25 | } 26 | } 27 | 28 | ///下拉刷新组件 29 | class HomePageRefreshIndicator extends StatefulWidget { 30 | @override 31 | _TestPageState createState() => _TestPageState(); 32 | } 33 | 34 | class _TestPageState extends State { 35 | @override 36 | Widget build(BuildContext context) { 37 | return Scaffold( 38 | appBar: AppBar( 39 | title: Text("圆形"), 40 | ), 41 | 42 | body: Center( 43 | child: Container( 44 | width: 55, 45 | height: 55, 46 | child: CircularProgressIndicator( 47 | // value: 0.3, 48 | //进度高亮颜色 49 | valueColor: new AlwaysStoppedAnimation(Colors.blue), 50 | //总进度的颜色 51 | backgroundColor: Color(0xff00ff00), 52 | //圆圈的厚度 53 | strokeWidth: 6.0, 54 | ), 55 | ), 56 | ), 57 | ); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /lib/progress/test_CupertinoActivityIndicator_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:animations/animations.dart'; 2 | import 'package:flutter/cupertino.dart'; 3 | import 'package:flutter/gestures.dart'; 4 | import 'package:flutter/material.dart'; 5 | 6 | /// 创建人: Created by zhaolong 7 | /// 创建时间:Created by on 2020/10/31. 8 | /// 9 | /// 可关注公众号:我的大前端生涯 获取最新技术分享 10 | /// 可关注网易云课堂:https://study.163.com/instructor/1021406098.htm 11 | /// 可关注博客:https://blog.csdn.net/zl18603543572 12 | /// 13 | /// 代码清单 下拉刷新 RefreshIndicator 14 | 15 | void main() { 16 | runApp(RootPage()); 17 | } 18 | 19 | class RootPage extends StatelessWidget { 20 | @override 21 | Widget build(BuildContext context) { 22 | return MaterialApp( 23 | home: HomePageRefreshIndicator(), 24 | ); 25 | } 26 | } 27 | 28 | class HomePageRefreshIndicator extends StatefulWidget { 29 | @override 30 | _TestPageState createState() => _TestPageState(); 31 | } 32 | 33 | class _TestPageState extends State { 34 | @override 35 | Widget build(BuildContext context) { 36 | return Scaffold( 37 | appBar: AppBar( 38 | title: Text("苹果风格"), 39 | ), 40 | body: Center( 41 | child: Container( 42 | child: CupertinoActivityIndicator( 43 | //半径 外部设置大小约束无效果 44 | radius: 30, 45 | //是否转动 默认为 true 开启转动 46 | animating: true, 47 | ), 48 | ), 49 | ), 50 | ); 51 | } 52 | } 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /lib/progress/test_CupertinoSliverIndicator_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:animations/animations.dart'; 2 | import 'package:flutter/cupertino.dart'; 3 | import 'package:flutter/gestures.dart'; 4 | import 'package:flutter/material.dart'; 5 | 6 | /// 创建人: Created by zhaolong 7 | /// 创建时间:Created by on 2020/10/31. 8 | /// 9 | /// 可关注公众号:我的大前端生涯 获取最新技术分享 10 | /// 可关注网易云课堂:https://study.163.com/instructor/1021406098.htm 11 | /// 可关注博客:https://blog.csdn.net/zl18603543572 12 | /// 13 | /// 代码清单 下拉刷新 RefreshIndicator 14 | 15 | void main() { 16 | runApp(RootPage()); 17 | } 18 | 19 | class RootPage extends StatelessWidget { 20 | @override 21 | Widget build(BuildContext context) { 22 | return MaterialApp( 23 | home: HomePageRefreshIndicator(), 24 | ); 25 | } 26 | } 27 | 28 | ///下拉刷新组件 29 | class HomePageRefreshIndicator extends StatefulWidget { 30 | @override 31 | _TestPageState createState() => _TestPageState(); 32 | } 33 | 34 | class _TestPageState extends State { 35 | @override 36 | Widget build(BuildContext context) { 37 | return Scaffold( 38 | appBar: AppBar( 39 | title: Text("下拉刷新"), 40 | ), 41 | body: CustomScrollView( 42 | slivers: [ 43 | //下拉刷新组件 44 | CupertinoSliverRefreshControl( 45 | //下拉刷新回调 46 | onRefresh: () async { 47 | //模拟网络请求 48 | await Future.delayed(Duration(milliseconds: 3000)); 49 | //结束刷新 50 | return Future.value(true); 51 | }, 52 | ), 53 | //列表 54 | SliverList( 55 | delegate: SliverChildBuilderDelegate((content, index) { 56 | return ListTile( 57 | title: Text('测试数据$index'), 58 | ); 59 | }, childCount: 100), 60 | ) 61 | ], 62 | ), 63 | ); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /lib/progress/test_LinearProgressIndicator_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:animations/animations.dart'; 2 | import 'package:flutter/cupertino.dart'; 3 | import 'package:flutter/gestures.dart'; 4 | import 'package:flutter/material.dart'; 5 | 6 | /// 创建人: Created by zhaolong 7 | /// 创建时间:Created by on 2020/10/31. 8 | /// 9 | /// 可关注公众号:我的大前端生涯 获取最新技术分享 10 | /// 可关注网易云课堂:https://study.163.com/instructor/1021406098.htm 11 | /// 可关注博客:https://blog.csdn.net/zl18603543572 12 | /// 13 | /// 代码清单 下拉刷新 RefreshIndicator 14 | 15 | void main() { 16 | runApp(RootPage()); 17 | } 18 | 19 | class RootPage extends StatelessWidget { 20 | @override 21 | Widget build(BuildContext context) { 22 | return MaterialApp( 23 | home: HomePageRefreshIndicator(), 24 | ); 25 | } 26 | } 27 | 28 | ///下拉刷新组件 29 | class HomePageRefreshIndicator extends StatefulWidget { 30 | @override 31 | _TestPageState createState() => _TestPageState(); 32 | } 33 | 34 | class _TestPageState extends State { 35 | @override 36 | Widget build(BuildContext context) { 37 | return Scaffold( 38 | appBar: AppBar( 39 | title: Text("线性"), 40 | ), 41 | 42 | body: Container( 43 | margin: EdgeInsets.all(20), 44 | width: 300, 45 | //会覆盖 进度条的 minHeight 46 | height: 10, 47 | child: LinearProgressIndicator( 48 | // value: 0.3, 49 | //进度高亮颜色 50 | valueColor: new AlwaysStoppedAnimation(Colors.blue), 51 | //总进度的颜色 52 | backgroundColor: Color(0xff00ff00), 53 | //设置进度条的高度 54 | minHeight: 10, 55 | ), 56 | ), 57 | ); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /lib/progress/test_RefreshIndicator_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:animations/animations.dart'; 2 | import 'package:flutter/cupertino.dart'; 3 | import 'package:flutter/gestures.dart'; 4 | import 'package:flutter/material.dart'; 5 | 6 | /// 创建人: Created by zhaolong 7 | /// 创建时间:Created by on 2020/10/31. 8 | /// 9 | /// 可关注公众号:我的大前端生涯 获取最新技术分享 10 | /// 可关注网易云课堂:https://study.163.com/instructor/1021406098.htm 11 | /// 可关注博客:https://blog.csdn.net/zl18603543572 12 | /// 13 | /// 代码清单 下拉刷新 RefreshIndicator 14 | 15 | void main() { 16 | runApp(RootPage()); 17 | } 18 | 19 | class RootPage extends StatelessWidget { 20 | @override 21 | Widget build(BuildContext context) { 22 | return MaterialApp( 23 | home: HomePageRefreshIndicator(), 24 | ); 25 | } 26 | } 27 | 28 | ///下拉刷新组件 29 | class HomePageRefreshIndicator extends StatefulWidget { 30 | @override 31 | _TestPageState createState() => _TestPageState(); 32 | } 33 | 34 | class _TestPageState extends State { 35 | @override 36 | Widget build(BuildContext context) { 37 | return Scaffold( 38 | appBar: AppBar( 39 | title: Text("下拉刷新"), 40 | ), 41 | //下拉刷新组件 42 | body: RefreshIndicator( 43 | //圆圈进度颜色 44 | color: Colors.blue, 45 | //下拉停止的距离 46 | displacement: 44.0, 47 | //背景颜色 48 | backgroundColor: Colors.grey[200], 49 | onRefresh: () async { 50 | //模拟网络请求 51 | await Future.delayed(Duration(milliseconds: 2000)); 52 | //结束刷新 53 | return Future.value(true); 54 | }, 55 | //一个列表 56 | child: ListView.builder( 57 | itemBuilder: (BuildContext context, int index) { 58 | return Container( 59 | height: 66, 60 | child: Text("测试数据"), 61 | ); 62 | }, 63 | //列表数据源数量 64 | itemCount: 100, 65 | ), 66 | ), 67 | ); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /lib/progress/test_SmartRefresher1_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:animations/animations.dart'; 2 | import 'package:flutter/cupertino.dart'; 3 | import 'package:flutter/gestures.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:pull_to_refresh/pull_to_refresh.dart'; 6 | 7 | /// 创建人: Created by zhaolong 8 | /// 创建时间:Created by on 2020/10/31. 9 | /// 10 | /// 可关注公众号:我的大前端生涯 获取最新技术分享 11 | /// 可关注网易云课堂:https://study.163.com/instructor/1021406098.htm 12 | /// 可关注博客:https://blog.csdn.net/zl18603543572 13 | /// 14 | /// 代码清单 下拉刷新 RefreshIndicator 15 | 16 | void main() { 17 | runApp(RootPage()); 18 | } 19 | 20 | class RootPage extends StatelessWidget { 21 | @override 22 | Widget build(BuildContext context) { 23 | return MaterialApp( 24 | home: HomePageRefreshIndicator(), 25 | ); 26 | } 27 | } 28 | 29 | ///下拉刷新组件 30 | class HomePageRefreshIndicator extends StatefulWidget { 31 | @override 32 | _TestPageState createState() => _TestPageState(); 33 | } 34 | 35 | class _TestPageState extends State { 36 | RefreshController _refreshController = 37 | RefreshController(initialRefresh: false); 38 | 39 | @override 40 | Widget build(BuildContext context) { 41 | return Scaffold( 42 | appBar: AppBar( 43 | title: Text("下拉刷新"), 44 | ), 45 | //下拉刷新组件 46 | body: SmartRefresher( 47 | controller: _refreshController, 48 | //水滴刷新头 49 | header: WaterDropMaterialHeader(), 50 | enablePullUp: true, 51 | onRefresh: () async { 52 | //模拟网络请求 53 | await Future.delayed(Duration(milliseconds: 2000)); 54 | //结束刷新 55 | _refreshController.refreshCompleted(); 56 | }, 57 | //一个列表 58 | child: ListView.builder( 59 | itemBuilder: (BuildContext context, int index) { 60 | return Container( 61 | height: 66, 62 | child: Text("测试数据"), 63 | ); 64 | }, 65 | //列表数据源数量 66 | itemCount: 100, 67 | ), 68 | ), 69 | ); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /lib/provider/demo1/main_provider.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_test_app/provider/demo1/test_provider_consumer_time_page.dart'; 4 | import 'package:flutter_test_app/provider/demo1/test_provider_time_page.dart'; 5 | import 'package:flutter_test_app/provider/demo2/test_provider_abc_page.dart'; 6 | import 'package:provider/provider.dart'; 7 | import 'time_model.dart'; 8 | 9 | ///代码清单 1-1 10 | ///flutter应用程序中的入口函数 11 | void main() => runApp( 12 | ChangeNotifierProvider( 13 | create: (BuildContext context) { 14 | return TimeCounterModel(); 15 | }, 16 | child: ProviderMainApp(), 17 | ), 18 | ); 19 | 20 | ///应用的根布局 21 | class ProviderMainApp extends StatelessWidget { 22 | @override 23 | Widget build(BuildContext context) { 24 | ///构建Materia Desin 风格的应用程序 25 | return MaterialApp( 26 | ///Android应用程序中任务栏中显示应用的名称 27 | title: "配制", 28 | theme: ThemeData( 29 | accentColor: Colors.blue, 30 | 31 | ///默认是 Brightness.light 32 | brightness: Brightness.light, 33 | ), 34 | 35 | ///默认的首页面 36 | 37 | home: ProviderHomePage(), 38 | ); 39 | } 40 | } 41 | 42 | class ProviderHomePage extends StatefulWidget { 43 | @override 44 | State createState() { 45 | return _ProviderHomePageState(); 46 | } 47 | } 48 | 49 | class _ProviderHomePageState extends State { 50 | final List> itemList = [ 51 | {"name": "Provider 接收数据", "widget": TestProviderTimePage()}, 52 | {"name": "Consumer 接收数据", "widget": TestProviderConsumerTimePage()}, 53 | {"name": "多个页面传值", "widget": TestProviderMulPage()}, 54 | ]; 55 | 56 | @override 57 | Widget build(BuildContext context) { 58 | return Scaffold( 59 | appBar: AppBar( 60 | title: Text("Provider 专题 "), 61 | ), 62 | body: Container( 63 | width: double.infinity, 64 | child: ListView.builder( 65 | itemBuilder: (BuildContext context, int index) { 66 | return itemBuildWidget(index); 67 | }, 68 | itemCount: itemList.length, 69 | ), 70 | ), 71 | ); 72 | } 73 | 74 | Widget itemBuildWidget(int index) { 75 | Map item = itemList[index]; 76 | String buttonTitle = item["name"]; 77 | Widget toPage = item["widget"]; 78 | 79 | return Container( 80 | margin: EdgeInsets.only(top: 10, bottom: 10), 81 | child: OutlineButton( 82 | child: Text(buttonTitle), 83 | onPressed: () { 84 | Navigator.of(context) 85 | .push(MaterialPageRoute(builder: (BuildContext context) { 86 | return toPage; 87 | })); 88 | }, 89 | ), 90 | ); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /lib/provider/demo1/test_provider_consumer_time_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_bloc/flutter_bloc.dart'; 4 | import 'package:provider/provider.dart'; 5 | import 'dart:async'; 6 | import 'time_model.dart'; 7 | 8 | 9 | 10 | 11 | ///Bloc 初探 12 | class TestProviderConsumerTimePage extends StatefulWidget { 13 | @override 14 | State createState() { 15 | return _TestABPageState(); 16 | } 17 | } 18 | 19 | class _TestABPageState extends State { 20 | ///计时器 21 | Timer _timer; 22 | @override 23 | void initState() { 24 | super.initState(); 25 | ///间隔1秒执行时间 26 | _timer = Timer.periodic(Duration(milliseconds: 1000), (timer) { 27 | ///发送事件 28 | Provider.of(context,listen: false).getCurrentTime(); //2 29 | }); 30 | } 31 | 32 | @override 33 | void dispose() { 34 | super.dispose(); 35 | ///取消计时器 36 | _timer.cancel(); 37 | } 38 | 39 | @override 40 | Widget build(BuildContext context) { 41 | ///页面主体脚手架 42 | return Scaffold( 43 | appBar: AppBar( 44 | title: Text("Provider "), 45 | ), 46 | body: buildBlocBuilder(), 47 | ); 48 | } 49 | 50 | ///代码清单1-4 51 | /// 通过 Consumer 来消费事件结果 52 | Widget buildBlocBuilder() { 53 | return Consumer( 54 | ///参数 value 就是绑定的事件结果 TimeCounterModel 55 | builder: (BuildContext context, value, Widget child) { 56 | return Container( 57 | ///外边距 58 | margin: EdgeInsets.only(left: 12, top: 12), 59 | child: Text( 60 | '${value.formatTime}', 61 | style: TextStyle(fontSize: 22.0, color: Colors.red), 62 | ), 63 | ); 64 | }, 65 | ); 66 | } 67 | } 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /lib/provider/demo1/test_provider_time_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_bloc/flutter_bloc.dart'; 4 | import 'package:provider/provider.dart'; 5 | import 'dart:async'; 6 | import 'time_model.dart'; 7 | 8 | 9 | 10 | ///Bloc 初探 11 | class TestProviderTimePage extends StatefulWidget { 12 | @override 13 | State createState() { 14 | return _TestABPageState(); 15 | } 16 | } 17 | 18 | class _TestABPageState extends State { 19 | ///计时器 20 | Timer _timer; 21 | 22 | @override 23 | void initState() { 24 | super.initState(); 25 | 26 | ///间隔1秒执行时间 27 | _timer = Timer.periodic(Duration(milliseconds: 1000), (timer) { 28 | ///发送事件 29 | Provider.of(context,listen: false).getCurrentTime(); //2 30 | }); 31 | } 32 | 33 | @override 34 | void dispose() { 35 | super.dispose(); 36 | 37 | ///取消计时器 38 | _timer.cancel(); 39 | } 40 | 41 | @override 42 | Widget build(BuildContext context) { 43 | ///页面主体脚手架 44 | return Scaffold( 45 | appBar: AppBar( 46 | title: Text("Bloc "), 47 | ), 48 | body: buildBlocBuilder(), 49 | ); 50 | } 51 | 52 | ///代码清单1-1 53 | /// 通过 BlocBuilder 来消费事件结果 54 | Widget buildBlocBuilder() { 55 | return Container( 56 | ///外边距 57 | margin: EdgeInsets.only(left: 12, top: 12), 58 | child: Text( 59 | '${Provider.of(context, listen: true).formatTime}', 60 | style: TextStyle(fontSize: 22.0, color: Colors.red), 61 | ), 62 | ); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /lib/provider/demo1/time_model.dart: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | /// 创建人: Created by zhaolong 7 | /// 创建时间:Created by on 2020/10/20. 8 | /// 9 | /// 可关注公众号:我的大前端生涯 获取最新技术分享 10 | /// 可关注网易云课堂:https://study.163.com/instructor/1021406098.htm 11 | /// 可关注博客:https://blog.csdn.net/zl18603543572 12 | /// 13 | /// 代码清单 14 | ///代码清单 15 | /// 16 | import 'package:flutter/cupertino.dart'; 17 | import 'package:intl/intl.dart'; 18 | 19 | class TimeCounterModel with ChangeNotifier { 20 | 21 | String _formatTime="00:00:00"; 22 | 23 | void getCurrentTime() { 24 | ///获取当前的时间 25 | DateTime dateTime= DateTime.now(); 26 | ///格式化时间 import 'package:intl/intl.dart'; 27 | ///需要添加 intl 依赖 28 | _formatTime = DateFormat("HH:mm:ss").format(dateTime); 29 | notifyListeners();//2 30 | } 31 | 32 | get formatTime => _formatTime;//3 33 | } -------------------------------------------------------------------------------- /lib/provider/demo2/number_model.dart: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | import 'dart:math'; 6 | 7 | import 'package:flutter/cupertino.dart'; 8 | /// 创建人: Created by zhaolong 9 | /// 创建时间:Created by on 2020/10/20. 10 | /// 11 | /// 可关注公众号:我的大前端生涯 获取最新技术分享 12 | /// 可关注网易云课堂:https://study.163.com/instructor/1021406098.htm 13 | /// 可关注博客:https://blog.csdn.net/zl18603543572 14 | /// 15 | /// 代码清单 16 | ///代码清单 17 | /// 18 | 19 | 20 | class RandomNumberModel with ChangeNotifier { 21 | int _randomNumber=0; 22 | 23 | ///指定数据 24 | void testNumber(int number) { 25 | _randomNumber = number; 26 | notifyListeners();//2 27 | } 28 | 29 | ///随机数据 30 | void testRandom(){ 31 | _randomNumber = Random().nextInt(100); 32 | notifyListeners(); 33 | } 34 | get randomNumber => _randomNumber;//3 35 | } -------------------------------------------------------------------------------- /lib/scroll/customscroll_demo_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class CustomScrollDemoPage extends StatefulWidget { 5 | @override 6 | State createState() { 7 | return _ScrollHomePageState(); 8 | } 9 | } 10 | 11 | class _ScrollHomePageState extends State { 12 | ///图片地址 13 | String imageUrl = 14 | "http://file02.16sucai.com/d/file/2015/0408/779334da99e40adb587d0ba715eca102.jpg"; 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | ///页面主体脚手架 19 | return Scaffold( 20 | 21 | /// 处理滑动 22 | body: CustomScrollView( 23 | slivers: [ 24 | ///顶部的标题图片部分 25 | buildSliverAppBar(), 26 | 27 | ///底部的列表部分 28 | buildSliverList() 29 | ], 30 | )); 31 | } 32 | ///代码清单1-3 33 | SliverList buildSliverList() { 34 | return SliverList( 35 | ///懒加载代理 36 | delegate: SliverChildBuilderDelegate((BuildContext context, num index) { 37 | ///子Item的布局 38 | return Container( 39 | height: 44, 40 | margin: EdgeInsets.only(bottom: 10), 41 | child: Text("item- $index"), 42 | ); 43 | }, childCount: 100),//子Item的个数 44 | ); 45 | } 46 | 47 | ///代码清单1-2 48 | SliverAppBar buildSliverAppBar() { 49 | return SliverAppBar( 50 | backgroundColor: Colors.pink, 51 | pinned: true, 52 | snap: false, 53 | floating: true, 54 | leading: Icon(Icons.home), 55 | actions: [Icon(Icons.menu)], 56 | title: Text("这里是标题"), 57 | expandedHeight: 180, 58 | flexibleSpace: FlexibleSpaceBar( 59 | background: Row( 60 | children: [ 61 | Expanded( 62 | child: Image.network( 63 | imageUrl, 64 | fit: BoxFit.cover, 65 | ), 66 | ) 67 | ], 68 | ), 69 | ), 70 | ); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /lib/scroll/customscroll_home_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class CustomScrollHomePage extends StatefulWidget { 5 | @override 6 | State createState() { 7 | return ScrollHomePageState(); 8 | } 9 | } 10 | 11 | class ScrollHomePageState extends State { 12 | @override 13 | Widget build(BuildContext context) { 14 | return Scaffold( 15 | appBar: new AppBar( 16 | title: Text(" 配制"), 17 | ), 18 | 19 | ///SingleChildScrollView 20 | ///NestedScrollView 21 | /// 处理滑动 22 | body: buildCustomScrollView(), 23 | ); 24 | } 25 | 26 | CustomScrollView buildCustomScrollView() { 27 | return CustomScrollView( 28 | ///反弹效果 29 | physics: BouncingScrollPhysics(), 30 | 31 | ///Sliver 家族的 Widget 32 | slivers: [ 33 | ///复杂的标题 34 | buildSliverAppBar(), 35 | 36 | ///间距 37 | SliverPadding( 38 | padding: EdgeInsets.all(5), 39 | ), 40 | 41 | ///九宫格 42 | buildSliverGrid(), 43 | 44 | ///间距 45 | SliverPadding( 46 | padding: EdgeInsets.all(5), 47 | ), 48 | 49 | ///列表 50 | buildSliverFixedExtentList() 51 | ], 52 | ); 53 | } 54 | 55 | SliverAppBar buildSliverAppBar() { 56 | return SliverAppBar( 57 | title: Text("讲解组合滑动"), 58 | ); 59 | } 60 | 61 | SliverGrid buildSliverGrid() { 62 | return SliverGrid( 63 | gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( 64 | ///九宫格的列数 65 | crossAxisCount: 3, 66 | ///子Widget 宽与高的比值 67 | childAspectRatio: 2.0, 68 | ///主方向的 两个 子Widget 之间的间距 69 | mainAxisSpacing: 10, 70 | /// 次方向 子Widget 之间的间距 71 | crossAxisSpacing: 10, 72 | ), 73 | ///子Item构建器 74 | delegate: new SliverChildBuilderDelegate( 75 | (BuildContext context, num index) { 76 | ///每一个子Item的样式 77 | return Container( 78 | color: Colors.blue, 79 | child: Text("grid $index"), 80 | ); 81 | }, 82 | ///子Item的个数 83 | childCount: 10, 84 | ), 85 | ); 86 | } 87 | 88 | SliverFixedExtentList buildSliverFixedExtentList() { 89 | return SliverFixedExtentList( 90 | ///子条目的高度 91 | itemExtent: 40, 92 | ///子条目布局构建代理 93 | delegate: new SliverChildBuilderDelegate( 94 | (BuildContext context, num index) { 95 | ///子条目的布局样式 96 | return Container( 97 | color: Colors.red, 98 | child: Text("list $index"), 99 | margin: EdgeInsets.only(bottom: 10), 100 | ); 101 | }, 102 | ///子条目的个数 103 | childCount: 40, 104 | ), 105 | ); 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /lib/scroll/main_scroll.dart: -------------------------------------------------------------------------------- 1 | 2 | 3 | import 'package:flutter/cupertino.dart'; 4 | import 'package:flutter/material.dart'; 5 | 6 | import 'customscroll_demo2_page.dart'; 7 | import 'customscroll_demo_page.dart'; 8 | import 'customscroll_home_page.dart'; 9 | import 'netscroll_home_page.dart'; 10 | import 'scroll_home_page.dart'; 11 | 12 | ///flutter应用程序中的入口函数 13 | void main()=>runApp(SwitchMainApp()); 14 | ///应用的根布局 15 | class SwitchMainApp extends StatelessWidget{ 16 | @override 17 | Widget build(BuildContext context) { 18 | ///构建Materia Desin 风格的应用程序 19 | return MaterialApp( 20 | ///Android应用程序中任务栏中显示应用的名称 21 | title: " 配制", 22 | theme: ThemeData( 23 | accentColor: Colors.blue, 24 | ///默认是 Brightness.light 25 | brightness: Brightness.light, 26 | ), 27 | ///默认的首页面 28 | // home: ScrollHomePage(), 29 | // home: NetScrollHomePage(), 30 | // home: CustomScrollHomePage(), 31 | // home: CustomScrollDemoPage(), 32 | home: CustomScrollDemo2Page(), 33 | ); 34 | } 35 | } 36 | 37 | 38 | -------------------------------------------------------------------------------- /lib/scroll/scroll_home_page.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:flutter/cupertino.dart'; 3 | import 'package:flutter/material.dart'; 4 | 5 | class ScrollHomePage extends StatefulWidget { 6 | @override 7 | State createState() { 8 | return ScrollHomePageState(); 9 | } 10 | } 11 | 12 | class ScrollHomePageState extends State { 13 | bool selecA = false; 14 | bool selecB = true; 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return Scaffold( 19 | appBar: new AppBar( 20 | title: Text(" 配制"), 21 | ), 22 | 23 | ///SingleChildScrollView 处理滑动视图,允许有一个子widget 在超出视图的情况滑动 24 | body: SingleChildScrollView( 25 | ///设置 SingleChildScrollView 滑动方向 竖直方向 Axis.vertical 26 | scrollDirection:Axis.horizontal , 27 | ///是否滑动到底部 true 滑动到底部 28 | reverse: false, 29 | ///设置内边距 30 | padding: EdgeInsets.all(20), 31 | ///设置滑动反弹效果 BouncingScrollPhysics 32 | /// 无滑动反弹效果 ClampingScrollPhysics 33 | /// SingleChildScrollView 不可滑动 NeverScrollableScrollPhysics 34 | physics:NeverScrollableScrollPhysics() , 35 | child: Container( 36 | width: 800, 37 | height: 800, 38 | color: Colors.grey, 39 | child: Text("这里是 SingleChildScrollView"), 40 | ), 41 | ), 42 | ); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /lib/shake/test_shak_bottom_middle_button_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:shake_animation_widget/shake_animation_widget.dart'; 4 | 5 | /// 创建人: Created by zhaolong 6 | /// 创建时间:Created by on 2020/10/31. 7 | /// 8 | /// 可关注公众号:我的大前端生涯 获取最新技术分享 9 | /// 可关注网易云课堂:https://study.163.com/instructor/1021406098.htm 10 | /// 可关注博客:https://blog.csdn.net/zl18603543572 11 | /// 12 | 13 | void main() { 14 | runApp(RootPage()); 15 | } 16 | 17 | 18 | ///仿开源中国APP底部弹出菜单 19 | class RootPage extends StatelessWidget { 20 | @override 21 | Widget build(BuildContext context) { 22 | return MaterialApp( 23 | home: HomePage(), 24 | ); 25 | } 26 | } 27 | 28 | class HomePage extends StatefulWidget { 29 | @override 30 | _TestPageState createState() => _TestPageState(); 31 | } 32 | 33 | class _TestPageState extends State { 34 | @override 35 | Widget build(BuildContext context) { 36 | return Scaffold( 37 | appBar: AppBar( 38 | title: Text("测试"), 39 | ), 40 | body: Container( 41 | //填充 42 | constraints: BoxConstraints.expand(), 43 | //层叠布局 44 | child: Stack( 45 | children: [ 46 | buildContainer(), 47 | ], 48 | ), 49 | ), 50 | ); 51 | } 52 | 53 | Container buildContainer() { 54 | return Container( 55 | child: BottomRoundFlowMenu( 56 | //菜单图标组 57 | iconList: [ 58 | Icon( 59 | Icons.backup_table_sharp, 60 | color: Colors.white, 61 | ), 62 | Icon(Icons.aspect_ratio, color: Colors.white), 63 | Icon(Icons.medical_services, color: Colors.white), 64 | Icon(Icons.add, color: Colors.white), 65 | ], 66 | iconBackgroundColorList: [ 67 | Colors.deepOrangeAccent, 68 | Colors.deepPurple, 69 | Colors.blueGrey, 70 | Colors.blueAccent, 71 | ], 72 | //点击事件回调 73 | clickCallBack: (int index) {}, 74 | ), 75 | ); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /lib/shake/test_shak_right_float_button_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:shake_animation_widget/shake_animation_widget.dart'; 4 | 5 | /// 创建人: Created by zhaolong 6 | /// 创建时间:Created by on 2020/10/31. 7 | /// 8 | /// 可关注公众号:我的大前端生涯 获取最新技术分享 9 | /// 可关注网易云课堂:https://study.163.com/instructor/1021406098.htm 10 | /// 可关注博客:https://blog.csdn.net/zl18603543572 11 | /// 12 | 13 | void main() { 14 | runApp(RootPage()); 15 | } 16 | 17 | class RootPage extends StatelessWidget { 18 | @override 19 | Widget build(BuildContext context) { 20 | return MaterialApp( 21 | home: HomePage(), 22 | ); 23 | } 24 | } 25 | 26 | class HomePage extends StatefulWidget { 27 | @override 28 | _TestPageState createState() => _TestPageState(); 29 | } 30 | 31 | class _TestPageState extends State { 32 | @override 33 | Widget build(BuildContext context) { 34 | return Scaffold( 35 | appBar: AppBar( 36 | title: Text("测试"), 37 | ), 38 | body: Container( 39 | //填充 40 | constraints: BoxConstraints.expand(), 41 | //层叠布局 42 | child: Stack( 43 | children: [ 44 | //页面中的其他布局 45 | //右侧向上弹出的动画菜单 46 | buildContainer(), 47 | ], 48 | ), 49 | ), 50 | ); 51 | } 52 | 53 | Container buildContainer() { 54 | return Container( 55 | child: RoteFlowButtonMenu( 56 | //菜单图标组 57 | iconList: [ 58 | Icon( 59 | Icons.backup_table_sharp, 60 | color: Colors.white, 61 | ), 62 | Icon(Icons.aspect_ratio, color: Colors.white), 63 | Icon(Icons.medical_services, color: Colors.white), 64 | Icon(Icons.add, color: Colors.white), 65 | ], 66 | //菜单项所使用的背景颜色 67 | iconBackgroundColorList: [ 68 | Colors.deepOrangeAccent, 69 | Colors.deepPurple, 70 | Colors.blueGrey, 71 | Colors.blueAccent, 72 | ], 73 | //点击事件回调 74 | clickCallBack: (int index) {}, 75 | ), 76 | ); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /lib/test_bottom_nvigationbar.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | /// 创建人: Created by zhaolong 5 | /// 创建时间:Created by on 2020/10/31. 6 | /// 7 | /// 可关注公众号:我的大前端生涯 获取最新技术分享 8 | /// 可关注网易云课堂:https://study.163.com/instructor/1021406098.htm 9 | /// 可关注博客:https://blog.csdn.net/zl18603543572 10 | /// 11 | /// 代码清单 12 | ///代码清单 13 | 14 | void main() { 15 | runApp(RootPage()); 16 | } 17 | 18 | class RootPage extends StatelessWidget { 19 | @override 20 | Widget build(BuildContext context) { 21 | return MaterialApp( 22 | home: HomePage(), 23 | ); 24 | } 25 | } 26 | 27 | class HomePage extends StatefulWidget { 28 | @override 29 | State createState() { 30 | return _HomePageState(); 31 | } 32 | } 33 | 34 | class _HomePageState extends State { 35 | @override 36 | Widget build(BuildContext context) { 37 | return Scaffold( 38 | //标题栏 39 | appBar: AppBar( 40 | title: Text("测试"), 41 | ), 42 | //页面主体 43 | body: homeItemList[_selectIndex], 44 | //底部菜单栏 45 | bottomNavigationBar: buildBottom(), 46 | ); 47 | } 48 | 49 | 50 | //所有的子页面 51 | List homeItemList = [ 52 | HomeItemPage(0), 53 | HomeItemPage(1), 54 | HomeItemPage(2), 55 | ]; 56 | //当前选中的页面 57 | int _selectIndex = 0; 58 | 59 | //底部菜单栏 60 | buildBottom() { 61 | return BottomNavigationBar( 62 | items: [ 63 | BottomNavigationBarItem(icon: Icon(Icons.home), label: "首页"), 64 | BottomNavigationBarItem(icon: Icon(Icons.message), label: "消息"), 65 | BottomNavigationBarItem(icon: Icon(Icons.people), label: "我的"), 66 | ], 67 | currentIndex: _selectIndex, //当前显示的页面索引 68 | //点击菜单栏的回调 69 | onTap: (int index) { 70 | setState(() { 71 | _selectIndex = index; 72 | }); 73 | }, 74 | ); 75 | } 76 | } 77 | 78 | class HomeItemPage extends StatelessWidget { 79 | int index = 0; 80 | HomeItemPage(this.index); 81 | 82 | @override 83 | Widget build(BuildContext context) { 84 | return Scaffold( 85 | backgroundColor: selectColor(), 86 | body: Container( 87 | child: Text("页面 $index"), 88 | ), 89 | ); 90 | } 91 | 92 | selectColor() { 93 | if (index == 0) { 94 | return Colors.grey; 95 | } else if (index == 1) { 96 | return Colors.blueGrey; 97 | } else { 98 | return Colors.green; 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /lib/test_common_login_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:animations/animations.dart'; 2 | import 'package:flutter/cupertino.dart'; 3 | import 'package:flutter/gestures.dart'; 4 | import 'package:flutter/material.dart'; 5 | 6 | /// 创建人: Created by zhaolong 7 | /// 创建时间:Created by on 2020/10/31. 8 | /// 9 | /// 可关注公众号:我的大前端生涯 获取最新技术分享 10 | /// 可关注网易云课堂:https://study.163.com/instructor/1021406098.htm 11 | /// 可关注博客:https://blog.csdn.net/zl18603543572 12 | /// 13 | /// 代码清单 14 | ///代码清单 15 | 16 | void main() { 17 | runApp(RootPage()); 18 | } 19 | 20 | class RootPage extends StatelessWidget { 21 | @override 22 | Widget build(BuildContext context) { 23 | return MaterialApp( 24 | home: HomePage(), 25 | ); 26 | } 27 | } 28 | 29 | class HomePage extends StatefulWidget { 30 | @override 31 | _TestPageState createState() => _TestPageState(); 32 | } 33 | 34 | class _TestPageState extends State { 35 | @override 36 | Widget build(BuildContext context) { 37 | return Scaffold( 38 | appBar: AppBar( 39 | title: Text("测试"), 40 | ), 41 | body: Container( 42 | margin: EdgeInsets.all(20), 43 | child: InkWell( 44 | onTap: (){ 45 | print("点击 了图片"); 46 | }, 47 | child: Image.asset( 48 | "assets/images/banner3.webp", 49 | fit: BoxFit.fill, 50 | ), 51 | ), 52 | ), 53 | ); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /lib/test_custom_button.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:flutter/cupertino.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter/services.dart'; 6 | import 'package:flutter_custom_camera_pugin/flutter_custom_camera_pugin.dart'; 7 | 8 | /// 创建人: Created by zhaolong 9 | /// 创建时间:Created by on 2020/9/9. 10 | /// 11 | /// 可关注公众号:我的大前端生涯 获取最新技术分享 12 | /// 可关注网易云课堂:https://study.163.com/instructor/1021406098.htm 13 | /// 可关注博客:https://blog.csdn.net/zl18603543572 14 | class TestCustomCameraPage extends StatefulWidget { 15 | @override 16 | _TestPageState createState() => _TestPageState(); 17 | } 18 | 19 | //lib/code/main_data.dart 20 | class _TestPageState extends State { 21 | CameraResultInfo _cameraResultInfo; 22 | 23 | @override 24 | void initState() { 25 | super.initState(); 26 | } 27 | 28 | Future testPlugin() async { 29 | CameraResultInfo platformVersion; 30 | 31 | try { 32 | platformVersion = await FlutterCustomCameraPugin.testPugin(); 33 | } on PlatformException { 34 | platformVersion = CameraResultInfo.fromError(); 35 | } 36 | if (!mounted) return; 37 | 38 | setState(() { 39 | _cameraResultInfo = platformVersion; 40 | }); 41 | } 42 | 43 | @override 44 | Widget build(BuildContext context) { 45 | return MaterialApp( 46 | home: Scaffold( 47 | appBar: AppBar( 48 | title: const Text(' Flutter 的一个 Button '), 49 | ), 50 | body: Column( 51 | crossAxisAlignment: CrossAxisAlignment.center, 52 | children: [ 53 | Container( 54 | width: 80, 55 | height: 80, 56 | padding: EdgeInsets.all(10), 57 | decoration: BoxDecoration( 58 | borderRadius: BorderRadius.circular(50), 59 | color: Colors.blue.withOpacity(.4)), 60 | child: InkWell( 61 | onTap: () {}, 62 | child: Stack(children: [ 63 | Container( 64 | width: 60, 65 | height: 60, 66 | decoration: BoxDecoration( 67 | shape: BoxShape.circle, color: Colors.blue), 68 | child: Icon( 69 | Icons.arrow_forward, 70 | color: Colors.white, 71 | ), 72 | ), 73 | ]), 74 | ), 75 | ) 76 | ], 77 | ), 78 | ), 79 | ); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /lib/test_drag_and_drop_gridview_widget.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:flutter/cupertino.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter/services.dart'; 6 | import 'package:flutter_custom_camera_pugin/flutter_custom_camera_pugin.dart'; 7 | 8 | /// 创建人: Created by zhaolong 9 | /// 创建时间:Created by on 2020/9/9. 10 | /// 11 | /// 可关注公众号:我的大前端生涯 获取最新技术分享 12 | /// 可关注网易云课堂:https://study.163.com/instructor/1021406098.htm 13 | /// 可关注博客:https://blog.csdn.net/zl18603543572 14 | class TestDropGridPage extends StatefulWidget { 15 | @override 16 | _TestPageState createState() => _TestPageState(); 17 | } 18 | 19 | //lib/code/main_data.dart 20 | class _TestPageState extends State { 21 | List _imageUris = [ 22 | "https://images.pexels.com/photos/4466054/pexels-photo-4466054.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940", 23 | "https://images.pexels.com/photos/4561739/pexels-photo-4561739.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500", 24 | "https://images.pexels.com/photos/4507967/pexels-photo-4507967.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500", 25 | "https://images.pexels.com/photos/4321194/pexels-photo-4321194.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500", 26 | "https://images.pexels.com/photos/1053924/pexels-photo-1053924.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500", 27 | "https://images.pexels.com/photos/1624438/pexels-photo-1624438.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260", 28 | "https://images.pexels.com/photos/1144687/pexels-photo-1144687.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260", 29 | "https://images.pexels.com/photos/2589010/pexels-photo-2589010.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" 30 | ]; 31 | 32 | int variableSet = 0; 33 | ScrollController _scrollController; 34 | double width; 35 | double height; 36 | 37 | @override 38 | void initState() { 39 | super.initState(); 40 | } 41 | 42 | @override 43 | Widget build(BuildContext context) { 44 | return MaterialApp( 45 | home: Scaffold( 46 | appBar: AppBar( 47 | title: const Text('Drag And drop Plugging'), 48 | ), 49 | body: Container()) 50 | ); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /lib/test_orientation_widget.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:flutter/cupertino.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter/services.dart'; 6 | import 'package:flutter/services.dart'; 7 | import 'package:flutter/services.dart'; 8 | import 'package:flutter_custom_camera_pugin/flutter_custom_camera_pugin.dart'; 9 | 10 | /// 创建人: Created by zhaolong 11 | /// 创建时间:Created by on 2020/9/9. 12 | /// 13 | /// 可关注公众号:我的大前端生涯 获取最新技术分享 14 | /// 可关注网易云课堂:https://study.163.com/instructor/1021406098.htm 15 | /// 可关注博客:https://blog.csdn.net/zl18603543572 16 | class TestOrientationPage extends StatefulWidget { 17 | @override 18 | _TestPageState createState() => _TestPageState(); 19 | } 20 | 21 | //lib/code/main_data.dart 22 | class _TestPageState extends State { 23 | String testStr = ''; 24 | 25 | @override 26 | void initState() { 27 | super.initState(); 28 | SystemChrome.setPreferredOrientations([DeviceOrientation.landscapeLeft]); 29 | } 30 | 31 | @override 32 | Widget build(BuildContext context) { 33 | return MaterialApp( 34 | home: Scaffold( 35 | appBar: AppBar( title: const Text(' Flutter 横竖屏切换 '),), 36 | // 在方向改变时 重新构建 37 | body: OrientationBuilder(builder: (context, orientation) { 38 | if (orientation == Orientation.portrait) { 39 | testStr = '竖屏'; 40 | } else { 41 | testStr = '横屏'; 42 | } 43 | 44 | 45 | 46 | return buildBodyFunction(); 47 | }), 48 | ), 49 | ); 50 | } 51 | 52 | Column buildBodyFunction() { 53 | return Column( 54 | crossAxisAlignment: CrossAxisAlignment.center, 55 | children: [ 56 | Text("当前:$testStr"), 57 | OutlineButton( 58 | child: Text('打开相机'), 59 | onPressed: () {}, 60 | ), 61 | ], 62 | ); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /lib/test_progress_home_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class ProgressHomePage extends StatefulWidget { 5 | @override 6 | State createState() { 7 | return ProgressHomePagePageState(); 8 | } 9 | } 10 | 11 | class ProgressHomePagePageState extends State { 12 | @override 13 | void initState() { 14 | super.initState(); 15 | } 16 | 17 | double sliderVlaue = 50; 18 | 19 | @override 20 | Widget build(BuildContext context) { 21 | double width = MediaQuery.of(context).size.width; 22 | return Scaffold( 23 | appBar: AppBar( 24 | title: Text("ProgressHomePage"), 25 | ), 26 | body: SingleChildScrollView( 27 | child: Column( 28 | children: [ 29 | Text("圆形"), 30 | Container( 31 | width: width, 32 | height: 300, 33 | alignment: Alignment.center, 34 | color: Colors.grey, 35 | child: buildSizedBox(), 36 | ), 37 | Text("条形"), 38 | Container( 39 | width: width, 40 | height: 300, 41 | alignment: Alignment.center, 42 | color: Colors.grey, 43 | child: buildLinearProgressIndicator(), 44 | ) 45 | ], 46 | ), 47 | ), 48 | ); 49 | } 50 | 51 | LinearProgressIndicator buildLinearProgressIndicator() { 52 | return LinearProgressIndicator( 53 | ///背景色 54 | backgroundColor: Colors.white, 55 | /// 前景色 56 | valueColor: AlwaysStoppedAnimation(Colors.red), 57 | ); 58 | } 59 | 60 | SizedBox buildSizedBox() { 61 | return SizedBox( 62 | width: 44, 63 | height: 44, 64 | child: CircularProgressIndicator( 65 | ///背景色 66 | backgroundColor: Colors.white, 67 | 68 | /// 前景色 69 | /// AlwaysStoppedAnimation 动画的类型 Always 总是 Stopped 停止 70 | valueColor: AlwaysStoppedAnimation(Colors.red), 71 | ), 72 | ); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /lib/test_right_float_button_page.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:flutter/cupertino.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:shake_animation_widget/shake_animation_widget.dart'; 5 | 6 | /// 创建人: Created by zhaolong 7 | /// 创建时间:Created by on 2020/10/31. 8 | /// 9 | /// 可关注公众号:我的大前端生涯 获取最新技术分享 10 | /// 可关注网易云课堂:https://study.163.com/instructor/1021406098.htm 11 | /// 可关注博客:https://blog.csdn.net/zl18603543572 12 | /// 13 | /// 代码清单 向上浮动弹出的效果 14 | ///代码清单 15 | 16 | void main() { 17 | runApp(RootPage()); 18 | } 19 | 20 | class RootPage extends StatelessWidget { 21 | @override 22 | Widget build(BuildContext context) { 23 | return MaterialApp( 24 | home: HomePage(), 25 | ); 26 | } 27 | } 28 | 29 | class HomePage extends StatefulWidget { 30 | @override 31 | _TestPageState createState() => _TestPageState(); 32 | } 33 | 34 | class _TestPageState extends State { 35 | 36 | @override 37 | Widget build(BuildContext context) { 38 | return Scaffold( 39 | appBar: AppBar( 40 | title: Text("测试"), 41 | ), 42 | body: Container( 43 | //填充 44 | constraints: BoxConstraints.expand(), 45 | //层叠布局 46 | child: Stack( 47 | children: [ 48 | 49 | Positioned( 50 | right: 33, 51 | bottom: 33, 52 | //悬浮按钮 53 | child: RoteFloatingButton( 54 | //菜单图标组 55 | iconList: [ 56 | Icon(Icons.add), 57 | Icon(Icons.message), 58 | Icon(Icons.aspect_ratio), 59 | ], 60 | //点击事件回调 61 | clickCallback: (int index){ 62 | 63 | }, 64 | ), 65 | ), 66 | 67 | ], 68 | ), 69 | ), 70 | ); 71 | } 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | //定义菜单按钮选项 95 | List iconList = [ 96 | Icon(Icons.add), 97 | Icon(Icons.save_outlined), 98 | Icon(Icons.share), 99 | ]; 100 | 101 | ///向上弹出的按钮组件 102 | RoteFloatingButton buildRoteFloatingButton() { 103 | return RoteFloatingButton( 104 | //子菜单按钮选项 105 | iconList: iconList, 106 | ///子菜单按钮的点击事件回调 107 | clickCallback: (int index) { 108 | print("点击了按钮$index"); 109 | 110 | }, 111 | ); 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /lib/test_slider_home_page.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:flutter/cupertino.dart'; 3 | import 'package:flutter/material.dart'; 4 | 5 | class SliderHomePage extends StatefulWidget { 6 | @override 7 | State createState() { 8 | return SliderHomePageState(); 9 | } 10 | } 11 | 12 | class SliderHomePageState extends State { 13 | @override 14 | void initState() { 15 | super.initState(); 16 | } 17 | 18 | double sliderVlaue = 50; 19 | 20 | @override 21 | Widget build(BuildContext context) { 22 | double width = MediaQuery.of(context).size.width; 23 | return Scaffold( 24 | appBar: AppBar( 25 | title: Text("SliderHome"), 26 | ), 27 | body: SingleChildScrollView( 28 | child: Column( 29 | children: [ 30 | Container( 31 | width: width, 32 | height: 300, 33 | alignment: Alignment.center, 34 | color: Colors.grey, 35 | 36 | /// Slider 是fluter 应用开发中的滑动条 37 | /// value 38 | child: Slider( 39 | ///当前进度值 40 | value: sliderVlaue, 41 | ///最小值 42 | min: 0, 43 | ///最大值 44 | max: 100, 45 | ///滑动时回调 46 | onChanged: (value) { 47 | setState(() { 48 | sliderVlaue = value; 49 | },); 50 | }, 51 | activeColor: Colors.red, 52 | inactiveColor: Colors.blue, 53 | label: "这是滑动的", 54 | ), 55 | ) 56 | ], 57 | ), 58 | ), 59 | ); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /lib/test_splash_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_html_rich_text/flutter_html_rich_text.dart'; 4 | import 'package:liquid_swipe/liquid_swipe.dart'; 5 | /// 创建人: Created by zhaolong 6 | /// 创建时间:Created by on 2020/9/9. 7 | /// 8 | /// 可关注公众号:我的大前端生涯 获取最新技术分享 9 | /// 可关注网易云课堂:https://study.163.com/instructor/1021406098.htm 10 | /// 可关注博客:https://blog.csdn.net/zl18603543572 11 | /// 代码清单 1-3-1 12 | class LiquidSwipeDemo extends StatefulWidget { 13 | LiquidSwipeDemo({Key key}) : super(key: key); 14 | 15 | @override 16 | _demoState createState() => _demoState(); 17 | } 18 | 19 | class _demoState extends State { 20 | 21 | WaveType currentAnimate=WaveType.liquidReveal; 22 | 23 | void changeAnimate(){ 24 | setState(() { 25 | if(currentAnimate==WaveType.liquidReveal){ 26 | currentAnimate=WaveType.circularReveal; 27 | }else{ 28 | currentAnimate=WaveType.liquidReveal; 29 | } 30 | }); 31 | } 32 | 33 | @override 34 | Widget build(BuildContext context) { 35 | return Scaffold( 36 | appBar: AppBar( 37 | title: Text("liquid_swipe"), 38 | actions: [ 39 | ], 40 | ), 41 | body: LiquidSwipe( 42 | pages: [ 43 | Container( 44 | color: Colors.blue, 45 | child: Center( 46 | child: FlatButton( 47 | child: Text("切换效果"), 48 | onPressed: (){ 49 | changeAnimate(); 50 | }, 51 | ), 52 | ), 53 | ), 54 | Container( 55 | color: Colors.pink, 56 | ), 57 | Container( 58 | color: Colors.teal, 59 | child: ConstrainedBox( 60 | child:Image.network('http://hbimg.b0.upaiyun.com/c9d0ae1ea6dafe5b7af0e2387e161778d7a146b83f571-ByOb1k_fw658', 61 | fit: BoxFit.cover,), 62 | constraints: new BoxConstraints.expand(), 63 | ) 64 | ), 65 | ], 66 | fullTransitionValue: 200, 67 | enableSlideIcon: true, 68 | enableLoop: true, 69 | positionSlideIcon: 0.5, 70 | waveType: currentAnimate, 71 | onPageChangeCallback: (page) => pageChangeCallback(page), 72 | currentUpdateTypeCallback: (updateType) => updateTypeCallback(updateType), 73 | ), 74 | ); 75 | } 76 | 77 | pageChangeCallback(int page) { 78 | print(page); 79 | } 80 | updateTypeCallback(UpdateType updateType) { 81 | print(updateType); 82 | } 83 | } -------------------------------------------------------------------------------- /lib/test_tabbar_home_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_test_app/custom_tabbar.dart'; 4 | 5 | class TestTabBarHomePage extends StatefulWidget { 6 | @override 7 | State createState() { 8 | return SliderHomePageState(); 9 | } 10 | } 11 | 12 | class SliderHomePageState extends State with SingleTickerProviderStateMixin { 13 | ///Tab 与 TabView 联动使用的控制器 14 | TabController tabController; 15 | //当前显示页面的 16 | int currentIndex = 0; 17 | //点击导航项是要显示的页面 18 | final pages = [Text("首页"), Text("发现"), Text("动态"), Text("我的")]; 19 | 20 | @override 21 | void initState() { 22 | ///初始化,这个函数在生命周期中只调用一次 23 | super.initState(); 24 | tabController = new TabController(length: pages.length, vsync: this); 25 | } 26 | 27 | @override 28 | Widget build(BuildContext context) { 29 | return new Scaffold( 30 | appBar: AppBar( 31 | title: Text("测试 Tab "), 32 | bottom: buildPreferredSize(), 33 | ), 34 | body: new TabBarView(controller: tabController, children: pages), 35 | ); 36 | } 37 | 38 | PreferredSize buildPreferredSize() { 39 | return PreferredSize( 40 | preferredSize: Size(0, 84), 41 | child: buildTheme(), 42 | ); 43 | } 44 | 45 | 46 | 47 | Widget buildTabBar() { 48 | return new TabBar( 49 | controller: tabController, 50 | tabs: [ 51 | new Tab(text: "首页", icon: new Icon(Icons.home)), 52 | new Tab(text: "发现", icon: new Icon(Icons.find_in_page)), 53 | new Tab(text: "动态", icon: new Icon(Icons.message)), 54 | new Tab(text: "我的", icon: new Icon(Icons.person)), 55 | ], 56 | indicatorWeight: 0.1, 57 | ); 58 | } 59 | 60 | Widget testCustomTabBar(){ 61 | return CustomTabBar(controller: null,); 62 | } 63 | 64 | Theme buildTheme() { 65 | return Theme( 66 | data: ThemeData( 67 | ///默认显示的背影颜色 68 | backgroundColor: Colors.blue[500], 69 | ///点击的高亮颜色 70 | highlightColor: Colors.blueGrey[600], 71 | ///水波纹颜色 72 | splashColor: Color.fromRGBO(0, 0, 0, 0), 73 | ), 74 | child: new TabBar( 75 | controller: tabController, 76 | tabs: [ 77 | new Tab(text: "首页", icon: new Icon(Icons.home)), 78 | new Tab(text: "发现", icon: new Icon(Icons.find_in_page)), 79 | new Tab(text: "动态", icon: new Icon(Icons.message)), 80 | new Tab(text: "我的", icon: new Icon(Icons.person)), 81 | ], 82 | indicatorWeight: 0.1, 83 | ), 84 | ); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /lib/test_warrp_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_html_rich_text/flutter_html_rich_text.dart'; 4 | import 'package:liquid_swipe/liquid_swipe.dart'; 5 | /// 创建人: Created by zhaolong 6 | /// 创建时间:Created by on 2020/9/9. 7 | /// 8 | /// 可关注公众号:我的大前端生涯 获取最新技术分享 9 | /// 可关注网易云课堂:https://study.163.com/instructor/1021406098.htm 10 | /// 可关注博客:https://blog.csdn.net/zl18603543572 11 | /// 代码清单 1-3-1 12 | class LiquidSwipeDemo extends StatefulWidget { 13 | LiquidSwipeDemo({Key key}) : super(key: key); 14 | 15 | @override 16 | _demoState createState() => _demoState(); 17 | } 18 | 19 | class _demoState extends State { 20 | 21 | WaveType currentAnimate=WaveType.liquidReveal; 22 | 23 | void changeAnimate(){ 24 | setState(() { 25 | if(currentAnimate==WaveType.liquidReveal){ 26 | currentAnimate=WaveType.circularReveal; 27 | }else{ 28 | currentAnimate=WaveType.liquidReveal; 29 | } 30 | }); 31 | } 32 | 33 | @override 34 | Widget build(BuildContext context) { 35 | return Scaffold( 36 | appBar: AppBar( 37 | title: Text("liquid_swipe"), 38 | actions: [ 39 | ], 40 | ), 41 | body: LiquidSwipe( 42 | pages: [ 43 | Container( 44 | color: Colors.blue, 45 | child: Center( 46 | child: FlatButton( 47 | child: Text("切换效果"), 48 | onPressed: (){ 49 | changeAnimate(); 50 | }, 51 | ), 52 | ), 53 | ), 54 | Container( 55 | color: Colors.pink, 56 | ), 57 | Container( 58 | color: Colors.teal, 59 | child: ConstrainedBox( 60 | child:Image.network('http://hbimg.b0.upaiyun.com/c9d0ae1ea6dafe5b7af0e2387e161778d7a146b83f571-ByOb1k_fw658', 61 | fit: BoxFit.cover,), 62 | constraints: new BoxConstraints.expand(), 63 | ) 64 | ), 65 | ], 66 | fullTransitionValue: 200, 67 | enableSlideIcon: true, 68 | enableLoop: true, 69 | positionSlideIcon: 0.5, 70 | waveType: currentAnimate, 71 | onPageChangeCallback: (page) => pageChangeCallback(page), 72 | currentUpdateTypeCallback: (updateType) => updateTypeCallback(updateType), 73 | ), 74 | ); 75 | } 76 | 77 | pageChangeCallback(int page) { 78 | print(page); 79 | } 80 | updateTypeCallback(UpdateType updateType) { 81 | print(updateType); 82 | } 83 | } -------------------------------------------------------------------------------- /lib/tk/demo1/constants.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | Color primaryTextColor = Color(0xFF414C6B); 4 | Color secondaryTextColor = Color(0xFFE4979E); 5 | Color titleTextColor = Colors.white; 6 | Color contentTextColor = Color(0xff868686); 7 | Color navigationColor = Color(0xFF6751B5); 8 | Color gradientStartColor = Color(0xFF0050AC); 9 | Color gradientEndColor = Color(0xFF9354B9); -------------------------------------------------------------------------------- /lib/tk/demo1/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'home_page.dart'; 3 | 4 | void main() { 5 | runApp(MyApp()); 6 | } 7 | 8 | class MyApp extends StatelessWidget { 9 | // This widget is the root of your application. 10 | @override 11 | Widget build(BuildContext context) { 12 | return MaterialApp( 13 | title: 'Flutter Demo', 14 | theme: ThemeData( 15 | primarySwatch: Colors.blue, 16 | visualDensity: VisualDensity.adaptivePlatformDensity, 17 | ), 18 | home: HomePage(), 19 | debugShowCheckedModeBanner: false, 20 | ); 21 | } 22 | } -------------------------------------------------------------------------------- /lib/tk/demo2/flare_demo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_test_app/tk/demo2/smart_flare_animation.dart'; 3 | 4 | class FlareDemo extends StatefulWidget { 5 | @override 6 | _FlareDemoState createState() => _FlareDemoState(); 7 | } 8 | 9 | class _FlareDemoState extends State { 10 | @override 11 | Widget build(BuildContext context) { 12 | return Scaffold( 13 | backgroundColor: Color.fromARGB(255, 102, 18, 222), 14 | body: Align( 15 | alignment: Alignment.bottomCenter, 16 | child: SmartFlareAnimation())); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /lib/tk/demo2/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import 'flare_demo.dart'; 4 | 5 | void main() => runApp(MyApp()); 6 | 7 | class MyApp extends StatelessWidget { 8 | // This widget is the root of your application. 9 | @override 10 | Widget build(BuildContext context) { 11 | return MaterialApp( 12 | title: 'Flutter Demo', 13 | theme: ThemeData( 14 | primarySwatch: Colors.blue, 15 | ), 16 | home: FlareDemo()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /lib/tk/demo3/components/search_box.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_svg/flutter_svg.dart'; 3 | 4 | import '../constants.dart'; 5 | 6 | class SearchBox extends StatelessWidget { 7 | const SearchBox({ 8 | Key key, 9 | this.onChanged, 10 | }) : super(key: key); 11 | 12 | final ValueChanged onChanged; 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return Container( 17 | margin: EdgeInsets.all(kDefaultPadding), 18 | padding: EdgeInsets.symmetric( 19 | horizontal: kDefaultPadding, 20 | vertical: kDefaultPadding / 4, // 5 top and bottom 21 | ), 22 | decoration: BoxDecoration( 23 | color: Colors.white.withOpacity(0.4), 24 | borderRadius: BorderRadius.circular(12), 25 | ), 26 | child: TextField( 27 | onChanged: onChanged, 28 | style: TextStyle(color: Colors.white), 29 | decoration: InputDecoration( 30 | enabledBorder: InputBorder.none, 31 | focusedBorder: InputBorder.none, 32 | icon: SvgPicture.asset("assets/images/search.svg"), 33 | hintText: 'Search', 34 | hintStyle: TextStyle(color: Colors.white), 35 | ), 36 | ), 37 | ); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/tk/demo3/constants.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | // list of colors that we use in our app 4 | const kBackgroundColor = Color(0xFFF1EFF1); 5 | const kPrimaryColor = Color(0xFF035AA6); 6 | const kSecondaryColor = Color(0xFFFFA41B); 7 | const kTextColor = Color(0xFF000839); 8 | const kTextLightColor = Color(0xFF747474); 9 | const kBlueColor = Color(0xFF40BAD5); 10 | 11 | const kDefaultPadding = 20.0; 12 | 13 | // our default Shadow 14 | const kDefaultShadow = BoxShadow( 15 | offset: Offset(0, 15), 16 | blurRadius: 27, 17 | color: Colors.black12, // Black color with 12% opacity 18 | ); 19 | -------------------------------------------------------------------------------- /lib/tk/demo3/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_test_app/tk/demo3/screens/product/products_screen.dart'; 3 | import 'package:google_fonts/google_fonts.dart'; 4 | 5 | import 'constants.dart'; 6 | 7 | void main() { 8 | runApp(MyApp()); 9 | } 10 | 11 | class MyApp extends StatelessWidget { 12 | // This widget is the root of your application. 13 | @override 14 | Widget build(BuildContext context) { 15 | return MaterialApp( 16 | debugShowCheckedModeBanner: false, 17 | title: 'Furniture app', 18 | theme: ThemeData( 19 | // We set Poppins as our default font 20 | textTheme: GoogleFonts.poppinsTextTheme(Theme.of(context).textTheme), 21 | primaryColor: kPrimaryColor, 22 | accentColor: kPrimaryColor, 23 | visualDensity: VisualDensity.adaptivePlatformDensity, 24 | ), 25 | home: ProductsScreen(), 26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/tk/demo3/models/product.dart: -------------------------------------------------------------------------------- 1 | class Product { 2 | final int id, price; 3 | final String title, description, image; 4 | 5 | Product({this.id, this.price, this.title, this.description, this.image}); 6 | } 7 | 8 | // list of products 9 | // for our demo 10 | List products = [ 11 | Product( 12 | id: 1, 13 | price: 56, 14 | title: "Classic Leather Arm Chair", 15 | image: "assets/images/Item_1.png", 16 | description: 17 | "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim", 18 | ), 19 | Product( 20 | id: 4, 21 | price: 68, 22 | title: "Poppy Plastic Tub Chair", 23 | image: "assets/images/Item_2.png", 24 | description: 25 | "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim", 26 | ), 27 | Product( 28 | id: 9, 29 | price: 39, 30 | title: "Bar Stool Chair", 31 | image: "assets/images/Item_3.png", 32 | description: 33 | "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim", 34 | ), 35 | ]; 36 | -------------------------------------------------------------------------------- /lib/tk/demo3/screens/details/components/chat_and_add_to_cart.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_svg/svg.dart'; 3 | 4 | import '../../../constants.dart'; 5 | 6 | class ChatAndAddToCart extends StatelessWidget { 7 | const ChatAndAddToCart({ 8 | Key key, 9 | }) : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return Container( 14 | margin: EdgeInsets.all(kDefaultPadding), 15 | padding: EdgeInsets.symmetric( 16 | horizontal: kDefaultPadding, 17 | vertical: kDefaultPadding / 2, 18 | ), 19 | decoration: BoxDecoration( 20 | color: Color(0xFFFCBF1E), 21 | borderRadius: BorderRadius.circular(30), 22 | ), 23 | child: Row( 24 | children: [ 25 | SvgPicture.asset( 26 | "assets/icons/chat.svg", 27 | height: 18, 28 | ), 29 | SizedBox(width: kDefaultPadding / 2), 30 | Text( 31 | "Chat", 32 | style: TextStyle(color: Colors.white), 33 | ), 34 | // it will cover all available spaces 35 | Spacer(), 36 | FlatButton.icon( 37 | onPressed: () {}, 38 | icon: SvgPicture.asset( 39 | "assets/icons/shopping-bag.svg", 40 | height: 18, 41 | ), 42 | label: Text( 43 | "Add to Cart", 44 | style: TextStyle(color: Colors.white), 45 | ), 46 | ), 47 | ], 48 | ), 49 | ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /lib/tk/demo3/screens/details/components/color_dots.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import '../../../constants.dart'; 4 | 5 | class ColorDot extends StatelessWidget { 6 | const ColorDot({ 7 | Key key, 8 | this.fillColor, 9 | // by default we set it false 10 | this.isSelected = false, 11 | }) : super(key: key); 12 | final Color fillColor; 13 | final bool isSelected; 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return Container( 18 | margin: 19 | // left and right padding 8 20 | EdgeInsets.symmetric(horizontal: kDefaultPadding / 2.5), 21 | padding: EdgeInsets.all(3), 22 | height: 24, 23 | width: 24, 24 | decoration: BoxDecoration( 25 | shape: BoxShape.circle, 26 | border: Border.all( 27 | color: isSelected ? Color(0xFF707070) : Colors.transparent, 28 | ), 29 | ), 30 | child: Container( 31 | decoration: BoxDecoration( 32 | shape: BoxShape.circle, 33 | color: fillColor, 34 | ), 35 | ), 36 | ); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/tk/demo3/screens/details/components/list_of_colors.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import '../../../constants.dart'; 4 | import 'color_dots.dart'; 5 | 6 | class ListOfColors extends StatelessWidget { 7 | const ListOfColors({ 8 | Key key, 9 | }) : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return Padding( 14 | padding: const EdgeInsets.symmetric(vertical: kDefaultPadding), 15 | child: Row( 16 | mainAxisAlignment: MainAxisAlignment.center, 17 | children: [ 18 | ColorDot( 19 | fillColor: Color(0xFF80989A), 20 | isSelected: true, 21 | ), 22 | ColorDot( 23 | fillColor: Color(0xFFFF5200), 24 | ), 25 | ColorDot( 26 | fillColor: kPrimaryColor, 27 | ), 28 | ], 29 | ), 30 | ); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/tk/demo3/screens/details/components/product_image.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import '../../../constants.dart'; 4 | 5 | class ProductPoster extends StatelessWidget { 6 | const ProductPoster({ 7 | Key key, 8 | @required this.size, 9 | this.image, 10 | }) : super(key: key); 11 | 12 | final Size size; 13 | final String image; 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return Container( 18 | margin: EdgeInsets.symmetric(vertical: kDefaultPadding), 19 | // the height of this container is 80% of our width 20 | height: size.width * 0.8, 21 | 22 | child: Stack( 23 | alignment: Alignment.bottomCenter, 24 | children: [ 25 | Container( 26 | height: size.width * 0.7, 27 | width: size.width * 0.7, 28 | decoration: BoxDecoration( 29 | color: Colors.white, 30 | shape: BoxShape.circle, 31 | ), 32 | ), 33 | Image.asset( 34 | image, 35 | height: size.width * 0.75, 36 | width: size.width * 0.75, 37 | fit: BoxFit.cover, 38 | ), 39 | ], 40 | ), 41 | ); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /lib/tk/demo3/screens/details/details_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_svg/svg.dart'; 3 | import 'package:flutter_test_app/tk/demo3/constants.dart'; 4 | import 'package:flutter_test_app/tk/demo3/models/product.dart'; 5 | 6 | import 'components/body.dart'; 7 | 8 | class DetailsScreen extends StatelessWidget { 9 | final Product product; 10 | 11 | const DetailsScreen({Key key, this.product}) : super(key: key); 12 | @override 13 | Widget build(BuildContext context) { 14 | return Scaffold( 15 | backgroundColor: kPrimaryColor, 16 | appBar: buildAppBar(context), 17 | body: Body( 18 | product: product, 19 | ), 20 | ); 21 | } 22 | 23 | AppBar buildAppBar(BuildContext context) { 24 | return AppBar( 25 | backgroundColor: kBackgroundColor, 26 | elevation: 0, 27 | leading: IconButton( 28 | padding: EdgeInsets.only(left: kDefaultPadding), 29 | icon: SvgPicture.asset("assets/icons/back.svg"), 30 | onPressed: () { 31 | Navigator.pop(context); 32 | }, 33 | ), 34 | centerTitle: false, 35 | title: Text( 36 | 'Back'.toUpperCase(), 37 | style: Theme.of(context).textTheme.bodyText2, 38 | ), 39 | actions: [ 40 | IconButton( 41 | icon: SvgPicture.asset('assets/icons/cart_with_item.svg'), 42 | onPressed: () {}, 43 | ), 44 | ], 45 | ); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /lib/tk/demo3/screens/product/components/body.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_test_app/tk/demo3/components/search_box.dart'; 3 | import 'package:flutter_test_app/tk/demo3/constants.dart'; 4 | import 'package:flutter_test_app/tk/demo3/models/product.dart'; 5 | import 'package:flutter_test_app/tk/demo3/screens/details/details_screen.dart'; 6 | 7 | import 'category_list.dart'; 8 | import 'product_card.dart'; 9 | 10 | class Body extends StatelessWidget { 11 | @override 12 | Widget build(BuildContext context) { 13 | return SafeArea( 14 | bottom: false, 15 | child: Column( 16 | children: [ 17 | SearchBox(onChanged: (value) {}), 18 | CategoryList(), 19 | SizedBox(height: kDefaultPadding / 2), 20 | Expanded( 21 | child: Stack( 22 | children: [ 23 | // Our background 24 | Container( 25 | margin: EdgeInsets.only(top: 70), 26 | decoration: BoxDecoration( 27 | color: kBackgroundColor, 28 | borderRadius: BorderRadius.only( 29 | topLeft: Radius.circular(40), 30 | topRight: Radius.circular(40), 31 | ), 32 | ), 33 | ), 34 | ListView.builder( 35 | // here we use our demo procuts list 36 | itemCount: products.length, 37 | itemBuilder: (context, index) => ProductCard( 38 | itemIndex: index, 39 | product: products[index], 40 | press: () { 41 | Navigator.push( 42 | context, 43 | MaterialPageRoute( 44 | builder: (context) => DetailsScreen( 45 | product: products[index], 46 | ), 47 | ), 48 | ); 49 | }, 50 | ), 51 | ) 52 | ], 53 | ), 54 | ), 55 | ], 56 | ), 57 | ); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /lib/tk/demo3/screens/product/components/category_list.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import '../../../constants.dart'; 4 | 5 | // We need statefull widget because we are gonna change some state on our category 6 | class CategoryList extends StatefulWidget { 7 | @override 8 | _CategoryListState createState() => _CategoryListState(); 9 | } 10 | 11 | class _CategoryListState extends State { 12 | // by default first item will be selected 13 | int selectedIndex = 0; 14 | List categories = ['All', 'Sofa', 'Park bench', 'Armchair']; 15 | @override 16 | Widget build(BuildContext context) { 17 | return Container( 18 | margin: EdgeInsets.symmetric(vertical: kDefaultPadding / 2), 19 | height: 30, 20 | child: ListView.builder( 21 | scrollDirection: Axis.horizontal, 22 | itemCount: categories.length, 23 | itemBuilder: (context, index) => GestureDetector( 24 | onTap: () { 25 | setState(() { 26 | selectedIndex = index; 27 | }); 28 | }, 29 | child: Container( 30 | alignment: Alignment.center, 31 | margin: EdgeInsets.only( 32 | left: kDefaultPadding, 33 | // At end item it add extra 20 right padding 34 | right: index == categories.length - 1 ? kDefaultPadding : 0, 35 | ), 36 | padding: EdgeInsets.symmetric(horizontal: kDefaultPadding), 37 | decoration: BoxDecoration( 38 | color: index == selectedIndex 39 | ? Colors.white.withOpacity(0.4) 40 | : Colors.transparent, 41 | borderRadius: BorderRadius.circular(6), 42 | ), 43 | child: Text( 44 | categories[index], 45 | style: TextStyle(color: Colors.white), 46 | ), 47 | ), 48 | ), 49 | ), 50 | ); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /lib/tk/demo3/screens/product/products_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_svg/svg.dart'; 3 | import 'package:flutter_test_app/tk/demo3/constants.dart'; 4 | 5 | import 'components/body.dart'; 6 | 7 | class ProductsScreen extends StatelessWidget { 8 | @override 9 | Widget build(BuildContext context) { 10 | return Scaffold( 11 | appBar: buildAppBar(), 12 | backgroundColor: kPrimaryColor, 13 | body: Body(), 14 | ); 15 | } 16 | 17 | AppBar buildAppBar() { 18 | return AppBar( 19 | elevation: 0, 20 | centerTitle: false, 21 | title: Text('Dashboard'), 22 | actions: [ 23 | IconButton( 24 | icon: SvgPicture.asset("assets/images/notification.svg"), 25 | onPressed: () {}, 26 | ), 27 | ], 28 | ); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/tk/demo4/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:clip_shadow/clip_shadow.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_custom_clippers/flutter_custom_clippers.dart'; 4 | import 'package:flutter_test_app/tk/demo4/style.dart'; 5 | import 'package:flutter_test_app/tk/demo4/widgets/iconbutton.dart'; 6 | 7 | void main() => runApp(MyApp()); 8 | 9 | class MyApp extends StatelessWidget { 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return MaterialApp( 14 | theme: ThemeData( 15 | primarySwatch: Colors.blue, 16 | ), 17 | home: MyHomePage(), 18 | ); 19 | } 20 | } 21 | 22 | class MyHomePage extends StatefulWidget { 23 | MyHomePage({Key key}) : super(key: key); 24 | 25 | @override 26 | _MyHomePageState createState() => _MyHomePageState(); 27 | } 28 | 29 | class _MyHomePageState extends State { 30 | bool isSelected = false; 31 | 32 | @override 33 | Widget build(BuildContext context) { 34 | return Scaffold( 35 | backgroundColor: Color(0XffCDDEEC), 36 | body: Padding( 37 | padding: const EdgeInsets.all(22.0), 38 | child: Column( 39 | mainAxisAlignment: MainAxisAlignment.start, 40 | crossAxisAlignment: CrossAxisAlignment.center, 41 | children: [ 42 | SizedBox( 43 | height: 80, 44 | ), 45 | ClipShadow( 46 | clipper: RoundedDiagonalPathClipper(), 47 | boxShadow: softUiShadow, 48 | child: Container( 49 | height: 450, 50 | decoration: BoxDecoration( 51 | borderRadius: BorderRadius.all(Radius.circular(36.0)), 52 | color: Color(0XffCDDEEC), 53 | ), 54 | child: Column( 55 | mainAxisAlignment: MainAxisAlignment.start, 56 | children: [ 57 | SizedBox( 58 | height: 60, 59 | ), 60 | Row( 61 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 62 | children: [ 63 | CustomIconButton(iconName: Icons.dehaze,) 64 | ], 65 | ), 66 | ], 67 | ), 68 | ), 69 | ), 70 | SizedBox( 71 | height: 50, 72 | ), 73 | ], 74 | ), 75 | ), 76 | ); 77 | } 78 | } 79 | 80 | 81 | -------------------------------------------------------------------------------- /lib/tk/demo4/style.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | const backgroundGradient = LinearGradient(colors: [ 4 | Color(0XffE5EEF4), 5 | Color(0XffCDDEEC), 6 | ], begin: Alignment.topCenter, end: Alignment.bottomCenter); 7 | 8 | List softUiShadow = [ 9 | BoxShadow( 10 | color: Colors.white, 11 | offset: Offset(-5, -5), 12 | spreadRadius: 1, 13 | blurRadius: 15, 14 | ), 15 | BoxShadow( 16 | color: Color(0XFF748CAC).withOpacity(.6), 17 | offset: Offset(5, 5), 18 | spreadRadius: 1, 19 | blurRadius: 15, 20 | ), 21 | ]; 22 | 23 | const activeGradient = LinearGradient( 24 | colors: [ 25 | Color(0Xffc94b4b), 26 | Color(0Xff4b134f), 27 | ], 28 | begin: Alignment.centerLeft, 29 | end: Alignment.centerRight, 30 | ); 31 | 32 | List iconBtns = [ 33 | Icons.directions_run, 34 | Icons.donut_small, 35 | Icons.track_changes, 36 | Icons.tune 37 | ]; 38 | -------------------------------------------------------------------------------- /lib/tk/demo4/widgets/iconbutton.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import '../style.dart'; 4 | 5 | class CustomIconButton extends StatefulWidget { 6 | 7 | final IconData iconName; 8 | 9 | const CustomIconButton({Key key, this.iconName}) : super(key: key); 10 | 11 | 12 | @override 13 | _CustomIconButtonState createState() => _CustomIconButtonState(); 14 | } 15 | 16 | class _CustomIconButtonState extends State { 17 | bool _active = false; 18 | 19 | 20 | 21 | @override 22 | Widget build(BuildContext context) { 23 | return GestureDetector( 24 | onTap: (){ 25 | setState(() { 26 | _active= !_active; 27 | }); 28 | }, 29 | child: Container( 30 | height: 60, 31 | width: 60, 32 | decoration: BoxDecoration( 33 | borderRadius: BorderRadius.circular(10), 34 | color: Color(0xFFEFF4F8), 35 | boxShadow: softUiShadow, 36 | gradient: _active ? activeGradient : null, 37 | ), 38 | child: Center( 39 | child: Icon( 40 | widget.iconName, 41 | size: 30, 42 | color: _active ? Colors.white : Colors.black, 43 | ), 44 | ), 45 | ), 46 | ); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/tk/demo5/consttants.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | const kBlackColor = Color(0xFF393939); 4 | const kLightBlackColor = Color(0xFF8F8F8F); 5 | const kIconColor = Color(0xFFF48A37); 6 | const kProgressIndicator = Color(0xFFBE7066); 7 | 8 | final kShadowColor = Color(0xFFD3D3D3).withOpacity(.84); 9 | -------------------------------------------------------------------------------- /lib/tk/demo5/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test_app/tk/demo5/consttants.dart'; 2 | import 'package:flutter_test_app/tk/demo5/screens/home_screen.dart'; 3 | import 'package:flutter_test_app/tk/demo5/widgets/rounded_button.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_test_app/tk/demo5/widgets/rounded_button.dart'; 6 | 7 | import 'consttants.dart'; 8 | 9 | void main() => runApp(MyApp()); 10 | 11 | class MyApp extends StatelessWidget { 12 | // This widget is the root of your application. 13 | @override 14 | Widget build(BuildContext context) { 15 | return MaterialApp( 16 | debugShowCheckedModeBanner: false, 17 | title: 'Book App', 18 | theme: ThemeData( 19 | scaffoldBackgroundColor: Colors.white, 20 | textTheme: Theme.of(context).textTheme.apply( 21 | displayColor: kBlackColor, 22 | ), 23 | ), 24 | home: WelcomeScreen(), 25 | ); 26 | } 27 | } 28 | 29 | class WelcomeScreen extends StatelessWidget { 30 | @override 31 | Widget build(BuildContext context) { 32 | return Scaffold( 33 | body: Container( 34 | width: double.infinity, 35 | decoration: BoxDecoration( 36 | image: DecorationImage( 37 | image: AssetImage("assets/images/Bitmap.png"), 38 | fit: BoxFit.fill, 39 | ), 40 | ), 41 | child: Column( 42 | mainAxisAlignment: MainAxisAlignment.center, 43 | children: [ 44 | RichText( 45 | text: TextSpan( 46 | style: Theme.of(context).textTheme.display3, 47 | children: [ 48 | TextSpan( 49 | text: "flamin", 50 | ), 51 | TextSpan( 52 | text: "go.", 53 | style: TextStyle(fontWeight: FontWeight.bold), 54 | ), 55 | ], 56 | ), 57 | ), 58 | SizedBox( 59 | width: MediaQuery.of(context).size.width * .6, 60 | child: RoundedButton( 61 | text: "start reading", 62 | fontSize: 20, 63 | press: () { 64 | Navigator.push( 65 | context, 66 | MaterialPageRoute( 67 | builder: (context) { 68 | return HomeScreen(); 69 | }, 70 | ), 71 | ); 72 | }, 73 | ), 74 | ), 75 | ], 76 | ), 77 | ), 78 | ); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/tk/demo5/widgets/book_rating.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test_app/tk/demo5/consttants.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class BookRating extends StatelessWidget { 5 | final double score; 6 | const BookRating({ 7 | Key key, 8 | this.score, 9 | }) : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return Container( 14 | padding: EdgeInsets.symmetric(vertical: 8, horizontal: 6), 15 | decoration: BoxDecoration( 16 | color: Colors.white, 17 | borderRadius: BorderRadius.circular(16), 18 | boxShadow: [ 19 | BoxShadow( 20 | offset: Offset(3, 7), 21 | blurRadius: 20, 22 | color: Color(0xFD3D3D3).withOpacity(.5), 23 | ), 24 | ], 25 | ), 26 | child: Column( 27 | children: [ 28 | Icon( 29 | Icons.star, 30 | color: kIconColor, 31 | size: 15, 32 | ), 33 | SizedBox(height: 5), 34 | Text( 35 | "$score", 36 | style: TextStyle( 37 | fontSize: 12, 38 | fontWeight: FontWeight.bold, 39 | ), 40 | ), 41 | ], 42 | ), 43 | ); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /lib/tk/demo5/widgets/rounded_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class RoundedButton extends StatelessWidget { 4 | 5 | final String text; 6 | final Function press; 7 | final double verticalPadding; 8 | final double horizontalPadding; 9 | final double fontSize; 10 | 11 | RoundedButton({ 12 | Key key, 13 | this.text, 14 | this.press, 15 | this.verticalPadding = 16, 16 | this.horizontalPadding = 30, 17 | this.fontSize = 16, 18 | }) : super(key: key); 19 | 20 | @override 21 | Widget build(BuildContext context) { 22 | return GestureDetector( 23 | onTap: press, 24 | child: Container( 25 | width: double.infinity, 26 | alignment: Alignment.center, 27 | margin: EdgeInsets.symmetric(vertical: 16), 28 | padding: 29 | EdgeInsets.symmetric(vertical: verticalPadding, horizontal: horizontalPadding), 30 | decoration: BoxDecoration( 31 | color: Colors.white, 32 | borderRadius: BorderRadius.circular(30), 33 | boxShadow: [ 34 | BoxShadow( 35 | offset: Offset(0, 15), 36 | blurRadius: 30, 37 | color: Color(0xFF666666).withOpacity(.11), 38 | ), 39 | ], 40 | ), 41 | child: Text( 42 | text, 43 | style: TextStyle( 44 | fontSize: fontSize, 45 | fontWeight: FontWeight.bold, 46 | ), 47 | ), 48 | ), 49 | ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /lib/tk/demo5/widgets/two_side_rounded_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test_app/tk/demo5/consttants.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class TwoSideRoundedButton extends StatelessWidget { 5 | final String text; 6 | final double radious; 7 | final Function press; 8 | const TwoSideRoundedButton({ 9 | Key key, 10 | this.text, 11 | this.radious = 29, 12 | this.press, 13 | }) : super(key: key); 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return GestureDetector( 18 | onTap: press, 19 | child: Container( 20 | alignment: Alignment.center, 21 | padding: EdgeInsets.symmetric(vertical: 10), 22 | decoration: BoxDecoration( 23 | color: kBlackColor, 24 | borderRadius: BorderRadius.only( 25 | topLeft: Radius.circular(radious), 26 | bottomRight: Radius.circular(radious), 27 | ), 28 | ), 29 | child: Text( 30 | text, 31 | style: TextStyle(color: Colors.white), 32 | ), 33 | ), 34 | ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/tk/demo6/components/appbar.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_test_app/tk/demo6/config/colors.dart'; 3 | import 'package:flutter_test_app/tk/demo6/config/size.dart'; 4 | 5 | 6 | class CustomAppBar extends StatelessWidget { 7 | @override 8 | Widget build(BuildContext context) { 9 | var height = SizeConfig.getHeight(context); 10 | var width = SizeConfig.getWidth(context); 11 | double fontSize(double size) { 12 | return size * width / 414; 13 | } 14 | 15 | return Container( 16 | margin: EdgeInsets.symmetric(horizontal: width / 20), 17 | child: Row( 18 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 19 | children: [ 20 | Container( 21 | child: Text( 22 | "Michael's Account", 23 | style: 24 | TextStyle(fontWeight: FontWeight.bold, fontSize: 25), 25 | )), 26 | Container( 27 | height: width / 6, 28 | width: width / 6, 29 | decoration: BoxDecoration( 30 | color: AppColors.primaryWhite, 31 | boxShadow: AppColors.neumorpShadow, 32 | shape: BoxShape.circle), 33 | child: Stack( 34 | children: [ 35 | Center( 36 | child: Container( 37 | margin: EdgeInsets.all(6), 38 | decoration: BoxDecoration( 39 | color: Colors.orange, shape: BoxShape.circle), 40 | ), 41 | ), 42 | Center( 43 | child: Container( 44 | margin: EdgeInsets.all(11), 45 | decoration: BoxDecoration( 46 | color: AppColors.primaryWhite, 47 | boxShadow: AppColors.neumorpShadow, 48 | shape: BoxShape.circle), 49 | ), 50 | ), 51 | Center( 52 | child: Icon(Icons.settings), 53 | ) 54 | ], 55 | ), 56 | ) 57 | ], 58 | ), 59 | ); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /lib/tk/demo6/components/arrowbutton.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_test_app/tk/demo6/config/colors.dart'; 3 | import 'package:flutter_test_app/tk/demo6/config/size.dart'; 4 | 5 | 6 | class ArrowButton extends StatelessWidget { 7 | final EdgeInsets margin; 8 | final Widget icon; 9 | ArrowButton({this.margin, this.icon}); 10 | @override 11 | Widget build(BuildContext context) { 12 | var height = SizeConfig.getHeight(context); 13 | var width = SizeConfig.getWidth(context); 14 | return Expanded( 15 | child: Container( 16 | margin: margin, 17 | decoration: BoxDecoration( 18 | color: AppColors.primaryWhite, 19 | borderRadius: BorderRadius.circular(15), 20 | boxShadow: AppColors.neumorpShadow), 21 | alignment: Alignment.center, 22 | child: icon, 23 | ), 24 | ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/tk/demo6/config/colors.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class AppColors { 4 | static Color primaryWhite = Color(0xFFCADCED); 5 | // static Color primaryWhite = Colors.indigo[100]; 6 | 7 | static List pieColors = [ 8 | Colors.indigo[400], 9 | Colors.blue, 10 | Colors.green, 11 | Colors.amber, 12 | Colors.deepOrange, 13 | Colors.brown, 14 | ]; 15 | static List neumorpShadow = [ 16 | BoxShadow( 17 | color: Colors.white.withOpacity(1.0), spreadRadius: -8, offset: Offset(-5, -5), blurRadius: 30), 18 | BoxShadow( 19 | color: Colors.blue[900].withOpacity(.2), 20 | spreadRadius: 2, 21 | 22 | offset: Offset(7, 7), 23 | blurRadius: 20) 24 | ]; 25 | } 26 | -------------------------------------------------------------------------------- /lib/tk/demo6/config/size.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | 3 | class SizeConfig { 4 | static getHeight(context) { 5 | return MediaQuery.of(context).size.height; 6 | } 7 | 8 | static getWidth(context) { 9 | return MediaQuery.of(context).size.width; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /lib/tk/demo6/config/strings.dart: -------------------------------------------------------------------------------- 1 | List category = [ 2 | {"name": "Groceries", "amount": 500.0}, 3 | {"name": "Online Shopping", "amount": 100.0}, 4 | {"name": "Eating Out", "amount": 80.0}, 5 | {"name": "Bills", "amount": 50.0}, 6 | {"name": "Subscriptions", "amount": 100.0}, 7 | {"name": "Fees", "amount": 30.0}, 8 | ]; 9 | -------------------------------------------------------------------------------- /lib/tk/demo6/dashboard.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import 'cardwidget.dart'; 4 | import 'components/appbar.dart'; 5 | import 'config/colors.dart'; 6 | import 'config/size.dart'; 7 | import 'expenseswidget.dart'; 8 | 9 | 10 | class DashboardPage extends StatefulWidget { 11 | @override 12 | _DashboardPageState createState() => _DashboardPageState(); 13 | } 14 | 15 | class _DashboardPageState extends State { 16 | @override 17 | Widget build(BuildContext context) { 18 | var height = SizeConfig.getHeight(context); 19 | var width = SizeConfig.getWidth(context); 20 | 21 | return Scaffold( 22 | body: Container( 23 | color: AppColors.primaryWhite, 24 | child: SafeArea( 25 | child: Column( 26 | children: [ 27 | Container( 28 | height: height / 8, 29 | child: CustomAppBar(), 30 | ), 31 | Expanded( 32 | child: CardWidget(), 33 | ), 34 | Expanded(child: ExpensesWidget()) 35 | ], 36 | ), 37 | ), 38 | ), 39 | ); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /lib/tk/demo6/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import 'dashboard.dart'; 4 | 5 | void main() => runApp(MyApp()); 6 | 7 | class MyApp extends StatelessWidget { 8 | // This widget is the root of your application. 9 | @override 10 | Widget build(BuildContext context) { 11 | return MaterialApp( 12 | title: 'Bank Expenses', 13 | home: DashboardPage(), 14 | theme: ThemeData(fontFamily: "Circular"), 15 | debugShowCheckedModeBanner: false, 16 | ); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /lib/tk/demo6/piechart/piechart.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_test_app/tk/demo6/config/colors.dart'; 3 | import 'package:flutter_test_app/tk/demo6/config/size.dart'; 4 | import 'package:flutter_test_app/tk/demo6/config/strings.dart'; 5 | import 'package:flutter_test_app/tk/demo6/piechart/piechartcustompainter.dart'; 6 | 7 | 8 | class PieChart extends StatefulWidget { 9 | @override 10 | _PieChartState createState() => _PieChartState(); 11 | } 12 | 13 | class _PieChartState extends State 14 | with SingleTickerProviderStateMixin { 15 | double total = 0; 16 | @override 17 | void initState() { 18 | 19 | super.initState(); 20 | category.forEach((e) => total += e['amount']); 21 | } 22 | 23 | @override 24 | Widget build(BuildContext context) { 25 | 26 | var width = SizeConfig.getWidth(context); 27 | double fontSize(double size) { 28 | return size * width / 414; 29 | } 30 | 31 | return LayoutBuilder( 32 | builder: (context, constraint) { 33 | return Container( 34 | decoration: BoxDecoration( 35 | color: AppColors.primaryWhite, 36 | shape: BoxShape.circle, 37 | boxShadow: AppColors.neumorpShadow), 38 | child: Stack( 39 | children: [ 40 | Center( 41 | child: SizedBox( 42 | width: constraint.maxWidth * 0.6, 43 | child: CustomPaint( 44 | child: Container(), 45 | foregroundPainter: PieChartCustomPainter( 46 | width: constraint.maxWidth * 0.5, 47 | categories: category, 48 | ), 49 | ), 50 | ), 51 | ), 52 | Center( 53 | child: Container( 54 | width: constraint.maxWidth * .5, 55 | decoration: BoxDecoration( 56 | color: AppColors.primaryWhite, 57 | shape: BoxShape.circle, 58 | boxShadow: [ 59 | BoxShadow( 60 | spreadRadius: 3, 61 | blurRadius: 5, 62 | offset: Offset(3, 3), 63 | color: Colors.black38) 64 | ]), 65 | child: Center( 66 | child: Text( 67 | "\$" + total.toString(), 68 | style: TextStyle( 69 | fontWeight: FontWeight.bold, fontSize: fontSize(22)), 70 | )), 71 | ), 72 | ) 73 | ], 74 | ), 75 | ); 76 | }, 77 | ); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /lib/tk/demo6/piechart/piechartcustompainter.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_test_app/tk/demo6/config/colors.dart'; 5 | 6 | class PieChartCustomPainter extends CustomPainter { 7 | final List categories; 8 | final double width; 9 | PieChartCustomPainter({this.categories, this.width}); 10 | @override 11 | void paint(Canvas canvas, Size size) { 12 | Offset center = Offset(size.width / 2, size.height / 2); 13 | double radius = min(size.width / 2, size.height / 2); 14 | double total = 0; 15 | double startRadian = -pi / 2; 16 | var paint = Paint() 17 | ..style = PaintingStyle.stroke 18 | ..strokeWidth = width / 1.8; 19 | categories.forEach((f) => total += f['amount']); 20 | for (var i = 0; i < categories.length; i++) { 21 | final currentCategory = categories[i]; 22 | final sweepRadian = (currentCategory['amount'] / total ) * 2 * pi; 23 | paint.color = AppColors.pieColors[i]; 24 | canvas.drawArc(Rect.fromCircle(center: center, radius: radius), 25 | startRadian, sweepRadian, false, paint); 26 | startRadian += sweepRadian; 27 | } 28 | } 29 | 30 | @override 31 | bool shouldRepaint(CustomPainter oldDelegate) => true; 32 | } 33 | -------------------------------------------------------------------------------- /lib/tk/demo7/Animations/FadeAnimation.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:simple_animations/simple_animations.dart'; 3 | 4 | class FadeAnimation extends StatelessWidget { 5 | final double delay; 6 | final Widget child; 7 | 8 | FadeAnimation(this.delay, this.child); 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | final tween = MultiTrackTween([ 13 | Track("opacity").add(Duration(milliseconds: 500), Tween(begin: 0.0, end: 1.0)), 14 | Track("translateY").add( 15 | Duration(milliseconds: 500), Tween(begin: -130.0, end: 0.0), 16 | curve: Curves.easeOut) 17 | ]); 18 | 19 | return ControlledAnimation( 20 | delay: Duration(milliseconds: (500 * delay).round()), 21 | duration: tween.duration, 22 | tween: tween, 23 | child: child, 24 | builderWithChild: (context, child, animation) => Opacity( 25 | opacity: animation["opacity"], 26 | child: Transform.translate( 27 | offset: Offset(0, animation["translateY"]), 28 | child: child 29 | ), 30 | ), 31 | ); 32 | } 33 | } -------------------------------------------------------------------------------- /lib/tk/demo7/LoginPage.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:flutter/material.dart'; 3 | 4 | import 'Animations/FadeAnimation.dart'; 5 | 6 | class LoginPage extends StatelessWidget { 7 | @override 8 | Widget build(BuildContext context) { 9 | return Scaffold( 10 | backgroundColor: Color.fromRGBO(3, 9, 23, 1), 11 | body: Container( 12 | padding: EdgeInsets.all(30), 13 | child: Column( 14 | crossAxisAlignment: CrossAxisAlignment.start, 15 | mainAxisAlignment: MainAxisAlignment.center, 16 | children: [ 17 | FadeAnimation(1.2, Text("Login", 18 | style: TextStyle(color: Colors.white, fontSize: 40, fontWeight: FontWeight.bold),)), 19 | SizedBox(height: 30,), 20 | FadeAnimation(1.5, Container( 21 | padding: EdgeInsets.all(10), 22 | decoration: BoxDecoration( 23 | borderRadius: BorderRadius.circular(10), 24 | color: Colors.white 25 | ), 26 | child: Column( 27 | children: [ 28 | Container( 29 | decoration: BoxDecoration( 30 | border: Border(bottom: BorderSide(color: Colors.grey[300])) 31 | ), 32 | child: TextField( 33 | decoration: InputDecoration( 34 | border: InputBorder.none, 35 | hintStyle: TextStyle(color: Colors.grey.withOpacity(.8)), 36 | hintText: "Email or Phone number" 37 | ), 38 | ), 39 | ), 40 | Container( 41 | decoration: BoxDecoration( 42 | ), 43 | child: TextField( 44 | decoration: InputDecoration( 45 | border: InputBorder.none, 46 | hintStyle: TextStyle(color: Colors.grey.withOpacity(.8)), 47 | hintText: "Password" 48 | ), 49 | ), 50 | ), 51 | ], 52 | ), 53 | )), 54 | SizedBox(height: 40,), 55 | FadeAnimation(1.8, Center( 56 | child: Container( 57 | width: 120, 58 | padding: EdgeInsets.all(15), 59 | decoration: BoxDecoration( 60 | borderRadius: BorderRadius.circular(50), 61 | color: Colors.blue[800] 62 | ), 63 | child: Center(child: Text("Login", style: TextStyle(color: Colors.white.withOpacity(.7)),)), 64 | ), 65 | )), 66 | ], 67 | ), 68 | ), 69 | ); 70 | } 71 | } -------------------------------------------------------------------------------- /lib/utils/DateUtils.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:intl/intl.dart'; 4 | 5 | /// 创建人: Created by zhaolong 6 | /// 创建时间:Created by on 2020/10/19. 7 | /// 8 | /// 可关注公众号:我的大前端生涯 获取最新技术分享 9 | /// 可关注网易云课堂:https://study.163.com/instructor/1021406098.htm 10 | /// 可关注博客:https://blog.csdn.net/zl18603543572 11 | /// 12 | /// 代码清单 13 | ///代码清单 14 | class DateUtils { 15 | 16 | ///获取默认格式的日期时间 17 | String getDefaultCurrentTime() { 18 | ///获取当前时间对象 19 | DateTime now = DateTime.now(); 20 | 21 | ///创建格式化对象 22 | DateFormat formatter = DateFormat('yy-MM-dd hh:mm:ss'); 23 | return formatter.format(now); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /pubimages/flutter_inspector.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaolongs/flutter_demo_app/bef039d29f69ea520a2494fd1e7a3137ad42d447/pubimages/flutter_inspector.gif -------------------------------------------------------------------------------- /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 | 9 | import 'package:flutter/material.dart'; 10 | import 'package:flutter_test/flutter_test.dart'; 11 | 12 | import 'package:flutter_test_app/main.dart'; 13 | 14 | void main() { 15 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 16 | // Build our app and trigger a frame. 17 | await tester.pumpWidget(MyApp()); 18 | 19 | // Verify that our counter starts at 0. 20 | expect(find.text('0'), findsOneWidget); 21 | expect(find.text('1'), findsNothing); 22 | 23 | // Tap the '+' icon and trigger a frame. 24 | await tester.tap(find.byIcon(Icons.add)); 25 | await tester.pump(); 26 | 27 | // Verify that our counter has incremented. 28 | expect(find.text('0'), findsNothing); 29 | expect(find.text('1'), findsOneWidget); 30 | }); 31 | 32 | testWidgets('testArray', (WidgetTester tester) async { 33 | List list = [4,6,7]; 34 | print(list); 35 | 36 | list.add(8);//[4,6,7,8] 37 | 38 | }); 39 | } 40 | --------------------------------------------------------------------------------