diff --git a/lib/community/community_view/community_dynamic.dart b/lib/community/community_view/community_dynamic.dart index 8ed024db..d026201e 100644 --- a/lib/community/community_view/community_dynamic.dart +++ b/lib/community/community_view/community_dynamic.dart @@ -560,6 +560,7 @@ class _CommunityDynamic extends State { arguments: {"articleId": widget.article.id,"shareUrl":buildShareUrl()}); return; } else if (platform == ShareSDKPlatforms.facebook) { + Navigator.of(context).popAndPushNamed('/router/chat_details_page', arguments: {"articleId": widget.article.id, "shareUrl":buildShareUrl(),}); diff --git a/lib/im/chat_details_page.dart b/lib/im/chat_details_page.dart index d1af9bb9..e8e2ab45 100644 --- a/lib/im/chat_details_page.dart +++ b/lib/im/chat_details_page.dart @@ -303,85 +303,82 @@ class _ChatDetailsPage extends State // setState(() {}); } } - return Scaffold( - // resizeToAvoidBottomInset: false, - backgroundColor: Color(0xFFF6F6F6), - appBar: MyAppBar( - title: _toUser.nickname, - titleColor: Color(0xFF0D0D0D), - titleSize: 17.sp, - leading: true, - leadingColor: Colors.black, - action: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - setState(() { - Navigator.of(context).pushNamed('/router/chat_setting',arguments: {"userId": _toUser.mid}); - copyIndex = 0; - }); - }, - child: Container( - alignment: Alignment.center, - child: Icon( - Icons.more_horiz, - color: Colors.black, - size: 30, + + return GestureDetector( + behavior: HitTestBehavior.translucent, + onTap: () { + FocusScope.of(context).requestFocus(FocusNode()); + setState(() { + emojiShowing = false; + isKeyBoardShow = emojiShowing; + moreShow = false; + isKeyBoardShow = moreShow; + }); + }, + child: Scaffold( + // resizeToAvoidBottomInset: false, + backgroundColor: Color(0xFFF6F6F6), + appBar: MyAppBar( + title: _toUser.nickname, + titleColor: Color(0xFF0D0D0D), + titleSize: 17.sp, + leading: true, + leadingColor: Colors.black, + action: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + Navigator.of(context).pushNamed('/router/chat_setting',arguments: {"userId": _toUser.mid}); + copyIndex = 0; + }); + }, + child: Container( + alignment: Alignment.center, + child: Icon( + Icons.more_horiz, + color: Colors.black, + size: 30, + ), + ), ), ), - ), - ), - body: Container( - child: Column( - children: [ - Expanded( - child: SmartRefresher( - enablePullDown: false, - enablePullUp: true, - header: MyHeader(), - reverse: true, - physics: BouncingScrollPhysics(), - footer: CustomFooter( - loadStyle: LoadStyle.ShowWhenLoading, - builder: (BuildContext context, LoadStatus mode) { - return (messages.length == 0) - ? Container() - : MyFooter(mode); - }, - ), - controller: refreshController, - onLoading: () { - refresh().then((value) { - refreshState(); - }); - }, - child: SingleChildScrollView( - physics: BouncingScrollPhysics(), - controller: scrollController, - child: Column( - children: [ - GestureDetector( - behavior: HitTestBehavior.translucent, - onTap: () { - setState(() { - emojiShowing = false; - isKeyBoardShow = emojiShowing; - moreShow = false; - isKeyBoardShow = moreShow; - FocusScope.of(context).requestFocus(FocusNode()); - }); - }, - child: chatDetailsList(), - ), - ], + body: Container( + child: Column( + children: [ + Expanded( + child: SmartRefresher( + enablePullDown: false, + enablePullUp: true, + header: MyHeader(), + reverse: true, + physics: BouncingScrollPhysics(), + footer: CustomFooter( + loadStyle: LoadStyle.ShowWhenLoading, + builder: (BuildContext context, LoadStatus mode) { + return (messages.length == 0) + ? Container() + : MyFooter(mode); + }, + ), + controller: refreshController, + onLoading: () { + refresh().then((value) { + refreshState(); + }); + }, + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + controller: scrollController, + child: chatDetailsList() + ), ), + flex: 1, ), - ), - flex: 1, + input() + ], ), - input() - ], - ), - ), + ), + ) ); } diff --git a/lib/im/im_view/friend_groip_list.dart b/lib/im/im_view/friend_groip_list.dart index 06e3b291..7d624d42 100644 --- a/lib/im/im_view/friend_groip_list.dart +++ b/lib/im/im_view/friend_groip_list.dart @@ -2,6 +2,8 @@ import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:huixiang/main.dart'; import 'package:huixiang/retrofit/data/im_user.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -151,20 +153,26 @@ class _FriendGroupList extends State { return GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { + if (list[position].mid == sharedPreferences.getString("userId")) { + SmartDialog.showToast("不能跟自己聊天", alignment: Alignment.center); + return; + } Navigator.of(context).pushNamed( '/router/chat_details_page', arguments: { "toUser": ImUser( avatar: list[position].avatar, mid: list[position].mid, - nickname: list[position].nickname), + nickname: list[position].nickname, + ), }, ); }, child: friendGroupItem(list[position]), ); }, - )), + ), + ), ], ), ); diff --git a/lib/im/im_view/im_page.dart b/lib/im/im_view/im_page.dart index 4cf6e560..f7def394 100644 --- a/lib/im/im_view/im_page.dart +++ b/lib/im/im_view/im_page.dart @@ -431,6 +431,10 @@ class _IMPage extends State implements OnChatMessage { return GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { + if (userIds[position] == sharedPreferences.getString("userId")) { + SmartDialog.showToast("不能跟自己聊天", alignment: Alignment.center); + return; + } Navigator.of(context).pushNamed( '/router/chat_details_page', arguments: { diff --git a/lib/main.dart b/lib/main.dart index fe142f67..a58e20d9 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -208,6 +208,7 @@ void main() async { ImgCachePath(); // initSdk(); bool isFirst = sharedPreferences.getBool("isFirst"); + initShared(); runApp(MyApp(locale, isFirst)); // FlutterBugly.postCatchedException((){ @@ -218,6 +219,11 @@ void main() async { // final XgFlutterPlugin xgFlutterPlugin = XgFlutterPlugin(); HxDatabase hxDatabase; +SharedPreferences sharedPreferences; + +initShared() async { + sharedPreferences = await SharedPreferences.getInstance(); +} initDatabase(String userId) async { hxDatabase = HxDatabase(); diff --git a/lib/mine/personal_page.dart b/lib/mine/personal_page.dart index 4ed4873d..09fdb547 100644 --- a/lib/mine/personal_page.dart +++ b/lib/mine/personal_page.dart @@ -8,6 +8,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/community/community_view/community_dynamic.dart'; import 'package:huixiang/community/photo_view_gallery_screen.dart'; import 'package:huixiang/generated/l10n.dart'; +import 'package:huixiang/main.dart'; import 'package:huixiang/retrofit/data/article.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/comunity_comment.dart'; @@ -862,6 +863,10 @@ class _PersonalPage extends State with WidgetsBindingObserver,Sing GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { + if (memberInfor?.id == sharedPreferences.getString("userId")) { + SmartDialog.showToast("不能跟自己聊天", alignment: Alignment.center); + return; + } Navigator.of(context) .pushNamed('/router/chat_details_page',arguments:{ "toUser": ImUser( @@ -1298,6 +1303,10 @@ class _PersonalPage extends State with WidgetsBindingObserver,Sing GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { + if (memberInfor?.id == sharedPreferences.getString("userId")) { + SmartDialog.showToast("不能跟自己聊天", alignment: Alignment.center); + return; + } Navigator.of(context) .pushNamed('/router/chat_details_page', arguments: { "toUser": ImUser(