Browse Source

Merge remote-tracking branch 'master/master'

# Conflicts:
#	lib/generated/i18n.dart
master
jiahao 5 years ago
parent
commit
bb974b674d
55 changed files with 638 additions and 749 deletions
  1. +2
    -0
      android/.settings/org.eclipse.buildship.core.prefs
  2. +3
    -3
      android/app/build.gradle
  3. +14
    -8
      lib/chat/ChatPage.dart
  4. +6
    -0
      lib/chat/ChatPageItem.dart
  5. +2
    -2
      lib/chat/emoji_gif_text.dart
  6. +42
    -76
      lib/chat/full_img_view.dart
  7. +13
    -0
      lib/chat/group_chat_view.dart
  8. +51
    -46
      lib/chat/util_keyboard.dart
  9. +0
    -1
      lib/data/UserData.dart
  10. +10
    -0
      lib/data/constants.dart
  11. +5
    -4
      lib/home/AddProgram.dart
  12. +2
    -0
      lib/home/DiscoverPage.dart
  13. +1
    -2
      lib/home/EditData.dart
  14. +1
    -2
      lib/home/IndexPage.dart
  15. +1
    -5
      lib/home/InfoList.dart
  16. +3
    -3
      lib/home/InformUser.dart
  17. +0
    -1
      lib/home/MoneyPageOld.dart
  18. +2
    -1
      lib/home/Myprogram.dart
  19. +55
    -182
      lib/home/ProfilePage.dart
  20. +2
    -3
      lib/home/ProgramDetail.dart
  21. +1
    -1
      lib/home/SearchPage.dart
  22. +1
    -1
      lib/home/add_friend.dart
  23. +0
    -10
      lib/home/alter_select_view.dart
  24. +2
    -2
      lib/home/create_group_view.dart
  25. +2
    -2
      lib/home/daily_bonus_page.dart
  26. +13
    -10
      lib/home/friend_page.dart
  27. +3
    -5
      lib/home/homeMain.dart
  28. +0
    -19
      lib/home/last_chat_item.dart
  29. +1
    -1
      lib/home/last_chat_record_widget.dart
  30. +0
    -1
      lib/home/money_detail.dart
  31. +1
    -1
      lib/home/my_qr.dart
  32. +1
    -2
      lib/home/qr_scanner_view.dart
  33. +2
    -2
      lib/home/service_view.dart
  34. +3
    -4
      lib/home/splash_page.dart
  35. +4
    -15
      lib/main.dart
  36. +1
    -1
      lib/map/google_map_location_picker.dart
  37. +1
    -1
      lib/map/search_input.dart
  38. +11
    -12
      lib/models/last_msg_description.dart
  39. +0
    -13
      lib/photo/ui/page/photo_folder_select_menu.dart
  40. +1
    -1
      lib/utils/ChargeMoney.dart
  41. +16
    -20
      lib/utils/CustomUI.dart
  42. +24
    -14
      lib/utils/HttpUtil.dart
  43. +3
    -3
      lib/utils/LoadingDialog.dart
  44. +2
    -2
      lib/utils/MessageBox.dart
  45. +1
    -2
      lib/utils/NetUtil.dart
  46. +255
    -213
      lib/utils/TempUserCard.dart
  47. +4
    -4
      lib/utils/UserCard.dart
  48. +31
    -12
      lib/utils/app_navigator.dart
  49. +0
    -3
      lib/utils/blacklist_mgr.dart
  50. +2
    -2
      lib/utils/conversation_table.dart
  51. +2
    -2
      lib/utils/keyboard/bottom_area_avoider.dart
  52. +8
    -1
      lib/utils/msgHandler.dart
  53. +22
    -18
      lib/utils/receive_share_file.dart
  54. +2
    -7
      lib/utils/screen_shot.dart
  55. +3
    -3
      lib/utils/upload_util.dart

+ 2
- 0
android/.settings/org.eclipse.buildship.core.prefs View File

@@ -0,0 +1,2 @@
connection.project.dir=
eclipse.preferences.version=1

+ 3
- 3
android/app/build.gradle View File

@@ -56,9 +56,9 @@ android {
// manifestPlaceholders = [ // manifestPlaceholders = [
// AMAP_KEY : "1fd4e93e3b4b13747da41f484c955fe2", /// 高德地图key // AMAP_KEY : "1fd4e93e3b4b13747da41f484c955fe2", /// 高德地图key
// ] // ]
ndk {
abiFilters 'armeabi-v7a'
}
// ndk {
// abiFilters 'armeabi-v7a'
// }
multiDexEnabled true multiDexEnabled true
manifestPlaceholders = [ manifestPlaceholders = [
JPUSH_PKGNAME : 'com.cyhd.henhoandroid', JPUSH_PKGNAME : 'com.cyhd.henhoandroid',


+ 14
- 8
lib/chat/ChatPage.dart View File

@@ -36,8 +36,6 @@ import 'ChatPageItem.dart';
import 'input_bar.dart'; import 'input_bar.dart';
import 'package:chat/utils/PopUpMenu.dart' as myPop; import 'package:chat/utils/PopUpMenu.dart' as myPop;
import 'package:chat/models/money_change.dart'; import 'package:chat/models/money_change.dart';
class ChatPage extends StatefulWidget { class ChatPage extends StatefulWidget {
final int friendId; final int friendId;
final int enterType; // 0默认 1图片 final int enterType; // 0默认 1图片
@@ -197,14 +195,22 @@ class _ChatPageState extends State<ChatPage> {
if (widget.enterType == 1) { if (widget.enterType == 1) {
print('接收到的:${widget.enterContent}'); print('接收到的:${widget.enterContent}');
File file = new File(widget.enterContent);
if(file.existsSync()){
print('接收到的文件--存在');
}else{
print('接收到的文件--不存在');
_sendFile(File(widget.enterContent));
} else if (widget.enterType == 2) {
//转发消息
MsgModel originMsg = widget.enterContent;
MsgModel msg = MsgHandler.createSendMsg(
ChatType.valueOf(originMsg.msgType), originMsg.msgContent);
msg.extraInfo = originMsg.extraInfo;
msg.extraFile = originMsg.extraFile;
msg.localFile = originMsg.localFile;
msg.friendId = widget.friendId;
if (msg.localFile != null) {
msg.state = MsgState.Uploaded;
} }
_sendFile(File(widget.enterContent));
sendMsg(msg);
} }
}); });
} }


+ 6
- 0
lib/chat/ChatPageItem.dart View File

@@ -614,6 +614,7 @@ class _ChatPageItemState extends State<ChatPageItem>
List<String> actions = [ List<String> actions = [
I18n.of(context).delete, I18n.of(context).delete,
I18n.of(context).reply, I18n.of(context).reply,
'转发'
]; ];
actionsFunc.add(() { actionsFunc.add(() {
@@ -623,6 +624,11 @@ class _ChatPageItemState extends State<ChatPageItem>
print('发送引用的消息'); print('发送引用的消息');
MessageMgr().emit('Reply Select Message', widget.msg); MessageMgr().emit('Reply Select Message', widget.msg);
}); });
actionsFunc.add(() {
print('转发消息');
AppNavigator.pushForwardPage(context, widget.msg);
});
if (widget.msg.msgType == ChatType.TextChatType.value) { if (widget.msg.msgType == ChatType.TextChatType.value) {
actions.insert(0, I18n.of(context).copy); actions.insert(0, I18n.of(context).copy);


+ 2
- 2
lib/chat/emoji_gif_text.dart View File

@@ -1,5 +1,5 @@
import 'package:chat/generated/i18n.dart'; import 'package:chat/generated/i18n.dart';
import 'package:chat/utils/LoadingDialog.dart';
import 'package:chat/data/constants.dart';
import 'package:extended_text_library/extended_text_library.dart'; import 'package:extended_text_library/extended_text_library.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -28,7 +28,7 @@ class EmojiGifText extends SpecialText {
imageHeight: size, imageHeight: size,
start: start, start: start,
fit: BoxFit.fill, fit: BoxFit.fill,
margin: EdgeInsets.only(left: 2.0, top: 2.0, right: 2.0)):SpecialTextSpan(text:'[${I18n.of(LoadingManage.context).emoji}]', actualText: '' );
margin: EdgeInsets.only(left: 2.0, top: 2.0, right: 2.0)):SpecialTextSpan(text:'[${I18n.of(Constants.getCurrentContext()).emoji}]', actualText: '' );
// return Image.asset(EmojiGifUitl.instance.emojiMap[key]); // return Image.asset(EmojiGifUitl.instance.emojiMap[key]);


+ 42
- 76
lib/chat/full_img_view.dart View File

