flustars 0.2.2

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 94

flustars(Flutter常用工具类库) #

Pub

[flustars] Flutter常用工具类库。主要对第三方库封装,以便于使用。如果你有好的工具类欢迎PR.

更新说明 #

v0.2.2 SpUtil新增get默认值。
SpUtil.getString('key', defValue: '');
SpUtil.getInt('key', defValue: 0);

关于使用本开源库 #

如果您是用于公司项目,请随意使用~
如果您是用于开源项目,未经本人许可,请勿copy源码到您的项目使用!

使用方式: #

dependencies:
  flustars: 0.2.1

Flutter工具类库 flustars #

1、SpUtil : 单例"同步" SharedPreferences 工具类.
2、ScreenUtil : 屏幕适配,获取屏幕宽、高、密度,AppBar高,状态栏高度,屏幕方向.
3、WidgetUtil : 获取Widget宽高,在屏幕上的坐标.

Dart常用工具类库 common_utils #

1、TimelineUtil : 时间轴.(新)
2、TimerUtil : 倒计时,定时任务.(新)
3、MoneyUtil : 精确转换,元转分,分转元,支持格式输出.(新)
4、LogUtil : 简单封装打印日志.(新)
5、DateUtil : 日期转换格式化输出.
6、RegexUtil : 正则验证手机号,身份证,邮箱等等.
7、NumUtil : 保留x位小数, 精确加、减、乘、除, 防止精度丢失.
8、ObjectUtil : 判断对象是否为空(String List Map),判断两个List是否相等.

Add dependency #

dependencies:
  flustars: x.x.x  #latest version

APIs #

getString
putString
getBool
putBool
getInt
putInt
getDouble
putDouble
getStringList
putStringList
getDynamic
getKeys
remove
clear
isInitialized
getWidth                  : 返回根据屏幕宽适配后尺寸.
getHeight                 : 返回根据屏幕高适配后尺寸.
getWidthPx                : 返回根据屏幕宽适配后尺寸.
getHeightPx               : 返回根据屏幕高适配后尺寸.
getSp                     : 返回根据屏幕宽适配后字体尺寸.
screenWidth               : 获取屏幕宽.
screenHeight              : 获取屏幕高.
screenDensity             : 获取屏幕密度.
appBarHeight              : 获取系统AppBar高度.
statusBarHeight           : 获取系统状态栏高度.
getScreenW(ctx)           : 当前屏幕 宽.
getScreenH(ctx)           : 当前屏幕 高.
getStatusBarH(ctx)        : 当前状态栏高度.
getBottomBarH(ctx)        : 当前BottomBar高度.
getScaleW(ctx,size)       : 返回根据屏幕宽适配后尺寸.
getScaleH(ctx,size)       : 返回根据屏幕高适配后尺寸.
getScaleSp(ctx,size)      : 返回根据屏幕宽适配后字体尺寸.

// 屏幕宽
double screenWidth = ScreenUtil.getInstance().screenWidth;
// 屏幕高
double screenHeight = ScreenUtil.getInstance().screenHeight;
// 屏幕像素密度
double screenDensity = ScreenUtil.getInstance().screenDensity;
// 系统状态栏高度
double statusBarHeight = ScreenUtil.getInstance().statusBarHeight;
// BottomBar高度 
double bottomBarHeight = ScreenUtil.getInstance().bottomBarHeight;
// 系统AppBar高度
double appBarHeight = ScreenUtil.getInstance().appBarHeight;
// 根据屏幕宽适配后尺寸
double adapterW100 = ScreenUtil.getInstance().getWidth(100);
// 根据屏幕高适配后尺寸
double adapterH100 = ScreenUtil.getInstance().getHeight(100);
// 根据屏幕宽适配后字体尺寸
double adapterSp100 = ScreenUtil.getInstance().getSp(100);
// 根据屏幕宽适配后尺寸(输入px)
double adapterW100px = ScreenUtil.getInstance().getWidthPx(300);
// 根据屏幕高适配后尺寸(输入px)
double adapterH100px = ScreenUtil.getInstance().getHeightPx(300);

// 屏幕宽
double screenWidth = ScreenUtil.getScreenW(context);
// 屏幕高
double screenHeight = ScreenUtil.getScreenH(context);
// 屏幕像素密度
double screenDensity = ScreenUtil.getScreenDensity(context);
// 系统状态栏高度
double statusBarHeight = ScreenUtil.getStatusBarH(context);
// BottomBar高度
double bottomBarHeight = ScreenUtil.getBottomBarH(context);
// 根据屏幕宽适配后尺寸
double adapterW100 = ScreenUtil.getScaleW(context, 100);
// 根据屏幕高适配后尺寸
double adapterH100 = ScreenUtil.getScaleH(context, 100);
// 根据屏幕宽适配后字体尺寸
double adapterSp100 = ScreenUtil.getScaleSp(context, 100);
// 屏幕方向
Orientation orientation = ScreenUtil.getOrientation(context);

