Browse Source

socketclient heartbeat

wr_202303
zsw 4 months ago
parent
commit
c93335b3fc
  1. 1
      lib/community/community_view/community_dynamic.dart
  2. 145
      lib/im/chat_details_page.dart
  3. 12
      lib/im/im_view/friend_groip_list.dart
  4. 4
      lib/im/im_view/im_page.dart
  5. 6
      lib/main.dart
  6. 9
      lib/mine/personal_page.dart

1
lib/community/community_view/community_dynamic.dart

@ -560,6 +560,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
arguments: {"articleId": widget.article.id,"shareUrl":buildShareUrl()}); arguments: {"articleId": widget.article.id,"shareUrl":buildShareUrl()});
return; return;
} else if (platform == ShareSDKPlatforms.facebook) { } else if (platform == ShareSDKPlatforms.facebook) {
Navigator.of(context).popAndPushNamed('/router/chat_details_page', Navigator.of(context).popAndPushNamed('/router/chat_details_page',
arguments: {"articleId": widget.article.id, arguments: {"articleId": widget.article.id,
"shareUrl":buildShareUrl(),}); "shareUrl":buildShareUrl(),});

145
lib/im/chat_details_page.dart

@ -303,85 +303,82 @@ class _ChatDetailsPage extends State<ChatDetailsPage>
// setState(() {}); // setState(() {});
} }
} }
return Scaffold(
// resizeToAvoidBottomInset: false, return GestureDetector(
backgroundColor: Color(0xFFF6F6F6), behavior: HitTestBehavior.translucent,
appBar: MyAppBar( onTap: () {
title: _toUser.nickname, FocusScope.of(context).requestFocus(FocusNode());
titleColor: Color(0xFF0D0D0D), setState(() {
titleSize: 17.sp, emojiShowing = false;
leading: true, isKeyBoardShow = emojiShowing;
leadingColor: Colors.black, moreShow = false;
action: GestureDetector( isKeyBoardShow = moreShow;
behavior: HitTestBehavior.opaque, });
onTap: () { },
setState(() { child: Scaffold(
Navigator.of(context).pushNamed('/router/chat_setting',arguments: {"userId": _toUser.mid}); // resizeToAvoidBottomInset: false,
copyIndex = 0; backgroundColor: Color(0xFFF6F6F6),
}); appBar: MyAppBar(
}, title: _toUser.nickname,
child: Container( titleColor: Color(0xFF0D0D0D),
alignment: Alignment.center, titleSize: 17.sp,
child: Icon( leading: true,
Icons.more_horiz, leadingColor: Colors.black,
color: Colors.black, action: GestureDetector(
size: 30, 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(
body: Container( children: [
child: Column( Expanded(
children: [ child: SmartRefresher(
Expanded( enablePullDown: false,
child: SmartRefresher( enablePullUp: true,
enablePullDown: false, header: MyHeader(),
enablePullUp: true, reverse: true,
header: MyHeader(), physics: BouncingScrollPhysics(),
reverse: true, footer: CustomFooter(
physics: BouncingScrollPhysics(), loadStyle: LoadStyle.ShowWhenLoading,
footer: CustomFooter( builder: (BuildContext context, LoadStatus mode) {
loadStyle: LoadStyle.ShowWhenLoading, return (messages.length == 0)
builder: (BuildContext context, LoadStatus mode) { ? Container()
return (messages.length == 0) : MyFooter(mode);
? Container() },
: MyFooter(mode); ),
}, controller: refreshController,
), onLoading: () {
controller: refreshController, refresh().then((value) {
onLoading: () { refreshState();
refresh().then((value) { });
refreshState(); },
}); child: SingleChildScrollView(
}, physics: BouncingScrollPhysics(),
child: SingleChildScrollView( controller: scrollController,
physics: BouncingScrollPhysics(), child: chatDetailsList()
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(),
),
],
), ),
flex: 1,
), ),
), input()
flex: 1, ],
), ),
input() ),
], )
),
),
); );
} }

