戴余标 3 years ago
commit a643f4af06

@ -3,6 +3,8 @@
/// FlutterGen
/// *****************************************************
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: directives_ordering,unnecessary_import
import 'package:flutter/widgets.dart';
@ -567,19 +569,23 @@ class Assets {
static const $AssetsUserGen user = $AssetsUserGen();
}
class AssetGenImage extends AssetImage {
const AssetGenImage(String assetName) : super(assetName);
class AssetGenImage {
const AssetGenImage(this._assetName);
final String _assetName;
Image image({
Key? key,
AssetBundle? bundle,
ImageFrameBuilder? frameBuilder,
ImageLoadingBuilder? loadingBuilder,
ImageErrorWidgetBuilder? errorBuilder,
String? semanticLabel,
bool excludeFromSemantics = false,
double? scale = 1.0,
double? width,
double? height,
Color? color,
Animation<double>? opacity,
BlendMode? colorBlendMode,
BoxFit? fit,
AlignmentGeometry alignment = Alignment.center,
@ -588,19 +594,24 @@ class AssetGenImage extends AssetImage {
bool matchTextDirection = false,
bool gaplessPlayback = false,
bool isAntiAlias = false,
String? package,
FilterQuality filterQuality = FilterQuality.low,
int? cacheWidth,
int? cacheHeight,
}) {
return Image(
return Image.asset(
_assetName,
key: key,
image: this,
bundle: bundle,
frameBuilder: frameBuilder,
loadingBuilder: loadingBuilder,
errorBuilder: errorBuilder,
semanticLabel: semanticLabel,
excludeFromSemantics: excludeFromSemantics,
scale: scale,
width: width,
height: height,
color: color,
opacity: opacity,
colorBlendMode: colorBlendMode,
fit: fit,
alignment: alignment,
@ -609,9 +620,12 @@ class AssetGenImage extends AssetImage {
matchTextDirection: matchTextDirection,
gaplessPlayback: gaplessPlayback,
isAntiAlias: isAntiAlias,
package: package,
filterQuality: filterQuality,
cacheWidth: cacheWidth,
cacheHeight: cacheHeight,
);
}
String get path => assetName;
String get path => _assetName;
}

@ -3,6 +3,8 @@
/// FlutterGen
/// *****************************************************
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: directives_ordering,unnecessary_import
class FontFamily {

@ -2,9 +2,9 @@
// Project imports:
import 'package:aku_new_community_manager/provider/app_provider.dart';
import 'package:aku_new_community_manager/provider/clock_timer_provider.dart';
import 'package:aku_new_community_manager/provider/data_provider.dart';
import 'package:aku_new_community_manager/provider/message_provider.dart';
import 'package:aku_new_community_manager/provider/timer_provider.dart';
import 'package:aku_new_community_manager/provider/user_provider.dart';
import 'package:aku_new_community_manager/style/apptheme.dart';
import 'package:aku_new_community_manager/tools/user_tool.dart';

@ -1,4 +1,5 @@
import 'package:aku_new_community_manager/new_ui/auth/sign_func.dart';
import 'package:aku_new_community_manager/provider/clock_timer_provider.dart';
import 'package:aku_new_community_manager/tools/user_tool.dart';
import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:bot_toast/bot_toast.dart';
@ -9,7 +10,6 @@ import 'package:provider/provider.dart';
import 'package:sms_autofill/sms_autofill.dart';
import 'package:velocity_x/velocity_x.dart';
import '../../provider/timer_provider.dart';
class CodeMessagePage extends StatefulWidget {
final String tel;

@ -1,6 +1,7 @@
import 'package:aku_new_community_manager/new_ui/auth/sign_func.dart';
import 'package:aku_new_community_manager/new_ui/auth/widget/login_button_widget.dart';
import 'package:aku_new_community_manager/new_ui/auth/widget/tel_textfield.dart';
import 'package:aku_new_community_manager/provider/clock_timer_provider.dart';
import 'package:aku_new_community_manager/tools/user_tool.dart';
import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:bot_toast/bot_toast.dart';
@ -11,7 +12,6 @@ import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'package:velocity_x/velocity_x.dart';
import '../../provider/timer_provider.dart';
import 'forgot_set_psd_page.dart';
class ForgotPsdPage extends StatefulWidget {

@ -3,6 +3,7 @@ import 'package:aku_new_community_manager/new_ui/auth/psd_verify.dart';
import 'package:aku_new_community_manager/new_ui/auth/sign_func.dart';
import 'package:aku_new_community_manager/new_ui/auth/widget/login_button_widget.dart';
import 'package:aku_new_community_manager/new_ui/auth/widget/psd_textfield.dart';
import 'package:aku_new_community_manager/provider/clock_timer_provider.dart';
import 'package:aku_new_community_manager/tools/user_tool.dart';
import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:bot_toast/bot_toast.dart';
@ -13,8 +14,6 @@ import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'package:velocity_x/velocity_x.dart';
import '../../provider/timer_provider.dart';
class ForgotSetPsdPage extends StatefulWidget {
final String tel;

@ -2,8 +2,7 @@ import 'package:aku_new_community_manager/new_ui/auth/sign_func.dart';
import 'package:aku_new_community_manager/new_ui/auth/widget/login_button_widget.dart';
import 'package:aku_new_community_manager/new_ui/auth/widget/psd_textfield.dart';
import 'package:aku_new_community_manager/new_ui/auth/widget/tel_textfield.dart';
import 'package:aku_new_community_manager/provider/app_provider.dart';
import 'package:aku_new_community_manager/provider/timer_provider.dart';
import 'package:aku_new_community_manager/provider/clock_timer_provider.dart';
import 'package:aku_new_community_manager/tools/user_tool.dart';
import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:bot_toast/bot_toast.dart';

@ -391,7 +391,7 @@ class _NewHomePageState extends State<NewHomePage> {
padding: EdgeInsets.symmetric(horizontal: 40.w, vertical: 48.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16.w),
image: DecorationImage(image: Assets.home.homeHead)),
image: DecorationImage(image: AssetImage(Assets.home.homeHead.path))),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
@ -433,7 +433,7 @@ class _NewHomePageState extends State<NewHomePage> {
borderRadius: BorderRadius.circular(4.w),
),
child:
'${UserTool.userProvider.userInfoModel!.positionName??''}'
'${UserTool.userProvider.userInfoModel!.positionName ?? ''}'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.85))

@ -147,30 +147,5 @@ class AppProvider extends ChangeNotifier {
_pickedCityAndCommunity = null;
notifyListeners();
}
///
/*int second = 60;
bool timerStart = false;
Timer? timer;
void startTimer() {
timerStart = true;
timer = Timer.periodic(Duration(seconds: 1), (timer) {
if (second > 0) {
second--;
notifyListeners();
} else {
stopTimer();
}
});
}
void stopTimer() {
second = 60;
timerStart = false;
timer?.cancel();
timer = null;
notifyListeners();
}*/
notifyListeners();
}

@ -2,7 +2,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
class ClockTimerProvider extends ChangeNotifier{
class ClockTimerProvider extends ChangeNotifier {
///
int second = 60;
bool timerStart = false;
@ -10,6 +10,10 @@ class ClockTimerProvider extends ChangeNotifier{
void startTimer() {
timerStart = true;
print(timer==null);
if (timer != null) {
return;
}
timer = Timer.periodic(Duration(seconds: 1), (timer) {
if (second > 0) {
second--;

@ -1,30 +0,0 @@
import 'dart:async';
import 'package:flutter/material.dart';
class ClockTimerProvider extends ChangeNotifier{
///
int second = 60;
bool timerStart = false;
Timer? timer;
void startTimer() {
timerStart = true;
timer = Timer.periodic(Duration(seconds: 1), (timer) {
if (second > 0) {
second--;
notifyListeners();
} else {
stopTimer();
}
});
}
void stopTimer() {
second = 60;
timerStart = false;
timer?.cancel();
timer = null;
notifyListeners();
}
}

@ -27,7 +27,6 @@ class UserProvider extends ChangeNotifier {
await HiveStore.appBox!.put('login', true);
if (isLogin) {
await updateUserInfo();
WebSocketUtil().setUser(_userInfoModel!.id.toString());
WebSocketUtil().startWebSocket();
await SignFunc.checkNameAndAccount();
}

@ -24,6 +24,7 @@ class UserInfoModel extends Equatable {
final String? entryDate;
final String? remake;
final List<ImgModel>? imgList;
final int communityCode;
final String communityName;
final String? positionName;
final int? workOrderJurisdiction;
@ -86,11 +87,12 @@ class UserInfoModel extends Equatable {
this.lastLoginDate,
this.nickName,
this.address,
required this.entryDate,
this.entryDate,
this.remake,
this.imgList,
required this.communityCode,
required this.communityName,
required this.positionName,
this.positionName,
this.workOrderJurisdiction,
});
}

@ -27,6 +27,7 @@ UserInfoModel _$UserInfoModelFromJson(Map<String, dynamic> json) =>
imgList: (json['imgList'] as List<dynamic>?)
?.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
communityCode: json['communityCode'] as int,
communityName: json['communityName'] as String,
positionName: json['positionName'] as String?,
workOrderJurisdiction: json['workOrderJurisdiction'] as int?,

@ -1,9 +1,9 @@
// Package imports:
// Project imports:
import 'package:aku_new_community_manager/provider/app_provider.dart';
import 'package:aku_new_community_manager/provider/clock_timer_provider.dart';
import 'package:aku_new_community_manager/provider/data_provider.dart';
import 'package:aku_new_community_manager/provider/message_provider.dart';
import 'package:aku_new_community_manager/provider/timer_provider.dart';
import 'package:aku_new_community_manager/provider/user_provider.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';

@ -1,11 +1,11 @@
import 'dart:async';
import 'package:aku_new_community_manager/tools/user_tool.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:power_logger/power_logger.dart';
import 'package:web_socket_channel/io.dart';
import 'package:web_socket_channel/web_socket_channel.dart';
const String baseUri = 'wss://shop.kaidalai.cn/websocket/butlerApp';
enum SOCKETSTATUS {
CONNECTED, //
BREAKOFF, //
@ -17,13 +17,18 @@ class WebSocketUtil {
//
WebSocketUtil._();
//
factory WebSocketUtil() => _socket;
IOWebSocketChannel? _webSocket;
///
String _user = 'admin';
static const String baseUri = 'wss://saas.kaidalai.cn/websocket/butlerApp';
String get urlAddress =>
'$baseUri/${UserTool.userProvider.userInfoModel?.communityCode}/${UserTool.userProvider.userInfoModel?.nickName}';
///
SOCKETSTATUS _socketStatus = SOCKETSTATUS.CLOSED;
@ -79,26 +84,23 @@ class WebSocketUtil {
print('——————————webSocket init ——————————');
}
///
void setUser(String user) {
this._user = user;
}
///websocket
void startWebSocket() {
closeWebSocket();
try {
_webSocket = IOWebSocketChannel.connect(Uri.parse('$baseUri/$_user'));
print('webSocket已连接服务器$baseUri/$_user');
_webSocket = IOWebSocketChannel.connect(Uri.parse(urlAddress));
print('webSocket已连接服务器$urlAddress');
_socketStatus = SOCKETSTATUS.CONNECTED;
endReconnect();
onStart?.call();
_webSocket!.stream.listen(
(event) => webSocketReceiveMessage(event as String),
onError: webSocketOnError, );
onError: webSocketOnError,
);
initHeartBeat();
} catch (e) {
BotToast.showText(text: 'webSocket连接失败');
print('webSocket连接失败');
onError?.call(e);
LoggerData.addData(e);
}

Loading…
Cancel
Save