kits
library
Functions
-
anyToBool(dynamic value)
→ bool
-
转为 bool 默认为 false
'true' 、'false'、'TRUE' 、'FALSE' 可以转换
-
anyToDouble(dynamic value)
→ double
-
转为double 默认为 0
-
anyToInt(dynamic value)
→ int
-
转为 int 默认为 0
-
anyToString(dynamic value)
→ String
-
用于 json_serializable 反序列化时的类型转换。
@JosnKey(fromJson:anyToString)
转为 String, null 时转为空串
-
logI(Object? message, {DateTime? time, int? sequenceNumber, int level = 0, String name = '', Zone? zone, Object? error, StackTrace? stackTrace, int stackIndex = 1})
→ void
-
日志打印
stackIndex 非负数时打印调用信息
-
systemEnabledUiMode({SystemUiMode mode = SystemUiMode.edgeToEdge, List<SystemUiOverlay>? overlays})
→ Future
-
设置是否隐藏状态栏或导航栏
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);// 隐藏状态栏,底部按钮栏
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: SystemUiOverlay.bottom);//隐藏状态栏,保留底部按钮栏
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: SystemUiOverlay.values);//显示状态栏、底部按钮栏
-
systemHideKeyboard({bool hideFocus = true})
→ void
-
关闭键盘
-
systemScreenOrientation({required List<DeviceOrientation> orientations})
→ Future<void>
-
设置屏幕方向
DeviceOrientation.portraitUp - 竖屏
DeviceOrientation.landscapeLeft - 横屏
当 orientations 为空时跟随系统。
-
systemScreenOrientationAuto()
→ Future<void>
-
orientations 为空时跟随系统屏幕方向。
组件:OrientationBuilder
或 MediaQuery.of(context).orientation 可获取屏幕方向
-
systemUIOverlayStyle(SystemUiOverlayStyle style)
→ void
-
-
systemUiStyleDark()
→ void
-
-
systemUiStyleLight()
→ void
-
设置状态栏, 如果flutter 是第一个启动的页面。
则app主题样式为flutter 设置的。 若不是首个则
样式跟随原生App