Sky24n 5 éve
szülő
commit
2a16573757
33 módosított fájl, 280 hozzáadás és 970 törlés
  1. 10 0
      .metadata
  2. 4 0
      CHANGELOG.md
  3. 22 222
      README.md
  4. 0 242
      doc/UPDATELOG.md
  5. 1 1
      example/.flutter-plugins-dependencies
  6. 12 39
      example/.gitignore
  7. 10 0
      example/.metadata
  8. 5 5
      example/README.md
  9. 0 7
      example/android/app/build.gradle
  10. 17 0
      example/android/app/src/main/AndroidManifest.xml
  11. 0 7
      example/android/app/src/main/java/com/thl/flustars_example/MainActivity.java
  12. 10 0
      example/android/app/src/main/res/values/styles.xml
  13. 11 11
      example/android/settings.gradle
  14. 3 3
      example/ios/Podfile
  15. 0 40
      example/ios/Podfile.lock
  16. 21 91
      example/ios/Runner.xcodeproj/project.pbxproj
  17. 8 0
      example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
  18. 8 0
      example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
  19. 0 3
      example/ios/Runner.xcworkspace/contents.xcworkspacedata
  20. 8 0
      example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
  21. 8 0
      example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
  22. 0 6
      example/ios/Runner/AppDelegate.h
  23. 0 13
      example/ios/Runner/AppDelegate.m
  24. 13 0
      example/ios/Runner/AppDelegate.swift
  25. 1 0
      example/ios/Runner/Runner-Bridging-Header.h
  26. 0 9
      example/ios/Runner/main.m
  27. 38 52
      example/lib/main.dart
  28. 29 14
      example/pubspec.yaml
  29. 30 0
      example/test/widget_test.dart
  30. 3 21
      flustars.iml
  31. 1 1
      lib/flustars.dart
  32. 2 176
      lib/src/sp_util.dart
  33. 5 7
      pubspec.yaml

+ 10 - 0
.metadata

@@ -0,0 +1,10 @@
+# This file tracks properties of this Flutter project.
+# Used by Flutter tool to assess capabilities and perform upgrades etc.
+#
+# This file should be version controlled and should not be manually edited.
+
+version:
+  revision: 8af6b2f038c1172e61d418869363a28dffec3cb4
+  channel: stable
+
+project_type: package

+ 4 - 0
CHANGELOG.md