asyncPrepare              : Widget渲染监听,监听widget宽高变化,callback返回宽高等参数.
getWidgetBounds           : 获取widget 宽高.
getWidgetLocalToGlobal    : 获取widget在屏幕上的坐标.

关于作者,欢迎关注~ #

jianshu juejin

最后,如果您觉得本项目不错的话,来个star支持下作者吧! #

Demo Github : #

flutter_wanandroid        flutter_demos

点击下载APK : #

v0.1.2        v1.0.4

扫码下载APK : #

flutter_wanandroid        flutter_demos

Screenshot #

<img src="https://raw.githubusercontent.com/Sky24n/LDocuments/master/AppImgs/flutter_demos/Screenshot_20181003-234414.jpg" width="200"> <img src="https://raw.githubusercontent.com/Sky24n/LDocuments/master/AppImgs/flutter_demos/Screenshot_20181003-211011.jpg" width="200"> <img src="https://raw.githubusercontent.com/Sky24n/LDocuments/master/AppImgs/flutter_demos/Screenshot_20180930-012302.jpg" width="200">
<img src="https://raw.githubusercontent.com/Sky24n/LDocuments/master/AppImgs/flutter_demos/Screenshot_20180930-012431.jpg" width="200"> <img src="https://raw.githubusercontent.com/Sky24n/LDocuments/master/AppImgs/flutter_demos/Screenshot_20180919-231618.jpg" width="200"> <img src="https://raw.githubusercontent.com/Sky24n/LDocuments/master/AppImgs/flutter_demos/Screenshot_20180926-144840.png" width="200">
<img src="https://raw.githubusercontent.com/Sky24n/LDocuments/master/AppImgs/flutter_demos/Screenshot_20180919-224204.jpg" width="200"> <img src="https://raw.githubusercontent.com/Sky24n/LDocuments/master/AppImgs/flutter_demos/Screenshot_20180919-224146.jpg" width="200"> <img src="https://raw.githubusercontent.com/Sky24n/LDocuments/master/AppImgs/flutter_demos/Screenshot_20180919-224231.jpg" width="200">

0.2.2 #

  • TODO: SpUtil add get default value.

0.1.9 #

  • TODO: remove DioUtil.

0.1.8 #

  • TODO: fix ScreenUtil bug, Dio v1.0.13.

0.1.7 #

  • TODO: Dio v1.0.12.

0.1.6 #

  • TODO: Dio Util, print http log, singleton mode.

0.1.5 #

  • TODO: Screen adaptation,屏幕适配.

0.1.4 #

  • TODO: ScreenUtil update. UI MyAppBar.

0.1.3 #

  • TODO: Health updated.

0.1.2 #

  • TODO: SpUtil updated.

0.1.0 #

  • TODO: Contains SpUtil,ScreenUtil,WidgetUtil.

0.0.1 #

  • TODO: Describe initial release.

example/README.md

flustars_example #

Demonstrates how to use the flustars plugin.

Getting Started #

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flustars: ^0.2.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flustars/flustars.dart';
  
Version Uploaded Documentation Archive
0.2.2 Feb 4, 2019 Go to the documentation of flustars 0.2.2 Download flustars 0.2.2 archive
0.2.1 Feb 3, 2019 Go to the documentation of flustars 0.2.1 Download flustars 0.2.1 archive
0.2.0 Feb 3, 2019 Go to the documentation of flustars 0.2.0 Download flustars 0.2.0 archive
0.1.9 Jan 7, 2019 Go to the documentation of flustars 0.1.9 Download flustars 0.1.9 archive
0.1.8 Dec 29, 2018 Go to the documentation of flustars 0.1.8 Download flustars 0.1.8 archive
0.1.7 Dec 20, 2018 Go to the documentation of flustars 0.1.7 Download flustars 0.1.7 archive
0.1.6 Dec 19, 2018 Go to the documentation of flustars 0.1.6 Download flustars 0.1.6 archive
0.1.5 Dec 13, 2018 Go to the documentation of flustars 0.1.5 Download flustars 0.1.5 archive
0.1.4 Nov 21, 2018 Go to the documentation of flustars 0.1.4 Download flustars 0.1.4 archive
0.1.3 Oct 26, 2018 Go to the documentation of flustars 0.1.3 Download flustars 0.1.3 archive

All 20 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
89
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
94
Learn more about scoring.

We analyzed this package on Feb 14, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.13
  • Flutter: 1.2.0

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.19.0 <3.0.0
flutter 0.0.0
shared_preferences ^0.5.0 0.5.1+1
synchronized ^1.5.3 1.5.3+2 2.0.2+1
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8