@@ -1,14 +1,14 @@
import 'dart:io'; import 'dart:io';
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:chat/chat/download_item.dart';
import 'package:chat/generated/i18n.dart'; import 'package:chat/generated/i18n.dart';
import 'package:chat/models/ChatMsg.dart'; import 'package:chat/models/ChatMsg.dart';
import 'package:chat/utils/screen.dart';
import 'package:extended_image/extended_image.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:image_gallery_saver/image_gallery_saver.dart'; import 'package:image_gallery_saver/image_gallery_saver.dart';
import 'package:oktoast/oktoast.dart'; import 'package:oktoast/oktoast.dart';
import '../r.dart';
class PhotoPage extends StatefulWidget { class PhotoPage extends StatefulWidget {
final MsgModel msg; final MsgModel msg;
@@ -20,12 +20,6 @@ class PhotoPage extends StatefulWidget {
class _PhotoPageState extends State<PhotoPage> class _PhotoPageState extends State<PhotoPage>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin {
AnimationController _controller; AnimationController _controller;
Animation<Offset> _animation;
Offset _offset = Offset.zero;
double _scale = 1.0;
Offset _normalizedOffset;
double _previousScale;
double _kMinFlingVelocity = 600.0;
ImageProvider provider; ImageProvider provider;
@@ -37,7 +31,6 @@ class _PhotoPageState extends State<PhotoPage>
_controller = AnimationController(vsync: this); _controller = AnimationController(vsync: this);
_controller.addListener(() { _controller.addListener(() {
setState(() { setState(() {
_offset = _animation.value;
}); });
}); });
} }
@@ -59,75 +52,50 @@ class _PhotoPageState extends State<PhotoPage>
super.dispose(); super.dispose();
} }
Offset _clampOffset(Offset offset) {
final Size size = context.size;
// widget的屏幕宽度
final Offset minOffset = Offset(size.width, size.height) * (1.0 - _scale);
// 限制他的最小尺寸
return Offset(
offset.dx.clamp(minOffset.dx, 0.0), offset.dy.clamp(minOffset.dy, 0.0));
}
void _handleOnScaleStart(ScaleStartDetails details) {
setState(() {
_previousScale = _scale;
_normalizedOffset = (details.focalPoint - _offset) / _scale;
// 计算图片放大后的位置
_controller.stop();
});
}
void _handleOnScaleUpdate(ScaleUpdateDetails details) {
setState(() {
_scale = (_previousScale * details.scale).clamp(1.0, 3.0);
// 限制放大倍数 1~3倍
_offset = _clampOffset(details.focalPoint - _normalizedOffset * _scale);
// 更新当前位置
});
}
void _handleOnScaleEnd(ScaleEndDetails details) {
final double magnitude = details.velocity.pixelsPerSecond.distance;
if (magnitude < _kMinFlingVelocity) return;
final Offset direction = details.velocity.pixelsPerSecond / magnitude;
// 计算当前的方向
final double distance = (Offset.zero & context.size).shortestSide;
// 计算放大倍速,并相应的放大宽和高,比如原来是600*480的图片,放大后倍数为1.25倍时,宽和高是同时变化的
_animation = _controller.drive(Tween<Offset>(
begin: _offset, end: _clampOffset(_offset + direction * distance)));
_controller
..value = 0.0
..fling(velocity: magnitude / 1000.0);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Uint8List fileData;
if (widget.msg.localFile != null) {
fileData = File(widget.msg.localFile).readAsBytesSync();
} else {
fileData = Uint8List.fromList(widget.msg.msgContent);
}
return GestureDetector( return GestureDetector(
onTap: () {
Navigator.pop(context);
},
onScaleStart: _handleOnScaleStart,
onScaleUpdate: _handleOnScaleUpdate,
onScaleEnd: _handleOnScaleEnd,
child: Material(
child: DownloadItem(
msg: widget.msg,
isAutoDown: false,
onComplete: () {
getImgData();
setState(() {});
onTap: () {
Navigator.pop(context);
}, },
child: Transform(
transform: Matrix4.identity()
..translate(_offset.dx, _offset.dy)
..scale(_scale),
child: Container(
width: Screen.width,
height: Screen.height,
alignment: Alignment.center,
child: Stack( child: Stack(
children: <Widget>[ children: <Widget>[
Image(
fit: BoxFit.fitWidth,
image: provider ?? AssetImage(R.assetsImagesIcAlbum),
),
SingleChildScrollView(
child: Column(
children: <Widget>[
Container(
width: Screen.width,
constraints: BoxConstraints(minHeight: Screen.height),
child: ExtendedImage.memory(
fileData,
fit: BoxFit.fitWidth,
mode: ExtendedImageMode.gesture,
initGestureConfigHandler: (state) {
return GestureConfig(
minScale: 0.9,
animationMinScale: 0.7,
maxScale: 3.0,
animationMaxScale: 3.5,
speed: 1.0,
inertialSpeed: 100.0,
initialScale: 1.0,
inPageView: true,
initialAlignment: InitialAlignment.center,
);
},
))
],
)),
Positioned( Positioned(
right: 10, right: 10,
bottom: 10, bottom: 10,
@@ -141,14 +109,12 @@ class _PhotoPageState extends State<PhotoPage>
child: Icon(Icons.save_alt, color: Colors.white70), child: Icon(Icons.save_alt, color: Colors.white70),
))) )))
], ],
)),
)),
);
)));
} }
saveToGallery() async { saveToGallery() async {
if (widget.msg.localFile != null) { if (widget.msg.localFile != null) {
var data= File(widget.msg.localFile).readAsBytesSync();
var data = File(widget.msg.localFile).readAsBytesSync();
ImageGallerySaver.saveImage(data).then((res) { ImageGallerySaver.saveImage(data).then((res) {
print(res); print(res);
if (res != null) { if (res != null) {


+ 13
- 0
lib/chat/group_chat_view.dart View File

@@ -106,6 +106,19 @@ class _GroupChatPageState extends State<GroupChatPage> {
if (widget.enterType == 1) { if (widget.enterType == 1) {
print('接收到的:${widget.enterContent}'); print('接收到的:${widget.enterContent}');
_sendFile(File(widget.enterContent)); _sendFile(File(widget.enterContent));
} else if (widget.enterType == 2) {
//转发消息
MsgModel originMsg = widget.enterContent;
MsgModel msg = MsgHandler.createSendMsg(
ChatType.valueOf(originMsg.msgType), originMsg.msgContent,channelType: ChatChannelType.Group);
msg.extraInfo = originMsg.extraInfo;
msg.extraFile = originMsg.extraFile;
msg.localFile = originMsg.localFile;
if (msg.localFile != null) {
msg.state = MsgState.Uploaded;
}
sendMsg(msg);
} }
}); });
} }


+ 51
- 46
lib/chat/util_keyboard.dart View File

@@ -13,7 +13,7 @@ import 'package:chat/proto/all.pbserver.dart';
import 'package:chat/utils/ChargeMoney.dart'; import 'package:chat/utils/ChargeMoney.dart';
import 'package:chat/utils/CustomUI.dart'; import 'package:chat/utils/CustomUI.dart';
import 'package:chat/utils/HttpUtil.dart'; import 'package:chat/utils/HttpUtil.dart';
import 'package:chat/utils/LoadingDialog.dart';
import 'package:chat/data/constants.dart';
import 'package:chat/utils/app_navigator.dart'; import 'package:chat/utils/app_navigator.dart';
import 'package:chat/utils/blacklist_mgr.dart'; import 'package:chat/utils/blacklist_mgr.dart';
import 'package:chat/utils/image_util.dart'; import 'package:chat/utils/image_util.dart';
@@ -33,13 +33,18 @@ import 'package:file_picker/file_picker.dart';
import '../r.dart'; import '../r.dart';
class UtilKeyboard extends StatelessWidget {
class UtilKeyboard extends StatefulWidget {
final double keyboardHeight; final double keyboardHeight;
final Function sendMsg; final Function sendMsg;
final bool isGroup; final bool isGroup;
UtilKeyboard({this.keyboardHeight, this.sendMsg, this.isGroup}); UtilKeyboard({this.keyboardHeight, this.sendMsg, this.isGroup});
bool isAuthority = false;
@override
_UtilKeyboardState createState() => _UtilKeyboardState();
}
class _UtilKeyboardState extends State<UtilKeyboard> {
bool isAuthority = false;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -58,7 +63,7 @@ class UtilKeyboard extends StatelessWidget {
_sendVideo(context); _sendVideo(context);
})); }));
if (!isGroup) {
if (!widget.isGroup) {
iconList.add( iconList.add(
_buildOtherSelect(R.assetsImagesChatItem3, I18n.of(context).chat, () { _buildOtherSelect(R.assetsImagesChatItem3, I18n.of(context).chat, () {
_audioChat(context); _audioChat(context);
@@ -70,7 +75,7 @@ class UtilKeyboard extends StatelessWidget {
_openMap(context); _openMap(context);
})); }));
if (!isGroup) {
if (!widget.isGroup) {
iconList.add(Offstage( iconList.add(Offstage(
offstage: !isShowRedPacket, offstage: !isShowRedPacket,
child: _buildOtherSelect( child: _buildOtherSelect(
@@ -91,7 +96,7 @@ class UtilKeyboard extends StatelessWidget {
return Container( return Container(
width: Screen.width, width: Screen.width,
color: Colors.white, color: Colors.white,
height: keyboardHeight,
height: widget.keyboardHeight,
padding: EdgeInsets.only(top: 20, bottom: 10, left: 20), padding: EdgeInsets.only(top: 20, bottom: 10, left: 20),
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: Wrap(spacing: 10.0, runSpacing: 20.0, children: iconList)); child: Wrap(spacing: 10.0, runSpacing: 20.0, children: iconList));
@@ -99,7 +104,7 @@ class UtilKeyboard extends StatelessWidget {
_showGiftSheet(BuildContext context) { _showGiftSheet(BuildContext context) {
int friendId = 0; int friendId = 0;
if (!isGroup) {
if (!widget.isGroup) {
friendId = Provider.of<int>(context); friendId = Provider.of<int>(context);
} }
@@ -113,7 +118,7 @@ class UtilKeyboard extends StatelessWidget {
builder: (BuildContext context) { builder: (BuildContext context) {
return StatefulBuilder( return StatefulBuilder(
builder: (BuildContext context, setBottomSheetState) { builder: (BuildContext context, setBottomSheetState) {
return GiftSelectWidget(friendId, sendMsg);
return GiftSelectWidget(friendId, widget.sendMsg);
}, },
); );
}); });
@@ -135,16 +140,16 @@ class UtilKeyboard extends StatelessWidget {
var reslutStr = jsonEncode(result); var reslutStr = jsonEncode(result);
int friendId = 0; int friendId = 0;
if (!isGroup) {
if (!widget.isGroup) {
friendId = Provider.of<int>(context); friendId = Provider.of<int>(context);
} }
var msg = MsgHandler.createSendMsg( var msg = MsgHandler.createSendMsg(
ChatType.PlaceChatType, utf8.encode(reslutStr), ChatType.PlaceChatType, utf8.encode(reslutStr),
friendId: friendId, friendId: friendId,
channelType: channelType:
isGroup ? ChatChannelType.Group : ChatChannelType.Session);
widget.isGroup ? ChatChannelType.Group : ChatChannelType.Session);
sendMsg(msg);
widget.sendMsg(msg);
} }
} }
@@ -163,8 +168,7 @@ class UtilKeyboard extends StatelessWidget {
showToast(I18n.of(context).cantt_voice); showToast(I18n.of(context).cantt_voice);
return; return;
} }
if (BlacklistMgr.isBlaklistMe(info.userId)) {
if (BlacklistMgr.isBlaklistMe(info.userId)) {
showToast(I18n.of(context).you_are_blaklisted); showToast(I18n.of(context).you_are_blaklisted);
return; return;
} }
@@ -285,7 +289,7 @@ class UtilKeyboard extends StatelessWidget {
int aspectRatio = rect.width * 100 ~/ rect.height; int aspectRatio = rect.width * 100 ~/ rect.height;
int friendId = 0; int friendId = 0;
if (!isGroup) {
if (!widget.isGroup) {
friendId = Provider.of<int>(context); friendId = Provider.of<int>(context);
} }
var msg = MsgHandler.createSendMsg(ChatType.ImageChatType, sendImg, var msg = MsgHandler.createSendMsg(ChatType.ImageChatType, sendImg,
@@ -293,9 +297,9 @@ class UtilKeyboard extends StatelessWidget {
friendId: friendId, friendId: friendId,
localFile: isNeedUpload ? imgFile.absolute.path : null, localFile: isNeedUpload ? imgFile.absolute.path : null,
channelType: channelType:
isGroup ? ChatChannelType.Group : ChatChannelType.Session);
widget.isGroup ? ChatChannelType.Group : ChatChannelType.Session);
sendMsg(msg);
widget.sendMsg(msg);
} }
} }
@@ -304,38 +308,39 @@ class UtilKeyboard extends StatelessWidget {
int fileSize = file.lengthSync(); int fileSize = file.lengthSync();
print('选择的文件 ${file.path} 大小 $fileSize'); print('选择的文件 ${file.path} 大小 $fileSize');
if (fileSize > 33 * 1024 * 1024) {
showToast('文件大于33M');
return;
}
if (fileSize > 33 * 1024 * 1024) {
showToast('文件大于33M');
return;
}
int friendId = 0;
if (!isGroup) {
friendId = Provider.of<int>(context);
}
int friendId = 0;
if (!widget.isGroup) {
friendId = Provider.of<int>(context);
}
var fileName = file.path.split('/').last;
print('fileName $fileName');
var fileName = file.path.split('/').last;
print('fileName $fileName');
var ext = '';
var extList = fileName.split('.');
if (extList.length > 1) {
ext = extList.last;
}
print('ext $ext');
var ext = '';
var extList = fileName.split('.');
if (extList.length > 1) {
ext = extList.last;
}
print('ext $ext');
var fileMsg = FileChat.create();
fileMsg.type = ext;
fileMsg.size = fileSize;
fileMsg.name = fileName;
var fileMsg = FileChat.create();
fileMsg.type = ext;
fileMsg.size = fileSize;
fileMsg.name = fileName;
var msg = MsgHandler.createSendMsg(ChatType.FileChatType, fileMsg.writeToBuffer(),
friendId: friendId,
localFile: file.path,
channelType:
widget.isGroup ? ChatChannelType.Group : ChatChannelType.Session);
var msg = MsgHandler.createSendMsg(
ChatType.FileChatType, fileMsg.writeToBuffer(),
friendId: friendId,
localFile: file.path,
channelType: isGroup ? ChatChannelType.Group : ChatChannelType.Session);
widget.sendMsg(msg);
sendMsg(msg);
} }
void _sendVideo(BuildContext context) async { void _sendVideo(BuildContext context) async {
@@ -349,7 +354,7 @@ class UtilKeyboard extends StatelessWidget {
print('视频大小:$videoSize'); print('视频大小:$videoSize');
if (videoSize > 33 * 1024 * 1024) { if (videoSize > 33 * 1024 * 1024) {
showToast(I18n.of(LoadingManage.context).video_more_big);
showToast(I18n.of(Constants.getCurrentContext()).video_more_big);
return; return;
} }
@@ -361,7 +366,7 @@ class UtilKeyboard extends StatelessWidget {
int aspectRatio = rect.width * 100 ~/ rect.height; int aspectRatio = rect.width * 100 ~/ rect.height;
int friendId = 0; int friendId = 0;
if (!isGroup) {
if (!widget.isGroup) {
friendId = Provider.of<int>(context); friendId = Provider.of<int>(context);
} }
var msg = MsgHandler.createSendMsg(ChatType.ShortVideoChatType, thumbnail, var msg = MsgHandler.createSendMsg(ChatType.ShortVideoChatType, thumbnail,
@@ -369,9 +374,9 @@ class UtilKeyboard extends StatelessWidget {
friendId: friendId, friendId: friendId,
localFile: video.path, localFile: video.path,
channelType: channelType:
isGroup ? ChatChannelType.Group : ChatChannelType.Session);
widget.isGroup ? ChatChannelType.Group : ChatChannelType.Session);
sendMsg(msg);
widget.sendMsg(msg);
} }
} }


+ 0
- 1
lib/data/UserData.dart View File

@@ -219,7 +219,6 @@ class UserData {
await prefs.setDouble(Constants.Longitude, UserData().longitude); await prefs.setDouble(Constants.Longitude, UserData().longitude);
HttpUtil().getAddress(loc.longitude, loc.latitude); HttpUtil().getAddress(loc.longitude, loc.latitude);
//HttpUtil().getAddress(106.600798525456, 10.7517368433358); //HttpUtil().getAddress(106.600798525456, 10.7517368433358);
//HttpUtil().getAddress(113.8669580078125, 22.568465711805555);
if (callback != null) callback(loc); if (callback != null) callback(loc);
} }
} }


+ 10
- 0
lib/data/constants.dart View File

@@ -109,6 +109,16 @@ class Constants {
///ture 应用商店版本 false线下渠道 ///ture 应用商店版本 false线下渠道
static const bool isStoreVersion = false; static const bool isStoreVersion = false;
//app全局key,处理content
static final GlobalKey<NavigatorState> navigatorKey = GlobalKey();
/// 获取当前的state
static NavigatorState getCurrentState() => navigatorKey.currentState;
/// 获取当前的context
static BuildContext getCurrentContext() => navigatorKey.currentContext;
///在pubspec.yaml中修改版本号 ///在pubspec.yaml中修改版本号
static String versionName = '1.0.0'; static String versionName = '1.0.0';


+ 5
- 4
lib/home/AddProgram.dart View File

@@ -868,7 +868,8 @@ class _AddProgramState extends State<AddProgram> {
contentPadding: contentPadding:
EdgeInsets.only(top: 6, bottom: 10, right: 10), EdgeInsets.only(top: 6, bottom: 10, right: 10),
hintText: I18n.of(context).please_civilization, hintText: I18n.of(context).please_civilization,
hintStyle: TextStyle(fontSize: 12, height: 1.15),
hintStyle:
TextStyle(fontSize: 12, height: 1.15),
border: InputBorder.none, border: InputBorder.none,
), ),
style: TextStyle( style: TextStyle(
@@ -1157,7 +1158,7 @@ class _AddProgramState extends State<AddProgram> {
.replaceFirst('/s1', UserData().addProgramPrice.toString()); .replaceFirst('/s1', UserData().addProgramPrice.toString());
} }
return Container( return Container(
padding: EdgeInsets.only(bottom: 100, left: 20, right: 20),
padding: EdgeInsets.only(bottom: 100, left: 20, right: 20),
child: Text( child: Text(
str, str,
textScaleFactor: 1.0, textScaleFactor: 1.0,
@@ -1311,8 +1312,8 @@ class _AddProgramState extends State<AddProgram> {
var hopeObject = ''; var hopeObject = '';
lovePeopleId.forEach((f) => hopeObject += hopeObject == '' ? f : ',$f'); lovePeopleId.forEach((f) => hopeObject += hopeObject == '' ? f : ',$f');
String temp = '';
String postTemp = '';
String temp='';
String postTemp='';
imgUrlList.forEach((str) { imgUrlList.forEach((str) {
temp += (temp == "" ? str : '|$str'); temp += (temp == "" ? str : '|$str');
postTemp += (postTemp == "" postTemp += (postTemp == ""


+ 2
- 0
lib/home/DiscoverPage.dart View File

@@ -691,6 +691,8 @@ class _DisCoverPageState extends State<DisCoverPage>
Widget _renderRow(int index, list, page) { Widget _renderRow(int index, list, page) {
if (index < list.length) { if (index < list.length) {
var userInfo = list[index]; var userInfo = list[index];
print('----------------------------------------------------');
print(userInfo);
return UserCard( return UserCard(
key: UniqueKey(), key: UniqueKey(),
userName: Provider.of<RefNameProvider>(context) userName: Provider.of<RefNameProvider>(context)


+ 1
- 2
lib/home/EditData.dart View File

@@ -742,8 +742,7 @@ class _EditPageState extends State<EditPage> {
widget.isEditPage ? idItem : Container(), widget.isEditPage ? idItem : Container(),
_buildDivider(), _buildDivider(),
_bottomBorderBox(I18n.of(context).nickname, I18n.of(context).fill_out, _bottomBorderBox(I18n.of(context).nickname, I18n.of(context).fill_out,
true, nickNameController, true, (str) => nickname = str,
inputFormatters: [LengthLimitingTextInputFormatter(20)]),
true, nickNameController, true, (str) => nickname = str),
_buildDivider(), _buildDivider(),
_bottomBorderBox(I18n.of(context).country, country, false, null, _bottomBorderBox(I18n.of(context).country, country, false, null,
countryId.length != 0, selectCountry), countryId.length != 0, selectCountry),


+ 1
- 2
lib/home/IndexPage.dart View File

@@ -1,6 +1,5 @@
import 'package:chat/data/UserData.dart'; import 'package:chat/data/UserData.dart';
import 'package:chat/generated/i18n.dart'; import 'package:chat/generated/i18n.dart';
import 'package:chat/utils/LoadingDialog.dart';
import 'package:chat/utils/screen.dart'; import 'package:chat/utils/screen.dart';
import 'package:connectivity/connectivity.dart'; import 'package:connectivity/connectivity.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@@ -153,7 +152,7 @@ class _IndexPageState extends State<IndexPage> {
return; return;
} }
if (resData['data'] != null) { if (resData['data'] != null) {
HttpUtil().changePage(LoadingManage.context, resData);
HttpUtil().changePage(Constants.getCurrentContext(), resData);
} }
} }


+ 1
- 5
lib/home/InfoList.dart View File

@@ -3,7 +3,6 @@ import 'package:chat/data/WebData.dart';
import 'package:chat/generated/i18n.dart'; import 'package:chat/generated/i18n.dart';
import 'package:chat/home/ProfilePage.dart'; import 'package:chat/home/ProfilePage.dart';
import 'package:chat/home/rich_title.dart'; import 'package:chat/home/rich_title.dart';
import 'package:chat/models/ref_name_provider.dart';
import 'package:chat/utils/CustomUI.dart'; import 'package:chat/utils/CustomUI.dart';
import 'package:chat/utils/HttpUtil.dart'; import 'package:chat/utils/HttpUtil.dart';
import 'package:chat/utils/MessageMgr.dart'; import 'package:chat/utils/MessageMgr.dart';
@@ -16,9 +15,7 @@ import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:oktoast/oktoast.dart'; import 'package:oktoast/oktoast.dart';
import 'package:provider/provider.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import '../data/constants.dart' show AppColors, Constants; import '../data/constants.dart' show AppColors, Constants;
@@ -27,6 +24,7 @@ import 'package:cached_network_image/cached_network_image.dart';
import 'ProgramDetail.dart'; import 'ProgramDetail.dart';
class _ConversationItem extends StatelessWidget { class _ConversationItem extends StatelessWidget {
const _ConversationItem( const _ConversationItem(
{Key key, {Key key,
@@ -352,8 +350,6 @@ class _ConversationItem extends StatelessWidget {
} }
} }
class InfoListPage extends StatefulWidget { class InfoListPage extends StatefulWidget {
@required @required
final String title; final String title;


+ 3
- 3
lib/home/InformUser.dart View File

@@ -27,7 +27,7 @@ enum reason {
liar, liar,
} }
int Max_Img_Num = 4;
const int MaxImgNum = 4;
class InformUserPage extends StatefulWidget { class InformUserPage extends StatefulWidget {
@required @required
@@ -182,7 +182,7 @@ class _InformUserPageState extends State<InformUserPage> {
var photos = await PhotoPicker.pickAsset( var photos = await PhotoPicker.pickAsset(
context: context, context: context,
themeColor: Color(0xFFF0F0F0), themeColor: Color(0xFFF0F0F0),
maxSelected: Max_Img_Num - imgUrlList.length,
maxSelected: MaxImgNum - imgUrlList.length,
textColor: Color(0xFF3F3F3F), textColor: Color(0xFF3F3F3F),
pickType: PickType.onlyImage); pickType: PickType.onlyImage);
@@ -346,7 +346,7 @@ class _InformUserPageState extends State<InformUserPage> {
List<Widget> list = imgUrlList.map((f) { List<Widget> list = imgUrlList.map((f) {
return _buildImg(f); return _buildImg(f);
}).toList(); }).toList();
if (list.length < Max_Img_Num) {
if (list.length < MaxImgNum) {
list.add(upButton); list.add(upButton);
} }
var socialCard = new Container( var socialCard = new Container(


+ 0
- 1
lib/home/MoneyPageOld.dart View File

@@ -8,7 +8,6 @@ import 'package:chat/data/constants.dart';
import 'package:chat/data/conversation.dart'; import 'package:chat/data/conversation.dart';
import 'package:chat/generated/i18n.dart'; import 'package:chat/generated/i18n.dart';
import 'package:chat/home/BindBank.dart'; import 'package:chat/home/BindBank.dart';
import 'package:chat/home/InfoList.dart';
import 'package:chat/home/ProfilePage.dart'; import 'package:chat/home/ProfilePage.dart';
import 'package:chat/home/rich_title.dart'; import 'package:chat/home/rich_title.dart';
import 'package:chat/models/money_change.dart'; import 'package:chat/models/money_change.dart';


+ 2
- 1
lib/home/Myprogram.dart View File

@@ -171,7 +171,8 @@ class _MyProgramPageState extends State<MyProgramPage> {
), ),
centerTitle: true, centerTitle: true,
leading: CustomUI.buildCustomLeading(context), leading: CustomUI.buildCustomLeading(context),
elevation: 1,
elevation: 1,
actions: <Widget>[ actions: <Widget>[
isMyself isMyself
? myPop.PopupMenuButton<String>( ? myPop.PopupMenuButton<String>(


+ 55
- 182
lib/home/ProfilePage.dart View File

@@ -1,6 +1,5 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:chat/home/InfoList.dart';
import 'package:chat/home/fans_page.dart'; import 'package:chat/home/fans_page.dart';
import 'package:chat/home/goddess_hot.dart'; import 'package:chat/home/goddess_hot.dart';
import 'package:chat/home/rich_title.dart'; import 'package:chat/home/rich_title.dart';
@@ -260,50 +259,6 @@ class _ProfilePageState extends State<ProfilePage>
myMsg = userInfo.ownMsg; myMsg = userInfo.ownMsg;
} }
// getFirstDy() async {
// var data = {
// "userId": UserData().basicInfo.userId,
// "visitUserId": widget.userId,
// "type": 2,
// };
// data['sign'] = TokenMgr().getSign(data);
// data['page'] = 1;
// data['rows'] = 1;
// Response res = await HttpUtil().post('station/gain/program', data: data);
// var resData = res.data;
// if (resData['code'] == 0 && resData['data'] != null) {
// var imgUrl = resData['data'][0]['ImgUrl'];
// if (imgUrl != '') {
// firstDyImg = imgUrl.split('|')[0];
// if (mounted) {
// setState(() {});
// }
// }
// }
// }
// getFirstProgram() async {
// var data = {
// "userId": UserData().basicInfo.userId,
// "visitUserId": widget.userId,
// //"type": 1,
// };
// data['sign'] = TokenMgr().getSign(data);
// data['page'] = 1;
// data['rows'] = 1;
// Response res = await HttpUtil().post('station/gain/program', data: data);
// var resData = res.data;
// if (resData['code'] == 0 &&
// resData['data'] != null &&
// resData['data'][0]['Status'] == 0) {
// if (mounted) {
// setState(() {
// programId = resData['data'][0]['Id'];
// });
// }
// }
// }
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@@ -314,21 +269,6 @@ class _ProfilePageState extends State<ProfilePage>
messageOn(); messageOn();
initLocalData(); initLocalData();
getUserInfo(); getUserInfo();
initAnimation();
}
initAnimation() {
// animationController = AnimationController(
// duration: Duration(milliseconds: 600),
// vsync: this,
// );
// movement =
// Tween(begin: EdgeInsets.only(right: 0), end: EdgeInsets.only(right: 10))
// .animate(animationController)
// ..addListener(() {
// setState(() {});
// });
// animationController.repeat();
} }
void initMyController() {} void initMyController() {}
@@ -449,6 +389,9 @@ class _ProfilePageState extends State<ProfilePage>
data['sign'] = TokenMgr().getSign(data); data['sign'] = TokenMgr().getSign(data);
Response res = await HttpUtil().post('user/personal/album', data: data); Response res = await HttpUtil().post('user/personal/album', data: data);
if (res == null) {
return;
}
Map resData = res.data; Map resData = res.data;
if (resData['code'] == 0) { if (resData['code'] == 0) {
imgList = resData['data'] == null ? [] : resData['data']; imgList = resData['data'] == null ? [] : resData['data'];
@@ -1147,8 +1090,9 @@ class _ProfilePageState extends State<ProfilePage>
top: 20, top: 20,
child: InkWell( child: InkWell(
onTap: () async { onTap: () async {
if (!userInfo.isLike) { if (!userInfo.isLike) {
HttpUtil().setLove(userInfo.userId, () {
HttpUtil().setLove(userInfo.userId, () {
MessageMgr().emit('refresh_love_list', MessageMgr().emit('refresh_love_list',
{'UserId': userInfo.userId, 'flag': 0}); {'UserId': userInfo.userId, 'flag': 0});
setState(() { setState(() {
@@ -1426,7 +1370,6 @@ class _ProfilePageState extends State<ProfilePage>
context, I18n.of(context).blacklist_choose, I18n.of(context).determine, context, I18n.of(context).blacklist_choose, I18n.of(context).determine,
() async { () async {
Navigator.pop(context); Navigator.pop(context);
HttpUtil().blackUser(userInfo.userId, () { HttpUtil().blackUser(userInfo.userId, () {
isblack = true; isblack = true;
}); });
@@ -2147,25 +2090,15 @@ class _ProfilePageState extends State<ProfilePage>
description: I18n.of(context).recovery_photo, description: I18n.of(context).recovery_photo,
showDivider: false, showDivider: false,
showRightIcon: false, showRightIcon: false,
onPressed: () async {
CustomUI.buildOneConfirm(
onPressed: () async {CustomUI.buildOneConfirm(
context, context,
I18n.of(context).confrim_recovery, I18n.of(context).confrim_recovery,
I18n.of(context).determine, () async { I18n.of(context).determine, () async {
Map data = {
"userId": UserData().basicInfo.userId,
};
data['sign'] = TokenMgr().getSign(data);
Response res = await HttpUtil().post('user/recover/photos',
data: data, isShowLoading: true);
Map resData = res.data;
if (resData['code'] == 0) {
showToast(resData['msg']);
HttpUtil().resetPhoto(() {
Navigator.of(context).pop(); Navigator.of(context).pop();
userInfo.burnNum = 0; userInfo.burnNum = 0;
setState(() {}); setState(() {});
}
});
}); });
}, },
), ),
@@ -2176,51 +2109,6 @@ class _ProfilePageState extends State<ProfilePage>
: Container(); : Container();
} }
// Widget _buildApplyCode() {
// //帮朋友申请邀请码
// return isMan
// ? Container(
// margin: EdgeInsets.only(top: Separate_Size),
// padding: EdgeInsets.symmetric(horizontal: 10),
// child: FullWidthButton(
// title: I18n.of(context).apply_code,
// showDivider: false,
// showRightIcon: false,
// onPressed: () {
// CustomUI.buildOneConfirm(context, I18n.of(context).issue_choose,
// I18n.of(context).determine, () async {
// Map data = {
// "userId": UserData().basicInfo.userId,
// };
// data['sign'] = TokenMgr().getSign(data);
// Response res =
// await HttpUtil().post('user/helper/apply', data: data);
// Map resData = res.data;
// if (resData['code'] == 0) {
// Navigator.of(context).pop();
// CustomUI.buildOneConfirm(
// context,
// I18n.of(context).receive_incode,
// I18n.of(context).ok, () {
// Navigator.of(context).pop();
// });
// } else {
// showToast(resData['msg']);
// }
// });
// },
// ),
// decoration: BoxDecoration(
// color: Colors.white,
// border: Border(
// top: Constants.GreyBorderSide,
// bottom: Constants.GreyBorderSide)),
// )
// : Container();
// }
Widget _buildShare() { Widget _buildShare() {
//分享 //分享
return Container( return Container(
@@ -2277,8 +2165,6 @@ class _ProfilePageState extends State<ProfilePage>
Size screenSize = MediaQuery.of(context).size; Size screenSize = MediaQuery.of(context).size;
cardWidth = screenSize.width; cardWidth = screenSize.width;
Widget appBar = AppBar( Widget appBar = AppBar(
// backgroundColor: AppColors.NewAppbarBgColor,
//automaticallyImplyLeading: !isMyself,
leading: isMyself ? Container() : CustomUI.buildCustomLeading(context), leading: isMyself ? Container() : CustomUI.buildCustomLeading(context),
titleSpacing: isMyself ? -40 : NavigationToolbar.kMiddleSpacing, titleSpacing: isMyself ? -40 : NavigationToolbar.kMiddleSpacing,
title: isMyself title: isMyself
@@ -2434,7 +2320,7 @@ class _ProfilePageState extends State<ProfilePage>
), ),
onTap: isblack onTap: isblack
? () async { ? () async {
HttpUtil().cancleBlackUser(
HttpUtil().cancleBlackUser(
userInfo.userId, () { userInfo.userId, () {
Navigator.of(context).pop(); Navigator.of(context).pop();
isblack = false; isblack = false;
@@ -2572,66 +2458,55 @@ class _ProfilePageState extends State<ProfilePage>
), ),
], ],
); );
var bottomWidget = Container(
height: 55,
decoration: BoxDecoration(
border: Border(top: BorderSide(color: Color(0xffeaeaea))),
color: Constants.LightGreyBackgroundColor,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: widget.addMode == 1
? <Widget>[_inviteFdBtn()]
: (widget.addMode == 2
? [_dealInvite()]
: <Widget>[
_buildIcon(0xe633, I18n.of(context).evaluate, true,
() async {
Map data = {
"userid": userInfo.userId,
'evaluateuserid': UserData().basicInfo.userId,
};
data['sign'] = TokenMgr().getSign(data);
Response res = await HttpUtil().post('evaluate/user/info',
data: data, isShowLoading: true);
Map resData = res.data;
print(resData);
if (resData['code'] == 0) {
Navigator.of(context).push(TutorialOverlay(
child: ApplyContent(
userId: userInfo.userId,
isMan: isMan,
userInfo: resData['data'])));
} else {
showToast(resData['msg']);
}
}),
_buildIcon(0xe637, I18n.of(context).private_chat,
isCanWatch, isCanWatch ? buyChatAccount : null,
iconSize: 24.0),
_buildIcon(
0xe62f, I18n.of(context).chat, isCanWatch, onAudio)
]),
),
);
Widget content = Container( Widget content = Container(
color: Colors.white, color: Colors.white,
child: SafeArea( child: SafeArea(
child: Scaffold( child: Scaffold(
bottomNavigationBar: !isMyself
? Container(
height: 55,
decoration: BoxDecoration(
border:
Border(top: BorderSide(color: Color(0xffeaeaea))),
color: Constants.LightGreyBackgroundColor,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: widget.addMode == 1
? <Widget>[_inviteFdBtn()]
: (widget.addMode == 2
? [_dealInvite()]
: <Widget>[
_buildIcon(
0xe633, I18n.of(context).evaluate, true,
() async {
Map data = {
"userid": userInfo.userId,
'evaluateuserid':
UserData().basicInfo.userId,
};
data['sign'] = TokenMgr().getSign(data);
Response res = await HttpUtil().post(
'evaluate/user/info',
data: data,
isShowLoading: true);
Map resData = res.data;
print(resData);
if (resData['code'] == 0) {
Navigator.of(context).push(
TutorialOverlay(
child: ApplyContent(
userId: userInfo.userId,
isMan: isMan,
userInfo:
resData['data'])));
} else {
showToast(resData['msg']);
}
}),
_buildIcon(
0xe637,
I18n.of(context).private_chat,
isCanWatch,
isCanWatch ? buyChatAccount : null,
iconSize: 24.0),
_buildIcon(0xe62f, I18n.of(context).chat,
isCanWatch, onAudio)
]),
),
)
: null,
bottomNavigationBar: !isMyself ? bottomWidget : null,
appBar: appBar, appBar: appBar,
key: registKey, key: registKey,
body: SafeArea( body: SafeArea(
@@ -2654,8 +2529,7 @@ class _ProfilePageState extends State<ProfilePage>
showToast(I18n.of(context).cantt_voice); showToast(I18n.of(context).cantt_voice);
return; return;
} }
if (BlacklistMgr.isBlaklistMe(userInfo.userId)) {
if (BlacklistMgr.isBlaklistMe(userInfo.userId)) {
showToast(I18n.of(context).you_are_blaklisted); showToast(I18n.of(context).you_are_blaklisted);
return; return;
} }
@@ -2664,7 +2538,6 @@ class _ProfilePageState extends State<ProfilePage>
showToast(I18n.of(context).reject_message); showToast(I18n.of(context).reject_message);
return; return;
} }
//对方关闭陌生人消息,则提示 //对方关闭陌生人消息,则提示
if (!userInfo.isCanStrangerNews) { if (!userInfo.isCanStrangerNews) {
showToast(I18n.of(context).stranger_close_tips); showToast(I18n.of(context).stranger_close_tips);


+ 2
- 3
lib/home/ProgramDetail.dart View File

@@ -119,7 +119,7 @@ class _ProgramDetailPageState extends State<ProgramDetailPage> {
textScaleFactor: 1.0, textScaleFactor: 1.0,
style: TextStyle(color: AppColors.NewAppbarTextColor), style: TextStyle(color: AppColors.NewAppbarTextColor),
), ),
elevation: 1,
elevation: 1,
leading: CustomUI.buildCustomLeading(context), leading: CustomUI.buildCustomLeading(context),
centerTitle: true, centerTitle: true,
); );
@@ -553,8 +553,7 @@ class _ProgramDetailPageState extends State<ProgramDetailPage> {
list.add(button); list.add(button);
} }
return Container( return Container(
padding: EdgeInsets.only(left: 23, top: 10, right: 8, bottom: 10),
color: Colors.white,
margin: EdgeInsets.only(left: 23, top: 10, right: 8, bottom: 10),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: list, children: list,


+ 1
- 1
lib/home/SearchPage.dart View File

@@ -175,7 +175,7 @@ class _SearchPageState extends State<SearchPage> {
child: Stack( child: Stack(
children: <Widget>[ children: <Widget>[
SmartRefresher( SmartRefresher(
enablePullDown: list.length > 0,
enablePullDown: list.length > 0,
enablePullUp: true, enablePullUp: true,
header: MaterialClassicHeader(), header: MaterialClassicHeader(),
footer: CustomUI.buildLoadingFooter(), footer: CustomUI.buildLoadingFooter(),


+ 1
- 1
lib/home/add_friend.dart View File

@@ -30,7 +30,7 @@ class _AddFriendPageState extends State<AddFriendPage> {
void initState() { void initState() {
super.initState(); super.initState();
print('AddFriendPage init');
print('AddFriendPage init111');
_txtCtrl.text = widget.originalName; _txtCtrl.text = widget.originalName;
} }


+ 0
- 10
lib/home/alter_select_view.dart View File

@@ -187,16 +187,6 @@ class _AlterSelectPageState extends State<AlterSelectPage> {
} }
} }
Widget _buildAvatar(url) {
return ClipRRect(
borderRadius: BorderRadius.circular(6),
child: CachedNetworkImage(
imageUrl: url,
width: Constants.ContactAvatarSize,
height: Constants.ContactAvatarSize,
));
}
String getLetter(BuildContext context, double tileHeight, Offset globalPos) { String getLetter(BuildContext context, double tileHeight, Offset globalPos) {
RenderBox _box = context.findRenderObject(); RenderBox _box = context.findRenderObject();
var local = _box.globalToLocal(globalPos); var local = _box.globalToLocal(globalPos);


+ 2
- 2
lib/home/create_group_view.dart View File

@@ -510,7 +510,7 @@ class _CreateGroupPageState extends State<CreateGroupPage> {
actions: <Widget>[ actions: <Widget>[
InkWell( InkWell(
child: Padding( child: Padding(
padding: EdgeInsets.only(right: 12, top: 14, bottom: 14),
padding: EdgeInsets.only(right: 15, top: 14, bottom: 14),
child: Consumer<GroupSelectProvider>( child: Consumer<GroupSelectProvider>(
builder: (context, counter, child) => Container( builder: (context, counter, child) => Container(
decoration: BoxDecoration( decoration: BoxDecoration(
@@ -525,7 +525,7 @@ class _CreateGroupPageState extends State<CreateGroupPage> {
? Colors.red ? Colors.red
: const Color(0xFF3875E9)), : const Color(0xFF3875E9)),
), ),
padding: EdgeInsets.symmetric(horizontal: 10),
padding: EdgeInsets.symmetric(horizontal: 18),
alignment: Alignment.center, alignment: Alignment.center,
child: fixedText( child: fixedText(
(widget.pageType == (widget.pageType ==


+ 2
- 2
lib/home/daily_bonus_page.dart View File

@@ -526,8 +526,8 @@ class DailyBouusState extends State with SingleTickerProviderStateMixin {
height: 37, height: 37,
child: Image.asset( child: Image.asset(
R.assetsImagesImgFyj, R.assetsImagesImgFyj,
width: needAnimate ? animation.value * 17 : 17,
height: needAnimate ? animation.value * 17 : 17,
width: needAnimate ? animation.value * 24 : 24,
height: needAnimate ? animation.value * 24 : 24,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(isEnough ? 0xff2D81FF : 0xffCBCBCB), color: Color(isEnough ? 0xff2D81FF : 0xffCBCBCB),


+ 13
- 10
lib/home/friend_page.dart View File

@@ -12,7 +12,6 @@ import 'package:chat/generated/i18n.dart';
import 'package:chat/models/ref_name_provider.dart'; import 'package:chat/models/ref_name_provider.dart';
import 'package:chat/utils/CustomUI.dart'; import 'package:chat/utils/CustomUI.dart';
import 'package:chat/utils/HttpUtil.dart'; import 'package:chat/utils/HttpUtil.dart';
import 'package:chat/utils/LoadingDialog.dart';
import 'package:chat/utils/MessageMgr.dart'; import 'package:chat/utils/MessageMgr.dart';
import 'package:chat/utils/TokenMgr.dart'; import 'package:chat/utils/TokenMgr.dart';
import 'package:chat/utils/conversation_table.dart'; import 'package:chat/utils/conversation_table.dart';
@@ -93,7 +92,7 @@ class _FriendPageState extends State<FriendPage> {
avatar: '', avatar: '',
userId: 0, userId: 0,
iconCode: 0xe66c, iconCode: 0xe66c,
title: I18n.of(LoadingManage.context).new_friends,
title: I18n.of(Constants.getCurrentContext()).new_friends,
gradient: LinearGradient( gradient: LinearGradient(
begin: Alignment.topCenter, begin: Alignment.topCenter,
end: Alignment.bottomCenter, end: Alignment.bottomCenter,
@@ -187,11 +186,11 @@ class _FriendPageState extends State<FriendPage> {
showPermission() async { showPermission() async {
if (await CustomUI.showPermissionSetting( if (await CustomUI.showPermissionSetting(
LoadingManage.context,
Constants.getCurrentContext(),
PermissionGroup.contacts, PermissionGroup.contacts,
I18n.of(LoadingManage.context).contact_permission)) {
I18n.of(Constants.getCurrentContext()).contact_permission)) {
MessageMgr().emit('PostContact'); MessageMgr().emit('PostContact');
Navigator.push(LoadingManage.context,
Navigator.push(Constants.getCurrentContext(),
MaterialPageRoute<void>(builder: (BuildContext context) { MaterialPageRoute<void>(builder: (BuildContext context) {
return ContactsPage(); return ContactsPage();
})); }));
@@ -215,6 +214,10 @@ class _FriendPageState extends State<FriendPage> {
Response res = Response res =
await HttpUtil().post('friendship/newFriends/record', data: data); await HttpUtil().post('friendship/newFriends/record', data: data);
if (res == null) {
return;
}
var resData = res.data; var resData = res.data;
if (resData['code'] == 0) { if (resData['code'] == 0) {
if (resData['data'] != null) { if (resData['data'] != null) {
@@ -255,7 +258,7 @@ class _FriendPageState extends State<FriendPage> {
avatar: '', avatar: '',
userId: 0, userId: 0,
iconCode: 0xe659, iconCode: 0xe659,
title: I18n.of(LoadingManage.context).scan,
title: I18n.of(Constants.getCurrentContext()).scan,
gradient: LinearGradient( gradient: LinearGradient(
begin: Alignment.topCenter, begin: Alignment.topCenter,
end: Alignment.bottomCenter, end: Alignment.bottomCenter,
@@ -264,14 +267,14 @@ class _FriendPageState extends State<FriendPage> {
const Color(0xFF3441C1), const Color(0xFF3441C1),
]), ]),
onPressed: () { onPressed: () {
CustomUI().goScanPage(LoadingManage.context);
CustomUI().goScanPage(Constants.getCurrentContext());
}), }),
FriendsInfo( FriendsInfo(
avatar: '', avatar: '',
userId: 0, userId: 0,
iconCode: 0xe67a, iconCode: 0xe67a,
isShowDivder: true, isShowDivder: true,
title: I18n.of(LoadingManage.context).contact_add,
title: I18n.of(Constants.getCurrentContext()).contact_add,
gradient: LinearGradient( gradient: LinearGradient(
begin: Alignment.topCenter, begin: Alignment.topCenter,
end: Alignment.bottomCenter, end: Alignment.bottomCenter,
@@ -299,7 +302,7 @@ class _FriendPageState extends State<FriendPage> {
userId: 0, userId: 0,
iconCode: 0xe662, iconCode: 0xe662,
isShowDivder: true, isShowDivder: true,
title: I18n.of(LoadingManage.context).add_friends,
title: I18n.of(Constants.getCurrentContext()).add_friends,
gradient: LinearGradient( gradient: LinearGradient(
begin: Alignment.topCenter, begin: Alignment.topCenter,
end: Alignment.bottomCenter, end: Alignment.bottomCenter,
@@ -308,7 +311,7 @@ class _FriendPageState extends State<FriendPage> {
const Color(0xFF6118A6), const Color(0xFF6118A6),
]), ]),
onPressed: () async { onPressed: () async {
Navigator.push(LoadingManage.context,
Navigator.push(Constants.getCurrentContext(),
MaterialPageRoute<void>(builder: (BuildContext context) { MaterialPageRoute<void>(builder: (BuildContext context) {
return SearchNewFriendsPage(); return SearchNewFriendsPage();
})); }));


+ 3
- 5
lib/home/homeMain.dart View File

@@ -9,11 +9,10 @@ import 'package:chat/home/unread_dot_widget.dart';
import 'package:chat/models/UserInfo.dart'; import 'package:chat/models/UserInfo.dart';
import 'package:chat/models/ref_name_provider.dart'; import 'package:chat/models/ref_name_provider.dart';
import 'package:chat/utils/HttpUtil.dart'; import 'package:chat/utils/HttpUtil.dart';
import 'package:chat/utils/LoadingDialog.dart';
import 'package:chat/utils/MessageMgr.dart'; import 'package:chat/utils/MessageMgr.dart';
import 'package:chat/utils/TokenMgr.dart'; import 'package:chat/utils/TokenMgr.dart';
import 'package:chat/utils/app_navigator.dart'; import 'package:chat/utils/app_navigator.dart';
import 'package:chat/utils/file_transfer_page.dart';
import 'package:chat/utils/file_preview_local.dart';
import 'package:chat/utils/local_notification_util.dart'; import 'package:chat/utils/local_notification_util.dart';
import 'package:chat/utils/msgHandler.dart'; import 'package:chat/utils/msgHandler.dart';
import 'package:chat/utils/receive_share_file.dart'; import 'package:chat/utils/receive_share_file.dart';
@@ -143,7 +142,6 @@ class _HomeMainState extends State<HomeMain> {
@override @override
void initState() { void initState() {
MsgHandler.context = context;
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.light); SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.light);
super.initState(); super.initState();
@@ -254,10 +252,10 @@ class _HomeMainState extends State<HomeMain> {
goShareInfo(data) async { goShareInfo(data) async {
Future.delayed(Duration(milliseconds: 1000), () { Future.delayed(Duration(milliseconds: 1000), () {
Navigator.of(LoadingManage.context).push(
Navigator.of(Constants.getCurrentContext()).push(
new MaterialPageRoute( new MaterialPageRoute(
builder: (context) { builder: (context) {
return FileTransferPage(data);
return FilePreview(data);
}, },
), ),
); );


+ 0
- 19
lib/home/last_chat_item.dart View File

@@ -41,8 +41,6 @@ class _LastChatItemState extends State<LastChatItem> {
lastMessageModel = widget.lastMessageModel; lastMessageModel = widget.lastMessageModel;
initUserInfo(); initUserInfo();
// initUserInfo();
// initUserInfo();
MessageMgr().on('UpdateUserInfo', msgUpdateUserInfo); MessageMgr().on('UpdateUserInfo', msgUpdateUserInfo);
} }
@@ -162,22 +160,5 @@ class _LastChatItemState extends State<LastChatItem> {
enterType: widget.enterType, enterContent: widget.enterContent); enterType: widget.enterType, enterContent: widget.enterContent);
}, },
); );
// FutureBuilder(
// future: _friendInfoFuture,
// builder: (BuildContext context, AsyncSnapshot snapshot) {
// if (snapshot.connectionState == ConnectionState.done) {
// if (snapshot.hasError) {
// return Container();
// } else {
// UserInfo friendInfo = snapshot.data;
// if (friendInfo == null) {
// return Container();
// }
// } else {
// return Container();
// }
// });
} }
} }

+ 1
- 1
lib/home/last_chat_record_widget.dart View File

@@ -17,7 +17,7 @@ import 'package:permission_handler/permission_handler.dart';
class LastChatPage extends StatefulWidget { class LastChatPage extends StatefulWidget {
final bool needRobot; final bool needRobot;
final int enterType; // 0默认 1图片
final int enterType; // 0默认 1图片 2转发消息
final dynamic enterContent; final dynamic enterContent;
LastChatPage({this.needRobot = true, this.enterType = 0, this.enterContent}); LastChatPage({this.needRobot = true, this.enterType = 0, this.enterContent});


+ 0
- 1
lib/home/money_detail.dart View File

@@ -6,7 +6,6 @@ import 'package:chat/data/WebData.dart';
import 'package:chat/data/constants.dart'; import 'package:chat/data/constants.dart';
import 'package:chat/data/conversation.dart'; import 'package:chat/data/conversation.dart';
import 'package:chat/generated/i18n.dart'; import 'package:chat/generated/i18n.dart';
import 'package:chat/home/InfoList.dart';
import 'package:chat/home/ProfilePage.dart'; import 'package:chat/home/ProfilePage.dart';
import 'package:chat/home/rich_title.dart'; import 'package:chat/home/rich_title.dart';
import 'package:chat/utils/CustomUI.dart'; import 'package:chat/utils/CustomUI.dart';


+ 1
- 1
lib/home/my_qr.dart View File

@@ -89,7 +89,7 @@ class MyQr extends StatelessWidget {
children: <Widget>[ children: <Widget>[
Row( Row(
children: <Widget>[ children: <Widget>[
Container(
Container(
constraints: BoxConstraints(maxWidth: 170), constraints: BoxConstraints(maxWidth: 170),
child: Text(name, child: Text(name,
textScaleFactor: 1.0, textScaleFactor: 1.0,


+ 1
- 2
lib/home/qr_scanner_view.dart View File

@@ -7,7 +7,6 @@ import 'package:chat/data/group_data_mgr.dart';
import 'package:chat/generated/i18n.dart'; import 'package:chat/generated/i18n.dart';
import 'package:chat/home/qr_scanner_overlay.dart'; import 'package:chat/home/qr_scanner_overlay.dart';
import 'package:chat/utils/CustomUI.dart'; import 'package:chat/utils/CustomUI.dart';
import 'package:chat/utils/LoadingDialog.dart';
import 'package:chat/utils/MessageMgr.dart'; import 'package:chat/utils/MessageMgr.dart';
import 'package:chat/utils/app_navigator.dart'; import 'package:chat/utils/app_navigator.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -208,7 +207,7 @@ class _QrScannerPageState extends State<QrScannerPage>
showToast(I18n.of(context).no_goupr_info); showToast(I18n.of(context).no_goupr_info);
return; return;
} }
Navigator.push(LoadingManage.context,
Navigator.push(Constants.getCurrentContext(),
MaterialPageRoute<void>(builder: (BuildContext context) { MaterialPageRoute<void>(builder: (BuildContext context) {
return JoinGroupConfirmPage( return JoinGroupConfirmPage(
groupInfoModel: groupInfo, groupInfoModel: groupInfo,


+ 2
- 2
lib/home/service_view.dart View File

@@ -32,8 +32,8 @@ class ServiceMsgModel {
} }
class ServiceCenterPage extends StatefulWidget { class ServiceCenterPage extends StatefulWidget {
int questionIndex = -1;
ServiceCenterPage(this.questionIndex);
final int questionIndex;
ServiceCenterPage({this.questionIndex = -1});
@override @override
_ServiceCenterPageState createState() => _ServiceCenterPageState(); _ServiceCenterPageState createState() => _ServiceCenterPageState();


+ 3
- 4
lib/home/splash_page.dart View File

@@ -1,5 +1,4 @@
import 'package:chat/generated/i18n.dart'; import 'package:chat/generated/i18n.dart';
import 'package:chat/utils/LoadingDialog.dart';
import 'package:chat/utils/screen.dart'; import 'package:chat/utils/screen.dart';
import 'package:chat/utils/sp_utils.dart'; import 'package:chat/utils/sp_utils.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@@ -34,11 +33,11 @@ class SplashPageState extends State<SplashPage> {
void initState() { void initState() {
super.initState(); super.initState();


list.add(SplashBean('assets/images/img_splash_1.png',I18n.of( LoadingManage.context).splash_tips1 , I18n.of( LoadingManage.context).splash_tips_content1,
list.add(SplashBean('assets/images/img_splash_1.png',I18n.of( Constants.getCurrentContext()).splash_tips1 , I18n.of( Constants.getCurrentContext()).splash_tips_content1,
Color(0xffEC527D))); Color(0xffEC527D)));
list.add(SplashBean('assets/images/img_splash_2.png', I18n.of( LoadingManage.context).splash_tips2, I18n.of( LoadingManage.context).splash_tips_content2,
list.add(SplashBean('assets/images/img_splash_2.png', I18n.of( Constants.getCurrentContext()).splash_tips2, I18n.of( Constants.getCurrentContext()).splash_tips_content2,
Color(0xffB439EB))); Color(0xffB439EB)));
list.add(SplashBean('assets/images/img_splash_3.png', I18n.of( LoadingManage.context).splash_tips3, I18n.of( LoadingManage.context).splash_tips_content3,
list.add(SplashBean('assets/images/img_splash_3.png', I18n.of( Constants.getCurrentContext()).splash_tips3, I18n.of( Constants.getCurrentContext()).splash_tips_content3,
Color(0xff2B79F7))); Color(0xff2B79F7)));


pageController = PageController( pageController = PageController(


+ 4
- 15
lib/main.dart View File

@@ -12,7 +12,6 @@ import 'package:chat/home/splash_page.dart';
import 'package:chat/models/gift_select_provider.dart'; import 'package:chat/models/gift_select_provider.dart';
import 'package:chat/models/money_change.dart'; import 'package:chat/models/money_change.dart';
import 'package:chat/models/ref_name_provider.dart'; import 'package:chat/models/ref_name_provider.dart';
import 'package:chat/utils/LoadingDialog.dart';
import 'package:chat/utils/MessageMgr.dart'; import 'package:chat/utils/MessageMgr.dart';
import 'package:chat/utils/NetUtil.dart'; import 'package:chat/utils/NetUtil.dart';
import 'package:chat/utils/OtherLogin.dart'; import 'package:chat/utils/OtherLogin.dart';
@@ -115,7 +114,7 @@ void setCustomErrorPage(BuildContext context) {
Container( Container(
margin: EdgeInsets.only(top: ScreenUtil().setHeight(50)), margin: EdgeInsets.only(top: ScreenUtil().setHeight(50)),
child: Text( child: Text(
I18n.of(LoadingManage.context).server_error_tips,
I18n.of(Constants.getCurrentContext()).server_error_tips,
style: TextStyle(color: Color(0xFF8F8E8E), fontSize: 18), style: TextStyle(color: Color(0xFF8F8E8E), fontSize: 18),
), ),
), ),
@@ -214,7 +213,6 @@ class MyApp extends StatefulWidget {
_MyAppState createState() => _MyAppState(); _MyAppState createState() => _MyAppState();
} }
final GlobalKey<NavigatorState> navigatorKey = new GlobalKey<NavigatorState>();
class _MyAppState extends State<MyApp> with WidgetsBindingObserver { class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
final i18n = I18n.delegate; final i18n = I18n.delegate;
@@ -232,15 +230,10 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
initVersionName(); initVersionName();
askLocationPermission(); askLocationPermission();
MsgHandler.context = context;
I18n.onLocaleChanged = onLocaleChange; I18n.onLocaleChanged = onLocaleChange;
WidgetsBinding.instance.addObserver(this); WidgetsBinding.instance.addObserver(this);
ReceiveShareFile.init(); ReceiveShareFile.init();
ScreenShot.getFileStream();
ScreenShot.getFileStream();
} }
isAvailableAppleSignIn() async { isAvailableAppleSignIn() async {
@@ -294,9 +287,6 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
MessageMgr().emit( MessageMgr().emit(
'Receive AudioChat Request', MsgHandler.audioChatRequestFriendId); 'Receive AudioChat Request', MsgHandler.audioChatRequestFriendId);
} }
break; break;
case AppLifecycleState.paused: // 应用程序不可见,后台 case AppLifecycleState.paused: // 应用程序不可见,后台
print('切换到后台'); print('切换到后台');
@@ -392,7 +382,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
// 此处 // 此处
return 'Hibok'; return 'Hibok';
}, },
navigatorKey: navigatorKey,
navigatorKey: Constants.navigatorKey,
routes: <String, WidgetBuilder>{ routes: <String, WidgetBuilder>{
'/main': (BuildContext context) => HomeMain(), '/main': (BuildContext context) => HomeMain(),
}, },
@@ -417,8 +407,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
} }
goIndex() { goIndex() {
LoadingManage.context = navigatorKey.currentState.overlay.context;
if (!isOpen) { if (!isOpen) {
return SplashPage(); return SplashPage();
} else { } else {


+ 1
- 1
lib/map/google_map_location_picker.dart View File

@@ -137,7 +137,7 @@ class LocationPickerState extends State<LocationPicker> {
), ),
Expanded( Expanded(
child: Text( child: Text(
"Finding place...",
"搜索中...",
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
), ),


+ 1
- 1
lib/map/search_input.dart View File

@@ -80,7 +80,7 @@ class SearchInputState extends State {
keyboardAppearance: Brightness.light, keyboardAppearance: Brightness.light,
style: TextStyle(textBaseline: TextBaseline.alphabetic), style: TextStyle(textBaseline: TextBaseline.alphabetic),
decoration: InputDecoration( decoration: InputDecoration(
hintText: 'Search place',
hintText: '搜索位置',
border: InputBorder.none, border: InputBorder.none,
), ),
controller: editController, controller: editController,


+ 11
- 12
lib/models/last_msg_description.dart View File

@@ -8,7 +8,6 @@ import 'package:chat/models/last_message_model.dart';
import 'package:chat/models/ref_name_provider.dart'; import 'package:chat/models/ref_name_provider.dart';
import 'package:chat/proto/chat.pb.dart'; import 'package:chat/proto/chat.pb.dart';
import 'package:chat/utils/HttpUtil.dart'; import 'package:chat/utils/HttpUtil.dart';
import 'package:chat/utils/LoadingDialog.dart';
import 'package:chat/utils/MessageMgr.dart'; import 'package:chat/utils/MessageMgr.dart';
import 'package:chat/utils/msgHandler.dart'; import 'package:chat/utils/msgHandler.dart';
import 'package:chat/utils/screen.dart'; import 'package:chat/utils/screen.dart';
@@ -82,19 +81,19 @@ class _LastMsgDescriptionState extends State<LastMsgDescription> {
} }
break; break;
case ChatType.EmoticonType: case ChatType.EmoticonType:
desc = '[${I18n.of(LoadingManage.context).emoji}]';
desc = '[${I18n.of(Constants.getCurrentContext()).emoji}]';
break; break;
case ChatType.ImageChatType: case ChatType.ImageChatType:
desc = '[${I18n.of(LoadingManage.context).picture}]';
desc = '[${I18n.of(Constants.getCurrentContext()).picture}]';
break; break;
case ChatType.ShortVideoChatType: case ChatType.ShortVideoChatType:
desc = '[${I18n.of(LoadingManage.context).video}]';
desc = '[${I18n.of(Constants.getCurrentContext()).video}]';
break; break;
case ChatType.PlaceChatType: case ChatType.PlaceChatType:
desc = '[${I18n.of(LoadingManage.context).locate}]';
desc = '[${I18n.of(Constants.getCurrentContext()).locate}]';
break; break;
case ChatType.ShortVoiceChatType: case ChatType.ShortVoiceChatType:
desc = '[${I18n.of(LoadingManage.context).voice}]';
desc = '[${I18n.of(Constants.getCurrentContext()).voice}]';
break; break;
case ChatType.GiftChatType: case ChatType.GiftChatType:
@@ -102,9 +101,9 @@ class _LastMsgDescriptionState extends State<LastMsgDescription> {
GiftChat.fromBuffer(widget.lastMessageModel.msgContent); GiftChat.fromBuffer(widget.lastMessageModel.msgContent);
if (giftChat.tuId == UserData().basicInfo.userId) { if (giftChat.tuId == UserData().basicInfo.userId) {
desc = I18n.of(LoadingManage.context).you_get;
desc = I18n.of(Constants.getCurrentContext()).you_get;
} else { } else {
desc = I18n.of(LoadingManage.context).you_give;
desc = I18n.of(Constants.getCurrentContext()).you_give;
} }
break; break;
@@ -118,21 +117,21 @@ class _LastMsgDescriptionState extends State<LastMsgDescription> {
if (wallet.state == RedWalletState.Received) { if (wallet.state == RedWalletState.Received) {
var myId = UserData().basicInfo.userId; var myId = UserData().basicInfo.userId;
if (wallet.suId == myId) { if (wallet.suId == myId) {
desc = I18n.of(LoadingManage.context)
desc = I18n.of(Constants.getCurrentContext())
.get_money .get_money
.replaceFirst('/s1', fdName); .replaceFirst('/s1', fdName);
} else { } else {
desc = I18n.of(LoadingManage.context)
desc = I18n.of(Constants.getCurrentContext())
.you_get_money .you_get_money
.replaceFirst('/s1', fdName); .replaceFirst('/s1', fdName);
} }
} else if (wallet.state == RedWalletState.Expire) { } else if (wallet.state == RedWalletState.Expire) {
desc = I18n.of(LoadingManage.context).money_over;
desc = I18n.of(Constants.getCurrentContext()).money_over;
} else { } else {
print('WWWWW${wallet.state}'); print('WWWWW${wallet.state}');
} }
} else { } else {
desc = '[${I18n.of(LoadingManage.context).red_money}]';
desc = '[${I18n.of(Constants.getCurrentContext()).red_money}]';
} }
break; break;


+ 0
- 13
lib/photo/ui/page/photo_folder_select_menu.dart View File

@@ -88,19 +88,6 @@ class _PhotoSelectMenuState extends State<PhotoSelectMenu> {
setState(() {}); setState(() {});
} }
Widget _mask() {
return GestureDetector(
onTap: () {
print('到mask了');
clearOverlay();
},
child: Expanded(
child: Container(
width: MediaQuery.of(context).size.width,
color: Color.fromRGBO(0, 0, 0, 0.1),
)));
}
void clearOverlay() { void clearOverlay() {
if (overlayEntry != null) { if (overlayEntry != null) {
overlayEntry.remove(); overlayEntry.remove();


+ 1
- 1
lib/utils/ChargeMoney.dart View File

@@ -219,7 +219,7 @@ class PayWayContentState extends State<PayWayContent> {
webPage: url, webPage: url,
title: '点我代付[${widget.money}元]', title: '点我代付[${widget.money}元]',
thumbnail: thumbnail:
"http://datasm.chengyouhd.com/Upload/default/icon120.png",
"http://datasm.chengyouhd.com/Upload/default/icon120.png",
description: '[${UserData().basicInfo.nickName}]正在购买H币,点击帮我支付吧'); description: '[${UserData().basicInfo.nickName}]正在购买H币,点击帮我支付吧');
fluwx.share(model); fluwx.share(model);
} }


+ 16
- 20
lib/utils/CustomUI.dart View File

@@ -1109,27 +1109,23 @@ class CustomUI {
if (height == null) { if (height == null) {
height = MediaQuery.of(context).size.height * 0.8; height = MediaQuery.of(context).size.height * 0.8;
} }
return InkWell(
onTap: null,
return Container(
width: MediaQuery.of(context).size.width,
height: height,
alignment: Alignment.topCenter,
child: Container( child: Container(
width: MediaQuery.of(context).size.width,
height: height,
alignment: Alignment.topCenter,
child: Container(
width: 40,
height: 40,
margin: EdgeInsets.only(top: 20),
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.white,
boxShadow: [
BoxShadow(blurRadius: 3.0, color: Colors.black26)
]),
child: new CircularProgressIndicator(
strokeWidth: 2,
),
)));
width: 40,
height: 40,
margin: EdgeInsets.only(top: 20),
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.white,
boxShadow: [BoxShadow(blurRadius: 3.0, color: Colors.black26)]),
child: new CircularProgressIndicator(
strokeWidth: 2,
),
));
} }
static Widget buildLoadingFooter() { static Widget buildLoadingFooter() {


+ 24
- 14
lib/utils/HttpUtil.dart View File

@@ -87,7 +87,7 @@ class HttpUtil {
return response; // continue return response; // continue
}, onError: (DioError e) async { }, onError: (DioError e) async {
// Do something with response error // Do something with response error
showToast(I18n.of(LoadingManage.context).net_error);
showToast(I18n.of(Constants.getCurrentContext()).net_error);
return e; //continue return e; //continue
})); }));
} }
@@ -172,7 +172,7 @@ class HttpUtil {
} }
print('post请求发生错误:$e'); print('post请求发生错误:$e');
if (isShowLoading) LoadingManage().closeLoading(); if (isShowLoading) LoadingManage().closeLoading();
showToast(I18n.of(LoadingManage.context).server_error_tips);
showToast(I18n.of(Constants.getCurrentContext()).server_error_tips);
if (failback != null) failback(); if (failback != null) failback();
} }
return response; return response;
@@ -282,15 +282,13 @@ class HttpUtil {
print('用户信息resData $resData'); print('用户信息resData $resData');
if (resData['code'] == 0) { if (resData['code'] == 0) {
var info = UserInfo.fromJson(resData['data']); var info = UserInfo.fromJson(resData['data']);
info.isBlackened
info.isBlackened
? BlacklistMgr.addBlackListMe(info.userId) ? BlacklistMgr.addBlackListMe(info.userId)
: BlacklistMgr.removeBalckListMe(info.userId); : BlacklistMgr.removeBalckListMe(info.userId);
info.isBlackList info.isBlackList
? BlacklistMgr.addMyBlackList(info.userId) ? BlacklistMgr.addMyBlackList(info.userId)
: BlacklistMgr.removeMyBalckList(info.userId); : BlacklistMgr.removeMyBalckList(info.userId);
friendCache[friendId] = info; friendCache[friendId] = info;
FriendListMgr().updateFriendInfo(info); FriendListMgr().updateFriendInfo(info);
UserInfoTable().insertUser(info); UserInfoTable().insertUser(info);
@@ -353,7 +351,6 @@ class HttpUtil {
if (resData['code'] == 0) { if (resData['code'] == 0) {
var info = UserInfo.fromJson(resData['data']); var info = UserInfo.fromJson(resData['data']);
info.isBlackened info.isBlackened
? BlacklistMgr.addBlackListMe(info.userId) ? BlacklistMgr.addBlackListMe(info.userId)
: BlacklistMgr.removeBalckListMe(info.userId); : BlacklistMgr.removeBalckListMe(info.userId);
@@ -361,7 +358,6 @@ class HttpUtil {
info.isBlackList info.isBlackList
? BlacklistMgr.addMyBlackList(info.userId) ? BlacklistMgr.addMyBlackList(info.userId)
: BlacklistMgr.removeMyBalckList(info.userId); : BlacklistMgr.removeMyBalckList(info.userId);
FriendListMgr().updateFriendInfo(info); FriendListMgr().updateFriendInfo(info);
friendCache[info.userId] = info; friendCache[info.userId] = info;
MessageMgr().emit('UpdateUserInfo', info); MessageMgr().emit('UpdateUserInfo', info);
@@ -1203,7 +1199,7 @@ class HttpUtil {
//根据经纬度获取用户国家城市 //根据经纬度获取用户国家城市
getAddress(double lon, double lat) async { getAddress(double lon, double lat) async {
Map data = { Map data = {
"lon": lon.toString(),
"lon": lon.toString(),
"lat": lat.toString(), "lat": lat.toString(),
}; };
data['sign'] = TokenMgr().getSign(data); data['sign'] = TokenMgr().getSign(data);
@@ -1244,12 +1240,12 @@ class HttpUtil {
} }
} }
//根据经纬度更新当前城市
//根据经纬度获取用户国家城市
changeCurrentCity(double lon, double lat, callback) async { changeCurrentCity(double lon, double lat, callback) async {
if (UserData().basicInfo.userId == null) return; if (UserData().basicInfo.userId == null) return;
Map data = { Map data = {
"userId": UserData().basicInfo.userId, "userId": UserData().basicInfo.userId,
"lon": lon.toString(),
"lon": lon.toString(),
"lat": lat.toString(), "lat": lat.toString(),
}; };
data['sign'] = TokenMgr().getSign(data); data['sign'] = TokenMgr().getSign(data);
@@ -1280,8 +1276,7 @@ class HttpUtil {
callback(resData['data']['UserId']); callback(resData['data']['UserId']);
} }
} }
//拉黑用户
//拉黑用户
blackUser(int userId, callback) async { blackUser(int userId, callback) async {
Map data = { Map data = {
"userid": UserData().basicInfo.userId, "userid": UserData().basicInfo.userId,
@@ -1354,7 +1349,6 @@ class HttpUtil {
callback(); callback();
} }
} }
//向企业服务助手提交信息 //向企业服务助手提交信息
Future<bool> commitInfoToCompany(MsgModel msgModel) async { Future<bool> commitInfoToCompany(MsgModel msgModel) async {
Map data = { Map data = {
@@ -1366,7 +1360,7 @@ class HttpUtil {
msgModel.state = MsgState.Sending; msgModel.state = MsgState.Sending;
print('commitInfoToCompany 参数 $data');
print('commitInfoToCompany 参数 $data');
Response res = await HttpUtil().post('feedback/user/insert', data: data); Response res = await HttpUtil().post('feedback/user/insert', data: data);
if (res == null) { if (res == null) {
@@ -1387,4 +1381,20 @@ class HttpUtil {
showToast(resData['msg']); showToast(resData['msg']);
return false; return false;
} }
//焚阅照片恢复
resetPhoto(callback) async {
Map data = {
"userId": UserData().basicInfo.userId,
};
data['sign'] = TokenMgr().getSign(data);
Response res = await HttpUtil()
.post('user/recover/photos', data: data, isShowLoading: true);
Map resData = res.data;
if (resData['code'] == 0) {
showToast(resData['msg']);
callback();
}
}
} }

+ 3
- 3
lib/utils/LoadingDialog.dart View File

@@ -5,6 +5,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:chat/utils/my_dialog.dart' as myDialog; import 'package:chat/utils/my_dialog.dart' as myDialog;
import 'package:chat/data/constants.dart';
class LoadingManage { class LoadingManage {
//私有构造函数 //私有构造函数
@@ -16,10 +17,9 @@ class LoadingManage {
//工厂构造函数 //工厂构造函数
factory LoadingManage() => _singleton; factory LoadingManage() => _singleton;
static BuildContext context;
showLoading() { showLoading() {
myDialog.showDialog( myDialog.showDialog(
context: context,
context: Constants.getCurrentContext(),
barrierDismissible: true, barrierDismissible: true,
builder: (BuildContext context) { builder: (BuildContext context) {
return LoadingDialog(); return LoadingDialog();
@@ -27,7 +27,7 @@ class LoadingManage {
} }
closeLoading() { closeLoading() {
Navigator.of(context).pop();
Constants.getCurrentState().pop();
} }
} }


+ 2
- 2
lib/utils/MessageBox.dart View File

@@ -85,7 +85,7 @@ class _MessageBoxState extends State<MessageBox> {
), ),
); );
} else if (str == 'black') { } else if (str == 'black') {
HttpUtil().blackUser(userId, () {});
HttpUtil().blackUser(userId, () {});
} else if (str == 'noContent') { } else if (str == 'noContent') {
var data = { var data = {
"userId": UserData().basicInfo.userId, "userId": UserData().basicInfo.userId,
@@ -481,7 +481,7 @@ class _MessageBoxState extends State<MessageBox> {
_buildTimebox(data), _buildTimebox(data),
_buildImgSet(data), _buildImgSet(data),
_buildImgList(data), _buildImgList(data),
widget.isDetail ? Container() : _buildDivder(),
widget.isDetail ? Container() : _buildDivder(),
_buildIconButtonList(data), _buildIconButtonList(data),
//_buildContent(), //_buildContent(),
], ],


+ 1
- 2
lib/utils/NetUtil.dart View File

@@ -9,7 +9,6 @@ import 'package:chat/data/constants.dart';
import 'package:chat/data/group_data_mgr.dart'; import 'package:chat/data/group_data_mgr.dart';
import 'package:chat/generated/i18n.dart'; import 'package:chat/generated/i18n.dart';
import 'package:chat/proto/all.pbserver.dart'; import 'package:chat/proto/all.pbserver.dart';
import 'package:chat/utils/LoadingDialog.dart';
import 'package:chat/utils/net_state_util.dart'; import 'package:chat/utils/net_state_util.dart';
import 'package:chat/utils/screen.dart'; import 'package:chat/utils/screen.dart';
import 'package:chat/utils/upload_util.dart'; import 'package:chat/utils/upload_util.dart';
@@ -164,7 +163,7 @@ class NetWork {
} else { } else {
_stateBloc.addState(ChatState.loginFailed); _stateBloc.addState(ChatState.loginFailed);
print('登录失败${msgContent.errorCode}'); print('登录失败${msgContent.errorCode}');
showToast(I18n.of(LoadingManage.context).fail);
showToast(I18n.of(Constants.getCurrentContext()).fail);
} }
} else if (msgId == 3) { } else if (msgId == 3) {
//用户登出,其他设备替换 //用户登出,其他设备替换


+ 255
- 213
lib/utils/TempUserCard.dart View File

@@ -12,8 +12,8 @@ import 'package:oktoast/oktoast.dart';
import '../utils/HttpUtil.dart'; import '../utils/HttpUtil.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import "../data/UserData.dart"; import "../data/UserData.dart";
import '../utils/TokenMgr.dart';
import 'TempUserChips.dart'; import 'TempUserChips.dart';
import 'TokenMgr.dart';


class TempUserCard extends StatelessWidget { class TempUserCard extends StatelessWidget {
final String userName; final String userName;
@@ -38,29 +38,31 @@ class TempUserCard extends StatelessWidget {


TempUserCard( TempUserCard(
{Key key, {Key key,
this.userName,
this.isReal: false,
this.city,
this.age,
this.constellation,
this.professional,
this.isOnline,
this.distance,
this.userId,
this.isLove: false,
this.sex,
this.headUrl: '',
this.payImg: false,
this.imgNum: 0,
this.isHidden: false,
this.member: 0,
this.hiddenDistince: false,
this.nameSize = 8,
this.isBalck: false})
this.userName,
this.isReal: false,
this.city,
this.age,
this.constellation,
this.professional,
this.isOnline,
this.distance,
this.userId,
this.isLove: false,
this.sex,
this.headUrl: '',
this.payImg: false,
this.imgNum: 0,
this.isHidden: false,
this.member: 0,
this.hiddenDistince: false,
this.nameSize = 8,
this.isBalck: false})
: super(key: key); : super(key: key);



@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

bool isVIP = member > 0; bool isVIP = member > 0;
bool isSVIP = member == 2; bool isSVIP = member == 2;


@@ -70,27 +72,27 @@ class TempUserCard extends StatelessWidget {
return Stack( return Stack(
children: <Widget>[ children: <Widget>[
Container( Container(
height: height - 40,
width: height - 40,
height: height-40,
width: height-40,
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: Radius.circular(15), topLeft: Radius.circular(15),
topRight: Radius.circular(15)), topRight: Radius.circular(15)),
child: headUrl == '' || headUrl == null child: headUrl == '' || headUrl == null
? Image.asset( ? Image.asset(
Constants.DefaultHeadImgUrl,
width: height - 40,
height: height - 40,
)
Constants.DefaultHeadImgUrl,
width: height-40,
height: height-40,
)
: CachedNetworkImage( : CachedNetworkImage(
imageUrl: headUrl,
placeholder: (context, url) => Image.asset(
Constants.DefaultHeadImgUrl,
width: height - 40,
height: height - 40,
),
fit: BoxFit.cover,
)),
imageUrl: headUrl,
placeholder: (context, url) => Image.asset(
Constants.DefaultHeadImgUrl,
width: height-40,
height: height-40,
),
fit: BoxFit.cover,
)),
), ),
Positioned( Positioned(
left: 0, left: 0,
@@ -100,15 +102,16 @@ class TempUserCard extends StatelessWidget {
width: 54, width: 54,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.black54, color: Colors.black54,
borderRadius:
BorderRadius.only(topRight: Radius.circular(10))),
borderRadius: BorderRadius.only(

topRight: Radius.circular(10))),
child: Row( child: Row(
//mainAxisAlignment: MainAxisAlignment.spaceEvenly, //mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[ children: <Widget>[
Padding( Padding(
padding: EdgeInsets.only(left: 6), padding: EdgeInsets.only(left: 6),
child: child:
Icon(Icons.image, size: 15, color: Colors.white)),
Icon(Icons.image, size: 15, color: Colors.white)),
Padding( Padding(
padding: EdgeInsets.only(left: 5, top: 2), padding: EdgeInsets.only(left: 5, top: 2),
child: fixedText(imgNum.toString(), child: fixedText(imgNum.toString(),
@@ -129,25 +132,87 @@ class TempUserCard extends StatelessWidget {
fontSize: 15), fontSize: 15),
isReal && sex == 2 isReal && sex == 2
? Container( ? Container(
margin: EdgeInsets.only(left: 5),
padding:
EdgeInsets.only(top: 2, bottom: 2, left: 5, right: 5),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Constants.PurpleBackgroundColor,
),
child: fixedText('Real', fontSize: 8, color: Colors.white))
margin: EdgeInsets.only(left: 5),
padding:
EdgeInsets.only(top: 2, bottom: 2, left: 5, right: 5),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Constants.PurpleBackgroundColor,
),
child: fixedText('Real', fontSize: 8, color: Colors.white))
: Container(), : Container(),
isVIP && sex == 1 isVIP && sex == 1
? Container( ? Container(
margin: EdgeInsets.only(left: 5),
child: isSVIP ? Constants.svipIcon : Constants.vipIcon)
margin: EdgeInsets.only(left: 5),
child: isSVIP ? Constants.svipIcon : Constants.vipIcon)
: Container(), : Container(),
], ],
); );
} }


// void _selectValue(str) async {
// if (str == 'collection') {
// Map data = {
// "userid": UserData().basicInfo.userId,
// "type": 0,
// "followUserId": this.userId,
// };
// data['sign'] = TokenMgr().getSign(data);
// Response res = await HttpUtil()
// .post('userfollow/follow/insert', data: data, isShowLoading: true);
// Map resData = res.data;
// if (resData['code'] == 0) {
// MessageMgr().emit('refresh_love_list', {'UserId': userId, 'flag': 0});
// showToast(resData['msg']);
// }
// } else if (str == 'cancleCollection') {
// Map data = {
// "userid": UserData().basicInfo.userId,
// "type": 0,
// "followUserId": this.userId,
// };
// data['sign'] = TokenMgr().getSign(data);
// Response res = await HttpUtil()
// .post('userfollow/follow/cancel', data: data, isShowLoading: true);
// Map resData = res.data;
// if (resData['code'] == 0) {
// MessageMgr().emit('refresh_love_list', {'UserId': userId, 'flag': 2});
// showToast(resData['msg']);
// }
// } else if (str == 'black') {
// Map data = {
// "userid": UserData().basicInfo.userId,
// "type": 1,
// "followUserId": this.userId,
// };
// data['sign'] = TokenMgr().getSign(data);

// Response res =
// await HttpUtil().post('userfollow/follow/insert', data: data);
// Map resData = res.data;
// showToast(resData['msg']);
// if (resData['code'] == 0) {
// MessageMgr().emit('refresh_love_list', {'UserId': userId, 'flag': 1});
// }
// } else if (str == 'cancleBlack') {
// var data = {
// "userid": UserData().basicInfo.userId,
// "type": 1,
// "followUserId": this.userId,
// };
// data['sign'] = TokenMgr().getSign(data);

// Response res =
// await HttpUtil().post('userfollow/follow/cancel', data: data);
// Map resData = res.data;
// showToast(resData['msg']);
// if (resData['code'] == 0) {
// MessageMgr().emit('refresh_love_list', {'UserId': userId, 'flag': 2});
// }
// }
// }

//距离、在线以及相册 //距离、在线以及相册
Widget otherWidget() { Widget otherWidget() {
var greyColor = const Color(0xFFB2B2B2); var greyColor = const Color(0xFFB2B2B2);
@@ -158,8 +223,8 @@ class TempUserCard extends StatelessWidget {
title: hiddenDistince title: hiddenDistince
? I18n.of(context).secrecy ? I18n.of(context).secrecy
: (UserData().hasLocationPermission : (UserData().hasLocationPermission
? WebData().getDistanceString(distance)
: I18n.of(context).unknown),
? WebData().getDistanceString(distance)
: I18n.of(context).unknown),
titleColor: greyColor, titleColor: greyColor,
isDivider: true), isDivider: true),
InfoTile( InfoTile(
@@ -168,24 +233,24 @@ class TempUserCard extends StatelessWidget {
isDivider: payImg || isHidden), isDivider: payImg || isHidden),
isHidden isHidden
? InfoTile( ? InfoTile(
icon: IconData(0xe645, fontFamily: 'iconfont'),
iconHeight: 22,
title: I18n.of(context).application_view,
titleColor: greyColor,
isDivider: false,
onTap: () {
print('click');
})
icon: IconData(0xe645, fontFamily: 'iconfont'),
iconHeight: 22,
title: I18n.of(context).application_view,
titleColor: greyColor,
isDivider: false,
onTap: () {
print('click');
})
: Container(), : Container(),
payImg payImg
? InfoTile( ? InfoTile(
icon: IconData(0xe632, fontFamily: Constants.IconFontFamily),
title: I18n.of(context).paid_photo,
titleColor: greyColor,
isDivider: false,
onTap: () {
print('click');
})
icon: IconData(0xe632, fontFamily: Constants.IconFontFamily),
title: I18n.of(context).paid_photo,
titleColor: greyColor,
isDivider: false,
onTap: () {
print('click');
})
: Container(), : Container(),
], ],
); );
@@ -210,148 +275,125 @@ class TempUserCard extends StatelessWidget {
), ),
); );
}, },
child: Container(
alignment: Alignment.center,
color: AppColors.NewAppbarBgColor,
width: Screen.width,
child: Container(
width: Screen.width - 40,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
SizedBox(
height: 23,
),
headImg(),
Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(15),
bottomRight: Radius.circular(15))),
child: Column(
children: <Widget>[
Container(
//背景
padding: EdgeInsets.only(
left: 15, right: 10, bottom: 14.5, top: 5),
child: Column(
children: <Widget>[
Stack(
children: <Widget>[
Row(
children: <Widget>[
//头像图片

//信息
Container(
width: MediaQuery.of(context)
.size
.width -
104,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.end,
children: <Widget>[
nameState(), //名字以及状态
//用户的信息标记
Padding(
padding:
EdgeInsets.only(top: 9)),
TempUserChips(
city: city,
age: age,
constellation: constellation,
professional: professional),
Padding(
padding:
EdgeInsets.only(top: 4)),
otherWidget(),
],
)),
],
),
],
)
],
)),
SizedBox(
height: 5,
),
Container(
child: //赞
sex == UserData().basicInfo.sex
? InkWell(
onTap: () {
showToast(UserData().isMan()
? I18n.of(context).not_love
: I18n.of(context).not_love2);
},
child: Container(
width: 100,
height: 30,
decoration: BoxDecoration(
border: Border.all(
color: Color(0xFF878787),
width: 1),
borderRadius:
BorderRadius.circular(16)),
padding: EdgeInsets.only(
left: 15,
right: 15,
bottom: 5,
top: 5),
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[
Icon(
IconData(
0xe625,
fontFamily:
Constants.IconFontFamily,
),
size: 15,
color: Color(0xffB2B2B2),
),
SizedBox(
width: 5,
),
Text(
'LOVE',
style: prefix0.TextStyle(
color: Color(0xffB2B2B2)),
)
],
)))
: LoveToggle(
isActive: isLove,
onTap: (bool isActive) async {
if (isActive) {
HttpUtil().setLove(userId, () {
MessageMgr().emit('refresh_love_list',
{'UserId': userId, 'flag': 0});
});
} else {
HttpUtil().cancleLove(userId, () {
MessageMgr().emit('refresh_love_list',
{'UserId': userId, 'flag': 2});
});
}
}),
),
SizedBox(
height: 15,
),
],
),
),
],
),
),
));
child: Container(alignment: Alignment.center,color: AppColors.NewAppbarBgColor,width: Screen.width,child: Container(width: Screen.width-40,child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
SizedBox(height: 23,),
headImg(),


Container(decoration: BoxDecoration(color: Colors.white,borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(15),
bottomRight: Radius.circular(15))) ,child: Column(children: <Widget>[
Container(
//背景
padding: EdgeInsets.only(left: 15,right: 10, bottom: 14.5,top: 5),
child: Column(children: <Widget>[
Stack(
children: <Widget>[
Row(
children: <Widget>[
//头像图片

//信息
Container(
width: MediaQuery.of(context).size.width - 104,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
nameState(), //名字以及状态
//用户的信息标记
Padding(padding: EdgeInsets.only(top: 9)),
TempUserChips(
city: city,
age: age,
constellation: constellation,
professional: professional),
Padding(padding: EdgeInsets.only(top: 4)),
otherWidget(),
],
)),
],
),

],
)
],)),
SizedBox(height: 5,),
Container(

child: //赞
sex == UserData().basicInfo.sex
? InkWell(
onTap: () {
showToast(UserData().isMan()
? I18n.of(context).not_love
: I18n.of(context).not_love2);
},
child: Container(
width: 100,
height: 30,
decoration: BoxDecoration(border: Border.all(color: Color(0xFF878787), width: 1),borderRadius: BorderRadius.circular(16)) ,
padding: EdgeInsets.only(
left: 15, right: 15, bottom: 5,top: 5 ),
child: Row( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
Icon(
IconData(
0xe625,
fontFamily: Constants.IconFontFamily,
),
size: 15,
color: Color(0xffB2B2B2),
),
SizedBox(width: 5,),
Text('LOVE',style: prefix0.TextStyle(color: Color(0xffB2B2B2)),)
],)))
: LoveToggle(isActive: isLove,onTap: (bool isActive) async {
Map data = {
"userid": UserData().basicInfo.userId,
"type": 0,
"followUserId": this.userId,
};
data['sign'] = TokenMgr().getSign(data);
if (isActive) {
Response res = await HttpUtil().post(
'userfollow/follow/insert',
data: data,
isShowLoading: true);
Map resData = res.data;
showToast(resData['msg']);
if (resData['code'] == 0) {
MessageMgr().emit('refresh_love_list',
{'UserId': userId, 'flag': 0});
showToast(resData['msg']);
}
} else {
Response res = await HttpUtil().post(
'userfollow/follow/cancel',
data: data,
isShowLoading: true);
Map resData = res.data;
if (resData['code'] == 0) {
MessageMgr().emit('refresh_love_list',
{'UserId': userId, 'flag': 2});
showToast(resData['msg']);
}
}
}),
),
SizedBox(height: 15,),



],),),





],
),),));
} }
} }


@@ -368,12 +410,12 @@ class InfoTile extends StatelessWidget {


const InfoTile( const InfoTile(
{Key key, {Key key,
this.title,
this.titleColor,
this.icon,
this.onTap,
this.iconHeight: TileHeight,
this.isDivider = false})
this.title,
this.titleColor,
this.icon,
this.onTap,
this.iconHeight: TileHeight,
this.isDivider = false})
: super(key: key); : super(key: key);


@override @override


+ 4
- 4
lib/utils/UserCard.dart View File

@@ -12,7 +12,6 @@ import 'package:oktoast/oktoast.dart';
import '../utils/HttpUtil.dart'; import '../utils/HttpUtil.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import "../data/UserData.dart"; import "../data/UserData.dart";
import '../utils/TokenMgr.dart';
class UserCard extends StatelessWidget { class UserCard extends StatelessWidget {
final String userName; final String userName;
@@ -277,13 +276,14 @@ class UserCard extends StatelessWidget {
isActive: isLove, isActive: isLove,
size: 16, size: 16,
onTap: (bool isActive) async { onTap: (bool isActive) async {
if (isActive) { if (isActive) {
HttpUtil().setLove(userId, () {
HttpUtil().setLove(userId, () {
MessageMgr().emit('refresh_love_list', MessageMgr().emit('refresh_love_list',
{'UserId': userId, 'flag': 0}); {'UserId': userId, 'flag': 0});
}); });
} else { } else {
HttpUtil().cancleLove(userId, () {
HttpUtil().cancleLove(userId, () {
MessageMgr().emit('refresh_love_list', MessageMgr().emit('refresh_love_list',
{'UserId': userId, 'flag': 2}); {'UserId': userId, 'flag': 2});
}); });
@@ -343,7 +343,7 @@ class InfoTile extends StatelessWidget {
Container( Container(
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,
constraints: BoxConstraints(minHeight: 17), constraints: BoxConstraints(minHeight: 17),
padding: EdgeInsets.only(right: 5, bottom: 1.5),
padding: EdgeInsets.only(right: 5,bottom: 1.5),
child: Text(title, child: Text(title,
textScaleFactor: 1.0, textScaleFactor: 1.0,
style: TextStyle( style: TextStyle(


+ 31
- 12
lib/utils/app_navigator.dart View File

@@ -10,6 +10,7 @@ import 'package:chat/home/ProfilePage.dart';
import 'package:chat/home/SearchPage.dart'; import 'package:chat/home/SearchPage.dart';
import 'package:chat/home/audio_chat_view.dart'; import 'package:chat/home/audio_chat_view.dart';
import 'package:chat/home/create_group_view.dart'; import 'package:chat/home/create_group_view.dart';
import 'package:chat/home/forward_view.dart';
import 'package:chat/home/group_all_member.dart'; import 'package:chat/home/group_all_member.dart';
import 'package:chat/home/group_qr_view.dart'; import 'package:chat/home/group_qr_view.dart';
import 'package:chat/home/homeMain.dart'; import 'package:chat/home/homeMain.dart';
@@ -99,28 +100,41 @@ class AppNavigator {
} }
//聊天 //聊天
static pushChatPage(BuildContext context, int friendId,{enterType=0,enterContent}) async {
if(enterType==1){
static pushChatPage(BuildContext context, int friendId,
{enterType = 0, enterContent}) async {
if (enterType == 1) {
Navigator.of(context).pop(context); Navigator.of(context).pop(context);
} }
AppNavigator.push(context, ChatPage(key: Key('Chat'), friendId: friendId,enterType: enterType,enterContent: enterContent,));
AppNavigator.push(
context,
ChatPage(
key: Key('Chat'),
friendId: friendId,
enterType: enterType,
enterContent: enterContent,
));
} }
//群聊 //群聊
static pushGroupChatPage(
BuildContext context, GroupInfoModel groupInfoModel,{enterType=0,enterContent}) async {
if(enterType==1){
static pushGroupChatPage(BuildContext context, GroupInfoModel groupInfoModel,
{enterType = 0, enterContent}) async {
if (enterType == 1) {
Navigator.of(context).pop(context); Navigator.of(context).pop(context);
} }
AppNavigator.defaultPush(context,
GroupChatPage(key: Key('GroupChat'), groupInfoModel: groupInfoModel,enterType: enterType,enterContent: enterContent,));
AppNavigator.defaultPush(
context,
GroupChatPage(
key: Key('GroupChat'),
groupInfoModel: groupInfoModel,
enterType: enterType,
enterContent: enterContent,
));
} }
//客服 //客服
static pushServicePage(BuildContext context, {questionIndex = -1}) async { static pushServicePage(BuildContext context, {questionIndex = -1}) async {
AppNavigator.push(context, ServiceCenterPage(questionIndex));
AppNavigator.push(context, ServiceCenterPage(questionIndex : questionIndex));
} }
//群成员列表 //群成员列表
@@ -129,7 +143,7 @@ class AppNavigator {
} }
//群聊二维码 //群聊二维码
static pushGroupQrPage(BuildContext context,GroupInfoModel model) {
static pushGroupQrPage(BuildContext context, GroupInfoModel model) {
AppNavigator.push(context, GroupQrPage(model)); AppNavigator.push(context, GroupQrPage(model));
} }
@@ -205,7 +219,7 @@ class AppNavigator {
AppNavigator.push(context, TranslateRobotPage()); AppNavigator.push(context, TranslateRobotPage());
} }
//进入反馈小助手页面
//进入反馈小助手页面
static pushCompanyServerPage(BuildContext context) { static pushCompanyServerPage(BuildContext context) {
AppNavigator.push(context, CompanyServerPage()); AppNavigator.push(context, CompanyServerPage());
} }
@@ -215,5 +229,10 @@ class AppNavigator {
BuildContext context, List<FriendModel> friendList) { BuildContext context, List<FriendModel> friendList) {
AppNavigator.push( AppNavigator.push(
context, CreateGroupPage(GroupOperatingPageType.CreateGroup, [], null)); context, CreateGroupPage(GroupOperatingPageType.CreateGroup, [], null));
}
//发起群聊界面
static pushForwardPage(BuildContext context, MsgModel msg) {
AppNavigator.push(context, ForwardPage(msg));
} }
} }

+ 0
- 3
lib/utils/blacklist_mgr.dart View File

@@ -1,6 +1,3 @@
import 'package:chat/generated/i18n.dart';
import 'package:chat/utils/LoadingDialog.dart';
import 'package:oktoast/oktoast.dart';
class BlacklistMgr { class BlacklistMgr {
//我拉黑的用户id //我拉黑的用户id


+ 2
- 2
lib/utils/conversation_table.dart View File

@@ -1,7 +1,7 @@
import 'package:chat/data/UserData.dart'; import 'package:chat/data/UserData.dart';
import 'package:chat/models/UserInfo.dart'; import 'package:chat/models/UserInfo.dart';
import 'package:chat/models/ref_name_provider.dart'; import 'package:chat/models/ref_name_provider.dart';
import 'package:chat/utils/LoadingDialog.dart';
import 'package:chat/data/constants.dart';
import 'package:chat/utils/sql_model.dart'; import 'package:chat/utils/sql_model.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:lpinyin/lpinyin.dart'; import 'package:lpinyin/lpinyin.dart';
@@ -39,7 +39,7 @@ class FriendModel {
} }
updataRefName() { updataRefName() {
refName = Provider.of<RefNameProvider>(LoadingManage.context, listen: false)
refName = Provider.of<RefNameProvider>(Constants.getCurrentContext(), listen: false)
.getRefName(friendId, name); .getRefName(friendId, name);
nameTag = getNameTag(); nameTag = getNameTag();
} }


+ 2
- 2
lib/utils/keyboard/bottom_area_avoider.dart View File

@@ -38,7 +38,7 @@ class BottomAreaAvoider extends StatefulWidget {
/// Animation curve. Defaults to [defaultCurve] /// Animation curve. Defaults to [defaultCurve]
final Curve curve; final Curve curve;


ScrollController scrollTo;
final ScrollController scrollTo;


BottomAreaAvoider({ BottomAreaAvoider({
Key key, Key key,
@@ -181,7 +181,7 @@ RenderObject findFocusedObject(RenderObject root) {
final q = Queue<RenderObject>(); final q = Queue<RenderObject>();
q.add(root); q.add(root);
while (q.isNotEmpty) { while (q.isNotEmpty) {
final node = q.removeFirst();
final RenderObject node = q.removeFirst();
final config = SemanticsConfiguration(); final config = SemanticsConfiguration();
node.describeSemanticsConfiguration(config); node.describeSemanticsConfiguration(config);
if (config.isFocused) { if (config.isFocused) {


+ 8
- 1
lib/utils/msgHandler.dart View File

@@ -218,6 +218,7 @@ class MsgHandler {
print('消息包大小超过3M'); print('消息包大小超过3M');
} }
//本地文件为空或者等发送成功之后才可以发送
if (msg.localFile == null || msg.state >= MsgState.Uploaded) { if (msg.localFile == null || msg.state >= MsgState.Uploaded) {
Future.delayed(Duration(seconds: 60), () { Future.delayed(Duration(seconds: 60), () {
if (msg.state != MsgState.SendingSuccess) { if (msg.state != MsgState.SendingSuccess) {
@@ -239,6 +240,7 @@ class MsgHandler {
seq.targetId = curActiveSession; seq.targetId = curActiveSession;
if (curActiveSession == 10000) { if (curActiveSession == 10000) {
seq.channelType = ChatChannelType.CSD; seq.channelType = ChatChannelType.CSD;
} else { } else {
seq.channelType = seq.channelType =
@@ -527,7 +529,12 @@ class MsgHandler {
msgModel.state = MsgState.DownloadFailed; msgModel.state = MsgState.DownloadFailed;
} }
} }
if (msgModel.sessionId == 10000 ) {
print('收到反馈小助手消息');
}
if (msgModel.sessionId == curActiveSession) { if (msgModel.sessionId == curActiveSession) {
MessageMgr().emit('New Chat Message', msgModel.sessionId); MessageMgr().emit('New Chat Message', msgModel.sessionId);
} }
} }
@@ -918,7 +925,7 @@ class MsgHandler {
NetWork().singOut(); NetWork().singOut();
UserData().reset(); UserData().reset();
break; break;
case 'blacklist':
case 'blacklist':
String messageJson = map['message']; String messageJson = map['message'];
Map messageMap = json.decode(messageJson); Map messageMap = json.decode(messageJson);
if (messageMap['Status'] == 0) { if (messageMap['Status'] == 0) {


+ 22
- 18
lib/utils/receive_share_file.dart View File

@@ -1,28 +1,26 @@
import 'dart:async';


import 'package:receive_sharing_intent/receive_sharing_intent.dart'; import 'package:receive_sharing_intent/receive_sharing_intent.dart';


import 'MessageMgr.dart'; import 'MessageMgr.dart';


class ReceiveShareFile { class ReceiveShareFile {
static StreamSubscription _intentDataStreamSubscription;
static List<SharedMediaFile> _sharedFiles;
static String tempFilePath; static String tempFilePath;


static int mLastClickTime = 0;
static int timeInterval = 3000;


static void init() { static void init() {
// For sharing images coming from outside the app while the app is in the memory // For sharing images coming from outside the app while the app is in the memory
_intentDataStreamSubscription = ReceiveSharingIntent.getMediaStream()
ReceiveSharingIntent.getMediaStream()
.listen((List<SharedMediaFile> value) { .listen((List<SharedMediaFile> value) {
// setState(() {
// _sharedFiles = value;
// print("Shared:" + (_sharedFiles?.map((f) => f.path)?.join(",") ?? ""));
// });
// print('#### getfilePath ${value[0].path}');


if (currentIndex == 1) { if (currentIndex == 1) {
if (value != null && value.length > 0) {
MessageMgr().emit(MessageMgr.RECEIVE_THIRD_SHARE, value[0].path);
int nowTime = DateTime.now().millisecondsSinceEpoch;

if (nowTime - mLastClickTime > timeInterval) {
if (value != null && value.length > 0) {
MessageMgr().emit(MessageMgr.RECEIVE_THIRD_SHARE, value[0].path);
}
} }
} else { } else {
// print("### 记录下来了1"); // print("### 记录下来了1");
@@ -44,9 +42,14 @@ class ReceiveShareFile {
// print('#### getfilePath ${value[0].path}'); // print('#### getfilePath ${value[0].path}');


if (currentIndex == 1) { if (currentIndex == 1) {
if (value != null && value.length > 0) {
MessageMgr().emit(MessageMgr.RECEIVE_THIRD_SHARE, value[0].path);
}
int nowTime = DateTime.now().millisecondsSinceEpoch;
if (nowTime - mLastClickTime > timeInterval) {
// do something
if (value != null && value.length > 0) {
MessageMgr().emit(MessageMgr.RECEIVE_THIRD_SHARE, value[0].path);
mLastClickTime = nowTime;
}
} else {}
} else { } else {
// print("### 记录下来了"); // print("### 记录下来了");
if (value != null && value.length > 0) { if (value != null && value.length > 0) {
@@ -56,11 +59,12 @@ class ReceiveShareFile {
}); });


// For sharing or opening urls/text coming from outside the app while the app is in the memory // For sharing or opening urls/text coming from outside the app while the app is in the memory
_intentDataStreamSubscription =
ReceiveSharingIntent.getTextStream().listen((String value) { ReceiveSharingIntent.getTextStream().listen((String value) {
print('#### getfilePath dddd $value ');

MessageMgr().emit(MessageMgr.RECEIVE_THIRD_SHARE, value);
print('#### getfilePath $value ');
// setState(() {
// _sharedText = value;
// print("Shared: $_sharedText");
// });
}, onError: (err) { }, onError: (err) {
print("getLinkStream error: $err"); print("getLinkStream error: $err");
}); });


+ 2
- 7
lib/utils/screen_shot.dart View File

@@ -1,20 +1,16 @@
import 'dart:io';
import 'dart:typed_data'; import 'dart:typed_data';
import 'dart:io';
import 'package:chat/map/location_result.dart'; import 'package:chat/map/location_result.dart';
import 'package:chat/utils/screen.dart'; import 'package:chat/utils/screen.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_image_compress/flutter_image_compress.dart'; import 'package:flutter_image_compress/flutter_image_compress.dart';
import 'MessageMgr.dart'; import 'MessageMgr.dart';
class ScreenShot { class ScreenShot {
static const MethodChannel _channel = static const MethodChannel _channel =
const MethodChannel('make.photo.screen.hibok'); const MethodChannel('make.photo.screen.hibok');
static const EventChannel eventChannel =
static const EventChannel eventChannel =
const EventChannel('com.file.hibok'); const EventChannel('com.file.hibok');
static Future<List<int>> takeScreenshotImage() async { static Future<List<int>> takeScreenshotImage() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
Uint8List bytes = await _channel.invokeMethod('makePhotoScreen', args); Uint8List bytes = await _channel.invokeMethod('makePhotoScreen', args);
@@ -45,7 +41,6 @@ class ScreenShot {
return _channel.invokeMethod('isSupportGoogle', args); return _channel.invokeMethod('isSupportGoogle', args);
} }
static getFileStream() { static getFileStream() {
eventChannel.receiveBroadcastStream().listen((Object agrs){ eventChannel.receiveBroadcastStream().listen((Object agrs){
print('######## receiveBroadcastStream $agrs'); print('######## receiveBroadcastStream $agrs');


+ 3
- 3
lib/utils/upload_util.dart View File

@@ -5,7 +5,7 @@ import 'package:chat/models/ChatMsg.dart';
import 'package:chat/models/group_info_model.dart'; import 'package:chat/models/group_info_model.dart';
import 'package:chat/models/group_info_server_model.dart'; import 'package:chat/models/group_info_server_model.dart';
import 'package:chat/proto/all.pbserver.dart'; import 'package:chat/proto/all.pbserver.dart';
import 'package:chat/utils/LoadingDialog.dart';
import 'package:chat/data/constants.dart';
import 'package:chat/utils/file_cache_mgr.dart'; import 'package:chat/utils/file_cache_mgr.dart';
import 'package:convert/convert.dart'; import 'package:convert/convert.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
@@ -224,12 +224,12 @@ class UploadUtil {
return path; return path;
} else { } else {
msg.state = MsgState.DownloadFailed; msg.state = MsgState.DownloadFailed;
showToast(I18n.of(LoadingManage.context).server_error_tips);
showToast(I18n.of(Constants.getCurrentContext()).server_error_tips);
return null; return null;
} }
} catch (e) { } catch (e) {
msg.state = MsgState.DownloadFailed; msg.state = MsgState.DownloadFailed;
showToast(I18n.of(LoadingManage.context).server_error_tips);
showToast(I18n.of(Constants.getCurrentContext()).server_error_tips);
print(response.toString()); print(response.toString());
} }
} }


Loading…
Cancel
Save