12
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/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.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:huixiang/retrofit/data/im_user.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
@ -151,20 +153,26 @@ class _FriendGroupList extends State<FriendGroupList> {
return GestureDetector( return GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
if (list[position].mid == sharedPreferences.getString("userId")) {
SmartDialog.showToast("不能跟自己聊天", alignment: Alignment.center);
return;
}
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/router/chat_details_page', '/router/chat_details_page',
arguments: { arguments: {
"toUser": ImUser( "toUser": ImUser(
avatar: list[position].avatar, avatar: list[position].avatar,
mid: list[position].mid, mid: list[position].mid,
nickname: list[position].nickname), nickname: list[position].nickname,
),
}, },
); );
}, },
child: friendGroupItem(list[position]), child: friendGroupItem(list[position]),
); );
}, },
)), ),
),
], ],
), ),
); );

4
lib/im/im_view/im_page.dart

@ -431,6 +431,10 @@ class _IMPage extends State<IMPage> implements OnChatMessage {
return GestureDetector( return GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
if (userIds[position] == sharedPreferences.getString("userId")) {
SmartDialog.showToast("不能跟自己聊天", alignment: Alignment.center);
return;
}
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/router/chat_details_page', '/router/chat_details_page',
arguments: { arguments: {

6
lib/main.dart

@ -208,6 +208,7 @@ void main() async {
ImgCachePath(); ImgCachePath();
// initSdk(); // initSdk();
bool isFirst = sharedPreferences.getBool("isFirst"); bool isFirst = sharedPreferences.getBool("isFirst");
initShared();
runApp(MyApp(locale, isFirst)); runApp(MyApp(locale, isFirst));
// FlutterBugly.postCatchedException((){ // FlutterBugly.postCatchedException((){
@ -218,6 +219,11 @@ void main() async {
// final XgFlutterPlugin xgFlutterPlugin = XgFlutterPlugin(); // final XgFlutterPlugin xgFlutterPlugin = XgFlutterPlugin();
HxDatabase hxDatabase; HxDatabase hxDatabase;
SharedPreferences sharedPreferences;
initShared() async {
sharedPreferences = await SharedPreferences.getInstance();
}
initDatabase(String userId) async { initDatabase(String userId) async {
hxDatabase = HxDatabase(); hxDatabase = HxDatabase();

9
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/community_view/community_dynamic.dart';
import 'package:huixiang/community/photo_view_gallery_screen.dart'; import 'package:huixiang/community/photo_view_gallery_screen.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/main.dart';
import 'package:huixiang/retrofit/data/article.dart'; import 'package:huixiang/retrofit/data/article.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/comunity_comment.dart'; import 'package:huixiang/retrofit/data/comunity_comment.dart';
@ -862,6 +863,10 @@ class _PersonalPage extends State<PersonalPage> with WidgetsBindingObserver,Sing
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
if (memberInfor?.id == sharedPreferences.getString("userId")) {
SmartDialog.showToast("不能跟自己聊天", alignment: Alignment.center);
return;
}
Navigator.of(context) Navigator.of(context)
.pushNamed('/router/chat_details_page',arguments:{ .pushNamed('/router/chat_details_page',arguments:{
"toUser": ImUser( "toUser": ImUser(
@ -1298,6 +1303,10 @@ class _PersonalPage extends State<PersonalPage> with WidgetsBindingObserver,Sing
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
if (memberInfor?.id == sharedPreferences.getString("userId")) {
SmartDialog.showToast("不能跟自己聊天", alignment: Alignment.center);
return;
}
Navigator.of(context) Navigator.of(context)
.pushNamed('/router/chat_details_page', arguments: { .pushNamed('/router/chat_details_page', arguments: {
"toUser": ImUser( "toUser": ImUser(

Loading…
Cancel
Save