@@ -1,3 +1,7 @@
+## 0.3.3
+
+* TODO: split [sp_util](https://github.com/Sky24n/sp_util) as a separate library.
+
 ## 0.3.2
 
 * TODO: remove MyAppBar.

+ 22 - 222
README.md

@@ -1,39 +1,33 @@
 Language: [English](README-EN.md) | 中文简体
 
-[![Pub](https://img.shields.io/pub/v/flustars.svg?style=flat-square)](https://pub.dartlang.org/packages/flustars)
+[![Pub](https://img.shields.io/pub/v/flustars.svg?style=flat-square&color=009688)](https://pub.dartlang.org/packages/flustars)      [![Pub](https://img.shields.io/pub/v/flustars.svg?style=flat-square&color=2196F3)](https://pub.flutter-io.cn/packages/flustars)
 
 # Flutter常用工具类库
 
 flustars依赖于Dart常用工具类库[common_utils](https://github.com/Sky24n/common_utils),以及对其他第三方库封装,致力于为大家分享简单易用工具类。如果你有好的工具类欢迎PR.  
 目前包含SharedPreferences Util, Screen Util, Directory Util, Widget Util, Image Util。
 
-Pub [flustars](https://pub.flutter-io.cn/packages/flustars)
-
 [✓] Flutter (Channel stable, v1.17.0, locale zh-Hans-CN)
 
-### 使用方式:
+### Pub
 ```yaml
 dependencies:
-  flustars: ^0.3.2
+  flustars: ^0.3.3
   
-import 'package:flustars/flustars.dart';
-
-or
-
-// git (version 0.3.2)
-dependencies:
-  flustars:
-    git:
-      url: git://github.com/Sky24n/flustars.git
+  # https://github.com/Sky24n/sp_util
+  # sp_util分拆成单独的库,可以直接引用
+  sp_util: ^1.0.1
 ```
 
 ### [Change Log](CHANGE_LOG.md)
+v0.3.3  
+分拆[sp_util](https://github.com/Sky24n/sp_util)成单独的库,可以直接引用
 
 [common_utils](https://github.com/Sky24n/common_utils)新版本v1.2.0。  
 如果项目中使用了 flustars: ^0.2.6及以上版本。  
 删除pubspec.lock文件,直接运行flutter  packages get 即可使用最新版!  
   
-common_utils v1.2.0 (未发布)  
+common_utils v1.2.0  
 1、新增JsonUtil。  
 2、新增EncryptUtil 简单加解密。  
 3、LogUtil 更新。
@@ -55,27 +49,11 @@ common_utils e | 7,988,989,990,991,992,993,994,995,996,997,998,999,
 common_utils e  — — — — — — — — — — — — — — — — ed — — — — — — — — — — — — — — — —
 ```
 
-v0.3.2
-remove MyAppBar。
-
-v0.3.0
-新增ImageUtil。
-
-DirectoryUtil 改变
-```dart
-bool _initTempDir = false;
-bool _initAppDocDir = false;
-bool _initAppSupportDir = false;
-bool _initStorageDir = false;
-
-移除package参数
-```
-
 ### [Flutter工具类库 flustars][flustars_github]
  1、SpUtil       : 单例"同步"SharedPreferences工具类。支持get传入默认值,支持存储对象,支持存储对象数组。  
  2、ScreenUtil   : 屏幕适配,获取屏幕宽、高、密度,AppBar高,状态栏高度,屏幕方向.  
  3、WidgetUtil   : 监听Widget渲染状态,获取Widget宽高,在屏幕上的坐标,获取网络/本地图片尺寸.  
- 4、DioUtil      : 单例Dio网络工具类(已迁移至此处[DioUtil](https://github.com/Sky24n/flutter_wanandroid/blob/master/lib/data/net/dio_util.dart))。
+ 4、DioUtil      : 单例Dio网络工具类(已迁移至此处[DioUtil](https://github.com/Sky24n/flutter_wanandroid/blob/master/lib/data/net/dio_util.dart))。  
  5、ImageUtil    : 获取网络/本地图片尺寸.
 
 ### [Dart常用工具类库 common_utils][common_utils_github]  
@@ -91,7 +69,6 @@ bool _initStorageDir = false;
  10、EncryptUtil : EncryptUtil.  
  11、JsonUtil    : JsonUtil.
 
-
 ### APIs
 
 * #### SpUtil -> [Example](./example/lib/main.dart)
@@ -125,6 +102,7 @@ isInitialized
 /// 等待sp初始化完成后再运行app。
 /// sp初始化时间 release模式下30ms左右,debug模式下100多ms。
 void main() async {
+  WidgetsFlutterBinding.ensureInitialized();
   await SpUtil.getInstance();
   runApp(MyApp());
 }
@@ -134,152 +112,6 @@ class MyAppState extends State<MyApp> {
   void initState() {
     super.initState();
     /// 同步使用Sp。
-    SpUtil.remove("username");
-    String defName = SpUtil.getString("username", defValue: "sky");
-    SpUtil.putString("username", "sky24");
-    String name = SpUtil.getString("username");
-    print("MyApp defName: $defName, name: $name");
-  }
-  @override
-  Widget build(BuildContext context) {
-    return MaterialApp(
-      home: SplashPage(),
-    );
-  }
-}  
-
-
-/// 方式二
-/// 增加闪屏页,在闪屏页SpUtil初始化完成, await SpUtil.getInstance();
-/// 跳转到主页后,可以直接同步使用。 String defName = SpUtil.getString("username");
-   
-import 'package:flustars/flustars.dart'; 
-  
-/// SpUtil详细使用示例!  
-void main() => runApp(MyApp());
-  
-class MyApp extends StatefulWidget {
-  @override
-  State<StatefulWidget> createState() {
-    return MyAppState();
-  }
-}
-  
-class MyAppState extends State<MyApp> {
-  @override
-  void initState() {
-    super.initState();
-    _initAsync();
-  }
-  
-  _initAsync() async {
-    /// App启动时读取Sp数据,需要异步等待Sp初始化完成。
-    await SpUtil.getInstance();
-
-    /// 同步使用Sp。
-    SpUtil.remove("username");
-    String defName = SpUtil.getString("username", defValue: "sky");
-    SpUtil.putString("username", "sky24");
-    String name = SpUtil.getString("username");
-    print("MyApp defName: $defName, name: $name");
-  }
-  
-  @override
-  Widget build(BuildContext context) {
-    return MaterialApp(
-      routes: {
-        '/MainPage': (ctx) => MyHomePage(),
-      },
-      home: SplashPage(),
-    );
-  }
-}  
-  
-/// 闪屏页。
-class SplashPage extends StatefulWidget {
-  SplashPage({Key key}) : super(key: key);
-  
-  @override
-  _SplashPageState createState() => _SplashPageState();
-}
-  
-class _SplashPageState extends State<SplashPage> {
-  String _info = '';
-  
-  @override
-  void initState() {
-    super.initState();
-    _initAsync();
-  }
-  
-  _initAsync() async {
-    /// App启动时读取Sp数据,需要异步等待Sp初始化完成。
-    await SpUtil.getInstance();
-    Future.delayed(new Duration(milliseconds: 500), () {
-      /// 同步使用Sp。
-      /// 是否显示引导页。
-      if (SpUtil.getBool("key_guide", defValue: true)) {
-        SpUtil.putBool("key_guide", false);
-        _initBanner();
-      } else {
-        _initSplash();
-      }
-    });
-  }
-  
-  /// App引导页逻辑。
-  void _initBanner() {
-    setState(() {
-      _info = "引导页~";
-    });
-  }
-  
-  /// App广告页逻辑。
-  void _initSplash() {
-    setState(() {
-      _info = "广告页,2秒后跳转到主页";
-    });
-    Future.delayed(new Duration(milliseconds: 2000), () {
-      Navigator.of(context).pushReplacementNamed('/MainPage');
-    });
-  }
-  
-  @override
-  Widget build(BuildContext context) {
-    return Scaffold(
-      appBar: AppBar(
-        title: Text("Splash"),
-      ),
-      body: new Center(
-        child: new Text("$_info"),
-      ),
-      floatingActionButton: FloatingActionButton(
-        onPressed: () {
-          bool isGuide = SpUtil.getBool("key_guide", defValue: true);
-          if (isGuide) {
-            Navigator.of(context).pushReplacementNamed('/MainPage');
-          }
-        },
-        child: Icon(Icons.navigate_next),
-      ),
-    );
-  }
-}
-  
-class MyHomePage extends StatefulWidget {
-  MyHomePage({Key key}) : super(key: key);
-  
-  @override
-  _MyHomePageState createState() => _MyHomePageState();
-}
-  
-class _MyHomePageState extends State<MyHomePage> {
-  @override
-  void initState() {
-    super.initState();
-    
-    /// 同步使用Sp。
-   
     /// 存取基础类型
     SpUtil.putString("username", "Sky24n");
     String userName = SpUtil.getString("username");
@@ -311,43 +143,14 @@ class _MyHomePageState extends State<MyHomePage> {
   
   @override
   Widget build(BuildContext context) {
-    return Scaffold(
-      appBar: AppBar(
-        title: Text("Home"),
-      ),
-      body: new Center(
-        child: new Text(SpUtil.getString("username")),
-      ),
-    );
-  }
-}
-  
-class City {
-  String name;
-  
-  City({this.name});
-  
-  /// 必须写.
-  City.fromJson(Map<String, dynamic> json) : name = json['name'];
-  
-  /// 必须写.
-  Map<String, dynamic> toJson() => {
-        'name': name,
-      };
-  
-  @override
-  String toString() {
-    StringBuffer sb = new StringBuffer('{');
-    sb.write("\"name\":\"$name\"");
-    sb.write('}');
-    return sb.toString();
+    return MaterialApp();
   }
 }
 
 ```
 
 * #### ScreenUtil -> [Example](./example/lib/main.dart) 
-```dart
+```
 getWidth                  : 返回根据屏幕宽适配后尺寸.
 getHeight                 : 返回根据屏幕高适配后尺寸.
 getWidthPx                : 返回根据屏幕宽适配后尺寸.
@@ -422,7 +225,7 @@ Orientation orientation = ScreenUtil.getOrientation(context);
 ```
 
 * #### DirectoryUtil
-```dart
+```
 setInitDir
 initTempDir
 initAppDocDir
@@ -461,7 +264,7 @@ createStorageDir
 ```
 
 * #### WidgetUtil -> [Example1](https://github.com/Sky24n/flutter_wanandroid/blob/master/lib/demos/widget_page.dart),[Example2](https://github.com/Sky24n/flutter_wanandroid/blob/master/lib/demos/image_size_page.dart)
-```dart
+```
 asyncPrepare              : Widget渲染监听,监听widget宽高变化,callback返回宽高等参数.
 getWidgetBounds           : 获取widget 宽高.
 getWidgetLocalToGlobal    : 获取widget在屏幕上的坐标.
@@ -514,7 +317,7 @@ getImageWH
 ```
 
 * #### DioUtil (dio: ^1.0.13) 详细请求+解析请参考[flutter_wanandroid][flutter_wanandroid_github]项目。
-```dart
+```
 // 打开debug模式.
 DioUtil.openDebug(); 
 
@@ -552,19 +355,16 @@ Github:[flutter_wanandroid](https://github.com/Sky24n/flutter_wanandroid)
 Apk &nbsp;&nbsp;&nbsp;&nbsp;:[Demos](https://github.com/Sky24n/Doc)
 
 ### 关于作者
-GitHub : [Sky24n](https://github.com/Sky24n)  
-简书 &nbsp;&nbsp;&nbsp;&nbsp;: [Sky24n](https://www.jianshu.com/u/cbf2ad25d33a)  
-掘金 &nbsp;&nbsp;&nbsp;&nbsp;: [Sky24n](https://juejin.im/user/5b9e8a92e51d453df0440422/posts)
+GitHub &nbsp;&nbsp;&nbsp;: [Sky24n](https://github.com/Sky24n)  
+简书 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: [Sky24n](https://www.jianshu.com/u/cbf2ad25d33a)  
+掘金 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: [Sky24n](https://juejin.im/user/5b9e8a92e51d453df0440422/posts)  
+项目合集 : [FlutterRepos](https://github.com/Sky24n/FlutterRepos)
 
 ⭐⭐⭐ 最新开源 ⭐⭐⭐  
-[nine_grid_view](https://juejin.im/post/5ee825ab5188251f3f07af75)  
-Flutter仿微信/微博九宫格、拖拽排序,钉钉群组,微信群组头像。
+[nine_grid_view](https://github.com/flutterchina/nine_grid_view)  
+Flutter仿微信/微博九宫格、拖拽排序,钉钉群组,微信群组,QQ讨论组头像。
 
-⭐⭐⭐ 个人作品 ⭐⭐⭐  
-[Fitness](https://juejin.im/post/5ebd74b5f265da7bbd2f9aa6)  
-Flutter开发的微博客户端,同时支持Android和iOS。与官方微博x9.99%相似度体验,离线模式,多语言支持,主题随心换,超乎想象的流畅度,各种惊喜的细节等待你一一发现。
 
- 
 [flutter_wanandroid_github]: https://github.com/Sky24n/flutter_wanandroid
 
 [common_utils_github]: https://github.com/Sky24n/common_utils

+ 0 - 242
doc/UPDATELOG.md

@@ -1,242 +0,0 @@
-## 更新说明
-v0.2.6 (2019.06.11)  
-1.新增文件目录工具类
-```dart  
-await DirectoryUtil.getInstance();
-String path = DirectoryUtil.getTempPath(fileName: 'demo.png', category: 'image');
-String path = DirectoryUtil.getAppDocPath(fileName: 'demo.mp4', category: 'video');
-String path = DirectoryUtil.getStoragePath(fileName: 'flutterwanandroid.apk', package: 'com.thl.flutterwanandroid');
-
-Directory dir = DirectoryUtil.createTempDirSync(package: 'doc', category: 'image');
-...
-```
-
-2.SpUtil全面支持读取对象,对象列表。
-```dart  
-City hisCity = SpUtil.getObj("loc_city", (v) => City.fromJson(v));  
-List<City> dataList = SpUtil.getObjList("loc_city_list", (v) => City.fromJson(v));
-```   
-
-3.ScreenUtil 兼容横/纵屏适配。
-```dart  
-double adapterSize = ScreenUtil.getInstance().getAdapterSize(100);
-double adapterSize = ScreenUtil.getAdapterSizeCtx(context, 100)
-``` 
-
-v0.2.5 (2019.03.07)  
-WidgetUtil 新增获取图片尺寸。   
-/// get image width height,load error return Rect.zero.(unit px)  
-/// 获取图片宽高,加载错误情况返回 Rect.zero.(单位 px)  
-Future<Rect> getImageWH({Image image, String url, String localUrl, String package});  
-  
-/// get image width height, load error throw exception.(unit px)  
-/// 获取图片宽高,加载错误会抛出异常.(单位 px)  
-Future<Rect> getImageWHE({Image image, String url, String localUrl, String package});
-```
-/// 获取CachedNetworkImage下的图片尺寸
-Image image = new Image(image: new CachedNetworkImageProvider("Url"));
-Rect rect1 = await WidgetUtil.getImageWH(image: image);  
-
-/// 其他image
-Image imageAsset = new Image.asset("");
-Image imageFile = new Image.file(File("path"));
-Image imageNetwork = new Image.network("url");
-Image imageMemory = new Image.memory(null);
-
-/// 获取网络图片尺寸
-Rect rect2 = await WidgetUtil.getImageWH(url: "Url");
-
-/// 获取本地图片尺寸 localUrl 需要全路径
-Rect rect3 = await WidgetUtil.getImageWH(localUrl: "assets/images/3.0x/ali_connors.png");
-
-/// 其他方式
-WidgetUtil.getImageWH(url: "Url").then((Rect rect) {
-  print("rect: " + rect.toString();
-});
-
-WidgetUtil.getImageWHE(url: "Url").then((Rect rect) {
-  print("rect: " + rect.toString();
-}).catchError((error) {
-  print("rect: " + error.toString();
-});
-```
-
-v0.2.4 (2019.02.27)  
-synchronized: '>=0.1.0 <3.0.0'  
-hared_preferences: '>=0.1.1 <1.0.0'  
-
-v0.2.3 (2019.02.26)  
-shared_preferences & synchronized 修改为动态依赖~  
-SpUtil 新增putObject,getObject,putObjectList,getObjectList。  
-Object 需要实现fromJson,toJson。
-```
-class City {
-  String name;
-
-  City({this.name});
-
-  City.fromJson(Map<String, dynamic> json) : name = json['name'];
-
-  Map<String, dynamic> toJson() => {
-        'name': name,
-      };
-
-  @override
-  String toString() {
-    StringBuffer sb = new StringBuffer('{');
-    sb.write("\"name\":\"$name\"");
-    sb.write('}');
-    return sb.toString();
-  }
-}
-
-void _initAsync() async {
-    await SpUtil.getInstance();
-
-    /// save object example.
-    /// 存储实体对象示例。
-    City city = new City();
-    city.name = "成都市";
-    SpUtil.putObject("loc_city", city);
-
-    Map dataStr = SpUtil.getObject("loc_city");
-    City hisCity = dataStr == null ? null : City.fromJson(dataStr);
-    print("thll Str: " + (hisCity == null ? "null" : hisCity.toString()));
-
-    /// save object list example.
-    /// 存储实体对象List示例。
-    List<City> list = new List();
-    list.add(new City(name: "成都市"));
-    list.add(new City(name: "北京市"));
-    SpUtil.putObjectList("loc_city_list", list);
-
-    List<Map> dataList = SpUtil.getObjectList("loc_city_list");
-    List<City> _cityList = dataList?.map((value) {
-      return City.fromJson(value);
-    })?.toList();
-
-    print("thll List: " + (_cityList == null ? "null" : _cityList.toString()));
-}
-    
-```
-
-v0.2.2(2019.02.04) 
-SpUtil新增get默认值。  
-SpUtil.getString('key', defValue: '');    
-SpUtil.getInt('key', defValue: 0);
-
-v0.1.9(2019.01.07)   
-移除DioUtil,如有需要,请到[flutter_wanandroid][flutter_wanandroid_github]该项目中copy。
-
-v0.1.8(2018.12.29)   
-ScreenUtil 屏幕适配更新。  
-方案一、不依赖context
-```
-步骤 1
-//如果设计稿尺寸默认配置一致,无需该设置。  配置设计稿尺寸 默认 360.0 / 640.0 / 3.0
-setDesignWHD(_designW,_designH,_designD);  
-  
-步骤 2
-// 在MainPageState build 调用MediaQuery.of(context)
-class MainPageState extends State<MainPage> {
-  @override
-  Widget build(BuildContext context) {
-  
-    // 在 MainPageState build 调用 MediaQuery.of(context)
-    MediaQuery.of(context);
-    
-    double width = ScreenUtil.getInstance().screenWidth;
-    double height = ScreenUtil.getInstance().screenHeight;
-    return new Scaffold(
-      appBar: new AppBar(),
-    );
-  }
-}  
-  
-步骤 3
-ScreenUtil.getInstance().screenWidth
-ScreenUtil.getInstance().screenHeight
-ScreenUtil.getInstance().screenDensity
-ScreenUtil.getInstance().statusBarHeight
-ScreenUtil.getInstance().bottomBarHeight
-//屏幕适配相关  
-ScreenUtil.getInstance().getWidth(size); //返回根据屏幕宽适配后尺寸(单位 dp or pt)
-ScreenUtil.getInstance().getHeight(size); //返回根据屏幕高适配后尺寸 (单位 dp or pt)
-ScreenUtil.getInstance().getWidthPx(sizePx); //sizePx 单位px
-ScreenUtil.getInstance().getHeightPx(sizePx); //sizePx 单位px
-ScreenUtil.getInstance().getSp(fontSize); //返回根据屏幕宽适配后字体尺寸
-
-```
-方案二、依赖context
-```
-//如果设计稿尺寸默认配置一致,无需该设置。  配置设计稿尺寸 默认 360.0 / 640.0 / 3.0
-setDesignWHD(_designW,_designH,_designD);  
-
-ScreenUtil.getScreenW(context); //屏幕 宽
-ScreenUtil.getScreenH(context); //屏幕 高
-ScreenUtil.getScreenDensity(context); //屏幕 像素密度
-ScreenUtil.getStatusBarH(context); //状态栏高度
-ScreenUtil.getBottomBarH(context); //bottombar 高度
-//屏幕适配相关  
-ScreenUtil.getScaleW(context, size); //返回根据屏幕宽适配后尺寸(单位 dp or pt)
-ScreenUtil.getScaleH(context, size); //返回根据屏幕高适配后尺寸 (单位 dp or pt)
-ScreenUtil.getScaleSp(context, size) ;//返回根据屏幕宽适配后字体尺寸
-```
-
-v0.1.6(2018.12.20)  
-新增网络请求工具DioUtil, 单例模式,可输出请求日志。详细请求+解析请参考[flutter_wanandroid][flutter_wanandroid_github]项目。
-```
-// 打开debug模式.
-DioUtil.openDebug(); 
-
-// 配置网络参数.
-Options options = DioUtil.getDefOptions();
-options.baseUrl = "http://www.wanandroid.com/";
-HttpConfig config = new HttpConfig(options: options);
-DioUtil().setConfig(config);
-  
-// 两种单例请求方式.
-DioUtil().request<List>(Method.get, "banner/json");
-DioUtil.getInstance().request(Method.get, "banner/json");
-  
-//示例
-LoginReq req = new LoginReq('username', 'password');
-DioUtil().request(Method.post, "user/login",data: req.toJson());
-  
-//示例
-FormData formData = new FormData.from({
-      "username": "username",
-      "password": "password",
-    });
-DioUtil().requestR(Method.post, "user/login",data: rformData);
-  
-// 网络请求日志  
-I/flutter ( 5922): ----------------Http Log----------------
-I/flutter ( 5922): [statusCode]:   200
-I/flutter ( 5922): [request   ]:   method: GET  baseUrl: http://www.wanandroid.com/  path: lg/collect/list/0/json
-I/flutter ( 5922): [reqdata   ]:   null
-I/flutter ( 5922): [response  ]:   {data: {curPage: 1, datas: [], offset: 0, over: true, pageCount: 0, size: 20, total: 0}, errorCode: 0, errorMsg: }
-```
-
-v0.1.5(2018.12.14)  
-ScreenUtil 新增屏幕适配。
-```
-//如果设计稿尺寸默认配置一致,无需该设置。  配置设计稿尺寸 默认 360.0 / 640.0 / 3.0
-setDesignWHD(_designW,_designH,_designD);
-
-//返回根据屏幕宽适配后尺寸(单位 dp or pt)
-ScreenUtil.getInstance().getWidth(100.0);  
-
-//返回根据屏幕高适配后尺寸(单位 dp or pt)
-ScreenUtil.getInstance().getHeight(100.0); 
-
-//返回根据屏幕宽适配后字体尺寸
-ScreenUtil.getInstance().getSp(12.0); 
-```
-v0.1.4(2018.11.22)  
-ScreenUtil不依赖context获取屏幕数据。  
-
-新增MyAppBar,不需要GlobalKey就能openDrawer。  
-
-
-[flutter_wanandroid_github]: https://github.com/Sky24n/flutter_wanandroid

+ 1 - 1
example/.flutter-plugins-dependencies

@@ -1 +1 @@
-{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider","path":"C:\\\\Users\\\\thl\\\\AppData\\\\Roaming\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider-1.6.9\\\\","dependencies":[]},{"name":"shared_preferences","path":"C:\\\\Users\\\\thl\\\\AppData\\\\Roaming\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\shared_preferences-0.5.7+3\\\\","dependencies":[]}],"android":[{"name":"path_provider","path":"C:\\\\Users\\\\thl\\\\AppData\\\\Roaming\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider-1.6.9\\\\","dependencies":[]},{"name":"shared_preferences","path":"C:\\\\Users\\\\thl\\\\AppData\\\\Roaming\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\shared_preferences-0.5.7+3\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"C:\\\\Users\\\\thl\\\\AppData\\\\Roaming\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_macos-0.0.4+3\\\\","dependencies":[]},{"name":"shared_preferences_macos","path":"C:\\\\Users\\\\thl\\\\AppData\\\\Roaming\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\shared_preferences_macos-0.0.1+9\\\\","dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"shared_preferences_web","path":"C:\\\\Users\\\\thl\\\\AppData\\\\Roaming\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\shared_preferences_web-0.1.2+7\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"path_provider","dependencies":["path_provider_macos"]},{"name":"path_provider_macos","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]}],"date_created":"2020-06-05 12:48:12.433204","version":"1.17.2"}
+{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider","path":"/Users/thl/.pub-cache/hosted/pub.flutter-io.cn/path_provider-1.6.11/","dependencies":[]},{"name":"shared_preferences","path":"/Users/thl/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences-0.5.8/","dependencies":[]}],"android":[{"name":"path_provider","path":"/Users/thl/.pub-cache/hosted/pub.flutter-io.cn/path_provider-1.6.11/","dependencies":[]},{"name":"shared_preferences","path":"/Users/thl/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences-0.5.8/","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"/Users/thl/.pub-cache/hosted/pub.flutter-io.cn/path_provider_macos-0.0.4+3/","dependencies":[]},{"name":"shared_preferences_macos","path":"/Users/thl/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences_macos-0.0.1+10/","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/thl/.pub-cache/hosted/pub.flutter-io.cn/path_provider_linux-0.0.1+2/","dependencies":[]},{"name":"shared_preferences_linux","path":"/Users/thl/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences_linux-0.0.2+1/","dependencies":["path_provider_linux"]}],"windows":[],"web":[{"name":"shared_preferences_web","path":"/Users/thl/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences_web-0.1.2+7/","dependencies":[]}]},"dependencyGraph":[{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_linux","shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]}],"date_created":"2020-07-14 00:01:36.197559","version":"1.17.5"}

+ 12 - 39
example/.gitignore

@@ -15,56 +15,29 @@
 *.iws
 .idea/
 
-# Visual Studio Code related
-.vscode/
+# The .vscode folder contains launch configuration and tasks you configure in
+# VS Code which you may wish to be included in version control, so this line
+# is commented out by default.
+#.vscode/
 
 # Flutter/Dart/Pub related
 **/doc/api/
 .dart_tool/
 .flutter-plugins
+.flutter-plugins-dependencies
 .packages
 .pub-cache/
 .pub/
 /build/
 
-# Android related
-**/android/**/gradle-wrapper.jar
-**/android/.gradle
-**/android/captures/
-**/android/gradlew
-**/android/gradlew.bat
-**/android/local.properties
-**/android/**/GeneratedPluginRegistrant.java
+# Web related
+lib/generated_plugin_registrant.dart
 
-# iOS/XCode related
-**/ios/**/*.mode1v3
-**/ios/**/*.mode2v3
-**/ios/**/*.moved-aside
-**/ios/**/*.pbxuser
-**/ios/**/*.perspectivev3
-**/ios/**/*sync/
-**/ios/**/.sconsign.dblite
-**/ios/**/.tags*
-**/ios/**/.vagrant/
-**/ios/**/DerivedData/
-**/ios/**/Icon?
-**/ios/**/Pods/
-**/ios/**/.symlinks/
-**/ios/**/profile
-**/ios/**/xcuserdata
-**/ios/.generated/
-**/ios/Flutter/App.framework
-**/ios/Flutter/Flutter.framework
-**/ios/Flutter/Generated.xcconfig
-**/ios/Flutter/app.flx
-**/ios/Flutter/app.zip
-**/ios/Flutter/flutter_assets/
-**/ios/ServiceDefinitions.json
-**/ios/Runner/GeneratedPluginRegistrant.*
+# Symbolication related
+app.*.symbols
+
+# Obfuscation related
+app.*.map.json
 
 # Exceptions to above rules.
-!**/ios/**/default.mode1v3
-!**/ios/**/default.mode2v3
-!**/ios/**/default.pbxuser
-!**/ios/**/default.perspectivev3
 !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages

+ 10 - 0
example/.metadata

@@ -0,0 +1,10 @@
+# This file tracks properties of this Flutter project.
+# Used by Flutter tool to assess capabilities and perform upgrades etc.
+#
+# This file should be version controlled and should not be manually edited.
+
+version:
+  revision: 8af6b2f038c1172e61d418869363a28dffec3cb4
+  channel: stable
+
+project_type: app

+ 5 - 5
example/README.md

@@ -1,6 +1,6 @@
 # flustars_example
 
-Demonstrates how to use the flustars plugin.
+A new Flutter application.
 
 ## Getting Started
 
@@ -8,9 +8,9 @@ This project is a starting point for a Flutter application.
 
 A few resources to get you started if this is your first Flutter project:
 
-- [Lab: Write your first Flutter app](https://flutter.io/docs/get-started/codelab)
-- [Cookbook: Useful Flutter samples](https://flutter.io/docs/cookbook)
+- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
+- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
 
-For help getting started with Flutter, view our 
-[online documentation](https://flutter.io/docs), which offers tutorials, 
+For help getting started with Flutter, view our
+[online documentation](https://flutter.dev/docs), which offers tutorials,
 samples, guidance on mobile development, and a full API reference.

+ 0 - 7
example/android/app/build.gradle

@@ -38,7 +38,6 @@ android {
         targetSdkVersion 28
         versionCode flutterVersionCode.toInteger()
         versionName flutterVersionName
-        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
     }
 
     buildTypes {
@@ -53,9 +52,3 @@ android {
 flutter {
     source '../..'
 }
-
-dependencies {
-    testImplementation 'junit:junit:4.12'
-    androidTestImplementation 'androidx.test:runner:1.1.1'
-    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
-}

+ 17 - 0
example/android/app/src/main/AndroidManifest.xml

@@ -16,6 +16,23 @@
             android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
             android:hardwareAccelerated="true"
             android:windowSoftInputMode="adjustResize">
+            <!-- Specifies an Android theme to apply to this Activity as soon as
+                 the Android process has started. This theme is visible to the user
+                 while the Flutter UI initializes. After that, this theme continues
+                 to determine the Window background behind the Flutter UI. -->
+            <meta-data
+              android:name="io.flutter.embedding.android.NormalTheme"
+              android:resource="@style/NormalTheme"
+              />
+            <!-- Displays an Android View that continues showing the launch screen
+                 Drawable until Flutter paints its first frame, then this splash
+                 screen fades out. A splash screen is useful to avoid any visual
+                 gap between the end of Android's launch screen and the painting of
+                 Flutter's first frame. -->
+            <meta-data
+              android:name="io.flutter.embedding.android.SplashScreenDrawable"
+              android:resource="@drawable/launch_background"
+              />
             <intent-filter>
                 <action android:name="android.intent.action.MAIN"/>
                 <category android:name="android.intent.category.LAUNCHER"/>

+ 0 - 7
example/android/app/src/main/java/com/thl/flustars_example/MainActivity.java

@@ -1,13 +1,6 @@
 package com.thl.flustars_example;
 
-import androidx.annotation.NonNull;
 import io.flutter.embedding.android.FlutterActivity;
-import io.flutter.embedding.engine.FlutterEngine;
-import io.flutter.plugins.GeneratedPluginRegistrant;
 
 public class MainActivity extends FlutterActivity {
-  @Override
-  public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
-    GeneratedPluginRegistrant.registerWith(flutterEngine);
-  }
 }

+ 10 - 0
example/android/app/src/main/res/values/styles.xml

@@ -1,8 +1,18 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
+    <!-- Theme applied to the Android Window while the process is starting -->
     <style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
         <!-- Show a splash screen on the activity. Automatically removed when
              Flutter draws its first frame -->
         <item name="android:windowBackground">@drawable/launch_background</item>
     </style>
+    <!-- Theme applied to the Android Window as soon as the process has started.
+         This theme determines the color of the Android Window while your
+         Flutter UI initializes, as well as behind your Flutter UI while its
+         running.
+         
+         This Theme is only used starting with V2 of Flutter's Android embedding. -->
+    <style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
+        <item name="android:windowBackground">@android:color/white</item>
+    </style>
 </resources>

+ 11 - 11
example/android/settings.gradle

@@ -1,15 +1,15 @@
+// Copyright 2014 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
 include ':app'
 
-def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
+def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
+def properties = new Properties()
 
-def plugins = new Properties()
-def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
-if (pluginsFile.exists()) {
-    pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
-}
+assert localPropertiesFile.exists()
+localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
 
-plugins.each { name, path ->
-    def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
-    include ":$name"
-    project(":$name").projectDir = pluginDirectory
-}
+def flutterSdkPath = properties.getProperty("flutter.sdk")
+assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
+apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"

+ 3 - 3
example/ios/Podfile

@@ -33,6 +33,9 @@ def parse_KV_file(file, separator='=')
 end
 
 target 'Runner' do
+  use_frameworks!
+  use_modular_headers!
+
   # Flutter Pod
 
   copied_flutter_dir = File.join(__dir__, 'Flutter')
@@ -75,9 +78,6 @@ target 'Runner' do
   end
 end
 
-# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
-install! 'cocoapods', :disable_input_output_paths => true
-
 post_install do |installer|
   installer.pods_project.targets.each do |target|
     target.build_configurations.each do |config|

+ 0 - 40
example/ios/Podfile.lock

@@ -1,40 +0,0 @@
-PODS:
-  - Flutter (1.0.0)
-  - path_provider (0.0.1):
-    - Flutter
-  - shared_preferences (0.0.1):
-    - Flutter
-  - shared_preferences_macos (0.0.1):
-    - Flutter
-  - shared_preferences_web (0.0.1):
-    - Flutter
-
-DEPENDENCIES:
-  - Flutter (from `Flutter`)
-  - path_provider (from `.symlinks/plugins/path_provider/ios`)
-  - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
-  - shared_preferences_macos (from `.symlinks/plugins/shared_preferences_macos/ios`)
-  - shared_preferences_web (from `.symlinks/plugins/shared_preferences_web/ios`)
-
-EXTERNAL SOURCES:
-  Flutter:
-    :path: Flutter
-  path_provider:
-    :path: ".symlinks/plugins/path_provider/ios"
-  shared_preferences:
-    :path: ".symlinks/plugins/shared_preferences/ios"
-  shared_preferences_macos:
-    :path: ".symlinks/plugins/shared_preferences_macos/ios"
-  shared_preferences_web:
-    :path: ".symlinks/plugins/shared_preferences_web/ios"
-
-SPEC CHECKSUMS:
-  Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
-  path_provider: f96fff6166a8867510d2c25fdcc346327cc4b259
-  shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d
-  shared_preferences_macos: f3f29b71ccbb56bf40c9dd6396c9acf15e214087
-  shared_preferences_web: 141cce0c3ed1a1c5bf2a0e44f52d31eeb66e5ea9
-
-PODFILE CHECKSUM: 3dbe063e9c90a5d7c9e4e76e70a821b9e2c1d271
-
-COCOAPODS: 1.8.4

+ 21 - 91
example/ios/Runner.xcodeproj/project.pbxproj

@@ -9,16 +9,10 @@
 /* Begin PBXBuildFile section */
 		1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
 		3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
-		3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
-		3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
-		9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
-		9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
-		978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
-		97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
+		74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
 		97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
 		97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
 		97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
-		98F29E90827F0A7EABE2A9F5 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6772A771EE0D58CC1176700A /* libPods-Runner.a */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXCopyFilesBuildPhase section */
@@ -28,8 +22,6 @@
 			dstPath = "";
 			dstSubfolderSpec = 10;
 			files = (
-				3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,
-				9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,
 			);
 			name = "Embed Frameworks";
 			runOnlyForDeploymentPostprocessing = 0;
@@ -39,24 +31,17 @@
 /* Begin PBXFileReference section */
 		1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
 		1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
-		208EDB1D91D02C3985E4CE45 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
 		3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
-		3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
-		3BBB84AD8B98690574E27263 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
-		6772A771EE0D58CC1176700A /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; };
+		74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
+		74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
 		7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
-		7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
-		7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
 		9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
 		9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
-		9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = "<group>"; };
 		97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
-		97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
 		97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
 		97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
 		97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
 		97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
-		CC230F2669B0012A7B5CFA1F /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -64,32 +49,16 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
-				3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
-				98F29E90827F0A7EABE2A9F5 /* libPods-Runner.a in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
-		2A0C40B110814A02113F4872 /* Pods */ = {
-			isa = PBXGroup;
-			children = (
-				208EDB1D91D02C3985E4CE45 /* Pods-Runner.debug.xcconfig */,
-				3BBB84AD8B98690574E27263 /* Pods-Runner.release.xcconfig */,
-				CC230F2669B0012A7B5CFA1F /* Pods-Runner.profile.xcconfig */,
-			);
-			name = Pods;
-			path = Pods;
-			sourceTree = "<group>";
-		};
 		9740EEB11CF90186004384FC /* Flutter */ = {
 			isa = PBXGroup;
 			children = (
-				3B80C3931E831B6300D905FE /* App.framework */,
 				3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
-				9740EEBA1CF902C7004384FC /* Flutter.framework */,
 				9740EEB21CF90195004384FC /* Debug.xcconfig */,
 				7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
 				9740EEB31CF90195004384FC /* Generated.xcconfig */,
@@ -103,8 +72,6 @@
 				9740EEB11CF90186004384FC /* Flutter */,
 				97C146F01CF9000F007C117D /* Runner */,
 				97C146EF1CF9000F007C117D /* Products */,
-				2A0C40B110814A02113F4872 /* Pods */,
-				D52E43F9952FB4695258CB6E /* Frameworks */,
 			);
 			sourceTree = "<group>";
 		};
@@ -119,8 +86,6 @@
 		97C146F01CF9000F007C117D /* Runner */ = {
 			isa = PBXGroup;
 			children = (
-				7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */,
-				7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */,
 				97C146FA1CF9000F007C117D /* Main.storyboard */,
 				97C146FD1CF9000F007C117D /* Assets.xcassets */,
 				97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
@@ -128,6 +93,8 @@
 				97C146F11CF9000F007C117D /* Supporting Files */,
 				1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
 				1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
+				74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
+				74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
 			);
 			path = Runner;
 			sourceTree = "<group>";
@@ -135,19 +102,10 @@
 		97C146F11CF9000F007C117D /* Supporting Files */ = {
 			isa = PBXGroup;
 			children = (
-				97C146F21CF9000F007C117D /* main.m */,
 			);
 			name = "Supporting Files";
 			sourceTree = "<group>";
 		};
-		D52E43F9952FB4695258CB6E /* Frameworks */ = {
-			isa = PBXGroup;
-			children = (
-				6772A771EE0D58CC1176700A /* libPods-Runner.a */,
-			);
-			name = Frameworks;
-			sourceTree = "<group>";
-		};
 /* End PBXGroup section */
 
 /* Begin PBXNativeTarget section */
@@ -155,14 +113,12 @@
 			isa = PBXNativeTarget;
 			buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
 			buildPhases = (
-				B7C522AA42A80F34B0CF1355 /* [CP] Check Pods Manifest.lock */,
 				9740EEB61CF901F6004384FC /* Run Script */,
 				97C146EA1CF9000F007C117D /* Sources */,
 				97C146EB1CF9000F007C117D /* Frameworks */,
 				97C146EC1CF9000F007C117D /* Resources */,
 				9705A1C41CF9048500538489 /* Embed Frameworks */,
 				3B06AD1E1E4923F5004D2608 /* Thin Binary */,
-				416631E430B6D9CC44E84C4B /* [CP] Embed Pods Frameworks */,
 			);
 			buildRules = (
 			);
@@ -180,15 +136,16 @@
 			isa = PBXProject;
 			attributes = {
 				LastUpgradeCheck = 1020;
-				ORGANIZATIONNAME = "The Chromium Authors";
+				ORGANIZATIONNAME = "";
 				TargetAttributes = {
 					97C146ED1CF9000F007C117D = {
 						CreatedOnToolsVersion = 7.3.1;
+						LastSwiftMigration = 1100;
 					};
 				};
 			};
 			buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
-			compatibilityVersion = "Xcode 3.2";
+			compatibilityVersion = "Xcode 9.3";
 			developmentRegion = en;
 			hasScannedForEncodings = 0;
 			knownRegions = (
@@ -232,22 +189,7 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = /bin/sh;
-			shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
-		};
-		416631E430B6D9CC44E84C4B /* [CP] Embed Pods Frameworks */ = {
-			isa = PBXShellScriptBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			inputPaths = (
-			);
-			name = "[CP] Embed Pods Frameworks";
-			outputPaths = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-			shellPath = /bin/sh;
-			shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
-			showEnvVarsInLog = 0;
+			shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
 		};
 		9740EEB61CF901F6004384FC /* Run Script */ = {
 			isa = PBXShellScriptBuildPhase;
@@ -263,28 +205,6 @@
 			shellPath = /bin/sh;
 			shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
 		};
-		B7C522AA42A80F34B0CF1355 /* [CP] Check Pods Manifest.lock */ = {
-			isa = PBXShellScriptBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			inputFileListPaths = (
-			);
-			inputPaths = (
-				"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
-				"${PODS_ROOT}/Manifest.lock",
-			);
-			name = "[CP] Check Pods Manifest.lock";
-			outputFileListPaths = (
-			);
-			outputPaths = (
-				"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-			shellPath = /bin/sh;
-			shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n    # print error to STDERR\n    echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n    exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
-			showEnvVarsInLog = 0;
-		};
 /* End PBXShellScriptBuildPhase section */
 
 /* Begin PBXSourcesBuildPhase section */
@@ -292,8 +212,7 @@
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */,
-				97C146F31CF9000F007C117D /* main.m in Sources */,
+				74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
 				1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
@@ -376,6 +295,7 @@
 			baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+				CLANG_ENABLE_MODULES = YES;
 				CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
 				ENABLE_BITCODE = NO;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -390,6 +310,8 @@
 				);
 				PRODUCT_BUNDLE_IDENTIFIER = com.thl.flustarsExample;
 				PRODUCT_NAME = "$(TARGET_NAME)";
+				SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
+				SWIFT_VERSION = 5.0;
 				VERSIONING_SYSTEM = "apple-generic";
 			};
 			name = Profile;
@@ -496,6 +418,7 @@
 				MTL_ENABLE_DEBUG_INFO = NO;
 				SDKROOT = iphoneos;
 				SUPPORTED_PLATFORMS = iphoneos;
+				SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
 				TARGETED_DEVICE_FAMILY = "1,2";
 				VALIDATE_PRODUCT = YES;
 			};
@@ -506,6 +429,7 @@
 			baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+				CLANG_ENABLE_MODULES = YES;
 				CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
 				ENABLE_BITCODE = NO;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -520,6 +444,9 @@
 				);
 				PRODUCT_BUNDLE_IDENTIFIER = com.thl.flustarsExample;
 				PRODUCT_NAME = "$(TARGET_NAME)";
+				SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
+				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+				SWIFT_VERSION = 5.0;
 				VERSIONING_SYSTEM = "apple-generic";
 			};
 			name = Debug;
@@ -529,6 +456,7 @@
 			baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+				CLANG_ENABLE_MODULES = YES;
 				CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
 				ENABLE_BITCODE = NO;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -543,6 +471,8 @@
 				);
 				PRODUCT_BUNDLE_IDENTIFIER = com.thl.flustarsExample;
 				PRODUCT_NAME = "$(TARGET_NAME)";
+				SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
+				SWIFT_VERSION = 5.0;
 				VERSIONING_SYSTEM = "apple-generic";
 			};
 			name = Release;

+ 8 - 0
example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>IDEDidComputeMac32BitWarning</key>
+	<true/>
+</dict>
+</plist>

+ 8 - 0
example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>PreviewsEnabled</key>
+	<false/>
+</dict>
+</plist>

+ 0 - 3
example/ios/Runner.xcworkspace/contents.xcworkspacedata

@@ -4,7 +4,4 @@
    <FileRef
       location = "group:Runner.xcodeproj">
    </FileRef>
-   <FileRef
-      location = "group:Pods/Pods.xcodeproj">
-   </FileRef>
 </Workspace>

+ 8 - 0
example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>IDEDidComputeMac32BitWarning</key>
+	<true/>
+</dict>
+</plist>

+ 8 - 0
example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>PreviewsEnabled</key>
+	<false/>
+</dict>
+</plist>

+ 0 - 6
example/ios/Runner/AppDelegate.h

@@ -1,6 +0,0 @@
-#import <Flutter/Flutter.h>
-#import <UIKit/UIKit.h>
-
-@interface AppDelegate : FlutterAppDelegate
-
-@end

+ 0 - 13
example/ios/Runner/AppDelegate.m

@@ -1,13 +0,0 @@
-#import "AppDelegate.h"
-#import "GeneratedPluginRegistrant.h"
-
-@implementation AppDelegate
-
-- (BOOL)application:(UIApplication *)application
-    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
-  [GeneratedPluginRegistrant registerWithRegistry:self];
-  // Override point for customization after application launch.
-  return [super application:application didFinishLaunchingWithOptions:launchOptions];
-}
-
-@end

+ 13 - 0
example/ios/Runner/AppDelegate.swift

@@ -0,0 +1,13 @@
+import UIKit
+import Flutter
+
+@UIApplicationMain
+@objc class AppDelegate: FlutterAppDelegate {
+  override func application(
+    _ application: UIApplication,
+    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
+  ) -> Bool {
+    GeneratedPluginRegistrant.register(with: self)
+    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
+  }
+}

+ 1 - 0
example/ios/Runner/Runner-Bridging-Header.h

@@ -0,0 +1 @@
+#import "GeneratedPluginRegistrant.h"

+ 0 - 9
example/ios/Runner/main.m

@@ -1,9 +0,0 @@
-#import <Flutter/Flutter.h>
-#import <UIKit/UIKit.h>
-#import "AppDelegate.h"
-
-int main(int argc, char* argv[]) {
-  @autoreleasepool {
-    return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
-  }
-}

+ 38 - 52
example/lib/main.dart

@@ -9,28 +9,6 @@ class MyApp extends StatefulWidget {
   _MyAppState createState() => _MyAppState();
 }
 
-class City {
-  String name;
-
-  City({this.name});
-
-  /// must.
-  City.fromJson(Map<String, dynamic> json) : name = json['name'];
-
-  /// must.
-  Map<String, dynamic> toJson() => {
-        'name': name,
-      };
-
-  @override
-  String toString() {
-    StringBuffer sb = StringBuffer('{');
-    sb.write("\"name\":\"$name\"");
-    sb.write('}');
-    return sb.toString();
-  }
-}
-
 class _MyAppState extends State<MyApp> {
   @override
   void initState() {
@@ -50,7 +28,7 @@ class _MyAppState extends State<MyApp> {
 
     SpUtil.putString("username", "sky24");
     String userName = SpUtil.getString("username", defValue: "");
-    print("thll userName: " + userName);
+    LogUtil.e("userName: " + userName);
 
     /// save object example.
     /// 存储实体对象示例。
@@ -59,7 +37,7 @@ class _MyAppState extends State<MyApp> {
     SpUtil.putObject("loc_city", city);
 
     City hisCity = SpUtil.getObj("loc_city", (v) => City.fromJson(v));
-    print("thll City: " + (hisCity == null ? "null" : hisCity.toString()));
+    LogUtil.e("City: " + (hisCity == null ? "null" : hisCity.toString()));
 
     /// save object list example.
     /// 存储实体对象list示例。
@@ -70,8 +48,7 @@ class _MyAppState extends State<MyApp> {
 
     List<City> dataList =
         SpUtil.getObjList("loc_city_list", (v) => City.fromJson(v));
-    print(
-        "thll CityList: " + (dataList == null ? "null" : dataList.toString()));
+    LogUtil.e("CityList: " + (dataList == null ? "null" : dataList.toString()));
   }
 
   @override
@@ -95,39 +72,28 @@ class MainPage extends StatefulWidget {
 /// Or use context-dependent methods to obtain screen parameters and adaptions.
 class MainPageState extends State<MainPage> {
   void test2() async {
-    print("thll xxxxxxxxxxx test7......");
+    LogUtil.e("xxxxxxxxxxx test7......");
     await DirectoryUtil.getInstance();
     String tempPath = DirectoryUtil.getTempPath(
         category: 'Pictures', fileName: 'demo', format: 'png');
-    print("thll  tempPath: $tempPath");
+    LogUtil.e("tempPath: $tempPath");
 
     String appDocPath = DirectoryUtil.getAppDocPath(
         category: 'Pictures', fileName: 'demo', format: 'png');
-    print("thll  appDocPath: $appDocPath");
+    LogUtil.e("appDocPath: $appDocPath");
 
     String appSupportPath = DirectoryUtil.getAppSupportPath(
         category: 'Pictures', fileName: 'demo', format: 'png');
-    print("thll  appSupportPath: $appSupportPath");
+    LogUtil.e("appSupportPath: $appSupportPath");
 
     String storagePath = DirectoryUtil.getStoragePath(
         category: 'Pictures', fileName: 'demo', format: 'png');
-    print("thll  storagePath: $storagePath");
+    LogUtil.e("storagePath: $storagePath");
   }
 
   @override
   void initState() {
     super.initState();
-    test2();
-  }
-
-  void test() async {
-    String _src =
-        "https://dsd361-oss1.oss-cn-beijing.aliyuncs.com/upload/advert/2d56ad78-472d-4eaf-b1f1-9a6887089d17.gif";
-
-    Rect rect2 = await WidgetUtil.getImageWH(url: _src);
-
-//    ImageUtil imageUtil = ImageUtil();
-//    imageUtil.getImageWH().then((Rect rect) {});
   }
 
   @override
@@ -144,8 +110,8 @@ class MainPageState extends State<MainPage> {
     double spc = ScreenUtil.getInstance().getAdapterSize(24);
     double adapterW = ScreenUtil.getInstance().getAdapterSize(360);
 
-    print(
-        "thll  MainPage statusBar: $statusBar, width: $width, height: $height, density: $density, sp: $sp, spc: $spc, adapterW: $adapterW");
+    LogUtil.e(
+        "MainPage statusBar: $statusBar, width: $width, height: $height, density: $density, sp: $sp, spc: $spc, adapterW: $adapterW");
     return Scaffold(
       // 一个不需要GlobalKey就可以openDrawer的AppBar
       appBar: AppBar(
@@ -164,9 +130,8 @@ class MainPageState extends State<MainPage> {
           IconButton(
             icon: Icon(Icons.search),
             onPressed: () {
-              print("thll onPressed......");
+              LogUtil.e("onPressed......");
               //test2();
-              test();
 //              Navigator.push(context,
 //                  CupertinoPageRoute<void>(builder: (ctx) => SecondPage()));
             },
@@ -235,8 +200,7 @@ class MyDrawer extends StatelessWidget {
     double statusBar = ScreenUtil.getInstance().statusBarHeight;
     double width = ScreenUtil.getInstance().screenWidth;
     double height = ScreenUtil.getInstance().screenHeight;
-    print(
-        " thll  MyDrawer statusBar: $statusBar, width: $width, height: $height");
+    LogUtil.e("MyDrawer statusBar: $statusBar, width: $width, height: $height");
 
     return Container(
       color: Colors.white,
@@ -290,7 +254,7 @@ class SecondPageState extends State<SecondPage> {
     double adapterW100px = ScreenUtil.getInstance().getWidthPx(300);
     double adapterH100px = ScreenUtil.getInstance().getHeightPx(300);
 
-    print("thll  SecondPage _init screenWidth: $screenWidth, screenHeight: $screenHeight, screenDensity: $screenDensity" +
+    LogUtil.e("SecondPage _init screenWidth: $screenWidth, screenHeight: $screenHeight, screenDensity: $screenDensity" +
         ", statusBarHeight: $statusBarHeight, bottomBarHeight: $bottomBarHeight, appBarHeight: $appBarHeight" +
         ", adapterW100: $adapterW100, adapterH100: $adapterH100, adapterSp100: $adapterSp100" +
         ", adapterW100px: $adapterW100px, adapterH100px: $adapterH100px");
@@ -307,7 +271,7 @@ class SecondPageState extends State<SecondPage> {
     double adapterSp100 = ScreenUtil.getScaleSp(context, 100);
     Orientation orientation = ScreenUtil.getOrientation(context);
 
-    print("thll  SecondPage _initWithCtx screenWidth: $screenWidth, screenHeight: $screenHeight, screenDensity: $screenDensity" +
+    LogUtil.e("SecondPage _initWithCtx screenWidth: $screenWidth, screenHeight: $screenHeight, screenDensity: $screenDensity" +
         ", statusBarHeight: $statusBarHeight, bottomBarHeight: $bottomBarHeight" +
         ", adapterW100: $adapterW100, adapterH100: $adapterH100, adapterSp100: $adapterSp100");
   }
@@ -317,8 +281,8 @@ class SecondPageState extends State<SecondPage> {
     double statusBar = ScreenUtil.getInstance().statusBarHeight;
     double width = ScreenUtil.getInstance().screenWidth;
     double height = ScreenUtil.getInstance().screenHeight;
-    print(
-        "thll  SecondPage statusBar: $statusBar, width: $width, height: $height");
+    LogUtil.e(
+        "SecondPage statusBar: $statusBar, width: $width, height: $height");
 
     return Scaffold(
       appBar: AppBar(
@@ -370,3 +334,25 @@ class SecondPageState extends State<SecondPage> {
     );
   }
 }
+
+class City {
+  String name;
+
+  City({this.name});
+
+  /// must.
+  City.fromJson(Map<String, dynamic> json) : name = json['name'];
+
+  /// must.
+  Map<String, dynamic> toJson() => {
+        'name': name,
+      };
+
+  @override
+  String toString() {
+    StringBuffer sb = StringBuffer('{');
+    sb.write("\"name\":\"$name\"");
+    sb.write('}');
+    return sb.toString();
+  }
+}

+ 29 - 14
example/pubspec.yaml

@@ -1,27 +1,42 @@
 name: flustars_example
-description: Demonstrates how to use the flustars plugin.
-publish_to: 'none'
+description: A new Flutter application.
+
+# The following line prevents the package from being accidentally published to
+# pub.dev using `pub publish`. This is preferred for private packages.
+publish_to: 'none' # Remove this line if you wish to publish to pub.dev
+
+# The following defines the version and build number for your application.
+# A version number is three numbers separated by dots, like 1.2.43
+# followed by an optional build number separated by a +.
+# Both the version and the builder number may be overridden in flutter
+# build by specifying --build-name and --build-number, respectively.
+# In Android, build-name is used as versionName while build-number used as versionCode.
+# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
+# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
+# Read more about iOS versioning at
+# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
+version: 1.0.0+1
 
 environment:
-  sdk: ">=2.1.0 <3.0.0"
+  sdk: ">=2.7.0 <3.0.0"
 
 dependencies:
   flutter:
     sdk: flutter
 
+
   # The following adds the Cupertino Icons font to your application.
   # Use with the CupertinoIcons class for iOS style icons.
-  cupertino_icons: ^0.1.2
+  cupertino_icons: ^0.1.3
+  flustars:
+    path: ../
 
 dev_dependencies:
   flutter_test:
     sdk: flutter
 
-  flustars:
-    path: ../
-
 # For information on the generic Dart part of this file, see the
-# following page: https://www.dartlang.org/tools/pub/pubspec
+# following page: https://dart.dev/tools/pub/pubspec
 
 # The following section is specific to Flutter.
 flutter:
@@ -32,18 +47,18 @@ flutter:
   uses-material-design: true
 
   assets:
-    - assets/images/ali_connors.png
+    - assets/images/
 
   # To add assets to your application, add an assets section, like this:
   # assets:
-  #  - images/a_dot_burr.jpeg
-  #  - images/a_dot_ham.jpeg
+  #   - images/a_dot_burr.jpeg
+  #   - images/a_dot_ham.jpeg
 
   # An image asset can refer to one or more resolution-specific "variants", see
-  # https://flutter.io/assets-and-images/#resolution-aware.
+  # https://flutter.dev/assets-and-images/#resolution-aware.
 
   # For details regarding adding assets from package dependencies, see
-  # https://flutter.io/assets-and-images/#from-packages
+  # https://flutter.dev/assets-and-images/#from-packages
 
   # To add custom fonts to your application, add a fonts section here,
   # in this "flutter" section. Each entry in this list should have a
@@ -63,4 +78,4 @@ flutter:
   #         weight: 700
   #
   # For details regarding fonts from package dependencies,
-  # see https://flutter.io/custom-fonts/#from-packages
+  # see https://flutter.dev/custom-fonts/#from-packages

+ 30 - 0
example/test/widget_test.dart

@@ -0,0 +1,30 @@
+// This is a basic Flutter widget test.
+//
+// To perform an interaction with a widget in your test, use the WidgetTester
+// utility that Flutter provides. For example, you can send tap and scroll
+// gestures. You can also use WidgetTester to find child widgets in the widget
+// tree, read text, and verify that the values of widget properties are correct.
+
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+
+import 'package:flustars_example/main.dart';
+
+void main() {
+  testWidgets('Counter increments smoke test', (WidgetTester tester) async {
+    // Build our app and trigger a frame.
+    await tester.pumpWidget(MyApp());
+
+    // Verify that our counter starts at 0.
+    expect(find.text('0'), findsOneWidget);
+    expect(find.text('1'), findsNothing);
+
+    // Tap the '+' icon and trigger a frame.
+    await tester.tap(find.byIcon(Icons.add));
+    await tester.pump();
+
+    // Verify that our counter has incremented.
+    expect(find.text('0'), findsNothing);
+    expect(find.text('1'), findsOneWidget);
+  });
+}

+ 3 - 21
flustars.iml

@@ -11,6 +11,7 @@
     <exclude-output />
     <content url="file://$MODULE_DIR$">
       <sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
       <sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" />
       <excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
       <excludeFolder url="file://$MODULE_DIR$/.idea" />
@@ -19,30 +20,11 @@
       <excludeFolder url="file://$MODULE_DIR$/example/.dart_tool" />
       <excludeFolder url="file://$MODULE_DIR$/example/.pub" />
       <excludeFolder url="file://$MODULE_DIR$/example/build" />
-      <excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/path_provider/.dart_tool" />
-      <excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/path_provider/.pub" />
-      <excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/path_provider/build" />
-      <excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/path_provider/example/.dart_tool" />
-      <excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/path_provider/example/.pub" />
-      <excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/path_provider/example/build" />
-      <excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/path_provider_macos/.dart_tool" />
-      <excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/path_provider_macos/.pub" />
-      <excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/path_provider_macos/build" />
-      <excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/path_provider_macos/example/.dart_tool" />
-      <excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/path_provider_macos/example/.pub" />
-      <excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/path_provider_macos/example/build" />
-      <excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/shared_preferences/.dart_tool" />
-      <excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/shared_preferences/.pub" />
-      <excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/shared_preferences/build" />
-      <excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/shared_preferences/example/.dart_tool" />
-      <excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/shared_preferences/example/.pub" />
-      <excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/shared_preferences/example/build" />
-      <excludeFolder url="file://$MODULE_DIR$/example/ios/Flutter/App.framework/flutter_assets/packages" />
     </content>
-    <orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
+    <orderEntry type="jdk" jdkName="Android API 25 Platform" jdkType="Android SDK" />
     <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="library" name="Dart Packages" level="project" />
     <orderEntry type="library" name="Dart SDK" level="project" />
     <orderEntry type="library" name="Flutter Plugins" level="project" />
-    <orderEntry type="library" name="Dart Packages" level="project" />
   </component>
 </module>

+ 1 - 1
lib/flustars.dart

@@ -1,9 +1,9 @@
 library flustars;
 
 export 'package:common_utils/common_utils.dart';
+export 'package:sp_util/sp_util.dart';
 
 export 'src/directory_util.dart';
 export 'src/image_util.dart';
 export 'src/screen_util.dart';
-export 'src/sp_util.dart';
 export 'src/widget_util.dart';

+ 2 - 176
lib/src/sp_util.dart

@@ -1,9 +1,3 @@
-import 'dart:async';
-import 'dart:convert';
-
-import 'package:shared_preferences/shared_preferences.dart';
-import 'package:synchronized/synchronized.dart';
-
 /**
  * @Author: Sky24n
  * @GitHub: https://github.com/Sky24n
@@ -13,173 +7,5 @@ import 'package:synchronized/synchronized.dart';
  */
 
 /// SharedPreferences Util.
-class SpUtil {
-  static SpUtil _singleton;
-  static SharedPreferences _prefs;
-  static Lock _lock = Lock();
-
-  static Future<SpUtil> getInstance() async {
-    if (_singleton == null) {
-      await _lock.synchronized(() async {
-        if (_singleton == null) {
-          // keep local instance till it is fully initialized.
-          // 保持本地实例直到完全初始化。
-          var singleton = SpUtil._();
-          await singleton._init();
-          _singleton = singleton;
-        }
-      });
-    }
-    return _singleton;
-  }
-
-  SpUtil._();
-
-  Future _init() async {
-    _prefs = await SharedPreferences.getInstance();
-  }
-
-  /// put object.
-  static Future<bool> putObject(String key, Object value) {
-    if (_prefs == null) return null;
-    return _prefs.setString(key, value == null ? "" : json.encode(value));
-  }
-
-  /// get obj.
-  static T getObj<T>(String key, T f(Map v), {T defValue}) {
-    Map map = getObject(key);
-    return map == null ? defValue : f(map);
-  }
-
-  /// get object.
-  static Map getObject(String key) {
-    if (_prefs == null) return null;
-    String _data = _prefs.getString(key);
-    return (_data == null || _data.isEmpty) ? null : json.decode(_data);
-  }
-
-  /// put object list.
-  static Future<bool> putObjectList(String key, List<Object> list) {
-    if (_prefs == null) return null;
-    List<String> _dataList = list?.map((value) {
-      return json.encode(value);
-    })?.toList();
-    return _prefs.setStringList(key, _dataList);
-  }
-
-  /// get obj list.
-  static List<T> getObjList<T>(String key, T f(Map v),
-      {List<T> defValue = const []}) {
-    List<Map> dataList = getObjectList(key);
-    List<T> list = dataList?.map((value) {
-      return f(value);
-    })?.toList();
-    return list ?? defValue;
-  }
-
-  /// get object list.
-  static List<Map> getObjectList(String key) {
-    if (_prefs == null) return null;
-    List<String> dataLis = _prefs.getStringList(key);
-    return dataLis?.map((value) {
-      Map _dataMap = json.decode(value);
-      return _dataMap;
-    })?.toList();
-  }
-
-  /// get string.
-  static String getString(String key, {String defValue = ''}) {
-    if (_prefs == null) return defValue;
-    return _prefs.getString(key) ?? defValue;
-  }
-
-  /// put string.
-  static Future<bool> putString(String key, String value) {
-    if (_prefs == null) return null;
-    return _prefs.setString(key, value);
-  }
-
-  /// get bool.
-  static bool getBool(String key, {bool defValue = false}) {
-    if (_prefs == null) return defValue;
-    return _prefs.getBool(key) ?? defValue;
-  }
-
-  /// put bool.
-  static Future<bool> putBool(String key, bool value) {
-    if (_prefs == null) return null;
-    return _prefs.setBool(key, value);
-  }
-
-  /// get int.
-  static int getInt(String key, {int defValue = 0}) {
-    if (_prefs == null) return defValue;
-    return _prefs.getInt(key) ?? defValue;
-  }
-
-  /// put int.
-  static Future<bool> putInt(String key, int value) {
-    if (_prefs == null) return null;
-    return _prefs.setInt(key, value);
-  }
-
-  /// get double.
-  static double getDouble(String key, {double defValue = 0.0}) {
-    if (_prefs == null) return defValue;
-    return _prefs.getDouble(key) ?? defValue;
-  }
-
-  /// put double.
-  static Future<bool> putDouble(String key, double value) {
-    if (_prefs == null) return null;
-    return _prefs.setDouble(key, value);
-  }
-
-  /// get string list.
-  static List<String> getStringList(String key,
-      {List<String> defValue = const []}) {
-    if (_prefs == null) return defValue;
-    return _prefs.getStringList(key) ?? defValue;
-  }
-
-  /// put string list.
-  static Future<bool> putStringList(String key, List<String> value) {
-    if (_prefs == null) return null;
-    return _prefs.setStringList(key, value);
-  }
-
-  /// get dynamic.
-  static dynamic getDynamic(String key, {Object defValue}) {
-    if (_prefs == null) return defValue;
-    return _prefs.get(key) ?? defValue;
-  }
-
-  /// have key.
-  static bool haveKey(String key) {
-    if (_prefs == null) return null;
-    return _prefs.getKeys().contains(key);
-  }
-
-  /// get keys.
-  static Set<String> getKeys() {
-    if (_prefs == null) return null;
-    return _prefs.getKeys();
-  }
-
-  /// remove.
-  static Future<bool> remove(String key) {
-    if (_prefs == null) return null;
-    return _prefs.remove(key);
-  }
-
-  /// clear.
-  static Future<bool> clear() {
-    if (_prefs == null) return null;
-    return _prefs.clear();
-  }
-
-  ///Sp is initialized.
-  static bool isInitialized() {
-    return _prefs != null;
-  }
-}
+/// move to https://github.com/Sky24n/sp_util.
+class SpUtil {}

+ 5 - 7
pubspec.yaml

@@ -1,20 +1,18 @@
 name: flustars
 description: Flutter common utils library. SpUtil, ScreenUtil, WidgetUtil, DirectoryUtil, ImageUtil. SharedPreferences Util. Screen info & Screen adaptation. get image size.
-version: 0.3.2
+version: 0.3.3
 author: Sky24n <863764940@qq.com>
 homepage: https://github.com/Sky24n/flustars
 
 environment:
-  sdk: ">=1.19.0 <3.0.0"
+  sdk: ">=2.0.0 <3.0.0"
 
 dependencies:
   flutter:
     sdk: flutter
   # Dart common utils library. https://github.com/Sky24n/common_utils
-  common_utils: '>=1.1.0 <3.0.0'
-  # https://github.com/tekartik/synchronized.dart
-  synchronized: '>=1.5.1 <4.0.0'
-  # https://github.com/flutter/plugins/tree/master/packages/shared_preferences
-  shared_preferences: '>=0.4.1 <3.0.0'
+  common_utils: '>=1.2.1 <3.0.0'
+  # https://github.com/Sky24n/sp_util
+  sp_util: '>=1.0.0 <3.0.0'
   # https://github.com/flutter/plugins/tree/master/packages/path_provider
   path_provider: '>=1.2.0 <3.0.0'