Commit 0cb95f74 authored by 汪林玲's avatar 汪林玲

更新

parents
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# 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
# 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/Flutter.podspec
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/flutter_assets/
**/ios/Flutter/flutter_export_environment.sh
**/ios/ServiceDefinitions.json
**/ios/Runner/GeneratedPluginRegistrant.*
# Exceptions to above rules.
!**/ios/**/default.mode1v3
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
.vscode/
# 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: 1aafb3a8b9b0c36241c5f5b34ee914770f015818
channel: stable
project_type: package
## [0.0.1] - TODO: Add release date.
* TODO: Describe initial release.
TODO: Add your license here.
# 小熊公共模块
小熊Flutter 公共模块
## /lib/utils
### 一、/store_utils.dart 本地存储相关
1、初始化
```dart
StoreUtils.getInstance().init().then(v){}
```
2、根据key获取相应存储的数据
```dart
dynamic data = StoreUtils.getInstance().getForKey(key:'',defaultValue:null);
```
3、根据key设置对应的数据
```dart
dynamic data = StoreUtils.getInstance().setKV(key:'',value:{});
```
4、根据key删除对应的数据
```dart
StoreUtils.getInstance().delForkey(key:'');
```
### 二、/navigate_utils.dart 导航相关
1、回到首页
```dart
NavigateUtils.popRoot(rootPath:'主页路径');
```
2、关闭页面时携带的数据
```dart
NavigateUtils.pop(arguments:{});
```
3、打开新的页面
```dart
NavigateUtils.push(path:'新页面的路径',isNative:'是否打开新的容器',arguments:{'key':'打开页面时携带的数据'});
```
### 三、/file_cache_utils.dart 文件缓存和下载有关
1、文件下载
```dart
FileCacheUtils.getInstance().downloadFile(filePath:'待下载的文件路径').then((value){})
```
###
\ No newline at end of file
import 'package:flutter/material.dart';
import 'base_route_widget_state.dart';
import 'dart:math' as math;
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart'
as extended;
import './base_tab_bar_view_item_state.dart';
/// PageView 子项抽象状态,仅支持直接使用PageView()构造
/// 提供了生命周期监听
/// 需要在MaterialApp.navigatorObservers中注册BaseRouteState.baseRouteStateObserver
abstract class BasePageViewItemState<T extends StatefulWidget>
extends BaseRouteWeigetState<T> with AutomaticKeepAliveClientMixin {
PageController _oldController;
@override
bool get wantKeepAlive => true;
@override
void initState() {
super.initState();
if (wantKeepAlive) {
Future.delayed(Duration(milliseconds: 300)).then((value) {
_controllerListener();
});
}
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
if (wantKeepAlive && _oldController != getPageController()) {
_addListener();
}
}
@override
void didUpdateWidget(covariant T oldWidget) {
super.didUpdateWidget(oldWidget);
_addListener();
}
void _addListener() {
if (wantKeepAlive && _oldController != getPageController()) {
_oldController = getPageController();
getPageController().addListener(_controllerListener);
_addParentListener();
}
}
void _addParentListener() {
BasePageViewItemState pstate =
context.findAncestorStateOfType<BasePageViewItemState>();
if (pstate != null && pstate.getPageController() != null) {
pstate.getPageController().addListener(() {
getPageController().notifyListeners();
});
}
BaseTabBarViewItemState tstate =
context.findAncestorStateOfType<BaseTabBarViewItemState>();
if (tstate != null && tstate.getTabController() != null) {
tstate.getTabController().addListener(() {
getPageController().notifyListeners();
});
}
}
void _controllerListener() {
if (isCurrent()) {
if (!isResumed()) {
onResume();
}
} else {
if (isResumed()) {
onPause();
}
}
}
PageController getPageController() {
PageView pageView = _getPageView();
return pageView.controller;
}
PageView _getPageView() {
PageView pageView = context.findAncestorWidgetOfExactType<PageView>();
return pageView;
}
List<Widget> _getTabs() {
PageView pageView = _getPageView();
SliverChildListDelegate delegate =
pageView.childrenDelegate as SliverChildListDelegate;
return delegate.children;
}
bool isCurrent() {
if (isParentCurrent()) {
List<ScrollPosition> positions = getPageController().positions;
for (int i = 0, len = positions.length; i < len; i++) {
var position = positions[i];
var pixels = getPageFromPixels(
position.pixels.clamp(
position.minScrollExtent, position.maxScrollExtent) as double,
position.viewportDimension);
int index = pixels.round();
var currentWidget = _getTabs()[index];
if (currentWidget
is extended.NestedScrollViewInnerScrollPositionKeyWidget) {
currentWidget = (currentWidget
as extended.NestedScrollViewInnerScrollPositionKeyWidget)
.child;
}
return widget == currentWidget;
}
}
return false;
}
bool isParentCurrent() {
BasePageViewItemState pstate =
context.findAncestorStateOfType<BasePageViewItemState>();
BaseTabBarViewItemState tstate =
context.findAncestorStateOfType<BaseTabBarViewItemState>();
if (pstate != null) {
return pstate.isCurrent();
}
if (tstate != null) {
return tstate.isCurrent();
}
return true;
}
double getPageFromPixels(double pixels, double viewportDimension) {
var viewportFraction = getPageController().viewportFraction;
double _initialPageOffset =
math.max(0, viewportDimension * (viewportFraction - 1) / 2);
final double actual = math.max(0.0, pixels - _initialPageOffset) /
math.max(1.0, viewportDimension * viewportFraction);
final double round = actual.roundToDouble();
if ((actual - round).abs() < 1e-10) {
return round;
}
return actual;
}
@override
void onPageShow() {
if (wantKeepAlive && isCurrent() && !isResumed()) {
super.onPageShow();
}
}
@override
void onPageHide() {
if (wantKeepAlive && isCurrent() && isResumed()) {
super.onPageHide();
}
}
@override
void onBackground() {
if (wantKeepAlive && isCurrent()) {
super.onBackground();
}
}
@override
void onForeground() {
if (wantKeepAlive && isCurrent()) {
super.onForeground();
}
}
}
import 'package:flutter/material.dart';
import 'package:flutter_boost/boost_navigator.dart';
import 'package:flutter_boost/flutter_boost.dart';
/// 路由状态基础类
/// 提供了页面生命周期监听和APP生命周期监听
/// 需要在MaterialApp.navigatorObservers中注册BaseRouteWeigetState.BaseRouteWeigetStateObserver
abstract class BaseRouteWeigetState<T extends StatefulWidget> extends State<T>
with PageVisibilityObserver {
static RouteObserver<PageRoute> weigetStateObserver = RouteObserver();
bool _isResumed = false;
bool _isDispose = false;
@override
void setState(VoidCallback fn) {
if (_isDispose) {
super.setState(fn);
}
}
@override
void initState() {
super.initState();
}
@override
void dispose() {
_isDispose = true;
PageVisibilityBinding.instance.removeObserver(this);
super.dispose();
}
@override
void didChangeDependencies() {
PageRoute route = ModalRoute.of(context) as PageRoute;
super.didChangeDependencies();
///注册监听器
PageVisibilityBinding.instance.addObserver(this, route);
}
@override
void onBackground() {
super.onBackground();
onAppPause();
}
@override
void onForeground() {
super.onForeground();
onAppResume();
}
@override
void onPageHide() {
super.onPageHide();
_onPause();
}
@override
void onPageShow() {
super.onPageShow();
_onResume();
}
void _onResume() {
if (_isResumed) {
return;
}
ModalRoute route = ModalRoute.of(context);
if (route == null) {
return;
}
RouteSettings settings = route.settings;
if (settings.name == null) {
return;
}
onResume();
}
void _onPause() {
if (!_isResumed) {
return;
}
ModalRoute route = ModalRoute.of(context);
if (route == null) {
return;
}
RouteSettings settings = route.settings;
if (settings.name == null) {
return;
}
onPause();
}
/// 页面可见
void onResume() {
_isResumed = true;
}
/// 页面不可见
void onPause() {
_isResumed = false;
}
/// 页面是否处于可见状态
bool isResumed() {
return _isResumed;
}
/// APP可见
void onAppResume() {}
/// APP不可见
void onAppPause() {}
/// 获取路由名称
String getRouteName() {
PageInfo info = BoostNavigator.instance.getTopByContext(context);
return info.pageName;
}
/// 获取路由参数
T getRouteArgs<T>() {
PageInfo info = BoostNavigator.instance.getTopByContext(context);
return info.arguments as T;
}
}
import 'package:flutter/material.dart';
import 'base_route_widget_state.dart';
import './base_page_view_item_state.dart';
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart'
as extended;
/// PageView 子项抽象状态
/// 提供了生命周期监听
/// 需要在MaterialApp.navigatorObservers中注册BaseRouteState.baseRouteStateObserver
abstract class BaseTabBarViewItemState<T extends StatefulWidget>
extends BaseRouteWeigetState<T> with AutomaticKeepAliveClientMixin {
TabController _oldController;
@override
bool get wantKeepAlive => true;
@override
void initState() {
super.initState();
if (wantKeepAlive) {
Future.delayed(Duration(milliseconds: 300)).then((value) {
_controllerListener();
});
}
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
_addListener();
}
@override
void didUpdateWidget(covariant T oldWidget) {
super.didUpdateWidget(oldWidget);
_addListener();
}
void _addListener() {
if (wantKeepAlive && _oldController != getTabController()) {
_oldController = getTabController();
getTabController().addListener(_controllerListener);
}
_addParentListener();
}
void _addParentListener() {
BasePageViewItemState pstate =
context.findAncestorStateOfType<BasePageViewItemState>();
if (pstate != null && pstate.getPageController() != null) {
pstate.getPageController().addListener(() {
getTabController().notifyListeners();
});
}
BaseTabBarViewItemState tstate =
context.findAncestorStateOfType<BaseTabBarViewItemState>();
if (tstate != null && tstate.getTabController() != null) {
tstate.getTabController().addListener(() {
getTabController().notifyListeners();
});
}
}
void _controllerListener() {
if (isCurrent()) {
if (!isResumed()) {
onResume();
}
} else {
if (isResumed()) {
onPause();
}
}
}
TabController getTabController() {
TabBarView tabBarView = _getTabBarView();
if (tabBarView.controller != null) {
return tabBarView.controller;
} else {
return DefaultTabController.of(context);
}
}
TabBarView _getTabBarView() {
TabBarView tabBarView = context.findAncestorWidgetOfExactType<TabBarView>();
return tabBarView;
}
List<Widget> _getTabs() {
return _getTabBarView().children;
}
bool isCurrent() {
var currentWidget = _getTabs()[getTabController().index];
if (currentWidget
is extended.NestedScrollViewInnerScrollPositionKeyWidget) {
currentWidget = (currentWidget
as extended.NestedScrollViewInnerScrollPositionKeyWidget)
.child;
}
return widget == currentWidget && isParentCurrent();
}
bool isParentCurrent() {
BasePageViewItemState pstate =
context.findAncestorStateOfType<BasePageViewItemState>();
BaseTabBarViewItemState tstate =
context.findAncestorStateOfType<BaseTabBarViewItemState>();
if (pstate != null) {
return pstate.isCurrent();
}
if (tstate != null) {
return tstate.isCurrent();
}
return true;
}
@override
void onPageShow() {
if (wantKeepAlive && isCurrent() && !isResumed()) {
super.onPageShow();
}
}
@override
void onPageHide() {
if (wantKeepAlive && isCurrent() && isResumed()) {
super.onPageHide();
}
}
@override
void onBackground() {
if (wantKeepAlive && isCurrent()) {
super.onBackground();
}
}
@override
void onForeground() {
if (wantKeepAlive && isCurrent()) {
super.onForeground();
}
}
}
import 'package:flutter/material.dart';
import './base_page_view_item_state.dart';
import 'package:common_module/utils/umeng_utils.dart';
/// 友盟埋点Pageview item基础类
abstract class BaseUmengPageViewItemState<T extends StatefulWidget>
extends BasePageViewItemState<T>{
String getPageViewName();
Map<String, String> getPageViewArgs();
@override
void onResume() {
super.onResume();
UmengUtils.onPageStart(getPageViewName(), getPageViewArgs());
}
@override
void onPause() {
super.onPause();
UmengUtils.onPageEnd(getPageViewName(), getPageViewArgs());
}
}
import 'package:flutter/material.dart';
import './base_route_widget_state.dart';
import 'package:common_module/utils/umeng_utils.dart';
/// 友盟埋点页面基础类
abstract class BaseUmengRouteWeigetState<T extends StatefulWidget>
extends BaseRouteWeigetState<T> {
@override
void onResume() {
super.onResume();
String routeName = getRouteName();
print('onResume=>>>>>>$routeName');
UmengUtils.onPageStart(getRouteName(), getRouteArgs());
}
@override
void onPause() {
super.onPause();
String routeName = getRouteName();
print('onPause=>>>>>>$routeName');
UmengUtils.onPageEnd(getRouteName(), getRouteArgs());
}
}
import 'package:flutter/material.dart';
import './base_tab_bar_view_item_state.dart';
import 'package:common_module/utils/umeng_utils.dart';
/// 友盟埋点tabbarview item基础类
abstract class BaseUmengTabBarViewItemState<T extends StatefulWidget>
extends BaseTabBarViewItemState<T> {
String getPageViewName();
Map<String, String> getPageViewArgs();
@override
void onResume() {
super.onResume();
UmengUtils.onPageStart(getPageViewName(), getPageViewArgs());
}
@override
void onPause() {
super.onPause();
UmengUtils.onPageEnd(getPageViewName(), getPageViewArgs());
}
}
library common_module;
/// A Calculator.
class Calculator {
/// Returns [value] plus 1.
int addOne(int value) => value + 1;
}
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../utils/xapp_utils.dart';
/// 页面头部组件
class IAppBar extends StatelessWidget implements PreferredSizeWidget {
final double _height = 44.rpx;
final Color color;
final String title;
final Widget child;
final double elevation;
final List<Widget> actions;
final bool leading;
IAppBar(
{this.child,
this.title,
this.actions,
this.leading = true,
this.color = Colors.red,
this.elevation = 0.1});
@override
Widget build(BuildContext context) {
double luminance = color.computeLuminance();
Color titleColor = luminance < 0.5 ? Colors.white : Colors.black;
Brightness style = luminance < 0.5 ? Brightness.dark : Brightness.light;
Widget leadingWidget;
if (leading == true) {
leadingWidget = IconButton(
color: titleColor,
icon: Icon(
Icons.arrow_back_ios,
size: 18.rpx,
),
onPressed: () {
Navigator.maybePop(context);
},
);
}
return AppBar(
backgroundColor: color,
elevation: elevation,
leading: leadingWidget,
toolbarHeight: _height,
actions: actions,
brightness: style,
automaticallyImplyLeading: false,
flexibleSpace: SafeArea(
bottom: false,
top: true,
child: Container(
alignment: Alignment.center,
width: double.infinity,
height: _height,
child: DefaultTextStyle(
style: TextStyle(
color: titleColor,
fontSize: 17.rpx,
fontWeight: FontWeight.bold),
child: child ??
Text(
title,
),
),
),
),
);
}
Size get preferredSize => Size.fromHeight(_height);
}
import 'package:connectivity/connectivity.dart';
import 'package:flutter/material.dart';
import 'package:common_module/utils/xapp_utils.dart';
class IEmptyStatus extends StatefulWidget {
// 距离顶部padding
final double paddingTop;
// 显示的图标
final String icon;
final double iconSize;
// 提示信息
final String msg;
// 按钮文字
final String btnText;
final Color btnColor;
final double btnRadius;
// 点击按钮回调,netWorkConnectd 网络是否连接
final Function(bool netWorkConnectd) onTap;
IEmptyStatus(
{this.paddingTop = 139,
this.msg = "加载失败,请刷新重试",
this.btnText = "点击刷新",
this.btnColor,
this.btnRadius,
this.onTap,
this.iconSize,
Key key,
this.icon})
: super(key: key);
@override
_IEmptyStatusState createState() => _IEmptyStatusState();
}
class _IEmptyStatusState extends State<IEmptyStatus> {
// 网络是否连接
bool netWorkConnected = true;
// 真正显示的icon
String get _icon {
if (!netWorkConnected) {
return "assets/network_status_icon.png";
}
if (widget.icon == null) {
return 'assets/empty_status_icon.png';
}
return widget.icon;
}
// 真正显示的提示信息
String get _msg {
if (!netWorkConnected) {
return '网络中断,请检查网络';
}
return widget.msg;
}
String get _btnText {
if (!netWorkConnected) {
return '点击刷新';
}
return widget.btnText;
}
@override
void initState() {
super.initState();
checkNetWork();
}
@override
Widget build(BuildContext context) {
return Container(
alignment: Alignment.center,
padding: EdgeInsets.only(top: widget.paddingTop.rpx),
child: Column(
children: <Widget>[
Image.asset(
_icon,
width: widget.iconSize ?? 261.rpx,
),
Padding(
padding: EdgeInsets.only(top: 16.rpx, bottom: 30.rpx),
child: Text(
_msg,
style: TextStyle(
color: Color.fromRGBO(153, 153, 153, 1),
fontSize: 14.rpx,
),
),
),
FlatButton(
onPressed: () async {
if (widget.onTap != null) {
var connectivityResult =
await (new Connectivity().checkConnectivity());
var netWorkConnected =
connectivityResult != ConnectivityResult.none;
widget.onTap(netWorkConnected);
}
},
child: ClipRRect(
borderRadius: BorderRadius.circular(widget.btnRadius ?? 8.rpx),
child: Container(
alignment: Alignment.center,
width: 210.rpx,
height: 40.rpx,
color: Color.fromRGBO(255, 202, 0, 1),
child: Text(
_btnText,
style: TextStyle(
fontSize: 16.rpx, color: widget.btnColor ?? Colors.white),
),
),
),
)
],
),
);
}
// 检查网络
void checkNetWork() async {
var connectivityResult = await (new Connectivity().checkConnectivity());
this.netWorkConnected = connectivityResult != ConnectivityResult.none;
setState(() {});
}
}
import 'package:flutter/material.dart';
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart'
as extended;
import 'package:flutter/gestures.dart' show DragStartBehavior;
typedef NestedScrollViewHeaderSliversBuilder = List<Widget> Function(
BuildContext context, bool innerBoxIsScrolled);
typedef NestedScrollViewPinnedHeaderSliverHeightBuilder = double Function();
class INestedScrollView extends StatelessWidget {
final ScrollController controller;
final TabController tabController;
final Axis scrollDirection;
final bool reverse;
final ScrollPhysics physics;
final NestedScrollViewHeaderSliversBuilder headerSliverBuilder;
final NestedScrollViewPinnedHeaderSliverHeightBuilder
pinnedHeaderSliverHeightBuilder;
final Widget body;
final DragStartBehavior dragStartBehavior;
final bool floatHeaderSlivers;
final Clip clipBehavior;
final String restorationId;
INestedScrollView(
{Key key,
this.controller,
this.tabController,
this.scrollDirection = Axis.vertical,
this.reverse = false,
this.physics,
this.pinnedHeaderSliverHeightBuilder,
@required this.headerSliverBuilder,
@required this.body,
this.dragStartBehavior = DragStartBehavior.start,
this.floatHeaderSlivers = false,
this.clipBehavior = Clip.hardEdge,
this.restorationId})
: super(key: key);
@override
Widget build(BuildContext context) {
return extended.NestedScrollView(
controller: controller,
scrollDirection: scrollDirection,
reverse: reverse,
physics: physics,
pinnedHeaderSliverHeightBuilder: pinnedHeaderSliverHeightBuilder,
dragStartBehavior: dragStartBehavior,
floatHeaderSlivers: floatHeaderSlivers,
clipBehavior: clipBehavior,
restorationId: restorationId,
headerSliverBuilder: headerSliverBuilder,
body: body,
innerScrollPositionKeyBuilder: () {
var index = "i_nested_scroll_view_tab_";
index += (_getTabController(context).index.toString());
return Key(index);
},
);
}
TabController _getTabController(BuildContext context) {
if (tabController != null) {
return tabController;
} else {
return DefaultTabController.of(context);
}
}
}
class INestedTabBarView extends StatelessWidget {
final Key key;
final TabController controller;
final ScrollPhysics physics;
final DragStartBehavior dragStartBehavior;
final List<Widget> children;
INestedTabBarView({
this.key,
@required this.children,
this.controller,
this.physics,
this.dragStartBehavior = DragStartBehavior.start,
});
@override
Widget build(BuildContext context) {
return TabBarView(
key: key,
controller: controller,
physics: physics,
dragStartBehavior: dragStartBehavior,
children: List.generate(children.length, (index) {
return extended.NestedScrollViewInnerScrollPositionKeyWidget(
Key("i_nested_scroll_view_tab_$index"), children[index]);
}),
);
}
}
import 'package:flutter/material.dart';
import 'dart:math' as math;
class PersistentHeaderDelegate extends SliverPersistentHeaderDelegate {
final Widget child;
final double minHeight;
final double maxHeight;
final Widget Function(
BuildContext context, double shrinkOffset, bool overlapsContent) builder;
@override
double get minExtent => minHeight;
@override
double get maxExtent => math.max(maxHeight, minHeight);
PersistentHeaderDelegate(
{this.child,
this.builder,
@required this.maxHeight,
@required this.minHeight});
@override
Widget build(
BuildContext context, double shrinkOffset, bool overlapsContent) {
if (builder != null) {
return builder(context, shrinkOffset, overlapsContent);
}
return child;
}
@override
bool shouldRebuild(PersistentHeaderDelegate oldDelegate) {
return maxHeight != oldDelegate.maxHeight ||
minHeight != oldDelegate.minHeight ||
child != oldDelegate.child;
}
}
///
/// 底部导航的事件
///
class NavTabBarEvent {
//索引
NavTabBarEnum tabEnum;
int index;
String key;
Map<String, dynamic> arguments;
NavTabBarEvent({this.index = 0,this.key = 'home',this.arguments, this.tabEnum = NavTabBarEnum.IndexChange});
}
enum NavTabBarEnum {
///索引改变
IndexChange,
///TabBar发生改变(例如购物车显示或隐藏)
TabBarChange,
///页面发生改变
TabBarPageChange,
}
import 'package:alarm_calendar/alarm_calendar_plugin.dart';
export 'package:alarm_calendar/calendars.dart';
class AlarmCalendarUtils {
static AlarmCalendarUtils _instance;
static AlarmCalendarUtils getInstance() {
if (_instance == null) {
_instance = new AlarmCalendarUtils._();
}
return _instance;
}
AlarmCalendarUtils._();
Future<String> create(Calendars calendars) {
return AlarmCalendar.createEvent(calendars);
}
Future<dynamic> selectEvent(String eventId) {
return AlarmCalendar.selectEvent(eventId);
}
Future<bool> deleteEvent(String eventId) {
return AlarmCalendar.deleteEvent(eventId);
}
Future<String> updateEvent(Calendars calendars) {
return AlarmCalendar.updateEvent(calendars);
}
}
import 'package:amaps_location/location.dart';
import 'package:common_module/utils/location_permission_utils.dart';
export 'package:amaps_location/src/location_entity.dart';
import 'package:life_repository/life_repository.dart';
const String key = '1a7c708f0a1f5164dfc4e2e0aae34451';
class AmapUtils {
static AmapUtils _instance;
static AmapUtils getInstance() {
if (_instance == null) {
_instance = new AmapUtils();
}
return _instance;
}
///
/// 获取当前的定位信息
///
Future<LocationEntity> getLocation() {
return AmapsLocation.create().getLocation(apiKey: key);
}
///
/// GPS 是否打开
///
Future<bool> get isOpenGPS async {
return AmapsLocation.create().isOpenGPS();
}
///
/// 打开GPS
///
Future<bool> enableGPS() async {
return AmapsLocation.create().enableGPS();
}
/// 判断权限
Future<bool> hasPermission() async {
return LocationPermissionUtils.getInstance().hasPermission();
}
/// 请求权限
Future<bool> reqPermission() async {
return LocationPermissionUtils.getInstance().reqPermission();
}
// 地址转gps
Future<String> addressToGps(String address, [String city]) {
return AMapRepository.get()
.addressToGps(key: key, address: address, city: city);
}
}
class AppTapConfigUtils {
static AppTapConfigUtils _instance;
static AppTapConfigUtils getInstance() {
if (_instance == null) {
_instance = new AppTapConfigUtils();
}
return _instance;
}
OnActivityConfigTapListener _activityConfigTapListener;
OnGoodsTapListener _goodsTapListener;
OnPriceGoodsTapListener _priceGoodsTapListener;
void activityConfigTap(Map<String, dynamic> jsonStr) {
if (_activityConfigTapListener != null) {
_activityConfigTapListener(jsonStr);
}
}
void setOnActivityConfigTapListener(OnActivityConfigTapListener t) {
_activityConfigTapListener = t;
}
void setOnPriceGoodsTapListener(OnPriceGoodsTapListener t) {
_priceGoodsTapListener = t;
}
void priceGoodsTap({
String productId,
String src,
String title,
String remark,
}) {
if (_priceGoodsTapListener != null) {
_priceGoodsTapListener(
productId: productId,
src: src,
title: title,
remark: remark,
);
}
}
void goodsTap({
String platform,
String itemId,
Map goodsItem,
String tabviewId,
}) {
if (_goodsTapListener != null) {
_goodsTapListener(
platform: platform,
itemId: itemId,
goodsItem: goodsItem,
tabviewId: tabviewId,
);
}
}
void setOnGoodsTapListener(OnGoodsTapListener t) {
_goodsTapListener = t;
}
}
typedef OnActivityConfigTapListener = Function(Map<String, dynamic> jsonStr);
typedef OnGoodsTapListener = Function({
String platform,
String itemId,
Map goodsItem,
String tabviewId,
});
typedef OnPriceGoodsTapListener = Function({
String productId,
String src,
String title,
String remark,
});
import 'package:common_module/utils/store_utils.dart';
const String _AUDIT_MODE_CACHE_KEY = "";
/// 审核模式工具类
class AuditModeUtils {
static AuditModeUtils _instance;
static AuditModeUtils getInstance() {
if (_instance == null) {
_instance = new AuditModeUtils._();
}
return _instance;
}
AuditModeUtils._();
String _isAuditMode;
String _adSwitch;
// 获取是否审核模式
bool isAuditMode() {
if (_isAuditMode == null) {
_isAuditMode =
StoreUtils.getInstance().getForKey(key: _AUDIT_MODE_CACHE_KEY,defaultValue: null);
}
return _isAuditMode == '1';
}
///
/// 是否开启广告
/// 2为隐藏
///
bool isHideAdSwitch(){
return (_adSwitch == '2');
}
void setAdSwitch(String adSwitch){
_adSwitch = adSwitch;
}
void setAuditMode(String isAuditMode) {
StoreUtils.getInstance().setKV(key: _AUDIT_MODE_CACHE_KEY, value: isAuditMode);
_isAuditMode = isAuditMode;
}
}
import 'package:flutter/services.dart';
import 'package:fluttet_clipboard/fluttet_clipboard.dart';
import 'dart:io';
import './store_utils.dart';
const LOCAL_COPY_TEXT_KEY = "__local_copy_text_key__";
class ClipboardUtils {
//复制到剪贴板
static Future<bool> copyText(String text) async {
//如果是本app内复制的,存起来不识别
StoreUtils.getInstance().setKV(key: LOCAL_COPY_TEXT_KEY, value: text);
if (Platform.isIOS) {
await Clipboard.setData(ClipboardData(text: text));
return true;
}
await FluttetClipboard.setText(text);
return true;
}
//获取剪贴板文字
static Future<String> getAppClipboardText() async {
if (Platform.isIOS) {
var data = await Clipboard.getData(Clipboard.kTextPlain);
if (data == null) {
return null;
}
return data.text;
}
try {
var data = await FluttetClipboard.getText();
if (data != null) {
return data;
} else {
return null;
}
} catch (e) {
return null;
}
}
//清除剪贴板文字
static Future<void> clearAppClipboardText() {
return ClipboardUtils.copyText("");
}
// 获取本地复制的文本
static String getLocalCopyText() {
return StoreUtils.getInstance().getForKey(key: LOCAL_COPY_TEXT_KEY,defaultValue:'');
}
}
/**
* @Author: Sky24n
* @GitHub: https://github.com/Sky24n
* @Description: Date Util.
* @Date: 2018/9/8
*/
/// 一些常用格式参照。可以自定义格式,例如:'yyyy/MM/dd HH:mm:ss','yyyy/M/d HH:mm:ss'。
/// 格式要求
/// year -> yyyy/yy month -> MM/M day -> dd/d
/// hour -> HH/H minute -> mm/m second -> ss/s
class DateFormats {
static String full = 'yyyy-MM-dd HH:mm:ss';
static String yyMMddhhmm = 'yyyy-MM-dd HH:mm';
static String yyMMdd = 'yyyy-MM-dd';
static String yyMM = 'yyyy-MM';
static String mMdd = 'MM-dd';
static String mMddhhmm = 'MM-dd HH:mm';
static String hhmmss = 'HH:mm:ss';
static String hhmm = 'HH:mm';
static String zhFull = 'yyyy年MM月dd日 HH时mm分ss秒';
static String zhyyMMddhhmm = 'yyyy年MM月dd日 HH时mm分';
static String zhyyMMdd = 'yyyy年MM月dd日';
static String zhyyMM = 'yyyy年MM月';
static String zhmMdd = 'MM月dd日';
static String zhmMddhhmm = 'MM月dd日 HH时mm分';
static String zhhhmmss = 'HH时mm分ss秒';
static String zhhhmm = 'HH时mm分';
}
/// month->days.
Map<int, int> monthDay = {
1: 31,
2: 28,
3: 31,
4: 30,
5: 31,
6: 30,
7: 31,
8: 31,
9: 30,
10: 31,
11: 30,
12: 31,
};
/// Date Util.
class DateUtil {
/// get DateTime By DateStr.
static DateTime getDateTime(String dateStr, {bool isUtc}) {
DateTime dateTime = DateTime.tryParse(dateStr);
if (isUtc != null) {
if (isUtc) {
dateTime = dateTime.toUtc();
} else {
dateTime = dateTime.toLocal();
}
}
return dateTime;
}
/// get DateTime By Milliseconds.
static DateTime getDateTimeByMs(int ms, {bool isUtc = false}) {
return ms == null
? null
: DateTime.fromMillisecondsSinceEpoch(ms, isUtc: isUtc);
}
/// get DateMilliseconds By DateStr.
static int getDateMsByTimeStr(String dateStr) {
DateTime dateTime = DateTime.tryParse(dateStr);
return dateTime?.millisecondsSinceEpoch;
}
/// get Now Date Milliseconds.
static int getNowDateMs() {
return DateTime.now().millisecondsSinceEpoch;
}
/// get Now Date Str.(yyyy-MM-dd HH:mm:ss)
static String getNowDateStr() {
return formatDate(DateTime.now());
}
/// format date by milliseconds.
/// milliseconds 日期毫秒
static String formatDateMs(int ms, {bool isUtc = false, String format}) {
return formatDate(getDateTimeByMs(ms, isUtc: isUtc), format: format);
}
/// format date by date str.
/// dateStr 日期字符串
static String formatDateStr(String dateStr, {bool isUtc, String format}) {
return formatDate(getDateTime(dateStr, isUtc: isUtc), format: format);
}
/// format date by DateTime.
/// format 转换格式(已提供常用格式 DateFormats,可以自定义格式:'yyyy/MM/dd HH:mm:ss')
/// 格式要求
/// year -> yyyy/yy month -> MM/M day -> dd/d
/// hour -> HH/H minute -> mm/m second -> ss/s
static String formatDate(DateTime dateTime, {String format}) {
if (dateTime == null) return '';
format = format ?? DateFormats.full;
if (format.contains('yy')) {
String year = dateTime.year.toString();
if (format.contains('yyyy')) {
format = format.replaceAll('yyyy', year);
} else {
format = format.replaceAll(
'yy', year.substring(year.length - 2, year.length));
}
}
format = _comFormat(dateTime.month, format, 'M', 'MM');
format = _comFormat(dateTime.day, format, 'd', 'dd');
format = _comFormat(dateTime.hour, format, 'H', 'HH');
format = _comFormat(dateTime.minute, format, 'm', 'mm');
format = _comFormat(dateTime.second, format, 's', 'ss');
format = _comFormat(dateTime.millisecond, format, 'S', 'SSS');
return format;
}
/// com format.
static String _comFormat(
int value, String format, String single, String full) {
if (format.contains(single)) {
if (format.contains(full)) {
format =
format.replaceAll(full, value < 10 ? '0$value' : value.toString());
} else {
format = format.replaceAll(single, value.toString());
}
}
return format;
}
/// get WeekDay.
/// dateTime
/// isUtc
/// languageCode zh or en
/// short
static String getWeekday(DateTime dateTime,
{String languageCode = 'en', bool short = false}) {
if (dateTime == null) return null;
String weekday;
switch (dateTime.weekday) {
case 1:
weekday = languageCode == 'zh' ? '星期一' : 'Monday';
break;
case 2:
weekday = languageCode == 'zh' ? '星期二' : 'Tuesday';
break;
case 3:
weekday = languageCode == 'zh' ? '星期三' : 'Wednesday';
break;
case 4:
weekday = languageCode == 'zh' ? '星期四' : 'Thursday';
break;
case 5:
weekday = languageCode == 'zh' ? '星期五' : 'Friday';
break;
case 6:
weekday = languageCode == 'zh' ? '星期六' : 'Saturday';
break;
case 7:
weekday = languageCode == 'zh' ? '星期日' : 'Sunday';
break;
default:
break;
}
return languageCode == 'zh'
? (short ? weekday.replaceAll('星期', '周') : weekday)
: weekday.substring(0, short ? 3 : weekday.length);
}
/// get WeekDay By Milliseconds.
static String getWeekdayByMs(int milliseconds,
{bool isUtc = false, String languageCode, bool short = false}) {
DateTime dateTime = getDateTimeByMs(milliseconds, isUtc: isUtc);
return getWeekday(dateTime, languageCode: languageCode, short: short);
}
/// get day of year.
/// 在今年的第几天.
static int getDayOfYear(DateTime dateTime) {
int year = dateTime.year;
int month = dateTime.month;
int days = dateTime.day;
for (int i = 1; i < month; i++) {
days = days + monthDay[i];
}
if (isLeapYearByYear(year) && month > 2) {
days = days + 1;
}
return days;
}
/// get day of year.
/// 在今年的第几天.
static int getDayOfYearByMs(int ms, {bool isUtc = false}) {
return getDayOfYear(DateTime.fromMillisecondsSinceEpoch(ms, isUtc: isUtc));
}
/// is today.
/// 是否是当天.
static bool isToday(int milliseconds, {bool isUtc = false, int locMs}) {
if (milliseconds == null || milliseconds == 0) return false;
DateTime old =
DateTime.fromMillisecondsSinceEpoch(milliseconds, isUtc: isUtc);
DateTime now;
if (locMs != null) {
now = DateUtil.getDateTimeByMs(locMs);
} else {
now = isUtc ? DateTime.now().toUtc() : DateTime.now().toLocal();
}
return old.year == now.year && old.month == now.month && old.day == now.day;
}
/// is yesterday by dateTime.
/// 是否是昨天.
static bool isYesterday(DateTime dateTime, DateTime locDateTime) {
if (yearIsEqual(dateTime, locDateTime)) {
int spDay = getDayOfYear(locDateTime) - getDayOfYear(dateTime);
return spDay == 1;
} else {
return ((locDateTime.year - dateTime.year == 1) &&
dateTime.month == 12 &&
locDateTime.month == 1 &&
dateTime.day == 31 &&
locDateTime.day == 1);
}
}
/// is yesterday by millis.
/// 是否是昨天.
static bool isYesterdayByMs(int ms, int locMs) {
return isYesterday(DateTime.fromMillisecondsSinceEpoch(ms),
DateTime.fromMillisecondsSinceEpoch(locMs));
}
/// is Week.
/// 是否是本周.
static bool isWeek(int ms, {bool isUtc = false, int locMs}) {
if (ms == null || ms <= 0) {
return false;
}
DateTime _old = DateTime.fromMillisecondsSinceEpoch(ms, isUtc: isUtc);
DateTime _now;
if (locMs != null) {
_now = DateUtil.getDateTimeByMs(locMs, isUtc: isUtc);
} else {
_now = isUtc ? DateTime.now().toUtc() : DateTime.now().toLocal();
}
DateTime old =
_now.millisecondsSinceEpoch > _old.millisecondsSinceEpoch ? _old : _now;
DateTime now =
_now.millisecondsSinceEpoch > _old.millisecondsSinceEpoch ? _now : _old;
return (now.weekday >= old.weekday) &&
(now.millisecondsSinceEpoch - old.millisecondsSinceEpoch <=
7 * 24 * 60 * 60 * 1000);
}
/// year is equal.
/// 是否同年.
static bool yearIsEqual(DateTime dateTime, DateTime locDateTime) {
return dateTime.year == locDateTime.year;
}
/// year is equal.
/// 是否同年.
static bool yearIsEqualByMs(int ms, int locMs) {
return yearIsEqual(DateTime.fromMillisecondsSinceEpoch(ms),
DateTime.fromMillisecondsSinceEpoch(locMs));
}
/// Return whether it is leap year.
/// 是否是闰年
static bool isLeapYear(DateTime dateTime) {
return isLeapYearByYear(dateTime.year);
}
/// Return whether it is leap year.
/// 是否是闰年
static bool isLeapYearByYear(int year) {
return year % 4 == 0 && year % 100 != 0 || year % 400 == 0;
}
}
import 'package:event_bus/event_bus.dart';
EventBus eventBus = EventBus();
import 'dart:io';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
///
/// 文件缓存工具
///
class FileCacheUtils {
static FileCacheUtils _instance;
static FileCacheUtils getInstance() {
if (_instance == null) {
_instance = new FileCacheUtils();
}
return _instance;
}
///
/// 下载文件
/// [filePath] 待下载的文件路径
///
Future<FileEntity> downloadFile({String filePath}) async {
FileInfo result = await DefaultCacheManager().downloadFile(filePath);
return FileEntity(
file: result.file,
source: result.source != null ? result.source.index : -1,
validTill: result.validTill,
originalUrl: result.originalUrl,
);
}
}
class FileEntity {
FileEntity({this.file, this.source, this.validTill, this.originalUrl});
final String originalUrl;
/// Fetched file
final File file;
/// Source from the file, can be cache or online (web).
final int source;
/// Validity date of the file. After this date the validity is not guaranteed
/// and the CacheManager will try to update the file.
final DateTime validTill;
}
import 'package:flutter/cupertino.dart';
class IconsXiaoXiong {
IconsXiaoXiong._();
static const String _fontFamily = 'XiaoXiongApp';
static const IconData icons1 = IconData(0xe61c, fontFamily: _fontFamily);
}
\ No newline at end of file
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:photo_view/photo_view.dart';
import 'package:photo_view/photo_view_gallery.dart';
/// 图片预览工具
class ImagePreviewUtils {
/*
显示
@params images 图片数组
@params heroTag hero动画tag
@index 当前索引
*/
// static void show(
// {BuildContext context, List<String> images, String heroTag}) {
// var route = MaterialPageRoute(builder: (context) {
// return _ImagePreviewWidget(
// images,
// heroTag: heroTag,
// );
// });
// Navigator.of(context).push(route);
// }
static void showIndex(
{BuildContext context,
List<String> images,
String heroTag,
int index = 0}) {
var route = MaterialPageRoute(builder: (context) {
return _ImagePreviewWidget(
images,
heroTag: heroTag,
index: index,
);
});
Navigator.of(context).push(route);
}
}
// 预览widget
class _ImagePreviewWidget extends StatefulWidget {
final String heroTag;
final List<String> images;
final int index;
_ImagePreviewWidget(this.images, {this.heroTag, Key key, this.index = 1})
: super(key: key);
@override
_ImagePreviewWidgetState createState() => _ImagePreviewWidgetState();
}
// 预览widget状态
class _ImagePreviewWidgetState extends State<_ImagePreviewWidget>
with AutomaticKeepAliveClientMixin {
PageController pageController;
ValueNotifier<int> currentIndex = ValueNotifier(0);
@override
void initState() {
super.initState();
pageController = PageController(initialPage: widget.index);
currentIndex.value = widget.index;
}
@override
Widget build(BuildContext context) {
super.build(context);
return AnnotatedRegion(
value: SystemUiOverlayStyle.light,
child: Scaffold(
backgroundColor: Colors.black,
body: SafeArea(
child: Container(
width: double.infinity,
height: double.infinity,
child: Stack(
alignment: Alignment.bottomCenter,
children: <Widget>[
_buildBody(),
// 关闭按钮
Positioned(
top: 20,
right: 20,
child: IconButton(
padding: EdgeInsets.all(10),
icon: Icon(
Icons.close,
color: Colors.white,
size: 30,
),
onPressed: () {
Navigator.pop(context);
},
),
),
// 索引
buildIndex(),
],
),
),
),
),
);
}
// 编译body
Widget _buildBody() {
return Positioned(
top: 0,
left: 0,
bottom: 0,
right: 0,
child: Container(
child: PhotoViewGallery.builder(
pageController: pageController,
itemCount: widget.images.length,
scrollPhysics: const BouncingScrollPhysics(),
backgroundDecoration: null,
enableRotation: true,
onPageChanged: (i) {
currentIndex.value = i;
},
builder: (BuildContext context, int i) {
return PhotoViewGalleryPageOptions(
maxScale: 1.0,
minScale: 0.1,
onTapUp: (context, d, c) {
Navigator.pop(context);
},
imageProvider: _buildImageProvider(widget.images[i]),
heroAttributes: widget.heroTag.isNotEmpty
? PhotoViewHeroAttributes(tag: widget.heroTag)
: null,
);
}),
),
);
}
ImageProvider<Object> _buildImageProvider(String url) {
if (url.contains('http')) {
return NetworkImage(url);
} else {
return FileImage(File(url));
}
}
// 编译索引
Widget buildIndex() {
if (widget.images.length <= 1) {
return Text('');
}
return Padding(
padding: EdgeInsets.only(bottom: 20),
child: ValueListenableBuilder<int>(
valueListenable: currentIndex,
builder: (BuildContext context, int page, Widget child) {
return Text(
"${page + 1}/${widget.images.length}",
style: TextStyle(color: Colors.white70),
);
},
),
);
}
@override
bool get wantKeepAlive => true;
}
import 'package:mvp/mvp.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:common_module/components/i_empty_status.dart';
class ListModelStatusUtils<T extends BaseListModel> {
static ListModelStatusUtils _instance;
static ListModelStatusUtils getInstance() {
if (_instance == null) {
_instance = new ListModelStatusUtils._();
}
return _instance;
}
ListModelStatusUtils._();
Widget form(
{T model,
double paddingTop = 139,
double loadingPaddingTop = 139,
String failText = '暂无数据',
String btnText = "点击刷新",
Color btnColor,
double btnRadius,
String icon,
double iconSize,
Function() onTap}) {
// 未请求完成 && 在第一页 显示加载中
if (!model.isRequestDone() && model.getPage() == 1) {
return Container(
padding: EdgeInsets.only(top: loadingPaddingTop),
child: CupertinoActivityIndicator(
radius: 12,
),
);
}
// 请求完成 && 加载的是第一页的时候 && 列表数据长度为0时,显示空组件
if (model.isRequestDone() && model.getList().length == 0) {
return IEmptyStatus(
icon: icon,
iconSize: iconSize,
btnText: btnText,
btnColor: btnColor,
btnRadius: btnRadius,
paddingTop: paddingTop,
msg: !model.isLoadFail() ? failText : '加载失败,请刷新重试',
onTap: (netWorkConnectd) {
if (onTap != null) {
onTap();
} else {
model.refresh();
}
},
);
}
return null;
}
}
import 'package:flutter/material.dart';
import 'package:flutter_boost/boost_navigator.dart';
import './xapp_utils.dart';
class LoadingDialogUtils {
static LoadingDialogUtils _instance;
static LoadingDialogUtils getInstance() {
if (_instance == null) {
_instance = new LoadingDialogUtils._();
}
return _instance;
}
LoadingDialogUtils._();
LoadingDialog show({String msg = '请稍后'}) {
return LoadingDialog(msg);
}
}
class LoadingDialog {
Route route;
LoadingDialog(String msg) {
route = _LoadingDialogRouter(_LoadingDialog(msg));
BoostNavigator.instance.appState.topContainer.navigator.push(route);
}
void close() {
if (route != null && route.navigator != null) {
route.navigator.pop(route);
}
}
}
// loading widget
class _LoadingDialog extends Dialog {
final String msg;
const _LoadingDialog(this.msg)
: super(
clipBehavior: Clip.none,
);
@override
Widget build(BuildContext context) {
print(this);
return WillPopScope(
child: Material(
type: MaterialType.transparency,
child: Center(
child: Container(
width: 100.rpx,
height: 100.rpx,
decoration: BoxDecoration(
color: rgba(0, 0, 0, 0.8),
borderRadius: BorderRadius.circular(8),
),
child: Column(
children: <Widget>[
Padding(
child: CircularProgressIndicator(
strokeWidth: 2.rpx,
backgroundColor: Theme.of(context).primaryColor,
),
padding: EdgeInsets.only(
left: 30.rpx, right: 30.rpx, top: 25.rpx, bottom: 10.rpx),
),
Padding(
padding: EdgeInsets.only(left: 10.rpx, right: 10.rpx),
child: Text(
msg,
style: TextStyle(
color: Colors.white, fontSize: 11.rpx, height: 1.5),
maxLines: 1,
overflow: TextOverflow.clip,
),
)
],
),
),
),
),
onWillPop: () async {
return false;
},
);
}
}
// loading路由
class _LoadingDialogRouter extends PageRouteBuilder {
final Widget page;
_LoadingDialogRouter(this.page)
: super(
opaque: false,
barrierColor: Color(0x00000001),
pageBuilder: (context, animation, secondaryAnimation) => page,
transitionsBuilder: (context, animation, secondaryAnimation, child) =>
child,
);
}
import 'package:common_module/utils/permission_utils.dart';
import 'package:permission_handler/permission_handler.dart';
///
/// 定位权限相关类
///
class LocationPermissionUtils {
static LocationPermissionUtils _instance;
static LocationPermissionUtils getInstance() {
if (_instance == null) {
_instance = new LocationPermissionUtils();
}
return _instance;
}
///
/// 判断是否有定位权限
///
Future<bool> hasPermission() async {
Map<Permission, PermissionUtilsStatus> result =
await PermissionUtils.getInstance()
.has(permissions: [Permission.location]);
return result[Permission.location] == PermissionUtilsStatus.granted;
}
///
/// 请求定位权限
///
Future<bool> reqPermission() async {
Map<Permission, PermissionUtilsStatus> result =
await PermissionUtils.getInstance()
.has(permissions: [Permission.location]);
var location = result[Permission.location];
if (location == PermissionUtilsStatus.permanentlyDenied) {
PermissionUtils.getInstance().openAppSetting();
return false;
} else if (location == PermissionUtilsStatus.denied) {
result = await PermissionUtils.getInstance()
.request(permissions: [Permission.location]);
location = result[Permission.location];
return location == PermissionUtilsStatus.granted;
}else if (location == PermissionUtilsStatus.granted) {
return true;
}
return false;
}
}
import 'dart:math';
import 'dart:io';
import 'package:url_launcher/url_launcher.dart';
import 'package:flutter_native_toast/flutter_native_toast.dart';
const num pi = 3.1415926535897932384626;
const num x_pi = 3.14159265358979324 * 3000.0 / 180.0;
const num a = 6378245.0;
const num ee = 0.00669342162296594323;
class MapUtils {
static MapUtils instance;
static MapUtils getInstance() {
if (instance == null) {
instance = new MapUtils();
}
return instance;
}
void open(String location, String addressStr) async {
var gps = location.split(',');
var url = await getMap(gps[0], gps[1], addressStr);
if (url == null) {
FlutterNativeToast.showToast('未安装导航');
} else {
launch(url);
}
}
Future<String> getMap(
String latitude, String longitude, String addressStr) async {
List<num> gps = gcj02ToBd09(num.parse(latitude), num.parse(longitude));
//'${gps[1]},${gps[0]}';
var aMapUrl =
'${Platform.isAndroid ? 'android' : 'ios'}amap://viewMap?sourceApplication=applicationName&poiname=$addressStr&lat=${gps[1]}&lon=${gps[0]}&dev=0';
var tMapUrl =
'qqmap://map/marker?marker=coord:${gps[1]},${gps[0]};title:$addressStr;addr:$addressStr&referer=VWBBZ-CRB33-BWZ3V-3PTXV-6TQGE-QZBMU';
List<num> bdGps = gcj02ToBd09(num.parse(latitude), num.parse(longitude));
String bdLatlng = '${bdGps[1]},${bdGps[0]}';
var bMapUrl =
'baidumap://map/direction?destination=name:$addressStr|latlng:$bdLatlng&index=0&sy=5&mode=walking&target=0&coord_type=bd09ll&src=andr.baidu.openAPIdemo';
List<String> maps = [bMapUrl, tMapUrl, aMapUrl];
for (int i = 0, len = maps.length; i < len; i++) {
String url = maps[i];
bool can = await canLaunch(url);
if (can) {
return url;
}
}
return null;
}
num transformLat(num x, num y) {
num ret = -100.0 +
2.0 * x +
3.0 * y +
0.2 * y * y +
0.1 * x * y +
0.2 * sqrt(x.abs());
ret += (20.0 * sin(6.0 * x * pi) + 20.0 * sin(2.0 * x * pi)) * 2.0 / 3.0;
ret += (20.0 * sin(y * pi) + 40.0 * sin(y / 3.0 * pi)) * 2.0 / 3.0;
ret += (160.0 * sin(y / 12.0 * pi) + 320 * sin(y * pi / 30.0)) * 2.0 / 3.0;
return ret;
}
num transformLon(num x, num y) {
num ret =
300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * sqrt(x.abs());
ret += (20.0 * sin(6.0 * x * pi) + 20.0 * sin(2.0 * x * pi)) * 2.0 / 3.0;
ret += (20.0 * sin(x * pi) + 40.0 * sin(x / 3.0 * pi)) * 2.0 / 3.0;
ret +=
(150.0 * sin(x / 12.0 * pi) + 300.0 * sin(x / 30.0 * pi)) * 2.0 / 3.0;
return ret;
}
List<num> transform(num lat, num lon) {
if (outOfChina(lat, lon)) {
return [lat, lon];
}
num dLat = transformLat(lon - 105.0, lat - 35.0);
num dLon = transformLon(lon - 105.0, lat - 35.0);
num radLat = lat / 180.0 * pi;
num magic = sin(radLat);
magic = 1 - ee * magic * magic;
num sqrtMagic = sqrt(magic);
dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi);
dLon = (dLon * 180.0) / (a / sqrtMagic * cos(radLat) * pi);
num mgLat = lat + dLat;
num mgLon = lon + dLon;
return [mgLat, mgLon];
}
bool outOfChina(num lat, num lon) {
if (lon < 72.004 || lon > 137.8347) return true;
if (lat < 0.8293 || lat > 55.8271) return true;
return false;
}
///
/// 84 to 火星坐标系 (GCJ-02) World Geodetic System ==> Mars Geodetic System
///
List<num> gps84ToGcj02(num lat, num lon) {
if (outOfChina(lat, lon)) {
return [lat, lon];
}
num dLat = transformLat(lon - 105.0, lat - 35.0);
num dLon = transformLon(lon - 105.0, lat - 35.0);
num radLat = lat / 180.0 * pi;
num magic = sin(radLat);
magic = 1 - ee * magic * magic;
num sqrtMagic = sqrt(magic);
dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi);
dLon = (dLon * 180.0) / (a / sqrtMagic * cos(radLat) * pi);
num mgLat = lat + dLat;
num mgLon = lon + dLon;
return [mgLat, mgLon];
}
///
/// 火星坐标系 (GCJ-02) to 84 * * @param lon * @param lat * @return
///
List<num> gcj02ToGps84(num lat, num lon) {
List<num> gps = transform(lat, lon);
num lontitude = lon * 2 - gps[1];
num latitude = lat * 2 - gps[0];
return [latitude, lontitude];
}
///
/// 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换算法 将 GCJ-02 坐标转换成 BD-09 坐标
///
List<num> gcj02ToBd09(num lat, num lon) {
num x = lon, y = lat;
num z = sqrt(x * x + y * y) + 0.00002 * sin(y * x_pi);
num theta = atan2(y, x) + 0.000003 * cos(x * x_pi);
num tempLon = z * cos(theta) + 0.0065;
num tempLat = z * sin(theta) + 0.006;
List<num> gps = [tempLat, tempLon];
return gps;
}
///
/// 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换算法 * * 将 BD-09 坐标转换成GCJ-02 坐标
///
List<num> bd09ToGcj02(num lat, num lon) {
num x = lon - 0.0065, y = lat - 0.006;
num z = sqrt(x * x + y * y) - 0.00002 * sin(y * x_pi);
num theta = atan2(y, x) - 0.000003 * cos(x * x_pi);
num tempLon = z * cos(theta);
num tempLat = z * sin(theta);
List<num> gps = [tempLat, tempLon];
return gps;
}
///
/// 将gps84转为bd09
///
List<num> gps84ToBd09(num lat, num lon) {
List<num> gcj02 = gps84ToGcj02(lat, lon);
List<num> bd09 = gcj02ToBd09(gcj02[0], gcj02[1]);
return bd09;
}
///
///
///
List<num> bd09ToGps84(num lat, num lon) {
List<num> gcj02 = bd09ToGcj02(lat, lon);
List<num> gps84 = gcj02ToGps84(gcj02[0], gcj02[1]);
//保留小数点后六位
gps84[0] = retain6(gps84[0]);
gps84[1] = retain6(gps84[1]);
return gps84;
}
///
/// 保留小数点后六位
/// [n] 参数
///
num retain6(num n) {
return num.parse(n.toStringAsFixed(6));
}
}
import 'package:url_launcher/url_launcher.dart';
import 'package:common_module/utils/navigate_utils.dart';
class MeituanUtils {
static MeituanUtils _instance;
static MeituanUtils getInstance() {
if (_instance == null) {
_instance = new MeituanUtils();
}
return _instance;
}
void openByUrl(String url) async {
var installed = await canLaunch("imeituan://");
if (installed) {
NavigateUtils.pushLaunch(urlString: url);
} else {
NavigateUtils.push(path: "app_h5_page", arguments: {
"url": url,
"title": "美团",
});
}
}
}
import 'package:common_module/eventbus/nav_tabbar_event.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_boost/flutter_boost.dart';
import 'package:url_launcher/url_launcher.dart';
import 'event_bus_utils.dart';
/// 路由前置拦截器
typedef PopBeforeFuntion = Future<void> Function(
String path, bool isNative, bool needLogin, Map<String, dynamic> arguments);
///
/// Boost导航路由管理器
///
class NavigateUtils {
/// 路由前置拦截器
static PopBeforeFuntion _onPopBefore;
///
/// 开启新页面统一API
/// [path] 待打开页面的路径
/// [isNative] 是否需伴随原生容器弹出,默认false
/// [needLogin] 是否需要登录
/// [arguments] 携带到下一页面的参数
///
///
static Future<Map<dynamic, dynamic>> push({
@required String path,
bool isNative = false,
bool needLogin = true,
Map<String, dynamic> arguments,
}) async {
if (_onPopBefore != null) {
await _onPopBefore(path, isNative, needLogin, arguments);
}
if (arguments == null) {
arguments = {};
}
// 记录上一个页面的名称
arguments['previousRouteName'] = _getPreviousRouteName();
dynamic result = await BoostNavigator.instance.push(
path,
withContainer: isNative,
arguments: arguments,
);
return result;
}
///
///
///
static Future<bool> pushLaunch({
@required String urlString,
bool needLogin = true,
}) async {
if (_onPopBefore != null) {
await _onPopBefore(urlString, false, needLogin, {});
}
var urlencode = Uri.encodeComponent(urlString);
return await launch(
"imeituan://www.meituan.com/web?lch=appshare_ker3284penn1&wkwebview=1&noquery=1&notitlebar=0&url=$urlencode");
}
///
/// 关闭当前页面
/// [arguments] 关闭页面时携带的参数
///
static Future<bool> pop({Map<String, dynamic> arguments = const {}}) async {
dynamic result = BoostNavigator.instance.pop(arguments);
return result;
}
///
///
/// 返回到指定导航页面
/// [index] 第index个索引
/// [arguments] 返回参数
///
static Future<bool> popTabBarNavigation(String key,{Map<String, dynamic> arguments = const {}}) async{
eventBus.fire(NavTabBarEvent(key: key,tabEnum:NavTabBarEnum.TabBarPageChange,arguments:arguments));
Future.delayed(Duration(milliseconds: 50), () async{
await NavigateUtils.popRoot(rootPath: '/main');
});
return Future.value(true);
}
///
/// 回到主页
/// [rootPath] 根路由路径
///
static popRoot({
@required String rootPath,
Map<String, dynamic> arguments = const {}
}) async {
PageInfo pageInfo = BoostNavigator.instance.getTopPageInfo();
String pageName = pageInfo?.pageName ?? '';
if(pageName != rootPath){
await BoostNavigator.instance.pop().then((value) async {
PageInfo pageInfo = BoostNavigator.instance.getTopPageInfo();
String pageName = pageInfo?.pageName ?? '';
if (pageName.isNotEmpty && pageName != rootPath) {
await popRoot(rootPath: rootPath,arguments:arguments);
}
}).whenComplete(() async {});
}
}
/// 设置路由前置拦截器
static void setPopBefore(PopBeforeFuntion popBeforeFuntion) {
_onPopBefore = popBeforeFuntion;
}
// 获取下一个新页面的上一个页面名称(页面路径)
static String _getPreviousRouteName() {
PageInfo pageInfo = BoostNavigator.instance.getTopPageInfo();
var boostPath = pageInfo?.pageName;
return boostPath;
}
}
import 'package:config_module/routes/config.dart';
import 'package:common_module/utils/navigate_utils.dart';
const String h5BaseURL = String.fromEnvironment("h5BaseURL",
defaultValue:
'https://xmxcdn.xiaomanxiong.net/'); //http://flutterh5.test.xiaomanxiong.cn/
class PageUtils {
static PageUtils _instance;
static PageUtils getInstance() {
if (_instance == null) {
_instance = new PageUtils();
}
return _instance;
}
/// 打开H5页面
/// [url] 链接
/// [title] 标题,不传会自动获取html页面title
/// [needLogin] 是否需要登录
/// [showRefresh] 是否显示刷新按钮
/// [hideTitleBar] 是否隐藏标题栏
Future openH5({
String url,
String title,
dynamic pageParam,
bool needLogin = true,
bool needAuth = false,
bool openNative = false,
bool hideTitleBar = false,
int clearCache = 1,
}) {
assert(url != null);
return NavigateUtils.push(
path: RouterName.H5_PAGE,
needLogin: needLogin,
isNative: openNative,
arguments: {
"url": url,
"title": title,
"clearCache": clearCache,
"pageParam": pageParam
});
}
/// 打开用户服务协议
void openAgreementRegister(
{bool needLogin = false, bool openNative = false}) {
var url = '$h5BaseURL#/agreement/register';
// 生产环境走其他域名
this.openH5(
url: url, title: "服务协议", needLogin: needLogin, openNative: openNative);
}
/// 打开用户隐私协议
void openAgreementPrivacy({bool needLogin = false, bool openNative = false}) {
var url = '$h5BaseURL#/agreement/privacy';
this.openH5(
url: url,
title: "隐私政策",
needLogin: needLogin,
openNative: openNative,
);
}
/// 打开用户隐私协议
void openAgreementSDK({bool needLogin = false, bool openNative = false}) {
var url = '$h5BaseURL#/agreement/sdk';
this.openH5(
url: url,
title: "第三方SDK",
needLogin: needLogin,
openNative: openNative,
);
}
/// 打开意见反馈
void openFAQ() {
PageUtils.getInstance().openH5(
clearCache: 0,
url: 'https://wenjuan.feishu.cn/m/cfm?t=sJEKcKXY1Qni-dy5g');
}
// 打开饿了么外卖
void openEleme() {
var url = '$h5BaseURL#/elm';
openH5(url: url, title: "饿了么外卖");
}
// 打开饿了么外卖
void openGuideBook() {
var url = '$h5BaseURL#/guide_book';
openH5(url: url, title: "新手教程");
}
// 打开新人免单
void openNewPeopleZero() {
var url = '$h5BaseURL#/new_people_zero';
openH5(url: url, title: "新人首单0元");
}
}
import 'package:permission_handler/permission_handler.dart';
import 'dart:io';
export 'package:permission_handler/permission_handler.dart';
class PermissionUtils {
static PermissionUtils _instance;
static PermissionUtils getInstance() {
if (_instance == null) {
_instance = new PermissionUtils();
}
return _instance;
}
/// 判断是否有权限
/// 状态进行了简化,统一
Future<Map<Permission, PermissionUtilsStatus>> has(
{List<Permission> permissions}) async {
assert(permissions != null && permissions.length > 0);
Map<Permission, PermissionUtilsStatus> resultPermissions = {};
for (int i = 0, len = permissions.length; i < len; i++) {
var permission = permissions[i];
var status = await permission.status;
if (status == PermissionStatus.undetermined) {
resultPermissions[permission] = PermissionUtilsStatus.denied;
} else if (status == PermissionStatus.denied) {
if (Platform.isIOS) {
resultPermissions[permission] =
PermissionUtilsStatus.permanentlyDenied;
} else {
resultPermissions[permission] = PermissionUtilsStatus.denied;
}
} else if (status == PermissionStatus.restricted) {
resultPermissions[permission] = PermissionUtilsStatus.restricted;
} else if (status == PermissionStatus.granted) {
resultPermissions[permission] = PermissionUtilsStatus.granted;
} else if (status == PermissionStatus.permanentlyDenied) {
resultPermissions[permission] = PermissionUtilsStatus.permanentlyDenied;
}
}
return resultPermissions;
}
/// 判断请求权限
/// 状态进行了简化,统一
Future<Map<Permission, PermissionUtilsStatus>> request(
{List<Permission> permissions}) async {
assert(permissions != null && permissions.length > 0);
Map<Permission, PermissionUtilsStatus> resultPermissions = {};
Map<Permission, PermissionStatus> resultMap = await permissions.request();
for (int i = 0, len = permissions.length; i < len; i++) {
var permission = permissions[i];
var status = resultMap[permission];
if (status == PermissionStatus.undetermined) {
resultPermissions[permission] = PermissionUtilsStatus.denied;
} else if (status == PermissionStatus.denied) {
if (Platform.isIOS) {
resultPermissions[permission] =
PermissionUtilsStatus.permanentlyDenied;
} else {
resultPermissions[permission] = PermissionUtilsStatus.denied;
}
} else if (status == PermissionStatus.restricted) {
resultPermissions[permission] = PermissionUtilsStatus.restricted;
} else if (status == PermissionStatus.granted) {
resultPermissions[permission] = PermissionUtilsStatus.granted;
} else if (status == PermissionStatus.permanentlyDenied) {
resultPermissions[permission] = PermissionUtilsStatus.permanentlyDenied;
}
}
return resultPermissions;
}
/// 打开app设置页面
Future<bool> openAppSetting() {
return openAppSettings();
}
}
/// 权限
/// denied=>没有权限,可以发起申请
/// permanentlyDenied=>没有权限,永久拒绝的,只能通过打开设置去开启权限
/// restricted=>受限制的权限,比如家长控制权限
/// granted=>有权限
enum PermissionUtilsStatus { denied, permanentlyDenied, restricted, granted }
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:localstorage/localstorage.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:path_provider/path_provider.dart';
///
/// 数据持久化工具
///
class StoreUtils {
/// app全局配置 eg:theme
SharedPreferences _sharedPreferences;
/// 临时目录 eg: cookie
Directory _temporaryDirectory;
/// 初始化必备操作 eg:user数据
LocalStorage _localStorage;
static StoreUtils _instance;
static StoreUtils getInstance() {
if (_instance == null) {
_instance = new StoreUtils();
}
return _instance;
}
///
/// 初始化
///
Future<bool> init() async {
// async 异步操作
// sync 同步操作
_sharedPreferences = await SharedPreferences.getInstance();
_localStorage = LocalStorage('LocalStorage');
_temporaryDirectory = await getTemporaryDirectory();
return await _localStorage.ready;
}
///
/// 根据[key]获取相应的值
/// [key] 键
///
dynamic getForKey({@required String key,dynamic defaultValue}) {
return getStorage?.getItem(key)??defaultValue;
}
///
/// 设置[key]以及对应的[value]
/// [key] 键
/// [value] 值
///
Future<void> setKV({@required String key, @required dynamic value}) {
return getStorage?.setItem(key, value);
}
///
/// 根据[key]删除对应的值
/// [key] 键
///
Future<void> delForkey({@required String key}) {
return getStorage.deleteItem(key);
}
///
/// 获取本地存储类
///
LocalStorage get getStorage {
return _localStorage;
}
///
/// 获取数据持久化的类
///
SharedPreferences get getShared {
return _sharedPreferences;
}
///
/// 获取缓存的文件夹
///
Directory get getTempDir {
return _temporaryDirectory;
}
}
import 'package:share_extend/share_extend.dart';
class SystemShareUtils {
static SystemShareUtils instance;
static SystemShareUtils getInstance() {
if (instance == null) {
instance = new SystemShareUtils();
}
return instance;
}
/// 调用系统分享文字
shareText(String text) {
ShareExtend.share(text, "text");
}
/// 分享图片
shareImage(String path) async {
ShareExtend.share(path, 'image');
}
/// 分享文件
shareFile(String path) {
ShareExtend.share(path, 'file');
}
}
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:umeng_common_sdk/umeng_common_sdk.dart';
import 'package:umeng_crash/umeng_crash.dart';
/// 公司友盟Key
const String _IOS_KEY = "611b2a4c1fee2e303c25b52a";
const String _ANDROID_KEY = "6110f075063bed4d8c112310";
// 友盟
class UmengUtils {
static void preInit() {
String appKey = Platform.isIOS ? _IOS_KEY : _ANDROID_KEY;
UmengCommonSdk.preInit(
appKey: appKey,
channel: 'qiaomeng',
enableLog: true,
);
}
static init() {
String appKey = Platform.isIOS ? _IOS_KEY : _ANDROID_KEY;
UmengCommonSdk.init(
appKey: appKey,
channel: 'qiaomeng',
deviceType: 1,
pushSecret: appKey,
mode: true,
process: true,
).then((value) {
print("####-友盟初始化-$value");
});
}
// 发送自定义事件(目前属性值支持字符、整数、浮点、长整数,暂不支持NULL、布尔、MAP、数组)
static void onEvent(String event, Map<String, dynamic> properties) {
UmengCommonSdk.onEvent(
event: event,
properties: properties,
);
}
// 进入页面统计(手动采集时才可设置)
static void onPageStart(String viewName, dynamic args) {
//$args
print('=======*****埋点触发*****in--$viewName=========');
Map<String, dynamic> _args = Map<String, dynamic>.from(args);
_args["_event_type_"] = 'page_start';
String time = DateTime.now().toString();
_args["_Time_"] = 'startTime:$time';
UmengCommonSdk.onEvent(
event: viewName,
properties: _args,
);
}
// 离开页面统计(手动采集时才可设置)
static void onPageEnd(String viewName, dynamic args) {
//$args
print('=======*****埋点触发*****out--$viewName=========');
Map<String, dynamic> _args = Map<String, dynamic>.from(args);
_args["_event_type_"] = 'page_end';
String time = DateTime.now().toString();
_args["_Time_"] = 'endTime:$time';
UmengCommonSdk.onEvent(
event: viewName,
properties: _args,
);
}
///
/// 自定义异常上报接口
/// [e] 异常信息
/// [type] 异常类型
///
static void generateCustomLog({@required String e,@required String type}){
UmengCrash.generateCustomLog(e: e, type: type);
}
///
/// 程序退出时,用于保存统计数据的API。 如果开发者调用kill或者exit之类的方法杀死进程,或者双击back键会杀死进程,请务必在此之前调用onKillProcess方法,用来保存统计数据。
///
static void onKillProcess(){
UmengCrash.onKillProcess();
}
}
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:fluwx/fluwx.dart' as wx;
export 'package:fluwx/src/share/share_models.dart';
class WxSdkUtils {
// 唤起登录回调
static Function(wx.WeChatAuthResponse res) _sendWeChatAuthCallback;
// 唤起分享回调
static Function(wx.WeChatShareResponse res) _shareToWeChatCallback;
// 唤起支付回调
static Function(wx.WeChatPaymentResponse res) _payWithWeChatCallback;
// 唤起消息订阅回调
static Function(wx.WeChatSubscribeMsgResponse res)
_subscribeWeChatMsgCallback;
// 初始化
static void init(String appId, String universalLink) {
wx.weChatResponseEventHandler.listen((res) {
if (res is wx.WeChatAuthResponse) {
if (_sendWeChatAuthCallback != null) {
_sendWeChatAuthCallback(res);
_sendWeChatAuthCallback = null;
}
} else if (res is wx.WeChatShareResponse) {
if (_shareToWeChatCallback != null) {
_shareToWeChatCallback(res);
_shareToWeChatCallback = null;
}
} else if (res is wx.WeChatPaymentResponse) {
if (_payWithWeChatCallback != null) {
_payWithWeChatCallback(res);
_payWithWeChatCallback = null;
}
} else if (res is wx.WeChatSubscribeMsgResponse) {
if (_subscribeWeChatMsgCallback != null) {
_subscribeWeChatMsgCallback(res);
_subscribeWeChatMsgCallback = null;
}
}
});
wx.registerWxApi(appId: appId, universalLink: universalLink);
}
// 调起微信登录
static Future<wx.WeChatAuthResponse> sendWeChatAuth({
String scope = 'snsapi_userinfo',
String state,
}) {
Completer<wx.WeChatAuthResponse> completer =
new Completer<wx.WeChatAuthResponse>();
_sendWeChatAuthCallback = (res) {
completer.complete(res);
};
wx.sendWeChatAuth(scope: scope, state: state);
return completer.future;
}
// 分享
static Future<wx.WeChatShareResponse> shareToWeChat(
wx.WeChatShareBaseModel model) {
Completer<wx.WeChatShareResponse> completer =
new Completer<wx.WeChatShareResponse>();
_shareToWeChatCallback = (res) {
completer.complete(res);
};
wx.shareToWeChat(model);
return completer.future;
}
// 微信支付
static Future<wx.WeChatPaymentResponse> payWithWeChat(
{@required String appId,
@required String partnerId,
@required String prepayId,
@required String packageValue,
@required String nonceStr,
@required int timeStamp,
@required String sign,
String signType,
String extData}) {
Completer<wx.WeChatPaymentResponse> completer =
new Completer<wx.WeChatPaymentResponse>();
_payWithWeChatCallback = (res) {
completer.complete(res);
};
wx.payWithWeChat(
appId: appId,
partnerId: partnerId,
prepayId: prepayId,
packageValue: packageValue,
nonceStr: nonceStr,
timeStamp: timeStamp,
sign: sign,
signType: signType,
extData: extData);
return completer.future;
}
// 消息订阅
static Future<wx.WeChatSubscribeMsgResponse> subscribeWeChatMsg({
@required String appId,
@required int scene,
@required String templateId,
String reserved,
}) {
Completer<wx.WeChatSubscribeMsgResponse> completer =
new Completer<wx.WeChatSubscribeMsgResponse>();
_subscribeWeChatMsgCallback = (res) {
completer.complete(res);
};
wx.subscribeWeChatMsg(
appId: appId, scene: scene, templateId: templateId, reserved: reserved);
return completer.future;
}
//是否安装微信
static Future<bool> isInstallWechat() {
return wx.isWeChatInstalled;
}
//打开微信
static Future<bool> openWeChatApp() {
return wx.openWeChatApp();
}
////
/// 启动微信小程序
/// [appId] 待打开的微信小程序的id,gh_开头
/// [path] 待打开的小程序路径
///
static Future<bool> launchWeChatMiniProgram(
{@required String appId, String path}) async {
return await wx.launchWeChatMiniProgram(username: appId, path: path);
}
}
library xapp_utils;
import 'dart:convert';
import 'dart:io';
import 'package:flutter/services.dart';
import 'package:flutter/services.dart' show rootBundle;
import 'package:device_info/device_info.dart';
import 'package:android_device/android_device.dart';
import 'package:crypto/crypto.dart' as crypto;
import 'package:flutter/material.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:package_info/package_info.dart';
import 'loading_dialog_utils.dart';
import 'package:flutter_native_toast/flutter_native_toast.dart';
class XAppUtils {
static XAppUtils _instance;
static XAppUtils getInstance() {
if (_instance == null) {
_instance = new XAppUtils._();
}
return _instance;
}
double _mediaWidth;
double _mediaHeight;
double _adaptWidth;
String _deviceId;
String _deviceType;
String _osVersion;
String _appVersion;
String _appBuildNumber;
String _idfaID;
XAppUtils._();
/// 初始化
/// [context] 上下文
/// [uiWidth] UI尺寸宽度
void init({@required BuildContext context, double uiWidth = 375}) async {
if (_adaptWidth == null || _adaptWidth == 0.0) {
Size size = MediaQuery.of(context).size;
_mediaWidth = size.width;
_mediaHeight = size.height;
_adaptWidth = _mediaWidth / uiWidth;
if(_appVersion == null){
var packageInfo = await PackageInfo.fromPlatform();
_appBuildNumber = packageInfo.buildNumber;
_appVersion = packageInfo.version;
}
}
}
/// 获取屏幕宽度
double getMediaWidth() {
return _mediaWidth;
}
/// 获取屏幕高度
double getMediaHeight() {
return _mediaHeight;
}
double getAdaptWidth() {
return _adaptWidth;
}
/// 根据UI单位转换成rpx
double rpx(num px) {
return double.parse((px * getAdaptWidth()).toStringAsFixed(6));
}
LoadingDialog showLoading([String msg = '请稍后']) {
return LoadingDialogUtils.getInstance().show(msg: msg);
}
/// sha1编码
String sha1(String data) {
var bytes = utf8.encode(data);
var digest = crypto.sha1.convert(bytes);
return digest.toString();
}
/// md5编码
String md5(String data) {
var bytes = utf8.encode(data);
var digest = crypto.md5.convert(bytes);
return digest.toString();
}
/// 获取rsa密钥
Future<String> getRSAKeyByAsset(String file) async {
var keyStr = await rootBundle.loadString(file);
return keyStr;
}
/// 获取设备ID
Future<String> getDeviceId() async {
if (_deviceId == null) {
if (Platform.isIOS) {
var info = await DeviceInfoPlugin().iosInfo;
_deviceId = info.identifierForVendor;
} else {
_deviceId = await AndroidDevice.getDeviceId();
}
}
return _deviceId;
}
/// 获取设备类型,如: iPod7,1
Future<String> getDeviceType() async {
if (_deviceType == null) {
if (Platform.isAndroid) {
AndroidDeviceInfo info = await DeviceInfoPlugin().androidInfo;
_deviceType = info.model;
} else {
IosDeviceInfo info = await DeviceInfoPlugin().iosInfo;
_deviceType = info.model;
}
}
return _deviceType;
}
/// 获取系统类型,如: ios、android
String getOsType() {
return Platform.operatingSystem;
}
/// 获取系统版本号,如: 10
Future<String> getOsVersion() async {
if (_osVersion == null) {
if (Platform.isAndroid) {
AndroidDeviceInfo info = await DeviceInfoPlugin().androidInfo;
_osVersion = info.version.release;
} else {
IosDeviceInfo info = await DeviceInfoPlugin().iosInfo;
_osVersion = info.systemVersion;
}
}
return _osVersion;
}
/// 获取app版本号,如: 1.0.0
String getAppVersion() {
return _appVersion;
}
String getAppBuildNumber(){
return _appBuildNumber;
}
/// 设置剪贴板内容
Future<void> setClipboardText(String text) {
return Clipboard.setData(ClipboardData(text: text));
}
/// 获取剪贴板内容
Future<String> getClipboardText() async {
ClipboardData data = await Clipboard.getData(Clipboard.kTextPlain);
if (data == null) {
return '';
}
return data.text ?? '';
}
Future<String> getIDFAID() async {
if (_idfaID != null) {
return _idfaID;
}
//读取存储的设备id,没有id就创建一个
//设备唯一id
_idfaID = await FlutterSecureStorage().read(key: 'kIDFAID');
if (_idfaID == null || _idfaID.contains('000000000000')) {
if (Platform.isIOS) {
var info = await DeviceInfoPlugin().iosInfo;
// idfaID = await pangle.getIdfaString();
_idfaID = info.identifierForVendor;
} else {
_idfaID = await AndroidDevice.getDeviceId();
}
FlutterSecureStorage().write(key: 'kIDFAID', value: _idfaID);
}
return _idfaID;
}
void toast(String msg) {
FlutterNativeToast.showToast(msg);
}
}
extension SizeExtension on num {
double get rpx => XAppUtils.getInstance().rpx(this);
double get w => XAppUtils.getInstance().rpx(this);
double get nsp => XAppUtils.getInstance().rpx(this);
}
Color rgba(int r, int g, int b, double a) => Color.fromRGBO(r, g, b, a);
import 'package:flutter/material.dart';
import 'listener/ds_listener.dart';
class DSFrame {
DSFrame._private();
static DSFrame create = DSFrame._private();
factory DSFrame() => create;
///
/// 按键点击监听
///
DSListener listener;
///
/// build 初始化
/// listener 监听,监听按钮的点击事件
///
void build({
DSListener listener,
}){
DSFrame.create.listener = listener;
}
///
/// 设置上报的数据监听
///
void dataListener({@required String id,String pageName,dynamic extras}){
if(listener != null){
listener(id,pageName,extras);
}
}
}
import 'package:cached_network_image/cached_network_image.dart' as Cache;
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class CachedNetworkImage extends StatelessWidget {
final String imageUrl;
final Widget Function(BuildContext, String) placeholder;
final Widget Function(
BuildContext context, String url, Cache.DownloadProgress progress)
progressIndicatorBuilder;
final double width;
final double height;
final BoxFit fit;
final Color color;
final AlignmentGeometry alignment;
const CachedNetworkImage(
{Key key,
@required this.imageUrl,
this.placeholder,
this.progressIndicatorBuilder,
this.width,
this.height,
this.fit,
this.color,
this.alignment = Alignment.center})
: assert(imageUrl != null),
super(key: key);
@override
Widget build(BuildContext context) {
var data = MediaQuery.of(context);
var devicePixelRatio = data.devicePixelRatio;
return Cache.CachedNetworkImage(
alignment: alignment,
imageUrl: imageUrl,
placeholder: placeholder,
width: width,
height: height,
fit: fit,
fadeInDuration: Duration(milliseconds: 100),
color: color,
memCacheHeight:
getMemCacheSize(size: height, devicePixelRatio: devicePixelRatio),
memCacheWidth:
getMemCacheSize(size: width, devicePixelRatio: devicePixelRatio),
// maxHeightDiskCache:
// getDiskCacheSize(size: height, devicePixelRatio: devicePixelRatio),
// maxWidthDiskCache:
// getDiskCacheSize(size: width, devicePixelRatio: devicePixelRatio),
);
}
int getDiskCacheSize({double size, double devicePixelRatio}) {
if (size == null || size == double.infinity) {
return null;
}
return (size * devicePixelRatio).toInt();
}
int getMemCacheSize({@required double size, double devicePixelRatio}) {
if (size == null || size == double.infinity) {
return null;
}
return (size * devicePixelRatio).toInt();
}
}
import 'package:common_module/widget/ds_frame.dart';
import 'package:flutter/material.dart';
import 'package:flutter_boost/boost_navigator.dart';
typedef DSListener = void Function(String id, String pageName,Map<String,dynamic> extras);
class DSWidgetListener extends StatelessWidget {
final Widget child; //包裹的布局
final String id; //按键的id值,用于区分点击的按键
final dynamic extras; //附加参数
const DSWidgetListener({Key key, @required this.child, this.id,this.extras = const {}}) : super(key: key);
@override
Widget build(BuildContext context) {
return Listener(
child: child,
onPointerDown: (e) {
PageInfo pageInfo = BoostNavigator.instance.getTopPageInfo();
if (DSFrame.create.listener != null) {
DSFrame.create.listener(id,pageInfo?.pageName??'',extras);
}
},
onPointerCancel:(e){
//print("监听 onPointerCancel");
},
onPointerMove:(e){
//print("监听 onPointerMove");
},
onPointerSignal:(e){
//print("监听 onPointerSignal");
},
onPointerUp:(e){
//print("监听 onPointerUp");
},
);
}
}
\ No newline at end of file
import 'package:flutter/cupertino.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
export 'package:pull_to_refresh/pull_to_refresh.dart';
class PullWidget extends StatelessWidget {
final Widget child;
final VoidCallback onRefresh;
final VoidCallback onLoad;
final Widget footer;
final int headerInsertIndex;
final RefreshController controller;
final ScrollController scrollController;
PullWidget(
{this.child,
this.onRefresh,
this.onLoad,
this.controller,
this.footer,
this.headerInsertIndex = 0,
this.scrollController}) {
assert(this.child != null);
}
@override
Widget build(BuildContext context) {
return SmartRefresher(
headerInsertIndex: headerInsertIndex,
footer: footer,
scrollController: scrollController,
controller: controller,
enablePullDown: onRefresh != null,
enablePullUp: onLoad != null,
onRefresh: onRefresh,
onLoading: onLoad,
child: child,
);
}
}
\ No newline at end of file
import 'package:flutter/material.dart';
import 'package:common_module/utils/xapp_utils.dart';
import 'package:mvp/mvp.dart';
class ScrollToTopWidget extends StatelessWidget {
final ScrollToModel model;
const ScrollToTopWidget({Key key, this.model}) : super(key: key);
@override
Widget build(BuildContext context) {
return QMProvider<ScrollToModel>.value(
model: model,
builderWidget: (context, model, child) => Offstage(
offstage: !model.showFloatingButton,
child: Container(
margin: EdgeInsets.only(bottom: 10.w),
width: 44.w,
height: 44.w,
child: FloatingActionButton(
elevation: 0.0,
backgroundColor: Colors.white,
onPressed: model.scrollToTop,
child: Container(
child: Image.asset(
"assets/all_top_icon.png",
),
),
),
),
),
);
}
}
class ScrollToModel extends BaseModel {
ScrollController scrollController = ScrollController();
bool showFloatingButton = false;
//记录是否是点击tab触发的事件
bool taped = false;
addScrollListener() {
scrollController.addListener(() {
if (scrollController.offset > 800 && showFloatingButton == false) {
if (taped == true) {
return;
}
showFloatingButton = true;
notifyListeners();
}
if (scrollController.offset <= 800 && showFloatingButton == true) {
if (taped == true) {
return;
}
showFloatingButton = false;
notifyListeners();
}
print('####################$showFloatingButton');
});
}
scrollToTop() {
scrollController.animateTo(0,
duration: Duration(milliseconds: 300), curve: Curves.linear);
}
@override
void dispose() {
scrollController.dispose();
super.dispose();
}
}
import 'package:flutter/cupertino.dart';
// ignore: must_be_immutable
class TapWidget extends StatelessWidget {
final Widget child;
final GestureTapCallback onTap;
final Function onLongPress;
final HitTestBehavior behavior;
int lastTapTime = 0;
TapWidget(
{@required this.child,
this.onTap,
Key key,
this.behavior = HitTestBehavior.translucent,
this.onLongPress})
: super(key: key) {
assert(this.child != null);
}
@override
Widget build(BuildContext context) {
return GestureDetector(
behavior: behavior,
child: child,
onLongPress: onLongPress,
onTap: () {
if (this.onTap != null) {
int now = DateTime.now().millisecondsSinceEpoch;
if (now - lastTapTime < 400) {
return;
}
lastTapTime = now;
this.onTap();
}
},
);
}
}
import 'package:flutter/material.dart';
import 'package:common_module/widget/image/index.dart';
var isAliCDN = RegExp('alicdn.com');
var isCache = RegExp(r'_\d+x\d+((Q\d+s\d+)?).(jpg|png|gif|jpeg)');
///公用的图片控件
///[imageUrl]图片地址
///[progressImage]占位图片名
///[fit]图片适应方式[BoxFit]
///[width]图片宽度
///[height]图片高度
///[placeholderFit]占位适应方式[BoxFit]
class XiaoxiongBaseImageWidget extends StatelessWidget {
final String imageUrl;
final String heroTag;
final String progressImage;
final BoxFit fit;
final double width;
final double height;
final BoxFit placeholderFit;
final AlignmentGeometry alignment;
final Widget Function(BuildContext, String) placeholder;
String get _imageUrl {
// var isAli = isAliCDN.hasMatch(imageUrl);
// var isCnd = !isCache.hasMatch(imageUrl);
// if (isAli && isCnd) {
// return "${imageUrl}_400x400Q50s50.jpg";
// }
return imageUrl;
}
const XiaoxiongBaseImageWidget(
{Key key,
@required this.imageUrl,
this.progressImage,
this.fit = BoxFit.cover,
this.width,
this.height,
this.placeholderFit = BoxFit.contain,
this.placeholder,
this.heroTag,
this.alignment = Alignment.center})
: super(key: key);
@override
Widget build(BuildContext context) {
if (heroTag != null && heroTag.isNotEmpty) {
return Hero(tag: heroTag, child: buildCachedNetworkImage());
}
return Container(
child: buildCachedNetworkImage(),
);
}
Widget buildCachedNetworkImage() {
if (imageUrl == null || imageUrl.isEmpty) {
return Container(
width: width,
height: height,
);
} else if (!imageUrl.startsWith('http')) {
return Image.asset(
imageUrl,
fit: fit,
width: width,
height: height,
);
}
return CachedNetworkImage(
alignment: alignment,
imageUrl: _imageUrl ?? '',
fit: fit,
width: width,
height: height,
placeholder: placeholder ??
(context, index) => Container(
width: width,
height: height,
color: Color.fromARGB(255, 233, 233, 233),
child: Image.asset(
progressImage ?? "assets/placeholderImage.png",
fit: placeholderFit,
),
),
);
}
}
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
alarm_calendar:
dependency: "direct main"
description:
name: alarm_calendar
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.3"
amaps_location:
dependency: "direct main"
description:
path: "../../plugins/amaps-location"
relative: true
source: path
version: "1.0.0"
android_device:
dependency: "direct main"
description:
path: "."
ref: HEAD
resolved-ref: ddd142196dcd2653049595fe76abf94e31a0bcc6
url: "http://git.xiaomanxiong.com/gitlab/lizengqiang/flutter_android_device.git"
source: git
version: "0.0.1"
archive:
dependency: transitive
description:
name: archive
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.13"
args:
dependency: transitive
description:
name: args
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.6.0"
base_repository:
dependency: transitive
description:
path: "../../repository/app-base-repository"
relative: true
source: path
version: "0.0.1"
cached_network_image:
dependency: "direct main"
description:
name: cached_network_image
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.5.1"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0-nullsafety.3"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.3"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.1"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.15.0-nullsafety.3"
config_module:
dependency: "direct main"
description:
path: "../config_module"
relative: true
source: path
version: "0.0.1"
connectivity:
dependency: "direct main"
description:
name: connectivity
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.2"
connectivity_for_web:
dependency: transitive
description:
name: connectivity_for_web
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.3.1+4"
connectivity_macos:
dependency: transitive
description:
name: connectivity_macos
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.0+7"
connectivity_platform_interface:
dependency: transitive
description:
name: connectivity_platform_interface
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.6"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.1"
crypto:
dependency: "direct main"
description:
name: crypto
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.5"
device_info:
dependency: "direct main"
description:
name: device_info
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.0"
device_info_platform_interface:
dependency: transitive
description:
name: device_info_platform_interface
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.1"
dio:
dependency: transitive
description:
name: dio
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.10"
event_bus:
dependency: "direct main"
description:
name: event_bus
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.1"
extended_nested_scroll_view:
dependency: "direct main"
description:
path: "."
ref: HEAD
resolved-ref: "8c63ea56972b2bb825e66071cf9b061b32849293"
url: "https://gitee.com/lzq-flutter/extended_nested_scroll_view-2.0.1.git"
source: git
version: "2.0.1"
ffi:
dependency: transitive
description:
name: ffi
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.3"
file:
dependency: transitive
description:
name: file
url: "https://pub.flutter-io.cn"
source: hosted
version: "5.2.1"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_album_save:
dependency: "direct main"
description:
path: "."
ref: HEAD
resolved-ref: "7a8b602f90c8a57f841ba08f8cbc37543c29f8cb"
url: "git@git.xiaomanxiong.com:front/flutter/flutter_album_save.git"
source: git
version: "0.0.1"
flutter_blurhash:
dependency: transitive
description:
name: flutter_blurhash
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.5.0"
flutter_boost:
dependency: "direct main"
description:
path: "."
ref: "v3.0-preview.9"
resolved-ref: fe438a61ffd6df6af51226b5a48bb9f533b7a1bc
url: "https://github.com.cnpmjs.org/alibaba/flutter_boost.git"
source: git
version: "3.0.0"
flutter_cache_manager:
dependency: transitive
description:
name: flutter_cache_manager
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.2"
flutter_native_toast:
dependency: "direct main"
description:
path: "."
ref: HEAD
resolved-ref: "87f37a8a384d4cd41e8fbe9bf6ad79e750d3e548"
url: "git@git.xiaomanxiong.com:lizengqiang/flutter_native_toast.git"
source: git
version: "0.0.1"
flutter_page_indicator:
dependency: transitive
description:
name: flutter_page_indicator
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.3"
flutter_secure_storage:
dependency: "direct main"
description:
name: flutter_secure_storage
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.3.5"
flutter_staggered_grid:
dependency: "direct main"
description:
path: "."
ref: HEAD
resolved-ref: "0de93539497ddf7a4a74c719c2e2e40549be4805"
url: "https://gitee.com/hxyl/flutter_staggered_grid.git"
source: git
version: "0.0.1"
flutter_staggered_grid_view:
dependency: "direct main"
description:
name: flutter_staggered_grid_view
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.3.4"
flutter_swiper:
dependency: "direct main"
description:
name: flutter_swiper
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.6"
flutter_web_plugins:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
fluttet_clipboard:
dependency: "direct main"
description:
path: "."
ref: HEAD
resolved-ref: ca6aece803f84ea663dfed876188c0ac143a1ab1
url: "http://git.xiaomanxiong.com/gitlab/lizengqiang/fluttet_clipboard.git"
source: git
version: "1.0.6"
fluwx:
dependency: "direct main"
description:
path: "."
ref: HEAD
resolved-ref: "7b825f875efdfe5102bccc57855ae938f1fe92db"
url: "http://git.xiaomanxiong.com/gitlab/lizengqiang/fluwx.git"
source: git
version: "2.6.2"
http:
dependency: transitive
description:
name: http
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.12.2"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.1.4"
image:
dependency: transitive
description:
name: image
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.19"
intl:
dependency: transitive
description:
name: intl
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.16.1"
life_repository:
dependency: "direct main"
description:
path: "../../repository/app-life-repository"
relative: true
source: path
version: "0.0.1"
localstorage:
dependency: "direct main"
description:
name: localstorage
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.0"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.0-nullsafety.3"
modal:
dependency: "direct main"
description:
path: "."
ref: "1.2.7"
resolved-ref: "13762c4c227a2112d5fd7fb9b997a9df156d1322"
url: "http://git.xiaomanxiong.com/gitlab/front/flutter/flutter_modal.git"
source: git
version: "1.2.6"
mvp:
dependency: "direct main"
description:
path: "../mvp"
relative: true
source: path
version: "0.0.1"
navigation_bar:
dependency: "direct main"
description:
path: "plugins/navigation_bar"
relative: true
source: path
version: "0.0.1"
nested:
dependency: transitive
description:
name: nested
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.4"
octo_image:
dependency: transitive
description:
name: octo_image
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.3.0"
package_info:
dependency: "direct main"
description:
name: package_info
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.4.3+4"
path:
dependency: transitive
description:
name: path
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.7.0"
path_provider:
dependency: transitive
description:
name: path_provider
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.6.28"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.1+2"
path_provider_macos:
dependency: transitive
description:
name: path_provider_macos
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.4+8"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.4"
path_provider_windows:
dependency: transitive
description:
name: path_provider_windows
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.4+3"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.9.2"
permission_handler:
dependency: "direct main"
description:
path: "."
ref: "5.0.1+1"
resolved-ref: "17e8d5152533ecc0c4d3b83ab9aecd39884feef4"
url: "http://git.xiaomanxiong.com/gitlab/lizengqiang/flutter-permission-handler.git"
source: git
version: "5.1.0+2"
permission_handler_platform_interface:
dependency: transitive
description:
name: permission_handler_platform_interface
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.2"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.1.0"
photo_view:
dependency: "direct main"
description:
name: photo_view
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.10.3"
platform:
dependency: transitive
description:
name: platform
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.1"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.3"
process:
dependency: transitive
description:
name: process
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.13"
provider:
dependency: transitive
description:
name: provider
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.3.3"
pull_to_refresh:
dependency: transitive
description:
path: "."
ref: HEAD
resolved-ref: "23c856ca4c948f02518038fdc9697de6fe898957"
url: "http://git.xiaomanxiong.com/gitlab/lizengqiang/pull_to_refresh-1.6.3.git"
source: git
version: "1.6.3"
qr:
dependency: transitive
description:
name: qr
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.0"
qr_flutter:
dependency: "direct main"
description:
name: qr_flutter
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.2.0"
rxdart:
dependency: transitive
description:
name: rxdart
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.25.0"
share_extend:
dependency: "direct main"
description:
path: "."
ref: HEAD
resolved-ref: "5efd165f3cb80f4c1dc0f8cbb446b1a689568766"
url: "http://git.xiaomanxiong.com/gitlab/lizengqiang/ShareExtend.git"
source: git
version: "1.1.9"
shared_preferences:
dependency: "direct main"
description:
name: shared_preferences
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.5.12+4"
shared_preferences_linux:
dependency: transitive
description:
name: shared_preferences_linux
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.2+4"
shared_preferences_macos:
dependency: transitive
description:
name: shared_preferences_macos
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.1+11"
shared_preferences_platform_interface:
dependency: transitive
description:
name: shared_preferences_platform_interface
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.4"
shared_preferences_web:
dependency: transitive
description:
name: shared_preferences_web
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.2+7"
shared_preferences_windows:
dependency: transitive
description:
name: shared_preferences_windows
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.2+3"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
source_span:
dependency: transitive
description:
name: source_span
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.7.0"
sqflite:
dependency: transitive
description:
name: sqflite
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.2+4"
sqflite_common:
dependency: transitive
description:
name: sqflite_common
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.3+3"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.5"
synchronized:
dependency: transitive
description:
name: synchronized
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.0+2"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0"
transformer_page_view:
dependency: transitive
description:
name: transformer_page_view
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.6"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.0-nullsafety.3"
umeng_common_sdk:
dependency: "direct main"
description:
path: "."
ref: HEAD
resolved-ref: b452f6966cf4fdffa5899090581726f1db1ca5c8
url: "git@git.xiaomanxiong.com:flutter-plugin/umeng_common_flutter.git"
source: git
version: "1.2.2"
umeng_crash:
dependency: "direct main"
description:
path: "."
ref: HEAD
resolved-ref: "076713525fad45e8ff9ef220fcb1464ae0fb2c08"
url: "git@git.xiaomanxiong.com:flutter-plugin/umeng-crash.git"
source: git
version: "2.0.1"
url_launcher:
dependency: "direct main"
description:
path: "."
ref: HEAD
resolved-ref: d90fed553a8e119be3eaa42b290e5404dd2e066a
url: "http://git.xiaomanxiong.com/gitlab/lizengqiang/url_launcher.git"
source: git
version: "5.7.10"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.1+4"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.1+9"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.9"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.5+3"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.1+3"
uuid:
dependency: transitive
description:
name: uuid
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.2"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0-nullsafety.3"
waterfall_flow:
dependency: "direct main"
description:
path: "."
ref: master
resolved-ref: d4928c02a081c3aaa6e637d5e190dd242cdd1a43
url: "git@git.xiaomanxiong.com:flutter-plugin/waterfall_flow.git"
source: git
version: "2.0.5"
win32:
dependency: transitive
description:
name: win32
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.7.4+1"
xdg_directories:
dependency: transitive
description:
name: xdg_directories
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.2"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.5.1"
sdks:
dart: ">=2.10.2 <2.11.0"
flutter: ">=1.22.4 <2.0.0"
name: common_module
description: A new Flutter package project.
version: 0.0.1
homepage: /
publish_to: none
environment:
sdk: ">=2.8.0 <3.0.0"
flutter: ">=1.17.0"
dependencies:
flutter:
sdk: flutter
event_bus: ^2.0.0
url_launcher: ^6.0.12
connectivity: ^3.0.6
localstorage: ^3.0.6
shared_preferences: ^2.0.8
cached_network_image: ^3.1.0
qr_flutter: ^4.0.0
package_info: ^2.0.2
device_info: ^2.0.2
crypto: ^3.0.1
photo_view: ^0.13.0 # 图片预览
alarm_calendar: ^0.0.5 # 读写日历插件
flutter_secure_storage: ^4.2.1
waterfall_flow: ^3.0.1
share_extend: ^2.0.0
fluwx: ^3.6.1+3
flutter_staggered_grid_view: ^0.4.1
extended_nested_scroll_view: ^5.0.0
permission_handler: ^8.2.5
flutter_boost:
git:
url: 'https://gitee.com/flutter-plugin/flutter_boost.git'
ref: 'v3.0-null-safety-preview.13'
amaps_location: # 高德地图插件
git:
url: 'git@git.xiaomanxiong.com:flutter-plugin/amaps-location.git'
ref: 'null-safety'
navigation_bar:
git:
url: 'git@git.xiaomanxiong.com:wangll/navigation_bar.git'
ref: 'null-safety'
life_repository:
git:
url: 'git@git.xiaomanxiong.com:flutter-plugin/app-life-repository.git'
ref: 'null-safety'
mvp:
git:
url: 'git@git.xiaomanxiong.com:flutter-plugin/mvp.git'
ref: 'null-safety'
config_module:
git:
url: 'git@git.xiaomanxiong.com:flutter-plugin/config_module.git'
ref: 'null-safety'
flutter_native_toast:
git:
url: git@git.xiaomanxiong.com:flutter-plugin/flutter_native_toast.git
ref: 'null-safety'
modal:
git:
url: git@git.xiaomanxiong.com:front/flutter/flutter_modal.git
ref: 'null-safety'
umeng_crash:
git:
url: 'git@git.xiaomanxiong.com:flutter-plugin/umeng-crash.git'
ref: 'null-safety'
umeng_common_sdk:
git:
url: git@git.xiaomanxiong.com:flutter-plugin/umeng_common_flutter.git
ref: 'null-safety'
flutter_album_save:
git:
url: git@git.xiaomanxiong.com:front/flutter/flutter_album_save.git
ref: 'null-safety'
fluttet_clipboard:
git:
url: http://git.xiaomanxiong.com/gitlab/lizengqiang/fluttet_clipboard.git
ref: 'null-safety'
android_device:
git:
url: http://git.xiaomanxiong.com/gitlab/lizengqiang/flutter_android_device.git
ref: 'null-safety'
flutter_swiper:
git:
url: git@git.xiaomanxiong.com:flutter-plugin/flutter_swiper.git
ref: 'null-safety'
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment