├── lib ├── router │ ├── route_handlers.dart │ └── routes.dart ├── pages │ ├── home │ │ ├── showcase_timeline.dart │ │ └── home_page.dart │ ├── message │ │ └── message_page.dart │ ├── bill │ │ ├── test.json │ │ ├── data.dart │ │ └── bill_page.dart │ ├── keep_account │ │ └── keep_account_page.dart │ ├── account_select │ │ └── account_select_page.dart │ ├── test │ │ ├── Item.dart │ │ ├── modal-screen.dart │ │ ├── dbhelper.dart │ │ ├── screens.dart │ │ └── test_page.dart │ ├── set │ │ └── set_page.dart │ ├── report │ │ ├── indicator.dart │ │ └── report_page.dart │ ├── balance_and_payments │ │ ├── indicator.dart │ │ └── pages.balance_and_payments_page.dart │ ├── mine │ │ ├── mine_ad_widget.dart │ │ └── mine_page.dart │ ├── encourage │ │ └── encourage_page.dart │ ├── register │ │ └── register_page.dart │ ├── login │ │ └── login_page.dart │ └── budget │ │ └── budget_page.dart ├── config │ ├── color.dart │ └── config.dart ├── utils │ ├── tool_util.dart │ ├── img_util.dart │ ├── navigator_util.dart │ ├── toast_util.dart │ ├── date_util.dart │ └── dio_util.dart ├── db │ ├── db_provider.dart │ ├── db_manager.dart │ └── provider │ │ └── user │ │ └── user_list_db_provider.dart ├── main.dart ├── dao │ └── user.dart ├── widgets │ ├── panel_widget.dart │ └── cell_widget.dart └── navigator │ └── tab_navigator.dart ├── ios ├── Flutter │ ├── Debug.xcconfig │ ├── Release.xcconfig │ └── AppFrameworkInfo.plist ├── Runner │ ├── Runner-Bridging-Header.h │ ├── Assets.xcassets │ │ ├── LaunchImage.imageset │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ ├── README.md │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ └── Contents.json │ ├── AppDelegate.swift │ ├── Base.lproj │ │ ├── Main.storyboard │ │ └── LaunchScreen.storyboard │ └── Info.plist ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── WorkspaceSettings.xcsettings │ │ └── IDEWorkspaceChecks.plist ├── Runner.xcodeproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ └── IDEWorkspaceChecks.plist │ ├── xcshareddata │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ └── project.pbxproj └── .gitignore ├── ui └── ui_01.jpg ├── asset └── images │ ├── empty.png │ ├── logo.png │ ├── zfbskm.jpg │ ├── icon_vip.png │ ├── ic_me_vip.png │ ├── icon_aixin.png │ ├── icon_fuli.png │ ├── icon_gongju.png │ ├── icon_jtcy.png │ ├── icon_kefu.png │ ├── icon_yusuan.png │ ├── ic_me_service.png │ ├── icon_biaoqian.png │ ├── account_banner.jpg │ ├── ic_me_yd_tab_ad.png │ ├── ic_mine_message.png │ ├── ic_mine_setting.png │ ├── ic_skin_home_me.png │ ├── ic_skin_home_bill.png │ ├── ic_skin_home_chart.png │ ├── ic_skin_home_finance.png │ ├── ic_skin_home_property.png │ ├── ic_vip_default_avatar.png │ ├── ic_skin_home_me_pressed.png │ ├── ic_skin_home_bill_pressed.png │ ├── ic_skin_home_chart_pressed.png │ ├── ic_skin_home_finance_pressed.png │ └── ic_skin_home_property_pressed.png ├── android ├── gradle.properties ├── .gitignore ├── app │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── drawable │ │ │ │ │ └── launch_background.xml │ │ │ │ └── values │ │ │ │ │ └── styles.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── flutter_pocket_book │ │ │ │ │ └── MainActivity.kt │ │ │ └── AndroidManifest.xml │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ └── profile │ │ │ └── AndroidManifest.xml │ └── build.gradle ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── settings.gradle └── build.gradle ├── .metadata ├── .gitignore ├── README.md ├── LICENSE ├── test └── widget_test.dart ├── pubspec.yaml └── pubspec.lock /lib/router/route_handlers.dart: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/pages/home/showcase_timeline.dart: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /lib/config/color.dart: -------------------------------------------------------------------------------- 1 | class Color { 2 | static const bottonColor = 'F55351'; 3 | } 4 | -------------------------------------------------------------------------------- /ui/ui_01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/ui/ui_01.jpg -------------------------------------------------------------------------------- /lib/config/config.dart: -------------------------------------------------------------------------------- 1 | class Config { 2 | static const baseUrl = 'https://www.baidu.com'; 3 | } 4 | -------------------------------------------------------------------------------- /asset/images/empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/asset/images/empty.png -------------------------------------------------------------------------------- /asset/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/asset/images/logo.png -------------------------------------------------------------------------------- /asset/images/zfbskm.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/asset/images/zfbskm.jpg -------------------------------------------------------------------------------- /asset/images/icon_vip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/asset/images/icon_vip.png -------------------------------------------------------------------------------- /asset/images/ic_me_vip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/asset/images/ic_me_vip.png -------------------------------------------------------------------------------- /asset/images/icon_aixin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/asset/images/icon_aixin.png -------------------------------------------------------------------------------- /asset/images/icon_fuli.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/asset/images/icon_fuli.png -------------------------------------------------------------------------------- /asset/images/icon_gongju.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/asset/images/icon_gongju.png -------------------------------------------------------------------------------- /asset/images/icon_jtcy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/asset/images/icon_jtcy.png -------------------------------------------------------------------------------- /asset/images/icon_kefu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/asset/images/icon_kefu.png -------------------------------------------------------------------------------- /asset/images/icon_yusuan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/asset/images/icon_yusuan.png -------------------------------------------------------------------------------- /asset/images/ic_me_service.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/asset/images/ic_me_service.png -------------------------------------------------------------------------------- /asset/images/icon_biaoqian.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/asset/images/icon_biaoqian.png -------------------------------------------------------------------------------- /asset/images/account_banner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/asset/images/account_banner.jpg -------------------------------------------------------------------------------- /asset/images/ic_me_yd_tab_ad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/asset/images/ic_me_yd_tab_ad.png -------------------------------------------------------------------------------- /asset/images/ic_mine_message.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/asset/images/ic_mine_message.png -------------------------------------------------------------------------------- /asset/images/ic_mine_setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/asset/images/ic_mine_setting.png -------------------------------------------------------------------------------- /asset/images/ic_skin_home_me.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/asset/images/ic_skin_home_me.png -------------------------------------------------------------------------------- /asset/images/ic_skin_home_bill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/asset/images/ic_skin_home_bill.png -------------------------------------------------------------------------------- /asset/images/ic_skin_home_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/asset/images/ic_skin_home_chart.png -------------------------------------------------------------------------------- /asset/images/ic_skin_home_finance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/asset/images/ic_skin_home_finance.png -------------------------------------------------------------------------------- /asset/images/ic_skin_home_property.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/asset/images/ic_skin_home_property.png -------------------------------------------------------------------------------- /asset/images/ic_vip_default_avatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/asset/images/ic_vip_default_avatar.png -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /asset/images/ic_skin_home_me_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/asset/images/ic_skin_home_me_pressed.png -------------------------------------------------------------------------------- /asset/images/ic_skin_home_bill_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/asset/images/ic_skin_home_bill_pressed.png -------------------------------------------------------------------------------- /asset/images/ic_skin_home_chart_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/asset/images/ic_skin_home_chart_pressed.png -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | -------------------------------------------------------------------------------- /asset/images/ic_skin_home_finance_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/asset/images/ic_skin_home_finance_pressed.png -------------------------------------------------------------------------------- /asset/images/ic_skin_home_property_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/asset/images/ic_skin_home_property_pressed.png -------------------------------------------------------------------------------- /lib/utils/tool_util.dart: -------------------------------------------------------------------------------- 1 | class Tool { 2 | static isEmpty(String str) { 3 | if (str == null || str == "") return true; 4 | return false; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /lib/utils/img_util.dart: -------------------------------------------------------------------------------- 1 | class Img { 2 | static getAssetsImg(String imgName) { 3 | assert(imgName != null); 4 | return "asset/images/" + imgName; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minimissile/flutter_pocket_book/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/flutter_pocket_book/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.flutter_pocket_book 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip 7 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /lib/utils/navigator_util.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/widgets.dart'; 3 | 4 | class NavigatorUtil { 5 | /// 跳转到指定页面 6 | static push(BuildContext context, Widget page) { 7 | Navigator.push(context, MaterialPageRoute(builder: (context) => page)); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /ios/Runner.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.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /lib/utils/toast_util.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:fluttertoast/fluttertoast.dart'; 3 | 4 | class Toast { 5 | static show(String msg) { 6 | Fluttertoast.showToast( 7 | msg: msg, 8 | gravity: ToastGravity.CENTER, 9 | backgroundColor: Colors.black54, 10 | ); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /.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: 8af6b2f038c1172e61d418869363a28dffec3cb4 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /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/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /lib/pages/message/message_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class MessagePage extends StatefulWidget { 4 | @override 5 | _MessagePageState createState() => _MessagePageState(); 6 | } 7 | 8 | class _MessagePageState extends State { 9 | @override 10 | Widget build(BuildContext context) { 11 | return Scaffold( 12 | appBar: AppBar( 13 | title: Text('消息中心'), 14 | centerTitle: true, 15 | elevation: 0, 16 | ), 17 | ); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/pages/bill/test.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "type": "信用卡", 4 | "name": "招商银行", 5 | "asset": 5000 6 | }, 7 | { 8 | "type": "信用卡", 9 | "name": "农业银行", 10 | "asset": 5000 11 | }, 12 | { 13 | "type": "投资账户", 14 | "name": "天天基金网", 15 | "asset": 5000 16 | }, 17 | { 18 | "type": "投资账户", 19 | "name": "华泰证券", 20 | "asset": 5000 21 | }, 22 | { 23 | "type": "信用卡", 24 | "name": "招商银行", 25 | "asset": 5000 26 | }, 27 | { 28 | "type": "现金", 29 | "name": "现金", 30 | "asset": 5000 31 | } 32 | ] -------------------------------------------------------------------------------- /lib/pages/keep_account/keep_account_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | /// 记账 4 | class KeepAccountPage extends StatefulWidget { 5 | @override 6 | _KeepAccountPageState createState() => _KeepAccountPageState(); 7 | } 8 | 9 | class _KeepAccountPageState extends State { 10 | @override 11 | Widget build(BuildContext context) { 12 | return Scaffold( 13 | appBar: AppBar( 14 | title: Text('记账'), 15 | ), 16 | body: Container( 17 | child: Text('记账页面'), 18 | ), 19 | ); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/pages/bill/data.dart: -------------------------------------------------------------------------------- 1 | class AccountData { 2 | String type; 3 | String name; 4 | int asset; 5 | 6 | AccountData({this.type, this.name, this.asset}); 7 | 8 | AccountData.fromJson(Map json) { 9 | type = json['type']; 10 | name = json['name']; 11 | asset = json['asset']; 12 | } 13 | 14 | Map toJson() { 15 | final Map data = new Map(); 16 | data['type'] = this.type; 17 | data['name'] = this.name; 18 | data['asset'] = this.asset; 19 | return data; 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /lib/pages/account_select/account_select_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | // 选择账户 4 | class AccountSelectPage extends StatefulWidget { 5 | @override 6 | _AccountSelectPageState createState() => _AccountSelectPageState(); 7 | } 8 | 9 | class _AccountSelectPageState extends State { 10 | @override 11 | Widget build(BuildContext context) { 12 | return Scaffold( 13 | appBar: AppBar( 14 | title: Text('选择账户类型'), 15 | ), 16 | body: ListView( 17 | children: [], 18 | ), 19 | ); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/utils/date_util.dart: -------------------------------------------------------------------------------- 1 | class DateUtil { 2 | /// 获取当月总天数 3 | static int getDaysNum(int year, int month) { 4 | if (month == 1 || 5 | month == 3 || 6 | month == 5 || 7 | month == 7 || 8 | month == 8 || 9 | month == 10 || 10 | month == 12) { 11 | return 31; 12 | } else if (month == 2) { 13 | if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) { 14 | //闰年 2月29 15 | return 29; 16 | } else { 17 | //平年 2月28 18 | return 28; 19 | } 20 | } else { 21 | return 30; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/pages/test/Item.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class Item extends StatefulWidget { 4 | final String title; 5 | 6 | Item({this.title}); 7 | 8 | @override 9 | _ItemState createState() => _ItemState(); 10 | } 11 | 12 | class _ItemState extends State { 13 | @override 14 | Widget build(BuildContext context) { 15 | return Container( 16 | child: Card( 17 | margin: EdgeInsets.only(left: 10.0, right: 10.0, top: 5.0, bottom: 5.0), 18 | child: Center( 19 | child: Text(widget.title), 20 | ), 21 | ), 22 | height: 100.0, 23 | ); 24 | } 25 | 26 | @override 27 | void dispose() { 28 | // TODO: implement dispose 29 | super.dispose(); 30 | } 31 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | /build/ 32 | 33 | # Web related 34 | lib/generated_plugin_registrant.dart 35 | 36 | # Symbolication related 37 | app.*.symbols 38 | 39 | # Obfuscation related 40 | app.*.map.json 41 | 42 | # Exceptions to above rules. 43 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 44 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /lib/pages/set/set_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class SetPage extends StatefulWidget { 4 | @override 5 | _SetPageState createState() => _SetPageState(); 6 | } 7 | 8 | class _SetPageState extends State { 9 | @override 10 | Widget build(BuildContext context) { 11 | return Scaffold( 12 | appBar: AppBar( 13 | title: Text('设置'), 14 | centerTitle: true, 15 | elevation: 0, 16 | ), 17 | body: ListView( 18 | children: [ 19 | Container( 20 | color: Colors.white12, 21 | child: Padding( 22 | padding: EdgeInsets.symmetric(horizontal: 15.0, vertical: 10.0), 23 | child: Text( 24 | '记账设置', 25 | style: TextStyle(fontSize: 14.0, color: Colors.black54), 26 | ), 27 | ), 28 | ) 29 | ], 30 | ), 31 | ); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 有钱记账 2 | 3 | > 换电脑后开发环境一直没搭成功,项目更新先搁置 4 | 5 | 基于flutter开发的全资产记账应用 6 | 7 | 8 | ## 期望 9 | 10 | > 一直想做一款全资产的记账软件,试用了市面上几十款应用,都离我的期待相差很远,刚好《网易有钱》现在不再维护了,它算是离我的预期最接近的一款了,所以决定在其基础之上继续完善,加入自己的想法,力争做出一款成熟的产品 11 | 12 | > 所谓的全资产管理,不单单局限于日常的收支统计,如今的投资理财多样化,基金、股票、现货、期货、外汇、银行理财、私募理财、虚拟货币投资、固定资产投资等等······五花八门, 13 | > 如何才能轻松的管理自己的资产,应该有不少人都有类似的困扰,这也是我想要挑战的难题 14 | 15 | 16 | ## 使用到的第三方库 17 | 18 | | 库 | 功能 | 19 | | ------------------------- | --------------- | 20 | | [fluro](https://pub.flutter-io.cn/packages/fluro) | **路由管理** | 21 | | [fluttertoast](https://pub.flutter-io.cn/packages/fluttertoast) | **吐司** | 22 | | [percent_indicator](https://pub.flutter-io.cn/packages/percent_indicator) | **进度条** | 23 | | [pull_to_refresh](https://pub.flutter-io.cn/packages/pull_to_refresh) | **下拉刷新** | 24 | | [sqflite](https://pub.flutter-io.cn/packages/sqflite) | **本地数据库** | 25 | 26 | 27 | ## 已实现的效果 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /lib/pages/report/indicator.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class Indicator extends StatelessWidget { 4 | final Color color; 5 | final String text; 6 | final bool isSquare; 7 | final double size; 8 | final Color textColor; 9 | 10 | const Indicator({ 11 | Key key, 12 | this.color, 13 | this.text, 14 | this.isSquare, 15 | this.size = 16, 16 | this.textColor = const Color(0xff505050), 17 | }) : super(key: key); 18 | 19 | @override 20 | Widget build(BuildContext context) { 21 | return Row( 22 | children: [ 23 | Container( 24 | width: size, 25 | height: size, 26 | decoration: BoxDecoration( 27 | shape: isSquare ? BoxShape.rectangle : BoxShape.circle, 28 | color: color, 29 | ), 30 | ), 31 | const SizedBox( 32 | width: 4, 33 | ), 34 | Text( 35 | text, 36 | style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: textColor), 37 | ) 38 | ], 39 | ); 40 | } 41 | } -------------------------------------------------------------------------------- /lib/pages/balance_and_payments/indicator.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class Indicator extends StatelessWidget { 4 | final Color color; 5 | final String text; 6 | final bool isSquare; 7 | final double size; 8 | final Color textColor; 9 | 10 | const Indicator({ 11 | Key key, 12 | this.color, 13 | this.text, 14 | this.isSquare, 15 | this.size = 16, 16 | this.textColor = const Color(0xff505050), 17 | }) : super(key: key); 18 | 19 | @override 20 | Widget build(BuildContext context) { 21 | return Row( 22 | children: [ 23 | Container( 24 | width: size, 25 | height: size, 26 | decoration: BoxDecoration( 27 | shape: isSquare ? BoxShape.rectangle : BoxShape.circle, 28 | color: color, 29 | ), 30 | ), 31 | const SizedBox( 32 | width: 4, 33 | ), 34 | Text( 35 | text, 36 | style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: textColor), 37 | ) 38 | ], 39 | ); 40 | } 41 | } -------------------------------------------------------------------------------- /lib/db/db_provider.dart: -------------------------------------------------------------------------------- 1 | import 'package:sqflite/sqflite.dart'; 2 | import 'package:meta/meta.dart'; 3 | import 'package:flutter_pocket_book/db/db_manager.dart'; 4 | 5 | /// 数据库操作基类 6 | abstract class BaseDbProvider { 7 | bool isTableExits = false; 8 | 9 | tableSqlString(); 10 | 11 | tableName(); 12 | 13 | ///创建表sql语句 14 | tableBaseString(String name, String columnId) { 15 | return ''' 16 | create table $name ( 17 | $columnId integer primary key autoincrement, 18 | '''; 19 | } 20 | 21 | Future getDataBase() async { 22 | return await open(); 23 | } 24 | 25 | ///super 函数对父类进行初始化 26 | @mustCallSuper 27 | prepare(name, String createSql) async { 28 | isTableExits = await DBManager.isTableExits(name); 29 | if (!isTableExits) { 30 | Database db = await DBManager.getCurrentDatabase(); 31 | return await db.execute(createSql); 32 | } 33 | } 34 | 35 | @mustCallSuper 36 | open() async { 37 | if (!isTableExits) { 38 | await prepare(tableName(), tableSqlString()); 39 | } 40 | return await DBManager.getCurrentDatabase(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 minimissile 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'package:fluro/fluro.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter/services.dart'; 5 | import 'package:flutter_pocket_book/router/routes.dart'; 6 | 7 | void main() { 8 | 9 | // 修改状态栏颜色 10 | SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.dark); 11 | 12 | runApp(MyApp()); 13 | // 透明状态栏 14 | if (Platform.isAndroid) { 15 | SystemUiOverlayStyle systemUiOverlayStyle = 16 | SystemUiOverlayStyle(statusBarColor: Colors.transparent); 17 | SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle); 18 | } 19 | } 20 | 21 | class MyApp extends StatelessWidget { 22 | @override 23 | Widget build(BuildContext context) { 24 | Router router = Router(); 25 | Routes.configureRoutes(router); 26 | 27 | return MaterialApp( 28 | title: '有钱记账', 29 | debugShowCheckedModeBanner: false, 30 | onGenerateRoute: router.generator, 31 | theme: ThemeData( 32 | primarySwatch: Colors.blue, 33 | visualDensity: VisualDensity.adaptivePlatformDensity, 34 | ), 35 | // home: TabNavigator() 36 | ); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/dao/user.dart: -------------------------------------------------------------------------------- 1 | //import 'package:flutter_pocket_book/db/db_provider.dart'; 2 | //import 'package:sqflite/sqflite.dart'; 3 | // 4 | //class User { 5 | // final String id; 6 | // final String account; 7 | // final String password; 8 | // 9 | // User(User msg, {this.id, this.account, this.password}); 10 | // 11 | // factory User.fromJson(Map json) { 12 | // return User( 13 | // id: json['id'], 14 | // account: json['account'], 15 | // password: json['password'], 16 | // ); 17 | // } 18 | //} 19 | // 20 | //class UserDao extends BaseDbProvider { 21 | // // 表名 22 | // final String name = 'User'; 23 | // 24 | // final String columnId = '_id'; 25 | // 26 | // @override 27 | // tableName() { 28 | // return name; 29 | // } 30 | // 31 | // @override 32 | // tableSqlString() { 33 | // return tableBaseString(name, columnId) + 34 | // ''' 35 | // id text not null, 36 | // account text, 37 | // password text) 38 | // '''; 39 | // } 40 | // 41 | // Future insert(User msg) async { 42 | // Database db = await getDataBase(); 43 | // return await db.insert(name, User(msg)); 44 | // } 45 | //} 46 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.50' 3 | repositories { 4 | // google() 5 | // jcenter() 6 | maven { url 'https://maven.aliyun.com/repository/google' } 7 | maven { url 'https://maven.aliyun.com/repository/jcenter' } 8 | maven { url 'http://maven.aliyun.com/nexus/content/groups/public' } 9 | } 10 | 11 | dependencies { 12 | classpath 'com.android.tools.build:gradle:3.5.0' 13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | // google() 20 | // jcenter() 21 | maven { url 'https://maven.aliyun.com/repository/google' } 22 | maven { url 'https://maven.aliyun.com/repository/jcenter' } 23 | maven { url 'http://maven.aliyun.com/nexus/content/groups/public' } 24 | } 25 | } 26 | 27 | rootProject.buildDir = '../build' 28 | subprojects { 29 | project.buildDir = "${rootProject.buildDir}/${project.name}" 30 | } 31 | subprojects { 32 | project.evaluationDependsOn(':app') 33 | } 34 | 35 | task clean(type: Delete) { 36 | delete rootProject.buildDir 37 | } 38 | -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:flutter_pocket_book/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /lib/db/db_manager.dart: -------------------------------------------------------------------------------- 1 | import 'package:sqflite/sqflite.dart'; 2 | import 'package:path/path.dart'; 3 | import 'dart:io'; 4 | 5 | class DBManager { 6 | /// 数据库版本 7 | static const _VERSION = 1; 8 | 9 | /// 数据库名 10 | static const _NAME = "pocket_book.db"; 11 | 12 | /// 数据库实例 13 | static Database _database; 14 | 15 | ///初始化 16 | static init() async { 17 | var databasesPath = await getDatabasesPath(); 18 | String path = join(databasesPath, _NAME); 19 | if(Platform.isIOS) { 20 | path = databasesPath + '/' + _NAME; 21 | } 22 | _database = await openDatabase(path, 23 | version: _VERSION, onCreate: (Database db, int version) async {}); 24 | } 25 | 26 | ///判断表是否存在 27 | static isTableExits(String tableName) async { 28 | await getCurrentDatabase(); 29 | var res = await _database.rawQuery( 30 | "select * from Sqlite_master where type = 'table' and name = '$tableName'"); 31 | return res != null && res.length > 0; 32 | } 33 | 34 | ///获取当前数据库对象 35 | static Future getCurrentDatabase() async { 36 | if (_database == null) { 37 | await init(); 38 | } 39 | return _database; 40 | } 41 | 42 | ///关闭 43 | static close() { 44 | _database?.close(); 45 | _database = null; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /lib/utils/dio_util.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | import '../config/config.dart'; 5 | 6 | class DioHttp { 7 | Dio _client; 8 | BuildContext context; 9 | 10 | static DioHttp of(BuildContext context) { 11 | return DioHttp._internal(context); 12 | } 13 | 14 | DioHttp._internal(BuildContext context) { 15 | if (_client == null || context != this.context) { 16 | this.context = context; 17 | var options = BaseOptions( 18 | baseUrl: Config.baseUrl, 19 | connectTimeout: 1000 * 10, 20 | receiveTimeout: 1000 * 3, 21 | extra: {'context': context}); 22 | 23 | var client = Dio(options); 24 | this._client = client; 25 | } 26 | } 27 | 28 | Future>> get(String path, 29 | [Map params, String token]) async { 30 | var options = Options(headers: {'Authorization': token}); 31 | return await _client.get(path, queryParameters: params, options: options); 32 | } 33 | 34 | Future>> post(String path, 35 | [Map params, String token]) async { 36 | var options = Options(headers: {'Authorization': token}); 37 | return await _client.post(path, data: params, options: options); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /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_pocket_book 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 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 28 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "com.example.flutter_pocket_book" 42 | minSdkVersion 16 43 | targetSdkVersion 28 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | } 47 | 48 | buildTypes { 49 | release { 50 | // TODO: Add your own signing config for the release build. 51 | // Signing with the debug keys for now, so `flutter run --release` works. 52 | signingConfig signingConfigs.debug 53 | } 54 | } 55 | } 56 | 57 | flutter { 58 | source '../..' 59 | } 60 | 61 | dependencies { 62 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 63 | } 64 | -------------------------------------------------------------------------------- /lib/pages/mine/mine_ad_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_pocket_book/utils/img_util.dart'; 4 | 5 | List adInfoMap = [ 6 | { 7 | "imgUrl": "ic_me_yd_tab_ad.png", 8 | "title": "主题换肤", 9 | "desc": "主题随心换", 10 | }, 11 | // { 12 | // "imgUrl": "ic_me_yd_tab_ad.png", 13 | // "title": "广告投放", 14 | // "desc": "广告", 15 | // }, 16 | // { 17 | // "imgUrl": "ic_me_yd_tab_ad.png", 18 | // "title": "广告投放", 19 | // "desc": "广告", 20 | // }, 21 | ]; 22 | 23 | class MineAd extends StatefulWidget { 24 | @override 25 | _MineAdState createState() => _MineAdState(); 26 | } 27 | 28 | class _MineAdState extends State { 29 | @override 30 | Widget build(BuildContext context) { 31 | return Container( 32 | color: Colors.red, 33 | padding: EdgeInsets.only(top: 28.0, bottom: 20.0), 34 | child: Row( 35 | mainAxisAlignment: MainAxisAlignment.start, 36 | crossAxisAlignment: CrossAxisAlignment.start, 37 | children: adBuilder(), 38 | ), 39 | ); 40 | } 41 | } 42 | 43 | // 广告位 创建 44 | List adBuilder() { 45 | List result = new List(); 46 | adInfoMap.forEach((item) { 47 | result.add(Expanded( 48 | flex: 1, 49 | child: Column( 50 | mainAxisAlignment: MainAxisAlignment.center, 51 | children: [ 52 | Image.asset( 53 | Img.getAssetsImg(item["imgUrl"]), 54 | fit: BoxFit.cover, 55 | height: 35.0, 56 | width: 35.0, 57 | ), 58 | SizedBox(height: 8.0), 59 | Text( 60 | item["title"], 61 | style: TextStyle( 62 | fontSize: 13.0, 63 | color: Colors.black, 64 | ), 65 | ), 66 | SizedBox(height: 3.0), 67 | Text( 68 | item["desc"], 69 | style: TextStyle( 70 | fontSize: 10.0, 71 | color: Colors.grey, 72 | ), 73 | ), 74 | ], 75 | ), 76 | )); 77 | }); 78 | return result.toList(); 79 | } 80 | -------------------------------------------------------------------------------- /lib/pages/test/modal-screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class SampleModalScreen extends ModalRoute { 4 | SampleModalScreen(); 5 | 6 | @override 7 | Duration get transitionDuration => Duration(milliseconds: 500); 8 | 9 | @override 10 | bool get opaque => false; 11 | 12 | @override 13 | bool get barrierDismissible => false; 14 | 15 | @override 16 | Color get barrierColor => Colors.black.withOpacity(0.5); 17 | 18 | @override 19 | String get barrierLabel => null; 20 | 21 | @override 22 | bool get maintainState => true; 23 | 24 | @override 25 | Widget buildPage( 26 | BuildContext context, 27 | Animation animation, 28 | Animation secondaryAnimation, 29 | ) { 30 | // This makes sure that text and other content follows the material style 31 | return Material( 32 | type: MaterialType.transparency, 33 | // make sure that the overlay content is not cut off 34 | child: SafeArea( 35 | child: _buildOverlayContent(context), 36 | ), 37 | ); 38 | } 39 | 40 | Widget _buildOverlayContent(BuildContext context) { 41 | return Container( 42 | height: MediaQuery.of(context).size.height * 0.3, 43 | width: MediaQuery.of(context).size.width * 0.3, 44 | margin: EdgeInsets.all(30.0), 45 | padding: EdgeInsets.symmetric(horizontal: 30.0), 46 | color: Colors.amber, 47 | child: Column( 48 | mainAxisAlignment: MainAxisAlignment.center, 49 | crossAxisAlignment: CrossAxisAlignment.center, 50 | children: [ 51 | Text( 52 | "This is a modal screen", 53 | textAlign: TextAlign.center, 54 | style: TextStyle( 55 | color: Colors.black, 56 | fontSize: 26.0, 57 | ), 58 | ), 59 | Center( 60 | child: RaisedButton( 61 | color: Colors.blue, 62 | onPressed: () { 63 | Navigator.pop(context); 64 | }, 65 | child: Text( 66 | "Return", 67 | style: TextStyle(color: Colors.white), 68 | ), 69 | ), 70 | ), 71 | ], 72 | ), 73 | ); 74 | } 75 | } -------------------------------------------------------------------------------- /lib/widgets/panel_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class PanelWidget extends StatelessWidget { 4 | const PanelWidget({ 5 | Key key, 6 | }) : super(key: key); 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | TextStyle _accountTitleStyle = TextStyle( 11 | fontSize: 12.0, 12 | color: Colors.black45, 13 | ); 14 | 15 | return Container( 16 | color: Colors.white, 17 | padding: EdgeInsets.symmetric(horizontal: 10.0), 18 | margin: EdgeInsets.only(bottom: 8.0), 19 | child: Column( 20 | children: [ 21 | Container( 22 | height: 30.0, 23 | child: Row( 24 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 25 | children: [ 26 | Text( 27 | '网络账户 (2)', 28 | style: _accountTitleStyle, 29 | ), 30 | Text(11111.toStringAsFixed(2), style: _accountTitleStyle), 31 | ], 32 | ), 33 | ), 34 | Column( 35 | children: [ 36 | rowItem(), 37 | rowItem(), 38 | rowItem(showBorder: false), 39 | ], 40 | ) 41 | ], 42 | ), 43 | ); 44 | } 45 | 46 | Container rowItem({bool showBorder = true}) { 47 | print(showBorder); 48 | return Container( 49 | height: 56.0, 50 | decoration: BoxDecoration( 51 | border: Border( 52 | bottom: BorderSide( 53 | width: (showBorder == true) ? 0.33 : 0, 54 | color: (showBorder == true) ? Colors.black12 : Colors.transparent, 55 | ), 56 | ), 57 | ), 58 | child: Row( 59 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 60 | children: [ 61 | Row( 62 | children: [ 63 | Icon( 64 | Icons.account_balance_wallet, 65 | size: 20.0, 66 | ), 67 | SizedBox( 68 | width: 6.0, 69 | ), 70 | Text('微信钱包'), 71 | ], 72 | ), 73 | Text( 74 | 500.toStringAsFixed(2), 75 | style: TextStyle(fontSize: 16.0), 76 | ) 77 | ], 78 | ), 79 | ); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /lib/pages/encourage/encourage_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_pocket_book/utils/img_util.dart'; 3 | import 'package:flutter_pocket_book/widgets/cell_widget.dart'; 4 | import 'package:share/share.dart'; 5 | 6 | /// 爱的鼓励 7 | class EncouragePage extends StatefulWidget { 8 | @override 9 | _EncouragePageState createState() => _EncouragePageState(); 10 | } 11 | 12 | class _EncouragePageState extends State { 13 | @override 14 | Widget build(BuildContext context) { 15 | return Scaffold( 16 | appBar: AppBar( 17 | elevation: 0, 18 | backgroundColor: Color(0xffFF5267), 19 | title: Text('爱的鼓励'), 20 | ), 21 | body: Container( 22 | color: Colors.white, 23 | child: Column( 24 | children: [ 25 | Container( 26 | height: 165.0, 27 | child: Center( 28 | child: Column( 29 | children: [ 30 | Container( 31 | width: 120.0, 32 | child: Image.asset( 33 | Img.getAssetsImg('logo.png'), 34 | ), 35 | ), 36 | Text( 37 | '有钱记账', 38 | style: TextStyle(fontSize: 18.0), 39 | ) 40 | ], 41 | ), 42 | ), 43 | ), 44 | Container( 45 | height: 10.0, 46 | color: Color.fromARGB(255, 245, 245, 245), 47 | ), 48 | CellWidget( 49 | title: '分享给好友', 50 | value: '', 51 | onTap: () { 52 | Share.share('https://pub.flutter-io.cn/packages/share/install'); 53 | }, 54 | ), 55 | Container( 56 | margin: EdgeInsets.symmetric(vertical: 36.0), 57 | width: MediaQuery.of(context).size.width * 0.7, 58 | child: Image.asset(Img.getAssetsImg('zfbskm.jpg')), 59 | ), 60 | Center( 61 | child: Text('您的鼓励,我的动力',style: TextStyle( 62 | fontSize: 18.0, 63 | color: Colors.black54, 64 | ),), 65 | ) 66 | ], 67 | ), 68 | ), 69 | ); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /lib/pages/register/register_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class RegisterPage extends StatefulWidget { 4 | @override 5 | _RegisterPageState createState() => _RegisterPageState(); 6 | } 7 | 8 | class _RegisterPageState extends State { 9 | @override 10 | Widget build(BuildContext context) { 11 | return Scaffold( 12 | appBar: AppBar( 13 | title: Text('注册'), 14 | centerTitle: true, 15 | ), 16 | body: SafeArea( 17 | minimum: EdgeInsets.all(20.0), 18 | child: ListView( 19 | children: [ 20 | TextField( 21 | decoration: InputDecoration( 22 | labelText: '账号', 23 | hintText: '请输入账号', 24 | ), 25 | ), 26 | TextField( 27 | obscureText: true, 28 | decoration: InputDecoration( 29 | labelText: '密码', 30 | hintText: '请输入密码', 31 | ), 32 | ), 33 | TextField( 34 | obscureText: true, 35 | decoration: InputDecoration( 36 | labelText: '确认密码', 37 | hintText: '请再次输入密码', 38 | ), 39 | ), 40 | Padding( 41 | padding: EdgeInsets.all(13.0), 42 | ), 43 | RaisedButton( 44 | color: Colors.blue, 45 | padding: EdgeInsets.symmetric(vertical: 13.0), 46 | onPressed: () {}, 47 | child: Text( 48 | '注册', 49 | style: TextStyle(color: Colors.white, fontSize: 16.0), 50 | ), 51 | ), 52 | Padding( 53 | padding: EdgeInsets.all(8.0), 54 | ), 55 | Row( 56 | mainAxisAlignment: MainAxisAlignment.end, 57 | children: [ 58 | Text('已有账号?'), 59 | FlatButton( 60 | padding: EdgeInsets.all(0.0), 61 | onPressed: () { 62 | Navigator.pushReplacementNamed(context, '/'); 63 | }, 64 | child: Text( 65 | '去登录', 66 | style: TextStyle(color: Colors.blue), 67 | ), 68 | ) 69 | ], 70 | ) 71 | ], 72 | ), 73 | ), 74 | ); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/widgets/cell_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | /// cell 5 | class CellWidget extends StatelessWidget { 6 | final Function onTap; 7 | 8 | ///左边文字 9 | final String title; 10 | 11 | ///右边文字 12 | final String value; 13 | 14 | ///是否显示右边箭头 15 | final bool showLink; 16 | 17 | ///左边icon 18 | final Widget icon; 19 | 20 | ///iconName 21 | final String iconName; 22 | 23 | const CellWidget( 24 | {Key key, 25 | this.onTap, 26 | this.title, 27 | this.value, 28 | this.showLink = true, 29 | this.icon, 30 | this.iconName}) 31 | : super(key: key); 32 | 33 | @override 34 | Widget build(BuildContext context) { 35 | return Padding( 36 | padding: EdgeInsets.symmetric(horizontal: 10.0), 37 | child: FlatButton( 38 | padding: EdgeInsets.all(0.0), 39 | onPressed: () { 40 | if (onTap != null) { 41 | onTap(); 42 | } 43 | }, 44 | child: Container( 45 | height: 50.0, 46 | decoration: BoxDecoration( 47 | border: Border( 48 | bottom: BorderSide( 49 | width: 0.33, 50 | color: Colors.black12, 51 | ), 52 | ), 53 | ), 54 | child: Row( 55 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 56 | children: [ 57 | Row( 58 | children: [ 59 | if (icon != null) 60 | Padding( 61 | padding: EdgeInsets.only(right: 10.0), 62 | child: icon, 63 | ), 64 | Text( 65 | title, 66 | style: 67 | TextStyle(fontWeight: FontWeight.w600, fontSize: 14.0), 68 | ), 69 | ], 70 | ), 71 | Row( 72 | crossAxisAlignment: CrossAxisAlignment.center, 73 | children: [ 74 | Text( 75 | value, 76 | style: TextStyle(color: Colors.black54, fontSize: 14.0), 77 | ), 78 | Padding( 79 | padding: EdgeInsets.only(left: 3.0), 80 | ), 81 | if (showLink) 82 | Icon( 83 | Icons.keyboard_arrow_right, 84 | color: Colors.black54, 85 | ), 86 | ], 87 | ) 88 | ], 89 | ), 90 | ), 91 | ), 92 | ); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /lib/pages/test/dbhelper.dart: -------------------------------------------------------------------------------- 1 | import 'package:path/path.dart'; 2 | import 'package:sqflite/sqflite.dart'; 3 | 4 | class DatabaseHelper { 5 | // 数据库名 6 | static final _databaseName = 'pocket_book.db'; 7 | 8 | static final _databaseVersion = 1; 9 | 10 | static final table = 'user_info_table'; 11 | 12 | static final columnID = 'id'; 13 | static final columnName = 'name'; 14 | static final columnAge = 'age'; 15 | 16 | static Database _database; 17 | 18 | DatabaseHelper._privateConstructor(); 19 | 20 | static final DatabaseHelper instance = DatabaseHelper._privateConstructor(); 21 | 22 | Future get databse async { 23 | if (_database != null) return _database; 24 | 25 | _database = await _initDatabase(); 26 | return _database; 27 | } 28 | 29 | _initDatabase() async { 30 | // Directory documentdirecoty = await getApplicationDocumentsDirectory(); 31 | // String path = join(documentdirecoty.path, _databaseName); 32 | 33 | var databasesPath = await getDatabasesPath(); 34 | String path = join(databasesPath, _databaseName); 35 | 36 | return await openDatabase(path, 37 | version: _databaseVersion, onCreate: _onCreate); 38 | } 39 | 40 | Future _onCreate(Database db, int version) async { 41 | await db.execute(''' 42 | CREATE TABLE $table ( 43 | $columnID INTEGER PRIMARY KEY, 44 | $columnName TEXT NOT NULL, 45 | $columnAge INTEGER NOT NULL 46 | ) 47 | '''); 48 | } 49 | 50 | // 插入数据 51 | Future insert(Map row) async { 52 | Database db = await instance.databse; 53 | return await db.insert(table, row); 54 | } 55 | 56 | // 查询所有数据 57 | Future>> queryAll() async { 58 | Database db = await instance.databse; 59 | return await db.query(table); 60 | } 61 | 62 | // 条件查询 63 | // todo: 测试未通过 64 | Future>> querySpecific(int age) async { 65 | Database db = await instance.databse; 66 | var res = await db.query(table, 67 | columns: [columnID, columnName, columnAge], 68 | where: '$columnAge > ?', 69 | whereArgs: [age]); 70 | // var res = await db.rawQuery('SELECT * FROM my_table WHERE age >?',[age]); 71 | return res; 72 | } 73 | 74 | // 删除数据 75 | Future deleteData(int id) async { 76 | Database db = await instance.databse; 77 | var res = await db.delete(table, where: "id = ?", whereArgs: [id]); 78 | return res; 79 | } 80 | 81 | Future update(int id,Map msg) async { 82 | Database db = await instance.databse; 83 | var res = await db.update(table, msg, where: "id = ?", whereArgs: [id]); 84 | return res; 85 | } 86 | 87 | 88 | } 89 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 9 | 13 | 20 | 24 | 28 | 33 | 37 | 38 | 39 | 40 | 41 | 42 | 44 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /lib/db/provider/user/user_list_db_provider.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_pocket_book/db/db_provider.dart'; 2 | import 'package:sqflite/sqflite.dart'; 3 | 4 | class UserListDbProvider extends BaseDbProvider { 5 | // 用户列表(家庭多成员记账) 6 | final String name = 'UserList'; 7 | final String columnId = '_id'; 8 | final String columnFullName = "fullName"; 9 | final String columnAccount = 'account'; 10 | final String columnPassword = 'password'; 11 | 12 | int id; 13 | String fullName; 14 | String account; 15 | String password; 16 | 17 | UserListDbProvider(); 18 | 19 | Map toMap(String fullName, String account, String password) { 20 | Map map = { 21 | columnFullName: fullName, 22 | columnAccount: account, 23 | columnPassword: password 24 | }; 25 | if (id != null) { 26 | map[columnId] = id; 27 | } 28 | return map; 29 | } 30 | 31 | UserListDbProvider.fromMap(Map map) { 32 | id = map[columnId]; 33 | fullName = map[columnFullName]; 34 | account = map[columnAccount]; 35 | password = map[columnPassword]; 36 | } 37 | 38 | @override 39 | tableSqlString() { 40 | return tableBaseString(name, columnId) + 41 | ''' 42 | $columnFullName text not null, 43 | $columnAccount text not null, 44 | $columnPassword text not null) 45 | '''; 46 | } 47 | 48 | @override 49 | tableName() { 50 | return name; 51 | } 52 | 53 | Future _getProvider(Database db, String fullName) async { 54 | List> maps = await db.query(name, 55 | columns: [columnId, columnFullName, columnAccount, columnPassword], 56 | where: "$columnFullName = ?", 57 | whereArgs: [fullName]); 58 | if (maps.length > 0) { 59 | UserListDbProvider provider = UserListDbProvider.fromMap(maps.first); 60 | return provider; 61 | } 62 | return null; 63 | } 64 | 65 | /// 插入到数据库 66 | Future insert(String fullName, String account, String password) async { 67 | Database db = await getDataBase(); 68 | var provider = await _getProvider(db, fullName); 69 | if (provider != null) { 70 | await db 71 | .delete(name, where: "$columnFullName = ?", whereArgs: [fullName]); 72 | } 73 | return await db.insert(name, toMap(fullName, account, password)); 74 | } 75 | 76 | // 查询所有数据, 测试通过 77 | Future>> queryAll() async { 78 | Database db = await getDataBase(); 79 | return await db.query(name); 80 | } 81 | 82 | // 删除数据, 测试通过 83 | Future delete(int id) async { 84 | Database db = await getDataBase(); 85 | var res = await db.delete(name, where: "_id = ?", whereArgs: [id]); 86 | return res; 87 | } 88 | 89 | // 条件查询 90 | Future querySpecific(String account) async { 91 | Database db = await getDataBase(); 92 | // var res = await db.query(name, 93 | // columns: [columnID, columnName, columnAge], 94 | // where: '$columnAge > ?', 95 | // whereArgs: [age]); 96 | // var res = await db.rawQuery('SELECT * FROM $name WHERE account =?',[account]); 97 | 98 | // List> maps = await db.query(name, 99 | // columns: [columnId, columnFullName, columnAccount, columnPassword], 100 | // where: "$columnAccount = ?", 101 | // whereArgs: [account]); 102 | 103 | print(account); 104 | 105 | 106 | // List> maps = await db.rawQuery('SELECT * FROM $name WHERE account =?',[account]); 107 | List maps = await db.rawQuery('SELECT * FROM $name WHERE account =?',[account]); 108 | 109 | 110 | return maps; 111 | } 112 | 113 | Future update(int id,Map msg) async { 114 | Database db = await getDataBase(); 115 | var res = await db.update(name, msg, where: "id = ?", whereArgs: [id]); 116 | return res; 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_pocket_book 2 | description: 基于flutter开发的全资产记账应用 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `pub publish`. This is preferred for private packages. 6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 7 | 8 | # The following defines the version and build number for your application. 9 | # A version number is three numbers separated by dots, like 1.2.43 10 | # followed by an optional build number separated by a +. 11 | # Both the version and the builder number may be overridden in flutter 12 | # build by specifying --build-name and --build-number, respectively. 13 | # In Android, build-name is used as versionName while build-number used as versionCode. 14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 16 | # Read more about iOS versioning at 17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 18 | version: 1.0.0+1 19 | 20 | environment: 21 | sdk: ">=2.7.0 <3.0.0" 22 | 23 | dependencies: 24 | flutter: 25 | sdk: flutter 26 | cupertino_icons: ^0.1.3 27 | local_auth: ^0.6.3+1 # 生物识别 28 | curved_navigation_bar: ^0.3.3 # tabBar动画 29 | sqflite: ^1.3.0 # 本地数据库 30 | fluro: ^1.6.3 # 路由框架 31 | fluttertoast: ^7.0.4 # 吐司 32 | dio: ^3.0.10 # http请求 33 | path_provider: ^1.6.14 # 查询文件系统常用位置 34 | fl_chart: ^0.11.1 # 图表库 35 | persistent_bottom_nav_bar: ^2.0.5 # tabBar 36 | percent_indicator: ^2.1.6 # 进度条 37 | timeline_tile: ^0.1.2 # 时间线 38 | google_fonts: ^1.1.0 # 谷歌字体库 39 | photo_view: ^0.10.2 # 图片预览 40 | pull_to_refresh: ^1.6.0 # 下拉刷新 41 | flutter_swiper: ^1.1.6 # 轮播图 42 | share: ^0.6.5 # 分享 43 | 44 | dev_dependencies: 45 | flutter_test: 46 | sdk: flutter 47 | 48 | # For information on the generic Dart part of this file, see the 49 | # following page: https://dart.dev/tools/pub/pubspec 50 | 51 | # The following section is specific to Flutter. 52 | flutter: 53 | 54 | # The following line ensures that the Material Icons font is 55 | # included with your application, so that you can use the icons in 56 | # the material Icons class. 57 | uses-material-design: true 58 | 59 | # To add assets to your application, add an assets section, like this: 60 | assets: 61 | - asset/images/ 62 | - asset/images/ic_mine_message.png 63 | - asset/images/ic_mine_setting.png 64 | - asset/images/ic_me_service.png 65 | - asset/images/ic_me_vip.png 66 | - asset/images/ic_skin_home_bill.png 67 | - asset/images/ic_skin_home_bill_pressed.png 68 | - asset/images/ic_skin_home_chart.png 69 | - asset/images/ic_skin_home_chart_pressed.png 70 | - asset/images/ic_skin_home_me.png 71 | - asset/images/ic_skin_home_me_pressed.png 72 | - asset/images/ic_skin_home_property.png 73 | - asset/images/ic_skin_home_property_pressed.png 74 | - asset/images/ic_vip_default_avatar.png 75 | - asset/images/ic_me_yd_tab_ad.png 76 | - asset/images/icon_fuli.png 77 | - asset/images/icon_gongju.png 78 | - asset/images/icon_kefu.png 79 | - asset/images/icon_vip.png 80 | - asset/images/account_banner.jpg 81 | - asset/images/icon_yusuan.png 82 | - asset/images/empty.png 83 | - asset/images/icon_biaoqian.png 84 | - asset/images/icon_jtcy.png 85 | - asset/images/icon_aixin.png 86 | - asset/images/logo.png 87 | - asset/images/zfbskm.jpg 88 | 89 | # An image asset can refer to one or more resolution-specific "variants", see 90 | # https://flutter.dev/assets-and-images/#resolution-aware. 91 | 92 | # For details regarding adding assets from package dependencies, see 93 | # https://flutter.dev/assets-and-images/#from-packages 94 | 95 | # To add custom fonts to your application, add a fonts section here, 96 | # in this "flutter" section. Each entry in this list should have a 97 | # "family" key with the font family name, and a "fonts" key with a 98 | # list giving the asset and other descriptors for the font. For 99 | # example: 100 | # fonts: 101 | # - family: Schyler 102 | # fonts: 103 | # - asset: fonts/Schyler-Regular.ttf 104 | # - asset: fonts/Schyler-Italic.ttf 105 | # style: italic 106 | # - family: Trajan Pro 107 | # fonts: 108 | # - asset: fonts/TrajanPro.ttf 109 | # - asset: fonts/TrajanPro_Bold.ttf 110 | # weight: 700 111 | # 112 | # For details regarding fonts from package dependencies, 113 | # see https://flutter.dev/custom-fonts/#from-packages 114 | -------------------------------------------------------------------------------- /lib/router/routes.dart: -------------------------------------------------------------------------------- 1 | import 'package:fluro/fluro.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_pocket_book/navigator/tab_navigator.dart'; 4 | import 'package:flutter_pocket_book/pages/account_select/account_select_page.dart'; 5 | import 'package:flutter_pocket_book/pages/balance_and_payments/pages.balance_and_payments_page.dart'; 6 | import 'package:flutter_pocket_book/pages/budget/budget_page.dart'; 7 | import 'package:flutter_pocket_book/pages/encourage/encourage_page.dart'; 8 | import 'package:flutter_pocket_book/pages/home/home_page.dart'; 9 | import 'package:flutter_pocket_book/pages/keep_account/keep_account_page.dart'; 10 | import 'package:flutter_pocket_book/pages/login/login_page.dart'; 11 | import 'package:flutter_pocket_book/pages/message/message_page.dart'; 12 | import 'package:flutter_pocket_book/pages/mine/mine_page.dart'; 13 | import 'package:flutter_pocket_book/pages/register/register_page.dart'; 14 | import 'package:flutter_pocket_book/pages/set/set_page.dart'; 15 | import 'package:flutter_pocket_book/pages/test/test_page.dart'; 16 | 17 | class Routes { 18 | static String navigator = '/'; 19 | static String home = '/home'; 20 | 21 | // 登录 22 | static String login = '/login'; 23 | 24 | // 注册 25 | static String register = '/register'; 26 | 27 | // 我的 28 | static String mine = '/mine'; 29 | 30 | // 设置 31 | static String set = '/set'; 32 | 33 | // 消息中心 34 | static String message = '/message'; 35 | 36 | // 测试 37 | static String test = '/test'; 38 | 39 | // 选择账户 40 | static String accountSelect = '/accountSelect'; 41 | 42 | // 收支报表 43 | static String balanceAndPayment = '/balanceAndPayment'; 44 | 45 | // 记账 46 | static String keepAccount = '/keepAccount'; 47 | 48 | // 预算中心 49 | static String budget = '/budget'; 50 | // 爱的鼓励 51 | static String encourage = '/encourage'; 52 | 53 | // 定义路由处理函数 54 | 55 | static Handler _budgetHandler = 56 | Handler(handlerFunc: (BuildContext context, Map params) { 57 | return BudgetPage(); 58 | }); 59 | 60 | static Handler _navigatorHandler = 61 | Handler(handlerFunc: (BuildContext context, Map params) { 62 | return TabNavigator(); 63 | }); 64 | 65 | static Handler _homeHandler = 66 | Handler(handlerFunc: (BuildContext context, Map params) { 67 | return HomePage(); 68 | }); 69 | 70 | static Handler _loginHandler = 71 | Handler(handlerFunc: (BuildContext context, Map params) { 72 | return LoginPage(); 73 | }); 74 | 75 | static Handler _registerHandler = 76 | Handler(handlerFunc: (BuildContext context, Map params) { 77 | return RegisterPage(); 78 | }); 79 | 80 | static Handler _mineHandler = 81 | Handler(handlerFunc: (BuildContext context, Map params) { 82 | return MinePage(); 83 | }); 84 | 85 | static Handler _setHandler = 86 | Handler(handlerFunc: (BuildContext context, Map params) { 87 | return SetPage(); 88 | }); 89 | 90 | static Handler _messageHandler = 91 | Handler(handlerFunc: (BuildContext context, Map params) { 92 | return MessagePage(); 93 | }); 94 | 95 | static Handler _testHandler = 96 | Handler(handlerFunc: (BuildContext context, Map params) { 97 | return TestPage(); 98 | }); 99 | 100 | static Handler _accountSelectHandler = 101 | Handler(handlerFunc: (BuildContext context, Map params) { 102 | return AccountSelectPage(); 103 | }); 104 | 105 | static Handler _balanceAndPaymentPageHandler = 106 | Handler(handlerFunc: (BuildContext context, Map params) { 107 | return BalanceAndPaymentPage(); 108 | }); 109 | 110 | static Handler _keepAccountHandler = 111 | Handler(handlerFunc: (BuildContext context, Map params) { 112 | return KeepAccountPage(); 113 | }); 114 | 115 | static Handler _encouragePageHandler = 116 | Handler(handlerFunc: (BuildContext context, Map params) { 117 | return EncouragePage(); 118 | }); 119 | 120 | // 3. 编写函数 configureRoutes 关联路由名称和处理函数 121 | static void configureRoutes(Router router) { 122 | router.define(navigator, handler: _navigatorHandler); 123 | router.define(home, handler: _homeHandler); 124 | router.define(login, handler: _loginHandler); 125 | router.define(register, handler: _registerHandler); 126 | router.define(mine, handler: _mineHandler); 127 | router.define(set, handler: _setHandler); 128 | router.define(message, handler: _messageHandler); 129 | router.define(test, handler: _testHandler); 130 | router.define(accountSelect, handler: _accountSelectHandler); 131 | router.define(keepAccount, handler: _keepAccountHandler); 132 | router.define(budget, handler: _budgetHandler); 133 | router.define(encourage, handler: _encouragePageHandler); 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /lib/pages/balance_and_payments/pages.balance_and_payments_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:fl_chart/fl_chart.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | import 'indicator.dart'; 5 | 6 | /// 收支报表 7 | class BalanceAndPaymentPage extends StatefulWidget { 8 | @override 9 | State createState() => PieChart2State(); 10 | } 11 | 12 | class PieChart2State extends State { 13 | int touchedIndex; 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return AspectRatio( 18 | aspectRatio: 1.3, 19 | child: Card( 20 | color: Colors.white, 21 | child: Row( 22 | children: [ 23 | const SizedBox( 24 | height: 18, 25 | ), 26 | Expanded( 27 | child: AspectRatio( 28 | aspectRatio: 1, 29 | child: PieChart( 30 | PieChartData( 31 | pieTouchData: PieTouchData(touchCallback: (pieTouchResponse) { 32 | setState(() { 33 | if (pieTouchResponse.touchInput is FlLongPressEnd || 34 | pieTouchResponse.touchInput is FlPanEnd) { 35 | touchedIndex = -1; 36 | } else { 37 | touchedIndex = pieTouchResponse.touchedSectionIndex; 38 | } 39 | }); 40 | }), 41 | borderData: FlBorderData( 42 | show: false, 43 | ), 44 | sectionsSpace: 0, 45 | centerSpaceRadius: 40, 46 | sections: showingSections()), 47 | ), 48 | ), 49 | ), 50 | Column( 51 | mainAxisSize: MainAxisSize.max, 52 | mainAxisAlignment: MainAxisAlignment.end, 53 | crossAxisAlignment: CrossAxisAlignment.start, 54 | children: const [ 55 | Indicator( 56 | color: Color(0xff0293ee), 57 | text: 'First', 58 | isSquare: true, 59 | ), 60 | SizedBox( 61 | height: 4, 62 | ), 63 | Indicator( 64 | color: Color(0xfff8b250), 65 | text: 'Second', 66 | isSquare: true, 67 | ), 68 | SizedBox( 69 | height: 4, 70 | ), 71 | Indicator( 72 | color: Color(0xff845bef), 73 | text: 'Third', 74 | isSquare: true, 75 | ), 76 | SizedBox( 77 | height: 4, 78 | ), 79 | Indicator( 80 | color: Color(0xff13d38e), 81 | text: 'Fourth', 82 | isSquare: true, 83 | ), 84 | SizedBox( 85 | height: 18, 86 | ), 87 | ], 88 | ), 89 | const SizedBox( 90 | width: 28, 91 | ), 92 | ], 93 | ), 94 | ), 95 | ); 96 | } 97 | 98 | List showingSections() { 99 | return List.generate(4, (i) { 100 | final isTouched = i == touchedIndex; 101 | final double fontSize = isTouched ? 25 : 16; 102 | final double radius = isTouched ? 60 : 50; 103 | switch (i) { 104 | case 0: 105 | return PieChartSectionData( 106 | color: const Color(0xff0293ee), 107 | value: 40, 108 | title: '40%', 109 | radius: radius, 110 | titleStyle: TextStyle( 111 | fontSize: fontSize, fontWeight: FontWeight.bold, color: const Color(0xffffffff)), 112 | ); 113 | case 1: 114 | return PieChartSectionData( 115 | color: const Color(0xfff8b250), 116 | value: 30, 117 | title: '30%', 118 | radius: radius, 119 | titleStyle: TextStyle( 120 | fontSize: fontSize, fontWeight: FontWeight.bold, color: const Color(0xffffffff)), 121 | ); 122 | case 2: 123 | return PieChartSectionData( 124 | color: const Color(0xff845bef), 125 | value: 15, 126 | title: '15%', 127 | radius: radius, 128 | titleStyle: TextStyle( 129 | fontSize: fontSize, fontWeight: FontWeight.bold, color: const Color(0xffffffff)), 130 | ); 131 | case 3: 132 | return PieChartSectionData( 133 | color: const Color(0xff13d38e), 134 | value: 15, 135 | title: '15%', 136 | radius: radius, 137 | titleStyle: TextStyle( 138 | fontSize: fontSize, fontWeight: FontWeight.bold, color: const Color(0xffffffff)), 139 | ); 140 | default: 141 | return null; 142 | } 143 | }); 144 | } 145 | } -------------------------------------------------------------------------------- /lib/pages/login/login_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | /// 登录页面 5 | class LoginPage extends StatefulWidget { 6 | @override 7 | _LoginPageState createState() => _LoginPageState(); 8 | } 9 | 10 | class _LoginPageState extends State { 11 | TextEditingController _accountController = TextEditingController(); 12 | TextEditingController _passwordController = TextEditingController(); 13 | 14 | FocusNode _passwordNode = FocusNode(); 15 | FocusNode _accountNode = FocusNode(); 16 | 17 | // 是否显示密码 18 | bool showPwd = false; 19 | 20 | @override 21 | Widget build(BuildContext context) { 22 | return Scaffold( 23 | appBar: AppBar( 24 | centerTitle: true, 25 | elevation: 0, 26 | title: Text('登录'), 27 | ), 28 | body: GestureDetector( 29 | // 点击区域: 容器内所有区域 30 | // behavior: HitTestBehavior.translucent, 31 | // 点击收起键盘 32 | onTap: () { 33 | // FocusScope.of(context).requestFocus(FocusNode()); 34 | }, 35 | child: ListView( 36 | children: [ 37 | // 账号输入框 38 | TextField( 39 | focusNode: _accountNode, 40 | keyboardType: TextInputType.phone, 41 | textInputAction: TextInputAction.next, 42 | onEditingComplete: () { 43 | // 激活密码输入框 44 | _passwordNode.requestFocus(); 45 | }, 46 | // onTap: () { 47 | // _accountNode.requestFocus(); 48 | // }, 49 | controller: _accountController, 50 | decoration: InputDecoration( 51 | hintText: '请输入手机号', 52 | labelText: '账号', 53 | prefixIcon: Icon( 54 | Icons.account_circle, 55 | size: 20.0, 56 | ), 57 | suffixIcon: IconButton( 58 | // 清除账号输入 59 | onPressed: () { 60 | _accountController.clear(); 61 | }, 62 | icon: Icon( 63 | Icons.clear, 64 | ), 65 | iconSize: 20.0, 66 | ), 67 | ), 68 | ), 69 | Padding( 70 | padding: EdgeInsets.only(top: 15.0), 71 | ), 72 | // 密码输入框 73 | TextField( 74 | focusNode: _passwordNode, 75 | keyboardType: TextInputType.visiblePassword, 76 | textInputAction: TextInputAction.done, 77 | onEditingComplete: () { 78 | print('点击了完成'); 79 | }, 80 | // onTap: () { 81 | // _passwordNode.requestFocus(); 82 | // }, 83 | // 输入是否可见 84 | obscureText: true, 85 | controller: _passwordController, 86 | decoration: InputDecoration( 87 | hintText: '请输入密码', 88 | labelText: '密码', 89 | prefixIcon: Icon( 90 | Icons.https, 91 | size: 20.0, 92 | ), 93 | suffixIcon: IconButton( 94 | onPressed: () { 95 | _passwordController.clear(); 96 | }, 97 | icon: Icon( 98 | Icons.clear, 99 | size: 20, 100 | ), 101 | ), 102 | ), 103 | ), 104 | // 登录按钮 105 | Container( 106 | margin: EdgeInsets.only(top: 30.0), 107 | padding: EdgeInsets.symmetric(horizontal: 15.0), 108 | width: MediaQuery.of(context).size.width, 109 | height: 44.0, 110 | child: FlatButton( 111 | color: Theme.of(context).primaryColor, 112 | onPressed: () { 113 | print(_accountController.text); 114 | print(_passwordController.text); 115 | Navigator.of(context).pushNamed('test'); 116 | }, 117 | child: Text( 118 | '登录', 119 | style: TextStyle(fontSize: 16.0, color: Colors.white), 120 | ), 121 | ), 122 | ), 123 | Padding( 124 | padding: const EdgeInsets.symmetric(horizontal: 15.0), 125 | child: Row( 126 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 127 | children: [ 128 | FlatButton( 129 | onPressed: () { 130 | Navigator.pushNamed(context, 'register'); 131 | }, 132 | padding: EdgeInsets.all(0.0), 133 | child: Text('没有账号?去注册'), 134 | ), 135 | GestureDetector( 136 | onTap: () { 137 | print('忘记密码'); 138 | }, 139 | child: Text('忘记密码'), 140 | ) 141 | ], 142 | ), 143 | ) 144 | ], 145 | ), 146 | ), 147 | ); 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /lib/navigator/tab_navigator.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/services.dart'; 3 | import 'package:flutter_pocket_book/pages/bill/bill_page.dart'; 4 | import 'package:flutter_pocket_book/pages/home/home_page.dart'; 5 | import 'package:flutter_pocket_book/pages/mine/mine_page.dart'; 6 | import 'package:flutter_pocket_book/pages/report/report_page.dart'; 7 | import 'package:flutter_pocket_book/utils/img_util.dart'; 8 | import 'package:flutter_pocket_book/utils/toast_util.dart'; 9 | 10 | class TabNavigator extends StatefulWidget { 11 | @override 12 | _TabNavigatorState createState() => _TabNavigatorState(); 13 | } 14 | 15 | class _TabNavigatorState extends State { 16 | int lastTime = 0; 17 | PageController pageController; 18 | int pageIndex = 0; 19 | 20 | @override 21 | void initState() { 22 | super.initState(); 23 | pageController = PageController(initialPage: this.pageIndex); 24 | } 25 | 26 | void onPageChanged(int value) { 27 | if (value >= 2) { 28 | value = value + 1; 29 | } 30 | setState(() { 31 | this.pageIndex = value; 32 | }); 33 | } 34 | 35 | // 跳转记账页 36 | void keepAccount() { 37 | Navigator.of(context).pushNamed('/keepAccount'); 38 | } 39 | 40 | // 点击tabBar 41 | void onTap(int value) { 42 | if (value == 2) { 43 | keepAccount(); 44 | return; 45 | } 46 | if (value > 2) { 47 | value = value - 1; 48 | } 49 | setState(() { 50 | pageIndex = value; 51 | }); 52 | // 控制页面切换,可添加动画切换效果 53 | pageController.jumpToPage(value); 54 | } 55 | 56 | _bottomNavigationBarItem( 57 | {String activeIcon, String icon, int index, String title}) { 58 | if (icon != null && activeIcon != null) { 59 | return BottomNavigationBarItem( 60 | activeIcon: Image.asset( 61 | Img.getAssetsImg(activeIcon), 62 | width: 28.0, 63 | ), 64 | icon: Image.asset( 65 | Img.getAssetsImg(icon), 66 | width: 28.0, 67 | ), 68 | title: Text( 69 | title, 70 | style: pageIndex == index 71 | ? TextStyle(color: Color(0xffFF5267)) 72 | : TextStyle(color: Color(0xff8C8F98)), 73 | ), 74 | ); 75 | } else { 76 | return BottomNavigationBarItem( 77 | activeIcon: Icon( 78 | Icons.add, 79 | color: Colors.transparent, 80 | ), 81 | icon: Icon( 82 | Icons.add, 83 | color: Colors.transparent, 84 | ), 85 | title: Text( 86 | title, 87 | style: pageIndex == index 88 | ? TextStyle(color: Color(0xffFF5267)) 89 | : TextStyle(color: Color(0xff8C8F98)), 90 | ), 91 | ); 92 | } 93 | } 94 | 95 | @override 96 | Widget build(BuildContext context) { 97 | return WillPopScope( 98 | child: Scaffold( 99 | body: PageView( 100 | physics: NeverScrollableScrollPhysics(), 101 | children: [HomePage(), BillPage(), ReportPage(), MinePage()], 102 | onPageChanged: onPageChanged, 103 | controller: pageController, 104 | ), 105 | floatingActionButton: FloatingActionButton( 106 | backgroundColor: Color(0xffFF5267), 107 | elevation: 0, 108 | focusElevation: 0, 109 | onPressed: () { 110 | keepAccount(); 111 | }, 112 | child: Icon( 113 | Icons.add, 114 | size: 25.0, 115 | color: Colors.white, 116 | ), 117 | ), 118 | floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, 119 | bottomNavigationBar: BottomNavigationBar( 120 | elevation: 3, 121 | backgroundColor: Color(0xffffffff), 122 | selectedFontSize: 12.0, 123 | unselectedFontSize: 12.0, 124 | items: [ 125 | _bottomNavigationBarItem( 126 | activeIcon: 'ic_skin_home_property_pressed.png', 127 | icon: 'ic_skin_home_property.png', 128 | index: 0, 129 | title: '首页', 130 | ), 131 | _bottomNavigationBarItem( 132 | activeIcon: 'ic_skin_home_bill_pressed.png', 133 | icon: 'ic_skin_home_bill.png', 134 | index: 1, 135 | title: '账户', 136 | ), 137 | _bottomNavigationBarItem( 138 | activeIcon: null, 139 | icon: null, 140 | index: 2, 141 | title: '记账', 142 | ), 143 | _bottomNavigationBarItem( 144 | activeIcon: 'ic_skin_home_chart_pressed.png', 145 | icon: 'ic_skin_home_chart.png', 146 | index: 3, 147 | title: '图表', 148 | ), 149 | _bottomNavigationBarItem( 150 | activeIcon: 'ic_skin_home_me_pressed.png', 151 | icon: 'ic_skin_home_me.png', 152 | index: 4, 153 | title: '我的', 154 | ), 155 | ], 156 | type: BottomNavigationBarType.fixed, 157 | fixedColor: Theme.of(context).primaryColor, 158 | onTap: onTap, 159 | currentIndex: pageIndex), 160 | ), 161 | onWillPop: () { 162 | int newTime = DateTime.now().millisecondsSinceEpoch; 163 | int result = newTime - lastTime; 164 | lastTime = newTime; 165 | if (result > 2000) { 166 | Toast.show('再按一次退出'); 167 | } else { 168 | SystemNavigator.pop(); 169 | } 170 | return null; 171 | }, 172 | ); 173 | } 174 | } 175 | -------------------------------------------------------------------------------- /lib/pages/budget/budget_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_pocket_book/utils/img_util.dart'; 4 | import 'package:percent_indicator/circular_percent_indicator.dart'; 5 | 6 | /// 预算中心 7 | class BudgetPage extends StatefulWidget { 8 | @override 9 | _BudgetPageState createState() => _BudgetPageState(); 10 | } 11 | 12 | class _BudgetPageState extends State { 13 | @override 14 | Widget build(BuildContext context) { 15 | return Scaffold( 16 | appBar: AppBar( 17 | flexibleSpace: Container( 18 | decoration: BoxDecoration( 19 | gradient: LinearGradient( 20 | colors: [Color(0xffF07D59), Color(0xffEB4F70)], 21 | ), 22 | ), 23 | ), 24 | backgroundColor: Color(0xffFF5267), 25 | elevation: 0, 26 | title: Text('预算中心'), 27 | ), 28 | body: Column( 29 | children: [ 30 | // 头部环形进度条 31 | Row( 32 | children: [ 33 | Container( 34 | padding: EdgeInsets.symmetric(horizontal: 25.0, vertical: 15.0), 35 | child: CircularPercentIndicator( 36 | // 进度条形状 37 | circularStrokeCap: CircularStrokeCap.round, 38 | // 进度条加载动画 39 | animation: true, 40 | // 动画时长,单位毫秒 41 | animationDuration: 1000, 42 | // 进度条宽度 43 | radius: 100.0, 44 | // 边框宽度 45 | lineWidth: 8.0, 46 | // 进度条颜色 47 | progressColor: Color(0xffFF5267), 48 | // 背景色 49 | backgroundColor: Color(0xffF3F0F1), 50 | // 环比进度 51 | percent: 0.5, 52 | header: Padding( 53 | padding: const EdgeInsets.only(bottom: 5.0), 54 | child: Text( 55 | "本月总预算", 56 | style: TextStyle( 57 | fontSize: 16.0, 58 | fontWeight: FontWeight.w600, 59 | color: Colors.black87, 60 | ), 61 | ), 62 | ), 63 | footer: null, 64 | center: Center( 65 | child: Column( 66 | crossAxisAlignment: CrossAxisAlignment.center, 67 | mainAxisAlignment: MainAxisAlignment.center, 68 | children: [ 69 | Text( 70 | '剩余', 71 | style: TextStyle( 72 | color: Colors.black54, 73 | fontSize: 14.0, 74 | ), 75 | ), 76 | SizedBox( 77 | height: 3.0, 78 | ), 79 | Text('50%', 80 | style: TextStyle( 81 | color: Colors.black87, 82 | fontSize: 18.0, 83 | )), 84 | ], 85 | ), 86 | ), 87 | // backgroundColor: Colors.grey, 88 | ), 89 | ), 90 | Expanded( 91 | child: Container( 92 | padding: EdgeInsets.only(top: 20.0), 93 | child: Column( 94 | children: [ 95 | rowItem(title: '总预算', sum: 3000), 96 | rowItem(title: '已支出', sum: 1500), 97 | rowItem(title: '剩余预算', sum: 1500), 98 | ], 99 | ), 100 | ), 101 | ) 102 | ], 103 | ), 104 | Container( 105 | height: 8.0, 106 | color: Color(0xffF6F6F6), 107 | ), 108 | // 缺省页 109 | Expanded( 110 | child: Container( 111 | padding: EdgeInsets.only(bottom: 20.0), 112 | child: Center( 113 | child: Column( 114 | mainAxisAlignment: MainAxisAlignment.center, 115 | children: [ 116 | Container( 117 | width: 178.0, 118 | child: Image.asset( 119 | Img.getAssetsImg('empty.png'), 120 | ), 121 | ), 122 | Text( 123 | '未设置分类预算', 124 | style: TextStyle(fontSize: 16.0, color: Colors.black38), 125 | ) 126 | ], 127 | ), 128 | ), 129 | ), 130 | ), 131 | 132 | Container( 133 | height: 50.0, 134 | width: double.infinity, 135 | child: RaisedButton( 136 | color: Color(0xffFF5267), 137 | onPressed: () {}, 138 | child: Text( 139 | '添加分类预算', 140 | style: TextStyle(fontSize: 16.0, color: Colors.white), 141 | ), 142 | ), 143 | ) 144 | ], 145 | ), 146 | ); 147 | } 148 | 149 | Container rowItem({String title, double sum}) { 150 | return Container( 151 | height: 22.0, 152 | padding: EdgeInsets.only( 153 | right: 20.0, 154 | ), 155 | child: Row( 156 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 157 | children: [ 158 | Text( 159 | title, 160 | style: TextStyle(fontSize: 14.0,color: Colors.black54), 161 | ), 162 | Text( 163 | sum.toStringAsFixed(2), 164 | style: TextStyle(fontSize: 14.0), 165 | ), 166 | ], 167 | ), 168 | ); 169 | } 170 | } 171 | -------------------------------------------------------------------------------- /lib/pages/bill/bill_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter/services.dart'; 4 | import 'package:flutter_pocket_book/widgets/panel_widget.dart'; 5 | import 'package:pull_to_refresh/pull_to_refresh.dart'; 6 | 7 | class BillPage extends StatefulWidget { 8 | @override 9 | _BillPageState createState() => _BillPageState(); 10 | } 11 | 12 | class _BillPageState extends State { 13 | TextStyle _bannerText = TextStyle(fontSize: 14.0, color: Colors.white); 14 | 15 | // 总资产 16 | num totalAssets = 266.55123; 17 | 18 | // 总负债 19 | num totalLiabilities = 8.00123; 20 | 21 | bool _isExpanded = false; 22 | 23 | // 是否可见 24 | bool _isVisible = true; 25 | 26 | // 账户列表 27 | List list; 28 | 29 | @override 30 | void initState() { 31 | super.initState(); 32 | } 33 | 34 | // 定义下拉加载控制器 35 | RefreshController _refreshController = 36 | RefreshController(initialRefresh: false); 37 | 38 | // 下拉刷新 39 | void _onRefresh() async { 40 | // monitor network fetch 41 | await Future.delayed(Duration(milliseconds: 500)); 42 | // if failed,use refreshFailed() 43 | _refreshController.refreshCompleted(); 44 | } 45 | 46 | @override 47 | Widget build(BuildContext context) { 48 | return AnnotatedRegion( 49 | value: SystemUiOverlayStyle.light, 50 | child: Scaffold( 51 | body: MediaQuery.removePadding( 52 | // 移除上边距 53 | removeTop: true, 54 | context: context, 55 | child: Container( 56 | color: Color(0xffF6F6F6), 57 | child: Column( 58 | children: [ 59 | Banner( 60 | isVisible: _isVisible, 61 | totalAssets: totalAssets, 62 | totalLiabilities: totalLiabilities, 63 | bannerText: _bannerText, 64 | onChange: () { 65 | setState(() { 66 | _isVisible = !_isVisible; 67 | }); 68 | }, 69 | ), 70 | Expanded( 71 | child: SmartRefresher( 72 | enablePullDown: true, 73 | enablePullUp: false, 74 | header: WaterDropMaterialHeader( 75 | color: Colors.white, 76 | backgroundColor: Color(0xffFF5267), 77 | ), 78 | controller: _refreshController, 79 | onRefresh: _onRefresh, 80 | child: ListView( 81 | children: [ 82 | PanelWidget(), 83 | PanelWidget(), 84 | PanelWidget(), 85 | ], 86 | ), 87 | ), 88 | ) 89 | ], 90 | ), 91 | ), 92 | ), 93 | ), 94 | ); 95 | } 96 | } 97 | 98 | // banner 99 | class Banner extends StatelessWidget { 100 | const Banner({ 101 | Key key, 102 | @required this.totalAssets, 103 | @required this.isVisible, 104 | @required this.totalLiabilities, 105 | @required TextStyle bannerText, 106 | this.onChange, 107 | }) : _bannerText = bannerText, 108 | super(key: key); 109 | 110 | final num totalAssets; 111 | final bool isVisible; 112 | final num totalLiabilities; 113 | final TextStyle _bannerText; 114 | final Function onChange; 115 | 116 | @override 117 | Widget build(BuildContext context) { 118 | return Container( 119 | padding: EdgeInsets.only( 120 | top: MediaQuery.of(context).padding.top, 121 | bottom: 20.0, 122 | left: 20.0, 123 | right: 5.0), 124 | // padding: EdgeInsets.all(20.0), 125 | height: 172.0, 126 | width: MediaQuery.of(context).size.width, 127 | decoration: BoxDecoration( 128 | gradient: const LinearGradient( 129 | colors: [Color(0xffF07D59), Color(0xffEB4F70)]), 130 | ), 131 | child: Column( 132 | mainAxisAlignment: MainAxisAlignment.end, 133 | crossAxisAlignment: CrossAxisAlignment.start, 134 | children: [ 135 | Row( 136 | mainAxisAlignment: MainAxisAlignment.end, 137 | children: [ 138 | IconButton( 139 | padding: EdgeInsets.all(0), 140 | onPressed: () { 141 | if (onChange != null) { 142 | onChange(); 143 | } 144 | }, 145 | icon: Icon( 146 | isVisible ? Icons.visibility_off : Icons.visibility, 147 | size: 20.0, 148 | color: Colors.white, 149 | ), 150 | ), 151 | IconButton( 152 | padding: EdgeInsets.all(0), 153 | onPressed: () { 154 | Navigator.pushNamed(context, 'accountSelect'); 155 | }, 156 | icon: Icon( 157 | Icons.add, 158 | size: 25.0, 159 | color: Colors.white, 160 | ), 161 | ), 162 | ], 163 | ), 164 | Text( 165 | '净资产', 166 | style: TextStyle(color: Colors.white, fontSize: 14.0), 167 | ), 168 | Padding( 169 | padding: const EdgeInsets.only(bottom: 8.0), 170 | child: RichText( 171 | text: TextSpan( 172 | text: isVisible 173 | ? ((totalAssets - totalLiabilities).toInt() ?? 0).toString() 174 | : '*****', 175 | style: TextStyle( 176 | fontSize: 36.0, 177 | ), 178 | children: [ 179 | if (isVisible == true) 180 | TextSpan(text: '.', style: TextStyle(fontSize: 20.0)), 181 | if (isVisible == true) 182 | TextSpan( 183 | text: (int.tryParse((totalAssets - totalLiabilities) 184 | .toStringAsFixed(2) 185 | .split('.')[1])) 186 | .toString(), 187 | style: TextStyle( 188 | fontSize: 20.0, 189 | ), 190 | ), 191 | ], 192 | ), 193 | ), 194 | ), 195 | Row( 196 | children: [ 197 | Text( 198 | '总资产', 199 | style: _bannerText, 200 | ), 201 | Padding( 202 | padding: const EdgeInsets.only(left: 5.0), 203 | child: Text( 204 | isVisible 205 | ? (totalAssets.toInt()).toStringAsFixed(2) 206 | : '*****', 207 | style: _bannerText, 208 | ), 209 | ), 210 | Container( 211 | margin: EdgeInsets.symmetric(horizontal: 10.0), 212 | width: 1.0, 213 | height: 10.0, 214 | color: Colors.white, 215 | ), 216 | Text( 217 | '总负债', 218 | style: _bannerText, 219 | ), 220 | Padding( 221 | padding: const EdgeInsets.only(left: 5.0), 222 | child: Text( 223 | isVisible 224 | ? (totalLiabilities.toInt()).toStringAsFixed(2) 225 | : '*****', 226 | style: _bannerText, 227 | ), 228 | ), 229 | ], 230 | ) 231 | ], 232 | ), 233 | ); 234 | } 235 | } 236 | -------------------------------------------------------------------------------- /lib/pages/report/report_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:fl_chart/fl_chart.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class ReportPage extends StatefulWidget { 5 | @override 6 | State createState() => ReportPageState(); 7 | } 8 | 9 | /// 收支统计 10 | class ReportPageState extends State { 11 | // 收入柱颜色 12 | final Color leftBarColor = const Color(0xff53fdd7); 13 | 14 | // 支出柱颜色 15 | final Color rightBarColor = const Color(0xffff5182); 16 | 17 | // 柱宽 18 | final double width = 5; 19 | 20 | List rawBarGroups; 21 | List showingBarGroups; 22 | 23 | int touchedGroupIndex; 24 | 25 | @override 26 | void initState() { 27 | super.initState(); 28 | final barGroup1 = makeGroupData(0, 5, 12); 29 | final barGroup2 = makeGroupData(1, 16, 12); 30 | final barGroup3 = makeGroupData(2, 18, 5); 31 | final barGroup4 = makeGroupData(3, 20, 16); 32 | final barGroup5 = makeGroupData(4, 17, 6); 33 | final barGroup6 = makeGroupData(5, 19, 1.5); 34 | final barGroup7 = makeGroupData(6, 10, 1.5); 35 | 36 | final items = [ 37 | barGroup1, 38 | barGroup2, 39 | barGroup3, 40 | barGroup4, 41 | barGroup5, 42 | barGroup6, 43 | barGroup7, 44 | ]; 45 | 46 | rawBarGroups = items; 47 | 48 | showingBarGroups = rawBarGroups; 49 | } 50 | 51 | @override 52 | Widget build(BuildContext context) { 53 | return MediaQuery.removePadding( 54 | context: context, 55 | removeTop: true, 56 | child: Column( 57 | children: [ 58 | Container( 59 | height: 345, 60 | padding: const EdgeInsets.only( 61 | bottom: 10, top: 15.0, left: 10.0, right: 10.0), 62 | color: const Color(0xff2c4260), 63 | child: Column( 64 | crossAxisAlignment: CrossAxisAlignment.stretch, 65 | mainAxisAlignment: MainAxisAlignment.start, 66 | mainAxisSize: MainAxisSize.max, 67 | children: [ 68 | Padding( 69 | padding: const EdgeInsets.symmetric(horizontal: 8.0), 70 | child: BarChart( 71 | BarChartData( 72 | maxY: 22, 73 | barTouchData: BarTouchData( 74 | touchTooltipData: BarTouchTooltipData( 75 | tooltipBgColor: Colors.grey, 76 | getTooltipItem: (_a, _b, _c, _d) => null, 77 | ), 78 | touchCallback: (response) { 79 | if (response.spot == null) { 80 | setState(() { 81 | touchedGroupIndex = -1; 82 | showingBarGroups = List.of(rawBarGroups); 83 | }); 84 | return; 85 | } 86 | 87 | touchedGroupIndex = 88 | response.spot.touchedBarGroupIndex; 89 | 90 | setState(() { 91 | if (response.touchInput is FlLongPressEnd || 92 | response.touchInput is FlPanEnd) { 93 | touchedGroupIndex = -1; 94 | showingBarGroups = List.of(rawBarGroups); 95 | } else { 96 | showingBarGroups = List.of(rawBarGroups); 97 | if (touchedGroupIndex != -1) { 98 | double sum = 0; 99 | for (BarChartRodData rod 100 | in showingBarGroups[touchedGroupIndex] 101 | .barRods) { 102 | sum += rod.y; 103 | } 104 | final avg = sum / 105 | showingBarGroups[touchedGroupIndex] 106 | .barRods 107 | .length; 108 | 109 | showingBarGroups[touchedGroupIndex] = 110 | showingBarGroups[touchedGroupIndex] 111 | .copyWith( 112 | barRods: showingBarGroups[touchedGroupIndex] 113 | .barRods 114 | .map((rod) { 115 | return rod.copyWith(y: avg); 116 | }).toList(), 117 | ); 118 | } 119 | } 120 | }); 121 | }), 122 | titlesData: FlTitlesData( 123 | show: true, 124 | bottomTitles: SideTitles( 125 | // x轴坐标信息 126 | showTitles: true, 127 | textStyle: TextStyle( 128 | color: const Color(0xff7589a2), fontSize: 12), 129 | margin: 10, 130 | getTitles: (double value) { 131 | switch (value.toInt()) { 132 | case 0: 133 | return '周一'; 134 | case 1: 135 | return '周二'; 136 | case 2: 137 | return '周三'; 138 | case 3: 139 | return '周四'; 140 | case 4: 141 | return '周五'; 142 | case 5: 143 | return '周六'; 144 | case 6: 145 | return '周日'; 146 | default: 147 | return ''; 148 | } 149 | }, 150 | ), 151 | leftTitles: SideTitles( 152 | showTitles: true, 153 | textStyle: TextStyle( 154 | color: const Color(0xff7589a2), fontSize: 12), 155 | margin: 15, 156 | reservedSize: 10, 157 | getTitles: (value) { 158 | if (value == 0) { 159 | return '1K'; 160 | } else if (value == 10) { 161 | return '5K'; 162 | } else if (value == 19) { 163 | return '10K'; 164 | } else { 165 | return ''; 166 | } 167 | }, 168 | ), 169 | ), 170 | borderData: FlBorderData( 171 | show: false, 172 | ), 173 | barGroups: showingBarGroups, 174 | ), 175 | ), 176 | ), 177 | const SizedBox( 178 | height: 12, 179 | ), 180 | ], 181 | ), 182 | ), 183 | ], 184 | ), 185 | ); 186 | } 187 | 188 | BarChartGroupData makeGroupData(int x, double y1, double y2) { 189 | return BarChartGroupData(barsSpace: 4, x: x, barRods: [ 190 | BarChartRodData( 191 | y: y1, 192 | color: leftBarColor, 193 | width: width, 194 | ), 195 | BarChartRodData( 196 | y: y2, 197 | color: rightBarColor, 198 | width: width, 199 | ), 200 | ]); 201 | } 202 | } 203 | -------------------------------------------------------------------------------- /lib/pages/test/screens.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:persistent_bottom_nav_bar/persistent-tab-view.dart'; 3 | 4 | import 'modal-screen.dart'; 5 | 6 | class MainScreen extends StatelessWidget { 7 | final BuildContext menuScreenContext; 8 | final Function onScreenHideButtonPressed; 9 | final bool hideStatus; 10 | const MainScreen( 11 | {Key key, 12 | this.menuScreenContext, 13 | this.onScreenHideButtonPressed, 14 | this.hideStatus = false}) 15 | : super(key: key); 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | return SingleChildScrollView( 20 | child: SizedBox( 21 | height: MediaQuery.of(context).size.height, 22 | width: MediaQuery.of(context).size.width, 23 | child: Scaffold( 24 | appBar: AppBar( 25 | title: Text("First Screen"), 26 | ), 27 | backgroundColor: Colors.indigo, 28 | body: Column( 29 | mainAxisAlignment: MainAxisAlignment.center, 30 | crossAxisAlignment: CrossAxisAlignment.center, 31 | children: [ 32 | Padding( 33 | padding: const EdgeInsets.symmetric( 34 | horizontal: 30.0, vertical: 20.0), 35 | child: TextField( 36 | decoration: InputDecoration(hintText: "Test Text Field"), 37 | ), 38 | ), 39 | Center( 40 | child: RaisedButton( 41 | color: Colors.blue, 42 | onPressed: () { 43 | pushNewScreenWithRouteSettings(context, 44 | settings: RouteSettings(name: '/home'), 45 | screen: MainScreen2(), 46 | pageTransitionAnimation: 47 | PageTransitionAnimation.scaleRotate); 48 | }, 49 | child: Text( 50 | "Go to Second Screen ->", 51 | style: TextStyle(color: Colors.white), 52 | ), 53 | ), 54 | ), 55 | Center( 56 | child: RaisedButton( 57 | color: Colors.deepOrange, 58 | onPressed: () { 59 | showModalBottomSheet( 60 | context: context, 61 | backgroundColor: Colors.white, 62 | useRootNavigator: true, 63 | builder: (context) => Center( 64 | child: RaisedButton( 65 | onPressed: () { 66 | Navigator.pop(context); 67 | }, 68 | color: Colors.blue, 69 | child: Text( 70 | "Exit", 71 | style: TextStyle(color: Colors.white), 72 | ), 73 | ), 74 | ), 75 | ); 76 | }, 77 | child: Text( 78 | "Push bottom sheet on TOP of Nav Bar", 79 | style: TextStyle(color: Colors.white), 80 | ), 81 | ), 82 | ), 83 | Center( 84 | child: RaisedButton( 85 | color: Colors.deepOrange, 86 | onPressed: () { 87 | showModalBottomSheet( 88 | context: context, 89 | backgroundColor: Colors.white, 90 | useRootNavigator: false, 91 | builder: (context) => Center( 92 | child: RaisedButton( 93 | onPressed: () { 94 | Navigator.pop(context); 95 | }, 96 | color: Colors.blue, 97 | child: Text( 98 | "Exit", 99 | style: TextStyle(color: Colors.white), 100 | ), 101 | ), 102 | ), 103 | ); 104 | }, 105 | child: Text( 106 | "Push bottom sheet BEHIND the Nav Bar", 107 | style: TextStyle(color: Colors.white), 108 | ), 109 | ), 110 | ), 111 | Center( 112 | child: RaisedButton( 113 | color: Colors.lime, 114 | onPressed: () { 115 | pushDynamicScreen(context, 116 | screen: SampleModalScreen(), withNavBar: true); 117 | }, 118 | child: Text( 119 | "Push Dynamic/Modal Screen", 120 | style: TextStyle(color: Colors.white), 121 | ), 122 | ), 123 | ), 124 | Center( 125 | child: RaisedButton( 126 | color: Colors.purpleAccent, 127 | onPressed: () { 128 | this.onScreenHideButtonPressed(); 129 | }, 130 | child: Text( 131 | this.hideStatus 132 | ? "Unhide Navigation Bar" 133 | : "Hide Navigation Bar", 134 | style: TextStyle(color: Colors.white), 135 | ), 136 | ), 137 | ), 138 | Center( 139 | child: RaisedButton( 140 | color: Colors.red, 141 | onPressed: () { 142 | Navigator.of(this.menuScreenContext).pop(); 143 | }, 144 | child: Text( 145 | "<- Main Menu", 146 | style: TextStyle(color: Colors.white), 147 | ), 148 | ), 149 | ), 150 | ], 151 | ), 152 | ), 153 | ), 154 | ); 155 | } 156 | } 157 | 158 | class MainScreen2 extends StatelessWidget { 159 | const MainScreen2({Key key}) : super(key: key); 160 | 161 | @override 162 | Widget build(BuildContext context) { 163 | return Scaffold( 164 | backgroundColor: Colors.teal, 165 | appBar: AppBar( 166 | title: Text("Second Screen"), 167 | ), 168 | body: Container( 169 | child: Center( 170 | child: Column( 171 | mainAxisAlignment: MainAxisAlignment.center, 172 | children: [ 173 | RaisedButton( 174 | color: Colors.indigo, 175 | onPressed: () { 176 | pushNewScreen(context, screen: MainScreen3()); 177 | }, 178 | child: Text( 179 | "Go to Third Screen", 180 | style: TextStyle(color: Colors.white), 181 | ), 182 | ), 183 | RaisedButton( 184 | color: Colors.indigo, 185 | onPressed: () { 186 | Navigator.pop(context); 187 | }, 188 | child: Text( 189 | "Go Back to First Screen", 190 | style: TextStyle(color: Colors.white), 191 | ), 192 | ), 193 | ], 194 | ), 195 | ), 196 | ), 197 | ); 198 | } 199 | } 200 | 201 | class MainScreen3 extends StatelessWidget { 202 | const MainScreen3({Key key}) : super(key: key); 203 | 204 | @override 205 | Widget build(BuildContext context) { 206 | return Scaffold( 207 | appBar: AppBar( 208 | title: Text("Third Screen"), 209 | ), 210 | backgroundColor: Colors.deepOrangeAccent, 211 | body: Container( 212 | child: Center( 213 | child: RaisedButton( 214 | color: Colors.blue, 215 | onPressed: () { 216 | Navigator.pop(context); 217 | }, 218 | child: Text( 219 | "Go Back to Second Screen", 220 | style: TextStyle(color: Colors.white), 221 | ), 222 | ), 223 | ), 224 | ), 225 | ); 226 | } 227 | } -------------------------------------------------------------------------------- /lib/pages/mine/mine_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter/services.dart'; 4 | import 'package:flutter_pocket_book/utils/img_util.dart'; 5 | import 'package:flutter_pocket_book/utils/toast_util.dart'; 6 | import 'package:flutter_pocket_book/widgets/cell_widget.dart'; 7 | 8 | import 'mine_ad_widget.dart'; 9 | 10 | class MinePage extends StatefulWidget { 11 | @override 12 | _MinePageState createState() => _MinePageState(); 13 | } 14 | 15 | class _MinePageState extends State { 16 | @override 17 | Widget build(BuildContext context) { 18 | // AnnotatedRegion 修改状态栏颜色 19 | return AnnotatedRegion( 20 | value: SystemUiOverlayStyle.dark, 21 | child: Scaffold( 22 | body: Column( 23 | children: [ 24 | // 顶部按钮 25 | Container( 26 | margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top), 27 | padding: EdgeInsets.only(right: 10.0, top: 10.0, bottom: 10.0), 28 | child: Row( 29 | mainAxisAlignment: MainAxisAlignment.end, 30 | children: [ 31 | InkWell( 32 | onTap: () { 33 | print('点击消息按钮'); 34 | Navigator.pushNamed(context, '/message'); 35 | }, 36 | borderRadius: BorderRadius.circular(100.0), 37 | child: Padding( 38 | padding: EdgeInsets.all(10.0), 39 | child: Image.asset( 40 | Img.getAssetsImg('ic_mine_message.png'), 41 | height: 20.0, 42 | ), 43 | ), 44 | ), 45 | InkWell( 46 | onTap: () { 47 | print('点击设置按钮'); 48 | // Toast.show('msg'); 49 | Navigator.pushNamed(context, '/set'); 50 | }, 51 | borderRadius: BorderRadius.circular(100.0), 52 | child: Padding( 53 | padding: EdgeInsets.all(10.0), 54 | child: Image.asset( 55 | Img.getAssetsImg('ic_mine_setting.png'), 56 | height: 20.0, 57 | ), 58 | ), 59 | ), 60 | ], 61 | ), 62 | ), 63 | // 用户信息 64 | GestureDetector( 65 | onTap: () { 66 | Navigator.pushNamed(context, '/login'); 67 | }, 68 | child: Container( 69 | padding: EdgeInsets.only(bottom: 15.0), 70 | child: Row( 71 | children: [ 72 | Padding( 73 | padding: EdgeInsets.only(left: 20.0), 74 | child: Image.asset( 75 | Img.getAssetsImg("ic_vip_default_avatar.png"), 76 | height: 65.0, 77 | width: 65.0, 78 | ), 79 | ), 80 | Container( 81 | margin: EdgeInsets.only(left: 15.0), 82 | // padding: EdgeInsets.only(bottom: 15.0), 83 | height: 58.0, 84 | child: Column( 85 | crossAxisAlignment: CrossAxisAlignment.start, 86 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 87 | children: [ 88 | Text( 89 | "立即登陆", 90 | style: TextStyle( 91 | fontSize: 18.0, 92 | fontWeight: FontWeight.w700, 93 | ), 94 | ), 95 | Text( 96 | "登陆后,将会拥有更好的使用体验", 97 | style: TextStyle( 98 | fontSize: 13.0, 99 | color: Colors.grey, 100 | ), 101 | ), 102 | ], 103 | ), 104 | ), 105 | ], 106 | ), 107 | ), 108 | ), 109 | // MineAd(), 110 | block(), 111 | // CellWidget( 112 | // onTap: () { 113 | // Toast.show('开通VIP'); 114 | // }, 115 | // title: '开通VIP', 116 | // value: '支持导出账单,专属皮肤', 117 | // icon: Image.asset( 118 | // Img.getAssetsImg('icon_vip.png'), 119 | // fit: BoxFit.cover, 120 | // width: 18.0, 121 | // ), 122 | // ), 123 | // CellWidget( 124 | // onTap: () { 125 | // Toast.show('我的福利'); 126 | // }, 127 | // title: '我的福利', 128 | // value: '热门活动', 129 | // icon: Image.asset( 130 | // Img.getAssetsImg('icon_fuli.png'), 131 | // fit: BoxFit.cover, 132 | // width: 18.0, 133 | // ), 134 | // ), 135 | // CellWidget( 136 | // onTap: () { 137 | // Toast.show('我的客服'); 138 | // }, 139 | // title: '我的客服', 140 | // value: '联系客服', 141 | // icon: Image.asset( 142 | // Img.getAssetsImg('icon_kefu.png'), 143 | // fit: BoxFit.cover, 144 | // width: 18.0, 145 | // ), 146 | // ), 147 | CellWidget( 148 | onTap: () { 149 | // Toast.show('我的客服'); 150 | Navigator.pushNamed(context, '/budget'); 151 | }, 152 | title: '预算中心', 153 | value: '收支管理', 154 | icon: Image.asset( 155 | Img.getAssetsImg('icon_yusuan.png'), 156 | fit: BoxFit.cover, 157 | width: 18.0, 158 | ), 159 | ), 160 | CellWidget( 161 | onTap: () { 162 | // Toast.show('我的客服'); 163 | Navigator.pushNamed(context, '/budget'); 164 | }, 165 | title: '标签管理', 166 | value: '分类统计', 167 | icon: Image.asset( 168 | Img.getAssetsImg('icon_biaoqian.png'), 169 | fit: BoxFit.cover, 170 | width: 16.0, 171 | height: 16.0, 172 | ), 173 | ), 174 | CellWidget( 175 | onTap: () { 176 | // Toast.show('我的客服'); 177 | Navigator.pushNamed(context, '/budget'); 178 | }, 179 | title: '家庭成员', 180 | value: '全家能用', 181 | icon: Image.asset( 182 | Img.getAssetsImg('icon_jtcy.png'), 183 | fit: BoxFit.cover, 184 | width: 16.0, 185 | height: 16.0, 186 | ), 187 | ), 188 | block(), 189 | CellWidget( 190 | onTap: () { 191 | // Toast.show('我的客服'); 192 | Navigator.pushNamed(context, '/encourage'); 193 | }, 194 | title: '爱的鼓励', 195 | value: '', 196 | icon: Image.asset( 197 | Img.getAssetsImg('icon_aixin.png'), 198 | fit: BoxFit.cover, 199 | width: 16.0, 200 | height: 16.0, 201 | ), 202 | ), 203 | 204 | 205 | 206 | // CellWidget( 207 | // onTap: () { 208 | // Toast.show('实用工具'); 209 | // }, 210 | // title: '实用工具', 211 | // value: '房贷计算器', 212 | // icon: Image.asset( 213 | // Img.getAssetsImg('icon_gongju.png'), 214 | // fit: BoxFit.cover, 215 | // width: 18.0, 216 | // ), 217 | // ), 218 | ], 219 | ), 220 | ), 221 | ); 222 | } 223 | 224 | Container block() { 225 | return Container( 226 | height: 10.0, 227 | color: Color.fromARGB(255, 245, 245, 245), 228 | ); 229 | } 230 | } 231 | -------------------------------------------------------------------------------- /lib/pages/home/home_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_pocket_book/utils/img_util.dart'; 4 | import 'package:photo_view/photo_view.dart'; 5 | import 'package:timeline_tile/timeline_tile.dart'; 6 | 7 | class HomePage extends StatefulWidget { 8 | @override 9 | _HomePageState createState() => _HomePageState(); 10 | } 11 | 12 | class _HomePageState extends State { 13 | @override 14 | Widget build(BuildContext context) { 15 | return Scaffold( 16 | appBar: AppBar( 17 | flexibleSpace: Container( 18 | decoration: BoxDecoration( 19 | gradient: LinearGradient( 20 | colors: [Color(0xffF07D59), Color(0xffEB4F70)], 21 | ), 22 | ), 23 | ), 24 | backgroundColor: Color(0xffFF5267), 25 | elevation: 0, 26 | title: Text('首页'), 27 | ), 28 | body: ListView( 29 | children: List.generate( 30 | 20, 31 | (index) => TimelineTile( 32 | indicatorStyle: IndicatorStyle(width: 6.0), 33 | bottomLineStyle: LineStyle(width: 0.33), 34 | topLineStyle: LineStyle(width: 0.33), 35 | // lineX: 115.0, 36 | alignment: TimelineAlign.center, 37 | leftChild: Container( 38 | padding: EdgeInsets.only(right: 8.0), 39 | alignment: Alignment.centerRight, 40 | child: Text( 41 | '09月 11日', 42 | style: TextStyle(fontSize: 16.0), 43 | ), 44 | ), 45 | rightChild: Container( 46 | // color: Colors.red, 47 | margin: EdgeInsets.only(bottom: 1), 48 | padding: EdgeInsets.only(left: 8.0), 49 | alignment: Alignment.centerLeft, 50 | constraints: BoxConstraints( 51 | minHeight: 120, 52 | ), 53 | child: Column( 54 | crossAxisAlignment: CrossAxisAlignment.start, 55 | mainAxisAlignment: MainAxisAlignment.center, 56 | children: [ 57 | recordItem( 58 | time: '15.02', 59 | type: '买菜', 60 | remark: '去晚了肉没了', 61 | img: 'empty.png'), 62 | recordItem( 63 | time: '15.02', type: '晚餐', remark: '楼下饭堂吃的'), 64 | ], 65 | ), 66 | ), 67 | ))), 68 | ); 69 | } 70 | 71 | Container recordItem({String time, String type, String remark, String img}) { 72 | return Container( 73 | padding: EdgeInsets.only(bottom: 5.0), 74 | child: Column( 75 | crossAxisAlignment: CrossAxisAlignment.start, 76 | mainAxisAlignment: MainAxisAlignment.center, 77 | children: [ 78 | Text( 79 | time, 80 | style: TextStyle(fontSize: 12.0, color: Colors.black45), 81 | ), 82 | Padding( 83 | padding: const EdgeInsets.symmetric(vertical: 1.0), 84 | child: Row( 85 | children: [ 86 | Text(type), 87 | SizedBox( 88 | width: 5.0, 89 | ), 90 | Text(50.toStringAsFixed(2)), 91 | ], 92 | ), 93 | ), 94 | if (remark != null) 95 | Text( 96 | remark, 97 | style: TextStyle(fontSize: 12.0, color: Colors.black45), 98 | ), 99 | 100 | // if(img != null) Container( 101 | // child: PhotoView( 102 | // imageProvider: AssetImage(Img.getAssetsImg(img)), 103 | // ), 104 | // ) 105 | 106 | if(img != null) GestureDetector(onTap: (){ 107 | PhotoView( 108 | imageProvider: AssetImage(Img.getAssetsImg(img)), 109 | ); 110 | }, child: Image.asset(Img.getAssetsImg(img),width: 50.0,height: 50.0,fit: BoxFit.cover,)) 111 | ], 112 | ), 113 | ); 114 | } 115 | } 116 | 117 | //import 'package:flutter/material.dart'; 118 | //import 'package:google_fonts/google_fonts.dart'; 119 | //import 'package:timeline_tile/timeline_tile.dart'; 120 | // 121 | //import '../showcase_timeline.dart'; 122 | // 123 | //const example8 = Example( 124 | // name: 'Or provide your own custom indicator.', 125 | // description: 126 | // 'With the indicator parameter you can customize the tile with your own ' 127 | // 'indicator.\nHowever, you must control its size through both width and ' 128 | // 'height parameters.', 129 | // child: Example8(), 130 | // code: ''' 131 | //class Example8 extends StatelessWidget { 132 | // const Example8({Key key}) : super(key: key); 133 | // @override 134 | // Widget build(BuildContext context) { 135 | // return Container( 136 | // color: Colors.white, 137 | // child: Column( 138 | // mainAxisSize: MainAxisSize.min, 139 | // children: [ 140 | // TimelineTile( 141 | // alignment: TimelineAlign.right, 142 | // isFirst: true, 143 | // indicatorStyle: IndicatorStyle( 144 | // width: 40, 145 | // height: 60, 146 | // padding: const EdgeInsets.all(8), 147 | // indicator: Image.asset('assets/hitchhiker_2.png'), 148 | // ), 149 | // leftChild: const _Child( 150 | // text: "Don't Panic!", 151 | // font: 'Bungee', 152 | // ), 153 | // ), 154 | // TimelineTile( 155 | // alignment: TimelineAlign.right, 156 | // indicatorStyle: IndicatorStyle( 157 | // width: 40, 158 | // height: 40, 159 | // padding: const EdgeInsets.symmetric( 160 | // horizontal: 8, 161 | // ), 162 | // drawGap: true, 163 | // indicator: Container( 164 | // decoration: const BoxDecoration( 165 | // border: Border.fromBorderSide( 166 | // BorderSide( 167 | // color: Colors.grey, 168 | // ), 169 | // ), 170 | // shape: BoxShape.circle, 171 | // ), 172 | // child: const Center( 173 | // child: Text( 174 | // '42', 175 | // style: TextStyle( 176 | // color: Colors.deepOrange, 177 | // fontSize: 30, 178 | // ), 179 | // ), 180 | // ), 181 | // ), 182 | // ), 183 | // leftChild: const _Child( 184 | // text: 'So long, and thanks', 185 | // ), 186 | // ), 187 | // TimelineTile( 188 | // alignment: TimelineAlign.right, 189 | // isLast: true, 190 | // indicatorStyle: IndicatorStyle( 191 | // width: 40, 192 | // height: 40, 193 | // padding: const EdgeInsets.all(8), 194 | // indicator: Image.asset('assets/hitchhiker.png'), 195 | // ), 196 | // leftChild: const _Child( 197 | // text: 'for all the fish !', 198 | // ), 199 | // ), 200 | // ], 201 | // ), 202 | // ); 203 | // } 204 | //} 205 | //class _Child extends StatelessWidget { 206 | // const _Child({ 207 | // Key key, 208 | // this.text, 209 | // this.font = 'Shrikhand', 210 | // }) : super(key: key); 211 | // final String text; 212 | // final String font; 213 | // @override 214 | // Widget build(BuildContext context) { 215 | // return Container( 216 | // padding: const EdgeInsets.all(8), 217 | // color: Colors.amberAccent, 218 | // constraints: const BoxConstraints(minHeight: 120), 219 | // child: Center( 220 | // child: Text( 221 | // text, 222 | // textAlign: TextAlign.center, 223 | // style: GoogleFonts.getFont( 224 | // font, 225 | // color: Colors.deepOrange, 226 | // fontSize: 26, 227 | // ), 228 | // ), 229 | // ), 230 | // ); 231 | // } 232 | //};''', 233 | //); 234 | // 235 | //class Example8 extends StatelessWidget { 236 | // const Example8({Key key}) : super(key: key); 237 | // 238 | // @override 239 | // Widget build(BuildContext context) { 240 | // return SliverList( 241 | // delegate: SliverChildListDelegate( 242 | // [ 243 | // Container( 244 | // color: Colors.white, 245 | // child: Column( 246 | // mainAxisSize: MainAxisSize.min, 247 | // children: [ 248 | // TimelineTile( 249 | // alignment: TimelineAlign.right, 250 | // isFirst: true, 251 | // indicatorStyle: IndicatorStyle( 252 | // width: 40, 253 | // height: 60, 254 | // padding: const EdgeInsets.all(8), 255 | // indicator: Image.asset('assets/hitchhiker_2.png'), 256 | // ), 257 | // leftChild: const _Child( 258 | // text: "Don't Panic!", 259 | // font: 'Bungee', 260 | // ), 261 | // ), 262 | // TimelineTile( 263 | // alignment: TimelineAlign.right, 264 | // indicatorStyle: IndicatorStyle( 265 | // width: 40, 266 | // height: 40, 267 | // padding: const EdgeInsets.symmetric( 268 | // horizontal: 8, 269 | // ), 270 | // drawGap: true, 271 | // indicator: Container( 272 | // decoration: const BoxDecoration( 273 | // border: Border.fromBorderSide( 274 | // BorderSide( 275 | // color: Colors.grey, 276 | // ), 277 | // ), 278 | // shape: BoxShape.circle, 279 | // ), 280 | // child: const Center( 281 | // child: Text( 282 | // '42', 283 | // style: TextStyle( 284 | // color: Colors.deepOrange, 285 | // fontSize: 30, 286 | // ), 287 | // ), 288 | // ), 289 | // ), 290 | // ), 291 | // leftChild: const _Child( 292 | // text: 'So long, and thanks', 293 | // ), 294 | // ), 295 | // TimelineTile( 296 | // alignment: TimelineAlign.right, 297 | // isLast: true, 298 | // indicatorStyle: IndicatorStyle( 299 | // width: 40, 300 | // height: 40, 301 | // padding: const EdgeInsets.all(8), 302 | // indicator: Image.asset('assets/hitchhiker.png'), 303 | // ), 304 | // leftChild: const _Child( 305 | // text: 'for all the fish !', 306 | // ), 307 | // ), 308 | // ], 309 | // ), 310 | // ), 311 | // ], 312 | // ), 313 | // ); 314 | // } 315 | //} 316 | // 317 | //class _Child extends StatelessWidget { 318 | // const _Child({ 319 | // Key key, 320 | // this.text, 321 | // this.font = 'Shrikhand', 322 | // }) : super(key: key); 323 | // 324 | // final String text; 325 | // final String font; 326 | // 327 | // @override 328 | // Widget build(BuildContext context) { 329 | // return Container( 330 | // padding: const EdgeInsets.all(8), 331 | // color: Colors.amberAccent, 332 | // constraints: const BoxConstraints(minHeight: 120), 333 | // child: Center( 334 | // child: Text( 335 | // text, 336 | // textAlign: TextAlign.center, 337 | // style: GoogleFonts.getFont( 338 | // font, 339 | // color: Colors.deepOrange, 340 | // fontSize: 26, 341 | // ), 342 | // ), 343 | // ), 344 | // ); 345 | // } 346 | //} 347 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | archive: 5 | dependency: transitive 6 | description: 7 | name: archive 8 | url: "https://pub.flutter-io.cn" 9 | source: hosted 10 | version: "2.0.13" 11 | args: 12 | dependency: transitive 13 | description: 14 | name: args 15 | url: "https://pub.flutter-io.cn" 16 | source: hosted 17 | version: "1.6.0" 18 | async: 19 | dependency: transitive 20 | description: 21 | name: async 22 | url: "https://pub.flutter-io.cn" 23 | source: hosted 24 | version: "2.4.1" 25 | boolean_selector: 26 | dependency: transitive 27 | description: 28 | name: boolean_selector 29 | url: "https://pub.flutter-io.cn" 30 | source: hosted 31 | version: "2.0.0" 32 | charcode: 33 | dependency: transitive 34 | description: 35 | name: charcode 36 | url: "https://pub.flutter-io.cn" 37 | source: hosted 38 | version: "1.1.3" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.flutter-io.cn" 44 | source: hosted 45 | version: "1.14.12" 46 | convert: 47 | dependency: transitive 48 | description: 49 | name: convert 50 | url: "https://pub.flutter-io.cn" 51 | source: hosted 52 | version: "2.1.1" 53 | crypto: 54 | dependency: transitive 55 | description: 56 | name: crypto 57 | url: "https://pub.flutter-io.cn" 58 | source: hosted 59 | version: "2.1.4" 60 | cupertino_icons: 61 | dependency: "direct main" 62 | description: 63 | name: cupertino_icons 64 | url: "https://pub.flutter-io.cn" 65 | source: hosted 66 | version: "0.1.3" 67 | curved_navigation_bar: 68 | dependency: "direct main" 69 | description: 70 | name: curved_navigation_bar 71 | url: "https://pub.flutter-io.cn" 72 | source: hosted 73 | version: "0.3.3" 74 | dio: 75 | dependency: "direct main" 76 | description: 77 | name: dio 78 | url: "https://pub.flutter-io.cn" 79 | source: hosted 80 | version: "3.0.10" 81 | equatable: 82 | dependency: transitive 83 | description: 84 | name: equatable 85 | url: "https://pub.flutter-io.cn" 86 | source: hosted 87 | version: "1.2.4" 88 | file: 89 | dependency: transitive 90 | description: 91 | name: file 92 | url: "https://pub.flutter-io.cn" 93 | source: hosted 94 | version: "5.2.1" 95 | fl_chart: 96 | dependency: "direct main" 97 | description: 98 | name: fl_chart 99 | url: "https://pub.flutter-io.cn" 100 | source: hosted 101 | version: "0.11.1" 102 | fluro: 103 | dependency: "direct main" 104 | description: 105 | name: fluro 106 | url: "https://pub.flutter-io.cn" 107 | source: hosted 108 | version: "1.6.3" 109 | flutter: 110 | dependency: "direct main" 111 | description: flutter 112 | source: sdk 113 | version: "0.0.0" 114 | flutter_page_indicator: 115 | dependency: transitive 116 | description: 117 | name: flutter_page_indicator 118 | url: "https://pub.flutter-io.cn" 119 | source: hosted 120 | version: "0.0.3" 121 | flutter_plugin_android_lifecycle: 122 | dependency: transitive 123 | description: 124 | name: flutter_plugin_android_lifecycle 125 | url: "https://pub.flutter-io.cn" 126 | source: hosted 127 | version: "1.0.8" 128 | flutter_swiper: 129 | dependency: "direct main" 130 | description: 131 | name: flutter_swiper 132 | url: "https://pub.flutter-io.cn" 133 | source: hosted 134 | version: "1.1.6" 135 | flutter_test: 136 | dependency: "direct dev" 137 | description: flutter 138 | source: sdk 139 | version: "0.0.0" 140 | flutter_web_plugins: 141 | dependency: transitive 142 | description: flutter 143 | source: sdk 144 | version: "0.0.0" 145 | fluttertoast: 146 | dependency: "direct main" 147 | description: 148 | name: fluttertoast 149 | url: "https://pub.flutter-io.cn" 150 | source: hosted 151 | version: "7.0.4" 152 | google_fonts: 153 | dependency: "direct main" 154 | description: 155 | name: google_fonts 156 | url: "https://pub.flutter-io.cn" 157 | source: hosted 158 | version: "1.1.0" 159 | http: 160 | dependency: transitive 161 | description: 162 | name: http 163 | url: "https://pub.flutter-io.cn" 164 | source: hosted 165 | version: "0.12.2" 166 | http_parser: 167 | dependency: transitive 168 | description: 169 | name: http_parser 170 | url: "https://pub.flutter-io.cn" 171 | source: hosted 172 | version: "3.1.4" 173 | image: 174 | dependency: transitive 175 | description: 176 | name: image 177 | url: "https://pub.flutter-io.cn" 178 | source: hosted 179 | version: "2.1.12" 180 | intl: 181 | dependency: transitive 182 | description: 183 | name: intl 184 | url: "https://pub.flutter-io.cn" 185 | source: hosted 186 | version: "0.16.1" 187 | local_auth: 188 | dependency: "direct main" 189 | description: 190 | name: local_auth 191 | url: "https://pub.flutter-io.cn" 192 | source: hosted 193 | version: "0.6.3+1" 194 | matcher: 195 | dependency: transitive 196 | description: 197 | name: matcher 198 | url: "https://pub.flutter-io.cn" 199 | source: hosted 200 | version: "0.12.6" 201 | meta: 202 | dependency: transitive 203 | description: 204 | name: meta 205 | url: "https://pub.flutter-io.cn" 206 | source: hosted 207 | version: "1.1.8" 208 | mime: 209 | dependency: transitive 210 | description: 211 | name: mime 212 | url: "https://pub.flutter-io.cn" 213 | source: hosted 214 | version: "0.9.7" 215 | path: 216 | dependency: transitive 217 | description: 218 | name: path 219 | url: "https://pub.flutter-io.cn" 220 | source: hosted 221 | version: "1.6.4" 222 | path_drawing: 223 | dependency: transitive 224 | description: 225 | name: path_drawing 226 | url: "https://pub.flutter-io.cn" 227 | source: hosted 228 | version: "0.4.1+1" 229 | path_parsing: 230 | dependency: transitive 231 | description: 232 | name: path_parsing 233 | url: "https://pub.flutter-io.cn" 234 | source: hosted 235 | version: "0.1.4" 236 | path_provider: 237 | dependency: "direct main" 238 | description: 239 | name: path_provider 240 | url: "https://pub.flutter-io.cn" 241 | source: hosted 242 | version: "1.6.14" 243 | path_provider_linux: 244 | dependency: transitive 245 | description: 246 | name: path_provider_linux 247 | url: "https://pub.flutter-io.cn" 248 | source: hosted 249 | version: "0.0.1+2" 250 | path_provider_macos: 251 | dependency: transitive 252 | description: 253 | name: path_provider_macos 254 | url: "https://pub.flutter-io.cn" 255 | source: hosted 256 | version: "0.0.4+3" 257 | path_provider_platform_interface: 258 | dependency: transitive 259 | description: 260 | name: path_provider_platform_interface 261 | url: "https://pub.flutter-io.cn" 262 | source: hosted 263 | version: "1.0.3" 264 | pedantic: 265 | dependency: transitive 266 | description: 267 | name: pedantic 268 | url: "https://pub.flutter-io.cn" 269 | source: hosted 270 | version: "1.9.0" 271 | percent_indicator: 272 | dependency: "direct main" 273 | description: 274 | name: percent_indicator 275 | url: "https://pub.flutter-io.cn" 276 | source: hosted 277 | version: "2.1.6" 278 | persistent_bottom_nav_bar: 279 | dependency: "direct main" 280 | description: 281 | name: persistent_bottom_nav_bar 282 | url: "https://pub.flutter-io.cn" 283 | source: hosted 284 | version: "2.0.5" 285 | petitparser: 286 | dependency: transitive 287 | description: 288 | name: petitparser 289 | url: "https://pub.flutter-io.cn" 290 | source: hosted 291 | version: "2.4.0" 292 | photo_view: 293 | dependency: "direct main" 294 | description: 295 | name: photo_view 296 | url: "https://pub.flutter-io.cn" 297 | source: hosted 298 | version: "0.10.2" 299 | platform: 300 | dependency: transitive 301 | description: 302 | name: platform 303 | url: "https://pub.flutter-io.cn" 304 | source: hosted 305 | version: "2.2.1" 306 | plugin_platform_interface: 307 | dependency: transitive 308 | description: 309 | name: plugin_platform_interface 310 | url: "https://pub.flutter-io.cn" 311 | source: hosted 312 | version: "1.0.2" 313 | process: 314 | dependency: transitive 315 | description: 316 | name: process 317 | url: "https://pub.flutter-io.cn" 318 | source: hosted 319 | version: "3.0.13" 320 | pull_to_refresh: 321 | dependency: "direct main" 322 | description: 323 | name: pull_to_refresh 324 | url: "https://pub.flutter-io.cn" 325 | source: hosted 326 | version: "1.6.1" 327 | quiver: 328 | dependency: transitive 329 | description: 330 | name: quiver 331 | url: "https://pub.flutter-io.cn" 332 | source: hosted 333 | version: "2.1.3" 334 | share: 335 | dependency: "direct main" 336 | description: 337 | name: share 338 | url: "https://pub.flutter-io.cn" 339 | source: hosted 340 | version: "0.6.5" 341 | sky_engine: 342 | dependency: transitive 343 | description: flutter 344 | source: sdk 345 | version: "0.0.99" 346 | source_span: 347 | dependency: transitive 348 | description: 349 | name: source_span 350 | url: "https://pub.flutter-io.cn" 351 | source: hosted 352 | version: "1.7.0" 353 | sqflite: 354 | dependency: "direct main" 355 | description: 356 | name: sqflite 357 | url: "https://pub.flutter-io.cn" 358 | source: hosted 359 | version: "1.3.1+1" 360 | sqflite_common: 361 | dependency: transitive 362 | description: 363 | name: sqflite_common 364 | url: "https://pub.flutter-io.cn" 365 | source: hosted 366 | version: "1.0.2+1" 367 | stack_trace: 368 | dependency: transitive 369 | description: 370 | name: stack_trace 371 | url: "https://pub.flutter-io.cn" 372 | source: hosted 373 | version: "1.9.3" 374 | stream_channel: 375 | dependency: transitive 376 | description: 377 | name: stream_channel 378 | url: "https://pub.flutter-io.cn" 379 | source: hosted 380 | version: "2.0.0" 381 | string_scanner: 382 | dependency: transitive 383 | description: 384 | name: string_scanner 385 | url: "https://pub.flutter-io.cn" 386 | source: hosted 387 | version: "1.0.5" 388 | synchronized: 389 | dependency: transitive 390 | description: 391 | name: synchronized 392 | url: "https://pub.flutter-io.cn" 393 | source: hosted 394 | version: "2.2.0+2" 395 | term_glyph: 396 | dependency: transitive 397 | description: 398 | name: term_glyph 399 | url: "https://pub.flutter-io.cn" 400 | source: hosted 401 | version: "1.1.0" 402 | test_api: 403 | dependency: transitive 404 | description: 405 | name: test_api 406 | url: "https://pub.flutter-io.cn" 407 | source: hosted 408 | version: "0.2.15" 409 | timeline_tile: 410 | dependency: "direct main" 411 | description: 412 | name: timeline_tile 413 | url: "https://pub.flutter-io.cn" 414 | source: hosted 415 | version: "0.1.2" 416 | transformer_page_view: 417 | dependency: transitive 418 | description: 419 | name: transformer_page_view 420 | url: "https://pub.flutter-io.cn" 421 | source: hosted 422 | version: "0.1.6" 423 | typed_data: 424 | dependency: transitive 425 | description: 426 | name: typed_data 427 | url: "https://pub.flutter-io.cn" 428 | source: hosted 429 | version: "1.1.6" 430 | vector_math: 431 | dependency: transitive 432 | description: 433 | name: vector_math 434 | url: "https://pub.flutter-io.cn" 435 | source: hosted 436 | version: "2.0.8" 437 | xdg_directories: 438 | dependency: transitive 439 | description: 440 | name: xdg_directories 441 | url: "https://pub.flutter-io.cn" 442 | source: hosted 443 | version: "0.1.0" 444 | xml: 445 | dependency: transitive 446 | description: 447 | name: xml 448 | url: "https://pub.flutter-io.cn" 449 | source: hosted 450 | version: "3.6.1" 451 | sdks: 452 | dart: ">=2.8.0 <3.0.0" 453 | flutter: ">=1.17.0 <2.0.0" 454 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 13 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 14 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 15 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXCopyFilesBuildPhase section */ 19 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 20 | isa = PBXCopyFilesBuildPhase; 21 | buildActionMask = 2147483647; 22 | dstPath = ""; 23 | dstSubfolderSpec = 10; 24 | files = ( 25 | ); 26 | name = "Embed Frameworks"; 27 | runOnlyForDeploymentPostprocessing = 0; 28 | }; 29 | /* End PBXCopyFilesBuildPhase section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 33 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 34 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 35 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 36 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 37 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 38 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 39 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 40 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 42 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 43 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 44 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | /* End PBXFrameworksBuildPhase section */ 56 | 57 | /* Begin PBXGroup section */ 58 | 9740EEB11CF90186004384FC /* Flutter */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 62 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 63 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 64 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 65 | ); 66 | name = Flutter; 67 | sourceTree = ""; 68 | }; 69 | 97C146E51CF9000F007C117D = { 70 | isa = PBXGroup; 71 | children = ( 72 | 9740EEB11CF90186004384FC /* Flutter */, 73 | 97C146F01CF9000F007C117D /* Runner */, 74 | 97C146EF1CF9000F007C117D /* Products */, 75 | ); 76 | sourceTree = ""; 77 | }; 78 | 97C146EF1CF9000F007C117D /* Products */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 97C146EE1CF9000F007C117D /* Runner.app */, 82 | ); 83 | name = Products; 84 | sourceTree = ""; 85 | }; 86 | 97C146F01CF9000F007C117D /* Runner */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 90 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 91 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 92 | 97C147021CF9000F007C117D /* Info.plist */, 93 | 97C146F11CF9000F007C117D /* Supporting Files */, 94 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 95 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 96 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 97 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 98 | ); 99 | path = Runner; 100 | sourceTree = ""; 101 | }; 102 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | ); 106 | name = "Supporting Files"; 107 | sourceTree = ""; 108 | }; 109 | /* End PBXGroup section */ 110 | 111 | /* Begin PBXNativeTarget section */ 112 | 97C146ED1CF9000F007C117D /* Runner */ = { 113 | isa = PBXNativeTarget; 114 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 115 | buildPhases = ( 116 | 9740EEB61CF901F6004384FC /* Run Script */, 117 | 97C146EA1CF9000F007C117D /* Sources */, 118 | 97C146EB1CF9000F007C117D /* Frameworks */, 119 | 97C146EC1CF9000F007C117D /* Resources */, 120 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 121 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 122 | ); 123 | buildRules = ( 124 | ); 125 | dependencies = ( 126 | ); 127 | name = Runner; 128 | productName = Runner; 129 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 130 | productType = "com.apple.product-type.application"; 131 | }; 132 | /* End PBXNativeTarget section */ 133 | 134 | /* Begin PBXProject section */ 135 | 97C146E61CF9000F007C117D /* Project object */ = { 136 | isa = PBXProject; 137 | attributes = { 138 | LastUpgradeCheck = 1020; 139 | ORGANIZATIONNAME = ""; 140 | TargetAttributes = { 141 | 97C146ED1CF9000F007C117D = { 142 | CreatedOnToolsVersion = 7.3.1; 143 | LastSwiftMigration = 1100; 144 | }; 145 | }; 146 | }; 147 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 148 | compatibilityVersion = "Xcode 9.3"; 149 | developmentRegion = en; 150 | hasScannedForEncodings = 0; 151 | knownRegions = ( 152 | en, 153 | Base, 154 | ); 155 | mainGroup = 97C146E51CF9000F007C117D; 156 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 157 | projectDirPath = ""; 158 | projectRoot = ""; 159 | targets = ( 160 | 97C146ED1CF9000F007C117D /* Runner */, 161 | ); 162 | }; 163 | /* End PBXProject section */ 164 | 165 | /* Begin PBXResourcesBuildPhase section */ 166 | 97C146EC1CF9000F007C117D /* Resources */ = { 167 | isa = PBXResourcesBuildPhase; 168 | buildActionMask = 2147483647; 169 | files = ( 170 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 171 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 172 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 173 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 174 | ); 175 | runOnlyForDeploymentPostprocessing = 0; 176 | }; 177 | /* End PBXResourcesBuildPhase section */ 178 | 179 | /* Begin PBXShellScriptBuildPhase section */ 180 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 181 | isa = PBXShellScriptBuildPhase; 182 | buildActionMask = 2147483647; 183 | files = ( 184 | ); 185 | inputPaths = ( 186 | ); 187 | name = "Thin Binary"; 188 | outputPaths = ( 189 | ); 190 | runOnlyForDeploymentPostprocessing = 0; 191 | shellPath = /bin/sh; 192 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 193 | }; 194 | 9740EEB61CF901F6004384FC /* Run Script */ = { 195 | isa = PBXShellScriptBuildPhase; 196 | buildActionMask = 2147483647; 197 | files = ( 198 | ); 199 | inputPaths = ( 200 | ); 201 | name = "Run Script"; 202 | outputPaths = ( 203 | ); 204 | runOnlyForDeploymentPostprocessing = 0; 205 | shellPath = /bin/sh; 206 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 207 | }; 208 | /* End PBXShellScriptBuildPhase section */ 209 | 210 | /* Begin PBXSourcesBuildPhase section */ 211 | 97C146EA1CF9000F007C117D /* Sources */ = { 212 | isa = PBXSourcesBuildPhase; 213 | buildActionMask = 2147483647; 214 | files = ( 215 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 216 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 217 | ); 218 | runOnlyForDeploymentPostprocessing = 0; 219 | }; 220 | /* End PBXSourcesBuildPhase section */ 221 | 222 | /* Begin PBXVariantGroup section */ 223 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 224 | isa = PBXVariantGroup; 225 | children = ( 226 | 97C146FB1CF9000F007C117D /* Base */, 227 | ); 228 | name = Main.storyboard; 229 | sourceTree = ""; 230 | }; 231 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 232 | isa = PBXVariantGroup; 233 | children = ( 234 | 97C147001CF9000F007C117D /* Base */, 235 | ); 236 | name = LaunchScreen.storyboard; 237 | sourceTree = ""; 238 | }; 239 | /* End PBXVariantGroup section */ 240 | 241 | /* Begin XCBuildConfiguration section */ 242 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 243 | isa = XCBuildConfiguration; 244 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 245 | buildSettings = { 246 | ALWAYS_SEARCH_USER_PATHS = NO; 247 | CLANG_ANALYZER_NONNULL = YES; 248 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 249 | CLANG_CXX_LIBRARY = "libc++"; 250 | CLANG_ENABLE_MODULES = YES; 251 | CLANG_ENABLE_OBJC_ARC = YES; 252 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 253 | CLANG_WARN_BOOL_CONVERSION = YES; 254 | CLANG_WARN_COMMA = YES; 255 | CLANG_WARN_CONSTANT_CONVERSION = YES; 256 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 257 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 258 | CLANG_WARN_EMPTY_BODY = YES; 259 | CLANG_WARN_ENUM_CONVERSION = YES; 260 | CLANG_WARN_INFINITE_RECURSION = YES; 261 | CLANG_WARN_INT_CONVERSION = YES; 262 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 263 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 264 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 265 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 266 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 267 | CLANG_WARN_STRICT_PROTOTYPES = YES; 268 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 269 | CLANG_WARN_UNREACHABLE_CODE = YES; 270 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 271 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 272 | COPY_PHASE_STRIP = NO; 273 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 274 | ENABLE_NS_ASSERTIONS = NO; 275 | ENABLE_STRICT_OBJC_MSGSEND = YES; 276 | GCC_C_LANGUAGE_STANDARD = gnu99; 277 | GCC_NO_COMMON_BLOCKS = YES; 278 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 279 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 280 | GCC_WARN_UNDECLARED_SELECTOR = YES; 281 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 282 | GCC_WARN_UNUSED_FUNCTION = YES; 283 | GCC_WARN_UNUSED_VARIABLE = YES; 284 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 285 | MTL_ENABLE_DEBUG_INFO = NO; 286 | SDKROOT = iphoneos; 287 | SUPPORTED_PLATFORMS = iphoneos; 288 | TARGETED_DEVICE_FAMILY = "1,2"; 289 | VALIDATE_PRODUCT = YES; 290 | }; 291 | name = Profile; 292 | }; 293 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 294 | isa = XCBuildConfiguration; 295 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 296 | buildSettings = { 297 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 298 | CLANG_ENABLE_MODULES = YES; 299 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 300 | ENABLE_BITCODE = NO; 301 | FRAMEWORK_SEARCH_PATHS = ( 302 | "$(inherited)", 303 | "$(PROJECT_DIR)/Flutter", 304 | ); 305 | INFOPLIST_FILE = Runner/Info.plist; 306 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 307 | LIBRARY_SEARCH_PATHS = ( 308 | "$(inherited)", 309 | "$(PROJECT_DIR)/Flutter", 310 | ); 311 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterPocketBook; 312 | PRODUCT_NAME = "$(TARGET_NAME)"; 313 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 314 | SWIFT_VERSION = 5.0; 315 | VERSIONING_SYSTEM = "apple-generic"; 316 | }; 317 | name = Profile; 318 | }; 319 | 97C147031CF9000F007C117D /* Debug */ = { 320 | isa = XCBuildConfiguration; 321 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 322 | buildSettings = { 323 | ALWAYS_SEARCH_USER_PATHS = NO; 324 | CLANG_ANALYZER_NONNULL = YES; 325 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 326 | CLANG_CXX_LIBRARY = "libc++"; 327 | CLANG_ENABLE_MODULES = YES; 328 | CLANG_ENABLE_OBJC_ARC = YES; 329 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 330 | CLANG_WARN_BOOL_CONVERSION = YES; 331 | CLANG_WARN_COMMA = YES; 332 | CLANG_WARN_CONSTANT_CONVERSION = YES; 333 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 334 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 335 | CLANG_WARN_EMPTY_BODY = YES; 336 | CLANG_WARN_ENUM_CONVERSION = YES; 337 | CLANG_WARN_INFINITE_RECURSION = YES; 338 | CLANG_WARN_INT_CONVERSION = YES; 339 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 340 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 341 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 342 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 343 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 344 | CLANG_WARN_STRICT_PROTOTYPES = YES; 345 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 346 | CLANG_WARN_UNREACHABLE_CODE = YES; 347 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 348 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 349 | COPY_PHASE_STRIP = NO; 350 | DEBUG_INFORMATION_FORMAT = dwarf; 351 | ENABLE_STRICT_OBJC_MSGSEND = YES; 352 | ENABLE_TESTABILITY = YES; 353 | GCC_C_LANGUAGE_STANDARD = gnu99; 354 | GCC_DYNAMIC_NO_PIC = NO; 355 | GCC_NO_COMMON_BLOCKS = YES; 356 | GCC_OPTIMIZATION_LEVEL = 0; 357 | GCC_PREPROCESSOR_DEFINITIONS = ( 358 | "DEBUG=1", 359 | "$(inherited)", 360 | ); 361 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 362 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 363 | GCC_WARN_UNDECLARED_SELECTOR = YES; 364 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 365 | GCC_WARN_UNUSED_FUNCTION = YES; 366 | GCC_WARN_UNUSED_VARIABLE = YES; 367 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 368 | MTL_ENABLE_DEBUG_INFO = YES; 369 | ONLY_ACTIVE_ARCH = YES; 370 | SDKROOT = iphoneos; 371 | TARGETED_DEVICE_FAMILY = "1,2"; 372 | }; 373 | name = Debug; 374 | }; 375 | 97C147041CF9000F007C117D /* Release */ = { 376 | isa = XCBuildConfiguration; 377 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 378 | buildSettings = { 379 | ALWAYS_SEARCH_USER_PATHS = NO; 380 | CLANG_ANALYZER_NONNULL = YES; 381 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 382 | CLANG_CXX_LIBRARY = "libc++"; 383 | CLANG_ENABLE_MODULES = YES; 384 | CLANG_ENABLE_OBJC_ARC = YES; 385 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 386 | CLANG_WARN_BOOL_CONVERSION = YES; 387 | CLANG_WARN_COMMA = YES; 388 | CLANG_WARN_CONSTANT_CONVERSION = YES; 389 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 390 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 391 | CLANG_WARN_EMPTY_BODY = YES; 392 | CLANG_WARN_ENUM_CONVERSION = YES; 393 | CLANG_WARN_INFINITE_RECURSION = YES; 394 | CLANG_WARN_INT_CONVERSION = YES; 395 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 396 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 397 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 398 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 399 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 400 | CLANG_WARN_STRICT_PROTOTYPES = YES; 401 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 402 | CLANG_WARN_UNREACHABLE_CODE = YES; 403 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 404 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 405 | COPY_PHASE_STRIP = NO; 406 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 407 | ENABLE_NS_ASSERTIONS = NO; 408 | ENABLE_STRICT_OBJC_MSGSEND = YES; 409 | GCC_C_LANGUAGE_STANDARD = gnu99; 410 | GCC_NO_COMMON_BLOCKS = YES; 411 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 412 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 413 | GCC_WARN_UNDECLARED_SELECTOR = YES; 414 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 415 | GCC_WARN_UNUSED_FUNCTION = YES; 416 | GCC_WARN_UNUSED_VARIABLE = YES; 417 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 418 | MTL_ENABLE_DEBUG_INFO = NO; 419 | SDKROOT = iphoneos; 420 | SUPPORTED_PLATFORMS = iphoneos; 421 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 422 | TARGETED_DEVICE_FAMILY = "1,2"; 423 | VALIDATE_PRODUCT = YES; 424 | }; 425 | name = Release; 426 | }; 427 | 97C147061CF9000F007C117D /* Debug */ = { 428 | isa = XCBuildConfiguration; 429 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 430 | buildSettings = { 431 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 432 | CLANG_ENABLE_MODULES = YES; 433 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 434 | ENABLE_BITCODE = NO; 435 | FRAMEWORK_SEARCH_PATHS = ( 436 | "$(inherited)", 437 | "$(PROJECT_DIR)/Flutter", 438 | ); 439 | INFOPLIST_FILE = Runner/Info.plist; 440 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 441 | LIBRARY_SEARCH_PATHS = ( 442 | "$(inherited)", 443 | "$(PROJECT_DIR)/Flutter", 444 | ); 445 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterPocketBook; 446 | PRODUCT_NAME = "$(TARGET_NAME)"; 447 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 448 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 449 | SWIFT_VERSION = 5.0; 450 | VERSIONING_SYSTEM = "apple-generic"; 451 | }; 452 | name = Debug; 453 | }; 454 | 97C147071CF9000F007C117D /* Release */ = { 455 | isa = XCBuildConfiguration; 456 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 457 | buildSettings = { 458 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 459 | CLANG_ENABLE_MODULES = YES; 460 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 461 | ENABLE_BITCODE = NO; 462 | FRAMEWORK_SEARCH_PATHS = ( 463 | "$(inherited)", 464 | "$(PROJECT_DIR)/Flutter", 465 | ); 466 | INFOPLIST_FILE = Runner/Info.plist; 467 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 468 | LIBRARY_SEARCH_PATHS = ( 469 | "$(inherited)", 470 | "$(PROJECT_DIR)/Flutter", 471 | ); 472 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterPocketBook; 473 | PRODUCT_NAME = "$(TARGET_NAME)"; 474 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 475 | SWIFT_VERSION = 5.0; 476 | VERSIONING_SYSTEM = "apple-generic"; 477 | }; 478 | name = Release; 479 | }; 480 | /* End XCBuildConfiguration section */ 481 | 482 | /* Begin XCConfigurationList section */ 483 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 484 | isa = XCConfigurationList; 485 | buildConfigurations = ( 486 | 97C147031CF9000F007C117D /* Debug */, 487 | 97C147041CF9000F007C117D /* Release */, 488 | 249021D3217E4FDB00AE95B9 /* Profile */, 489 | ); 490 | defaultConfigurationIsVisible = 0; 491 | defaultConfigurationName = Release; 492 | }; 493 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 494 | isa = XCConfigurationList; 495 | buildConfigurations = ( 496 | 97C147061CF9000F007C117D /* Debug */, 497 | 97C147071CF9000F007C117D /* Release */, 498 | 249021D4217E4FDB00AE95B9 /* Profile */, 499 | ); 500 | defaultConfigurationIsVisible = 0; 501 | defaultConfigurationName = Release; 502 | }; 503 | /* End XCConfigurationList section */ 504 | }; 505 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 506 | } 507 | -------------------------------------------------------------------------------- /lib/pages/test/test_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:pull_to_refresh/pull_to_refresh.dart'; 4 | 5 | List items = ["1", "2", "3", "4", "5", "6", "7", "8"]; 6 | RefreshController _refreshController = 7 | RefreshController(initialRefresh: false); 8 | 9 | class TestPage extends StatefulWidget { 10 | @override 11 | _TestPageState createState() => _TestPageState(); 12 | } 13 | 14 | class _TestPageState extends State { 15 | 16 | 17 | void _onRefresh() async{ 18 | // monitor network fetch 19 | await Future.delayed(Duration(milliseconds: 1000)); 20 | // if failed,use refreshFailed() 21 | _refreshController.refreshCompleted(); 22 | } 23 | 24 | void _onLoading() async{ 25 | // monitor network fetch 26 | await Future.delayed(Duration(milliseconds: 1000)); 27 | // if failed,use loadFailed(),if no data return,use LoadNodata() 28 | items.add((items.length+1).toString()); 29 | if(mounted) 30 | setState(() { 31 | 32 | }); 33 | _refreshController.loadComplete(); 34 | } 35 | 36 | 37 | 38 | 39 | @override 40 | Widget build(BuildContext context) { 41 | return Scaffold( 42 | body: SmartRefresher( 43 | enablePullDown: true, 44 | enablePullUp: true, 45 | header: WaterDropMaterialHeader( 46 | color: Colors.green, 47 | backgroundColor: Colors.red, 48 | ), 49 | footer: CustomFooter( 50 | builder: (BuildContext context,LoadStatus mode){ 51 | Widget body ; 52 | if(mode==LoadStatus.idle){ 53 | body = Text("pull up load"); 54 | } 55 | else if(mode==LoadStatus.loading){ 56 | body = CupertinoActivityIndicator(); 57 | } 58 | else if(mode == LoadStatus.failed){ 59 | body = Text("Load Failed!Click retry!"); 60 | } 61 | else if(mode == LoadStatus.canLoading){ 62 | body = Text("release to load more"); 63 | } 64 | else{ 65 | body = Text("No more Data"); 66 | } 67 | return Container( 68 | height: 55.0, 69 | child: Center(child:body), 70 | ); 71 | }, 72 | ), 73 | controller: _refreshController, 74 | onRefresh: _onRefresh, 75 | onLoading: _onLoading, 76 | child: ListView.builder( 77 | itemBuilder: (c, i) => Card(child: Center(child: Text(items[i]))), 78 | itemExtent: 100.0, 79 | itemCount: items.length, 80 | ), 81 | ), 82 | ); 83 | } 84 | } 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | //import 'package:flutter/cupertino.dart'; 95 | //import 'package:flutter/material.dart'; 96 | //import 'package:flutter/rendering.dart'; 97 | //import 'package:flutter_swiper/flutter_swiper.dart'; 98 | //import 'package:pull_to_refresh/pull_to_refresh.dart'; 99 | //import './Item.dart'; 100 | // 101 | ///* 102 | // the most common usage, 103 | // child wrap ListView,GridView,CustomView,Widget, 104 | // RefreshConfiguration is a global setting,just like theme,All refreshers under the RefreshConfiguration subtree will refer to its properties, 105 | // in this example,I gave RefreshConfiguration a property headerBuilder,The default header indicator for the four refreshers is it. 106 | // If you use almost the same page indicator, using Refresh Configuration can greatly reduce the complexity of your work. 107 | //*/ 108 | // 109 | //class TestPage extends StatefulWidget { 110 | // @override 111 | // State createState() { 112 | // // TODO: implement createState 113 | // return _TestPageState(); 114 | // } 115 | //} 116 | // 117 | //class _TestPageState extends State 118 | // with SingleTickerProviderStateMixin { 119 | //// int pageIndex = 0; 120 | // List data1 = [], data2 = [], data3 = []; 121 | // TabController _tabController; 122 | // 123 | // @override 124 | // void initState() { 125 | // // TODO: implement initState 126 | // _tabController = TabController(length: 6, vsync: this); 127 | // _tabController.addListener(() {}); 128 | // for (int i = 0; i < 10; i++) { 129 | // data1.add("Item $i"); 130 | // } 131 | // for (int i = 0; i < 10; i++) { 132 | // data2.add("Item $i"); 133 | // } 134 | // for (int i = 0; i < 10; i++) { 135 | // data3.add("Item $i"); 136 | // } 137 | // super.initState(); 138 | // } 139 | // 140 | // @override 141 | // Widget build(BuildContext context) { 142 | // // TODO: implement build 143 | // return RefreshConfiguration.copyAncestor( 144 | // enableLoadingWhenFailed: true, 145 | // context: context, 146 | // child: Scaffold( 147 | // appBar: AppBar( 148 | // bottom: TabBar( 149 | // isScrollable: true, 150 | // controller: _tabController, 151 | // tabs: [ 152 | // Tab( 153 | // text: "ListView", 154 | // ), 155 | // Tab( 156 | // text: "GridView", 157 | // ), 158 | // Tab( 159 | // text: "非滚动组件", 160 | // ), 161 | // Tab( 162 | // text: "SliverAppBar+list", 163 | // ), 164 | // Tab( 165 | // text: "GridView+ListView", 166 | // ), 167 | // Tab( 168 | // text: "水平组件+listView", 169 | // ), 170 | // ], 171 | // ), 172 | // ), 173 | // body: TabBarView( 174 | // physics: NeverScrollableScrollPhysics(), 175 | // controller: _tabController, 176 | // children: [ 177 | // Scrollbar( 178 | // child: OnlyListView(), 179 | // ), 180 | // Scrollbar( 181 | // child: OnlyGridView(), 182 | // ), 183 | // Scrollbar( 184 | // child: NoScrollable(), 185 | // ), 186 | // Scrollbar( 187 | // child: SliverAppBarWithList(), 188 | // ), 189 | // Scrollbar( 190 | // child: GridAndList(), 191 | // ), 192 | // Scrollbar( 193 | // child: SwiperAndList(), 194 | // ) 195 | // ], 196 | // ), 197 | // ), 198 | // headerBuilder: () => WaterDropMaterialHeader( 199 | // backgroundColor: Theme.of(context).primaryColor, 200 | // ), 201 | // footerTriggerDistance: 30.0, 202 | // ); 203 | // } 204 | //} 205 | // 206 | ////only ListView 207 | //class OnlyListView extends StatefulWidget { 208 | // @override 209 | // State createState() { 210 | // // TODO: implement createState 211 | // return _OnlyListViewState(); 212 | // } 213 | //} 214 | // 215 | //class _OnlyListViewState extends State { 216 | // RefreshController _refreshController = 217 | // RefreshController(initialRefresh: false); 218 | // List data = ["1", "2", "3", "4", "5", "6", "7", "8", "9"]; 219 | // 220 | // Widget buildCtn() { 221 | // return ListView.separated( 222 | // reverse: true, 223 | // padding: EdgeInsets.only(left: 5, right: 5), 224 | // itemBuilder: (c, i) => Item( 225 | // title: data[i], 226 | // ), 227 | // separatorBuilder: (context, index) { 228 | // return Container( 229 | // height: 0.5, 230 | // color: Colors.greenAccent, 231 | // ); 232 | // }, 233 | // itemCount: data.length, 234 | // ); 235 | // } 236 | // 237 | // @override 238 | // Widget build(BuildContext context) { 239 | // // TODO: implement build 240 | // return SmartRefresher( 241 | // controller: _refreshController, 242 | // enablePullUp: true, 243 | // child: buildCtn(), 244 | // physics: BouncingScrollPhysics(), 245 | // footer: ClassicFooter( 246 | // loadStyle: LoadStyle.ShowWhenLoading, 247 | // completeDuration: Duration(milliseconds: 500), 248 | // ), 249 | // onRefresh: () async { 250 | // //monitor fetch data from network 251 | // await Future.delayed(Duration(milliseconds: 1000)); 252 | // 253 | // for (int i = 0; i < 10; i++) { 254 | // data.add("Item $i"); 255 | // } 256 | // 257 | // if (mounted) setState(() {}); 258 | // _refreshController.refreshCompleted(); 259 | // 260 | // /* 261 | // if(failed){ 262 | // _refreshController.refreshFailed(); 263 | // } 264 | // */ 265 | // }, 266 | // onLoading: () async { 267 | // //monitor fetch data from network 268 | // await Future.delayed(Duration(milliseconds: 180)); 269 | //// for (int i = 0; i < 10; i++) { 270 | //// data.add("Item $i"); 271 | //// } 272 | // if (mounted) setState(() {}); 273 | // _refreshController.loadFailed(); 274 | // }, 275 | // ); 276 | // } 277 | //} 278 | // 279 | ////only GridView 280 | //class OnlyGridView extends StatefulWidget { 281 | // @override 282 | // State createState() { 283 | // // TODO: implement createState 284 | // return _OnlyGridViewState(); 285 | // } 286 | //} 287 | // 288 | //class _OnlyGridViewState extends State { 289 | // RefreshController _refreshController = 290 | // RefreshController(initialRefresh: false); 291 | // List data = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]; 292 | // 293 | // Widget buildCtn() { 294 | // return GridView.builder( 295 | // physics: ClampingScrollPhysics(), 296 | // gridDelegate: 297 | // SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2), 298 | // itemBuilder: (c, i) => Item( 299 | // title: data[i], 300 | // ), 301 | // itemCount: data.length, 302 | // ); 303 | // } 304 | // 305 | // @override 306 | // Widget build(BuildContext context) { 307 | // // TODO: implement build 308 | // return SmartRefresher( 309 | // controller: _refreshController, 310 | // enablePullUp: true, 311 | // child: buildCtn(), 312 | // header: ClassicHeader(), 313 | // onRefresh: () async { 314 | // //monitor fetch data from network 315 | // await Future.delayed(Duration(milliseconds: 1000)); 316 | // 317 | // if (data.length == 0) { 318 | // for (int i = 0; i < 10; i++) { 319 | // data.add("Item $i"); 320 | // } 321 | // } 322 | // if (mounted) setState(() {}); 323 | // _refreshController.refreshCompleted(); 324 | // 325 | // /* 326 | // if(failed){ 327 | // _refreshController.refreshFailed(); 328 | // } 329 | // */ 330 | // }, 331 | // onLoading: () async { 332 | // //monitor fetch data from network 333 | // await Future.delayed(Duration(milliseconds: 1000)); 334 | // for (int i = 0; i < 10; i++) { 335 | // data.add("Item $i"); 336 | // } 337 | //// pageIndex++; 338 | // if (mounted) setState(() {}); 339 | // _refreshController.loadComplete(); 340 | // }, 341 | // ); 342 | // } 343 | //} 344 | // 345 | //// No vertical Scrollable (like SingleChildScrollView) 346 | //// if child is not extends CustomScrollView,this will add it to SliverToBoxAdapter 347 | //// mostly for emptyView 348 | //class NoScrollable extends StatefulWidget { 349 | // @override 350 | // State createState() { 351 | // // TODO: implement createState 352 | // return _NoScrollableState(); 353 | // } 354 | //} 355 | // 356 | //class _NoScrollableState extends State { 357 | // RefreshController _refreshController = 358 | // RefreshController(initialRefresh: false); 359 | // List data = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]; 360 | // 361 | // Widget buildCtn() { 362 | // return Container( 363 | // height: 1000.0, 364 | // child: Column( 365 | // children: [ 366 | // Container( 367 | // color: Colors.redAccent, 368 | // height: 200.0, 369 | // ), 370 | // Text("标题"), 371 | // Container( 372 | // color: Colors.redAccent, 373 | // height: 200.0, 374 | // ), 375 | // Text("标题"), 376 | // Container( 377 | // color: Colors.redAccent, 378 | // height: 200.0, 379 | // ), 380 | // Text("标题"), 381 | // Container( 382 | // color: Colors.redAccent, 383 | // height: 200.0, 384 | // ), 385 | // Text("标题"), 386 | // ], 387 | // )); 388 | // } 389 | // 390 | // @override 391 | // Widget build(BuildContext context) { 392 | // // TODO: implement build 393 | // return SmartRefresher( 394 | // controller: _refreshController, 395 | // enablePullUp: true, 396 | // child: buildCtn(), 397 | // header: MaterialClassicHeader(), 398 | // onRefresh: () async { 399 | // //monitor fetch data from network 400 | // await Future.delayed(Duration(milliseconds: 1000)); 401 | // 402 | // if (data.length == 0) { 403 | // for (int i = 0; i < 10; i++) { 404 | // data.add("Item $i"); 405 | // } 406 | // } 407 | // if (mounted) setState(() {}); 408 | // _refreshController.refreshCompleted(); 409 | // 410 | // /* 411 | // if(failed){ 412 | // _refreshController.refreshFailed(); 413 | // } 414 | // */ 415 | // }, 416 | // onLoading: () async { 417 | // //monitor fetch data from network 418 | // await Future.delayed(Duration(milliseconds: 1000)); 419 | // for (int i = 0; i < 10; i++) { 420 | // data.add("Item $i"); 421 | // } 422 | //// pageIndex++; 423 | // if (mounted) setState(() {}); 424 | // _refreshController.loadComplete(); 425 | // }, 426 | // ); 427 | // } 428 | //} 429 | // 430 | ////SliverAppBar + ListView 431 | //class SliverAppBarWithList extends StatefulWidget { 432 | // @override 433 | // State createState() { 434 | // // TODO: implement createState 435 | // return _SliverAppBarWithListState(); 436 | // } 437 | //} 438 | // 439 | //class _SliverAppBarWithListState extends State { 440 | // RefreshController _refreshController = 441 | // RefreshController(initialRefresh: false); 442 | // List data = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]; 443 | // 444 | // Widget buildCtn() { 445 | // return CustomScrollView( 446 | // slivers: [ 447 | // SliverToBoxAdapter(), 448 | // SliverAppBar( 449 | // title: Text("SliverAppBar"), 450 | // expandedHeight: 100.0, 451 | // ), 452 | // SliverList( 453 | // delegate: SliverChildBuilderDelegate( 454 | // (c, i) => Item(title: data[i]), 455 | // childCount: data.length, 456 | // ), 457 | // ) 458 | // ], 459 | // ); 460 | // } 461 | // 462 | // @override 463 | // Widget build(BuildContext context) { 464 | // // TODO: implement build 465 | // return SmartRefresher( 466 | // controller: _refreshController, 467 | // enablePullUp: true, 468 | // child: buildCtn(), 469 | // header: WaterDropHeader(), 470 | // onRefresh: () async { 471 | // //monitor fetch data from network 472 | // await Future.delayed(Duration(milliseconds: 1000)); 473 | // 474 | // if (data.length == 0) { 475 | // for (int i = 0; i < 10; i++) { 476 | // data.add("Item $i"); 477 | // } 478 | // } 479 | // if (mounted) setState(() {}); 480 | // _refreshController.refreshCompleted(); 481 | // 482 | // /* 483 | // if(failed){ 484 | // _refreshController.refreshFailed(); 485 | // } 486 | // */ 487 | // }, 488 | // onLoading: () async { 489 | // //monitor fetch data from network 490 | // await Future.delayed(Duration(milliseconds: 1000)); 491 | // for (int i = 0; i < 10; i++) { 492 | // data.add("Item $i"); 493 | // } 494 | //// pageIndex++; 495 | // if (mounted) setState(() {}); 496 | // _refreshController.loadComplete(); 497 | // }, 498 | // ); 499 | // } 500 | //} 501 | // 502 | //// GridView + ListView 503 | //class GridAndList extends StatefulWidget { 504 | // @override 505 | // State createState() { 506 | // // TODO: implement createState 507 | // return _GridAndListState(); 508 | // } 509 | //} 510 | // 511 | //class _GridAndListState extends State { 512 | // RefreshController _refreshController = 513 | // RefreshController(initialRefresh: false); 514 | // List data = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]; 515 | // 516 | // Widget buildCtn() { 517 | // return CustomScrollView( 518 | // slivers: [ 519 | // SliverGrid( 520 | // gridDelegate: 521 | // SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3), 522 | // delegate: SliverChildBuilderDelegate( 523 | // (c, i) => Column( 524 | // mainAxisAlignment: MainAxisAlignment.center, 525 | // children: [Icon(Icons.storage), Text("菜单标题")], 526 | // ), 527 | // childCount: 6, 528 | // ), 529 | // ), 530 | // SliverList( 531 | // delegate: SliverChildBuilderDelegate( 532 | // (c, i) => Item(title: data[i]), 533 | // childCount: data.length, 534 | // ), 535 | // ) 536 | // ], 537 | // ); 538 | // } 539 | // 540 | // @override 541 | // Widget build(BuildContext context) { 542 | // // TODO: implement build 543 | // return SmartRefresher( 544 | // controller: _refreshController, 545 | // enablePullUp: true, 546 | // child: buildCtn(), 547 | // header: WaterDropHeader(), 548 | // onRefresh: () async { 549 | // //monitor fetch data from network 550 | // await Future.delayed(Duration(milliseconds: 1000)); 551 | // 552 | // if (data.length == 0) { 553 | // for (int i = 0; i < 10; i++) { 554 | // data.add("Item $i"); 555 | // } 556 | // } 557 | // if (mounted) setState(() {}); 558 | // _refreshController.refreshCompleted(); 559 | // 560 | // /* 561 | // if(failed){ 562 | // _refreshController.refreshFailed(); 563 | // } 564 | // */ 565 | // }, 566 | // onLoading: () async { 567 | // //monitor fetch data from network 568 | // await Future.delayed(Duration(milliseconds: 1000)); 569 | // for (int i = 0; i < 10; i++) { 570 | // data.add("Item $i"); 571 | // } 572 | //// pageIndex++; 573 | // if (mounted) setState(() {}); 574 | // _refreshController.loadComplete(); 575 | // }, 576 | // ); 577 | // } 578 | //} 579 | // 580 | //// 水平组件(例子:轮播图)+List 581 | //class SwiperAndList extends StatefulWidget { 582 | // @override 583 | // State createState() { 584 | // // TODO: implement createState 585 | // return _SwiperAndListState(); 586 | // } 587 | //} 588 | // 589 | //class _SwiperAndListState extends State { 590 | // RefreshController _refreshController = 591 | // RefreshController(initialRefresh: false); 592 | // List data = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]; 593 | // 594 | // Widget buildCtn() { 595 | // return CustomScrollView( 596 | // slivers: [ 597 | // SliverToBoxAdapter( 598 | // child: Swiper( 599 | // layout: SwiperLayout.CUSTOM, 600 | // customLayoutOption: 601 | // new CustomLayoutOption(startIndex: -1, stateCount: 3) 602 | // .addRotate([-45.0 / 180, 0.0, 45.0 / 180]).addTranslate([ 603 | // new Offset(-370.0, -40.0), 604 | // new Offset(0.0, 0.0), 605 | // new Offset(370.0, -40.0) 606 | // ]), 607 | // itemWidth: double.infinity, 608 | // itemHeight: 200, 609 | // itemBuilder: (context, index) { 610 | // return Container( 611 | // height: 200, 612 | // child: new Image.asset( 613 | // "images/empty.png", 614 | // fit: BoxFit.cover, 615 | // ), 616 | // ); 617 | // }, 618 | // itemCount: 10), 619 | // ), 620 | // SliverList( 621 | // delegate: SliverChildBuilderDelegate( 622 | // (c, i) => Item(title: data[i]), 623 | // childCount: data.length, 624 | // ), 625 | // ) 626 | // ], 627 | // ); 628 | // } 629 | // 630 | // @override 631 | // Widget build(BuildContext context) { 632 | // // TODO: implement build 633 | // return SmartRefresher( 634 | // controller: _refreshController, 635 | // enablePullUp: true, 636 | // child: buildCtn(), 637 | // header: WaterDropHeader(), 638 | // onRefresh: () async { 639 | // //monitor fetch data from network 640 | // await Future.delayed(Duration(milliseconds: 1000)); 641 | // 642 | // if (data.length == 0) { 643 | // for (int i = 0; i < 10; i++) { 644 | // data.add("Item $i"); 645 | // } 646 | // } 647 | // if (mounted) setState(() {}); 648 | // _refreshController.refreshCompleted(); 649 | // 650 | // /* 651 | // if(failed){ 652 | // _refreshController.refreshFailed(); 653 | // } 654 | // */ 655 | // }, 656 | // onLoading: () async { 657 | // //monitor fetch data from network 658 | // await Future.delayed(Duration(milliseconds: 1000)); 659 | // for (int i = 0; i < 10; i++) { 660 | // data.add("Item $i"); 661 | // } 662 | //// pageIndex++; 663 | // if (mounted) setState(() {}); 664 | // _refreshController.loadComplete(); 665 | // }, 666 | // ); 667 | // } 668 | //} 669 | --------------------------------------------------------------------------------