Pārlūkot izejas kodu

1.《消息提示:有新消息了,机器人的图标出现红点了》

2.《消息:有消息,红点没提示》
3.优化、备注:这里可以加一个叉叉,可以全部删除的,不用一个个删除
4.名字:二维码、编辑资料里面和名字有关的地方,限制长度
master
ZCM pirms 5 gadiem
vecāks
revīzija
5acbb9bbf6
17 mainītis faili ar 165 papildinājumiem un 151 dzēšanām
  1. +13
    -0
      .vscode/launch.json
  2. +11
    -1
      lib/chat/group_chat_item.dart
  3. +7
    -4
      lib/data/constants.dart
  4. +28
    -23
      lib/home/ConversActionPage.dart
  5. +5
    -2
      lib/home/EditData.dart
  6. +14
    -79
      lib/home/ProfilePage.dart
  7. +21
    -8
      lib/home/add_friend.dart
  8. +7
    -1
      lib/home/create_group_view.dart
  9. +5
    -0
      lib/home/friend_page.dart
  10. +13
    -9
      lib/home/global_search.dart
  11. +6
    -13
      lib/home/group_all_member.dart
  12. +11
    -6
      lib/home/homeMain.dart
  13. +1
    -0
      lib/home/last_chat_item.dart
  14. +5
    -0
      lib/home/new_friends.dart
  15. +6
    -4
      lib/home/unread_dot_widget.dart
  16. +1
    -0
      lib/main.dart
  17. +11
    -1
      lib/models/friends_info.dart

+ 13
- 0
.vscode/launch.json Parādīt failu

@@ -0,0 +1,13 @@
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Flutter",
"request": "launch",
"type": "dart"
}
]
}

+ 11
- 1
lib/chat/group_chat_item.dart Parādīt failu

@@ -638,6 +638,11 @@ class _GroupChatPageItemState extends State<GroupChatPageItem>
child: hasHeadImg
? CachedNetworkImage(
imageUrl: UserData().basicInfo.headimgurl,
placeholder: (context, url) => Image.asset(
Constants.DefaultHeadImgUrl,
width: 40,
height: 40,
),
width: 40,
height: 40,
)
@@ -1279,6 +1284,11 @@ class _GroupChatPageItemState extends State<GroupChatPageItem>
child: hasHeadImg
? CachedNetworkImage(
imageUrl: memberModel.avtar,
placeholder: (context, url) => Image.asset(
Constants.DefaultHeadImgUrl,
width: 40,
height: 40,
),
width: 40,
height: 40,
)
@@ -1288,7 +1298,7 @@ class _GroupChatPageItemState extends State<GroupChatPageItem>
child: Image.asset(R.assetsImagesDefaultNorAvatar))),
onTap: () {
AppNavigator.pushProfileInfoPage(context, memberModel.memberId,
fromWhere: 2,addMode: 1);
fromWhere: 2, addMode: 1);
},
onLongPress: () {
print('long press user');


+ 7
- 4
lib/data/constants.dart Parādīt failu

@@ -91,9 +91,10 @@ class GroupOperatingPageType {
//消息发送界面类别
class SendMessagePageType {
static const int AddFriends = 0; //添加朋友
static const int ChangeGroupName = 1; //修改群名字
static const int AddFriends = 0; //添加朋友
static const int ChangeGroupName = 1; //修改群名字
static const int ChangeGroupNickName = 2; //修改群昵称
static const int Remark = 3; //修改备注
}
//全局搜索类别
@@ -112,12 +113,12 @@ class Constants {
//app全局key,处理content
static final GlobalKey<NavigatorState> navigatorKey = GlobalKey();
/// 获取当前的state
static NavigatorState getCurrentState() => navigatorKey.currentState;
/// 获取当前的context
static BuildContext getCurrentContext() => navigatorKey.currentState.overlay.context;//navigatorKey.currentContext;
static BuildContext getCurrentContext() =>
navigatorKey.currentState.overlay.context; //navigatorKey.currentContext;
///在pubspec.yaml中修改版本号
static String versionName = '1.0.0';
@@ -138,6 +139,8 @@ class Constants {
static const FullWidthIconButtonIconSize = 24.0;
static const ProfileHeaderIconSize = 60.0;
static const int NameLength = 14;
static const AppId = 'wx02328a8853f058ad';
static const Secret = '9d401b6a8bfe7b2fe63b3bf5c040b2f2';


+ 28
- 23
lib/home/ConversActionPage.dart Parādīt failu

@@ -17,7 +17,13 @@ import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../data/constants.dart' show AppColors, AppStyles, Constants, GlobalSearchPageType, GroupOperatingPageType;
import '../data/constants.dart'
show
AppColors,
AppStyles,
Constants,
GlobalSearchPageType,
GroupOperatingPageType;
import 'package:cached_network_image/cached_network_image.dart';
import 'create_group_view.dart';
@@ -253,7 +259,6 @@ class _ConversActionPageState extends State<ConversActionPage>
@override
Widget build(BuildContext context) {
List<GroupInfoModel> groupList = GroupInfoMgr().groupInfoList;
return Scaffold(
@@ -350,9 +355,6 @@ class _ConversActionPageState extends State<ConversActionPage>
child: TabBarView(
children: <Widget>[
LastChatPage(),
ListView.builder(
// controller: _scrollController,
itemBuilder: (BuildContext context, int index) {
@@ -365,7 +367,6 @@ class _ConversActionPageState extends State<ConversActionPage>
},
itemCount: groupList.length + 1,
),
ListView(
children: <Widget>[
SizedBox(height: 8.5),
@@ -544,21 +545,23 @@ class _ConversActionPageState extends State<ConversActionPage>
);
},
child: Container(
height: ItemHeight-20,
// margin: EdgeInsets.only(top: 1.5, bottom:1),
decoration: BoxDecoration(color: Colors.white),
child: Row(
children: <Widget>[
SizedBox(width: LeftPadding),
_avatarIcon,
SizedBox(width: 14.0),
Text(
I18n.of(context).create_group_chat,
style: TextStyle(fontSize: 15.5),
padding: EdgeInsets.only(top: 14, bottom: 14),
color: Constants.GreyBackgroundColor,
child: Container(
height: ItemHeight,
decoration: BoxDecoration(color: Colors.white),
child: Row(
children: <Widget>[
SizedBox(width: LeftPadding),
_avatarIcon,
SizedBox(width: 14.0),
Text(
I18n.of(context).create_group_chat,
style: TextStyle(fontSize: 15.5),
),
],
),
],
),
));
)));
Widget tips = Container(
alignment: Alignment.centerLeft,
@@ -573,7 +576,9 @@ class _ConversActionPageState extends State<ConversActionPage>
return Column(
children: <Widget>[
SizedBox(height: 10,),
SizedBox(
height: 10,
),
CustomUI.buildSearchButton(context, () {
Navigator.of(context).push(
new MaterialPageRoute(
@@ -584,10 +589,9 @@ class _ConversActionPageState extends State<ConversActionPage>
},
),
);
},bottom: 10 ),
}, bottom: 10),
_button,
tips,
],
);
}
@@ -599,6 +603,7 @@ class _ConversActionPageState extends State<ConversActionPage>
});
}
}
updateGroupLastMsg(args) async {
await GroupInfoMgr().sortGroupList();
if (mounted) {


+ 5
- 2
lib/home/EditData.dart Parādīt failu

@@ -334,7 +334,7 @@ class _EditPageState extends State<EditPage> {
showToast(I18n.of(context).only1_8);
return;
}
if (dateRangeId.length == 0) {
if (dateRangeId.length == 0 && UserData().hasLocationPermission) {
showToast(I18n.of(context).Please_select_a_resident_city);
return;
}
@@ -742,7 +742,10 @@ class _EditPageState extends State<EditPage> {
widget.isEditPage ? idItem : Container(),
_buildDivider(),
_bottomBorderBox(I18n.of(context).nickname, I18n.of(context).fill_out,
true, nickNameController, true, (str) => nickname = str),
true, nickNameController, true, (str) => nickname = str,
inputFormatters: [
LengthLimitingTextInputFormatter(Constants.NameLength)
]),
_buildDivider(),
_bottomBorderBox(I18n.of(context).country, country, false, null,
countryId.length != 0, selectCountry),


+ 14
- 79
lib/home/ProfilePage.dart Parādīt failu

@@ -2359,86 +2359,21 @@ class _ProfilePageState extends State<ProfilePage>
InkWell(
onTap: () async {
Navigator.of(context).pop();
nickNameController.text =
Provider.of<RefNameProvider>(context)
.getRefName(userInfo.userId,
userInfo.nickName);
var confirm = CustomUI.buildConfirmBotton(
I18n.of(context).determine, () async {
nickNameController.text =
nickNameController.text.trim();
if (nickNameController.text == null ||
nickNameController.text.length >
25) {
showToast(I18n.of(context).only1_8);
return;
}
Provider.of<RefNameProvider>(
registKey.currentContext)
.changeRefName(userInfo.userId,
nickNameController.text, () {
Navigator.of(registKey.currentContext)
.pop();
});
});
var tip = Column(
children: <Widget>[
Container(
margin: EdgeInsets.only(top: 20),
child: Text(
I18n.of(context).setRemark,
style: TextStyle(
color:
Constants.BlackTextColor,
fontSize: 16),
),
),
Container(
margin: EdgeInsets.only(
top: 23, bottom: 25),
decoration: BoxDecoration(
color: Colors.grey[200],
borderRadius: BorderRadius.all(
Radius.circular(8))),
child: TextField(
keyboardAppearance:
Brightness.light,
controller: nickNameController,
textAlign: TextAlign.center,
textInputAction:
TextInputAction.search,
style: TextStyle(
textBaseline:
TextBaseline.alphabetic,
fontSize: 14),
decoration: InputDecoration(
hintText: userInfo.nickName,
hintStyle:
TextStyle(fontSize: 12),
filled: true,
contentPadding: EdgeInsets.only(
top: 10, bottom: 10),
fillColor: Colors.transparent,
border: InputBorder.none,
),
maxLines: 1,
inputFormatters: [
LengthLimitingTextInputFormatter(
15)
],
),
)
],
Navigator.of(context).push(
new MaterialPageRoute(
builder: (context) {
return AddFriendPage(
userId: userInfo.userId,
pageType:
SendMessagePageType.Remark,
originalName: Provider.of<
RefNameProvider>(
context)
.getRefName(userInfo.userId,
userInfo.nickName));
},
),
);
var content =
CustomUI.buildConfirmContent(
tip, confirm);
CustomUI.buildTip(
registKey.currentContext,
'',
content);
},
child: Container(
alignment: Alignment.center,


+ 21
- 8
lib/home/add_friend.dart Parādīt failu

@@ -1,11 +1,13 @@
import 'package:chat/data/constants.dart';
import 'package:chat/generated/i18n.dart';
import 'package:chat/models/ref_name_provider.dart';
import 'package:chat/utils/CustomUI.dart';
import 'package:chat/utils/HttpUtil.dart';
import 'package:chat/utils/MessageMgr.dart';
import 'package:chat/utils/msgHandler.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:provider/provider.dart';
class AddFriendPage extends StatefulWidget {
final int userId;
@@ -32,6 +34,8 @@ class _AddFriendPageState extends State<AddFriendPage> {
print('AddFriendPage init111');
_txtCtrl.text = widget.originalName;
_hasdeleteIcon =
!(widget.originalName == null || widget.originalName == "");
}
@override
@@ -47,6 +51,9 @@ class _AddFriendPageState extends State<AddFriendPage> {
case SendMessagePageType.ChangeGroupNickName:
title = I18n.of(context).my_group_nickname;
break;
case SendMessagePageType.Remark:
title = I18n.of(context).setRemark;
break;
default:
}
Widget appBar = new AppBar(
@@ -73,7 +80,6 @@ class _AddFriendPageState extends State<AddFriendPage> {
});
break;
case SendMessagePageType.ChangeGroupName:
Navigator.of(context).pop();
MsgHandler.updateGroupName(widget.userId, content);
break;
@@ -81,6 +87,12 @@ class _AddFriendPageState extends State<AddFriendPage> {
Navigator.of(context).pop();
MsgHandler.updateMemberRefName(widget.userId, content);
break;
case SendMessagePageType.Remark:
Provider.of<RefNameProvider>(context)
.changeRefName(widget.userId, content, () {
Navigator.of(context).pop();
});
break;
default:
}
},
@@ -88,16 +100,16 @@ class _AddFriendPageState extends State<AddFriendPage> {
alignment: Alignment.center,
margin: EdgeInsets.only(top: 15, bottom: 15, right: 20),
height: 20,
padding: EdgeInsets.only(left: 18,right: 18,bottom: 1),
padding: EdgeInsets.only(left: 18, right: 18, bottom: 1),
decoration: BoxDecoration(
color: Constants.ConfrimButtonColor, borderRadius: BorderRadius.circular(4.5)),
color: Constants.ConfrimButtonColor,
borderRadius: BorderRadius.circular(4.5)),
child: Text(
widget.pageType == SendMessagePageType.AddFriends
? I18n.of(context).send
: I18n.of(context).determine,
style: TextStyle(
color: Colors.white , fontSize: 14),
textScaleFactor: 1.0,
style: TextStyle(color: Colors.white, fontSize: 14),
textScaleFactor: 1.0,
),
),
)
@@ -124,8 +136,9 @@ class _AddFriendPageState extends State<AddFriendPage> {
height: 36.5,
color: Colors.white,
child: TextField(
keyboardAppearance: Brightness.light,
keyboardAppearance: Brightness.light,
controller: _txtCtrl,
//autofocus: true,
style: TextStyle(
fontSize: 16,
color: Constants.BlackTextColor,
@@ -188,7 +201,7 @@ class _AddFriendPageState extends State<AddFriendPage> {
margin: EdgeInsets.only(top: 20.5, left: 15, bottom: 6),
child: Text(
title,
textScaleFactor: 1.0,
textScaleFactor: 1.0,
style: TextStyle(fontSize: 11),
),
);


+ 7
- 1
lib/home/create_group_view.dart Parādīt failu

@@ -95,7 +95,13 @@ class _FriendSelectItemState extends State<FriendSelectItem> {
SizedBox(width: 10),
_avatarIcon,
SizedBox(width: 10.0),
Text(widget.friendModel.getTitle()),
Expanded(
child: Container(
child: Text(
widget.friendModel.getTitle(),
overflow: TextOverflow.ellipsis,
)),
)
],
),
);


+ 5
- 0
lib/home/friend_page.dart Parādīt failu

@@ -111,6 +111,11 @@ class _FriendPageState extends State<FriendPage> {
borderRadius: BorderRadius.circular(6),
child: CachedNetworkImage(
imageUrl: url,
placeholder: (context, url) => Image.asset(
Constants.DefaultHeadImgUrl,
width: Constants.ContactAvatarSize,
height: Constants.ContactAvatarSize,
),
width: Constants.ContactAvatarSize,
height: Constants.ContactAvatarSize,
));


+ 13
- 9
lib/home/global_search.dart Parādīt failu

@@ -113,9 +113,10 @@ class _GlobalSearchPageState extends State<GlobalSearchPage> {
width: Screen.width,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
textBaseline: TextBaseline.ideographic,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 20,right: 13),
margin: EdgeInsets.only(left: 20, right: 13),
width: Constants.ContactAvatarSize,
height: Constants.ContactAvatarSize,
decoration: BoxDecoration(
@@ -132,15 +133,18 @@ class _GlobalSearchPageState extends State<GlobalSearchPage> {
color: Colors.white,
),
),
Container(
child: Text('${I18n.of(context).search_phone}: ',
style: TextStyle(fontSize: 16.23)),
),
Container(
margin: EdgeInsets.only(top: 5),
child: Text(searchStr,
RichText(
text: TextSpan(children: [
TextSpan(
text: '${I18n.of(context).search_phone}: ',
style: TextStyle(
fontSize: 16.23, color: Color(0xFF008AFF))))
color: Constants.BlackTextColor, fontSize: 16.23)),
TextSpan(
text: searchStr,
style: TextStyle(
color: Color(0xFF008AFF), fontSize: 16.23)),
]),
),
],
),
color: Colors.white));


+ 6
- 13
lib/home/group_all_member.dart Parādīt failu

@@ -30,16 +30,12 @@ class GroupAllMemberState extends State<GroupAllMember> {
static const Separate_Size = 15.0;
bool isHost;


///是否是群主
@override
void initState() {
super.initState();
MessageMgr().on('Update Group Info', updateGroupInfo);
isHost = widget.groupInfoModel.hosterId == UserData().basicInfo.userId;



}

updateGroupInfo(args) async {
@@ -51,18 +47,12 @@ class GroupAllMemberState extends State<GroupAllMember> {

@override
void dispose() {
super.dispose();
MessageMgr().off('Update Group Info', updateGroupInfo);
}

@override
Widget build(BuildContext context) {





Widget appBar = new AppBar(
backgroundColor: AppColors.NewAppbarBgColor,
title: new Text(
@@ -150,14 +140,17 @@ class GroupAllMemberState extends State<GroupAllMember> {
borderRadius: BorderRadius.all(Radius.circular(8.0)),
child: CachedNetworkImage(
imageUrl: member.avtar,
placeholder: CustomUI.buildImgLoding,
placeholder: (context, url) => Image.asset(
Constants.DefaultHeadImgUrl,
width: size - 30,
height: size - 30,
),
width: size - 30,
height: size - 30,
)),
SizedBox(
height: 5,
),

SizedBox(
width: size - 30,
child: Text(
@@ -176,7 +169,7 @@ class GroupAllMemberState extends State<GroupAllMember> {
onTap: () {
if (member.memberId != UserData().basicInfo.userId) {
AppNavigator.pushProfileInfoPage(context, member.memberId,
fromWhere: 2,addMode: 1);
fromWhere: 2, addMode: 1);
}
},
));


+ 11
- 6
lib/home/homeMain.dart Parādīt failu

@@ -39,6 +39,7 @@ class NavigationIconView {
String title,
IconData icon,
int type,
EdgeInsets iconMargin,
double iconSize = 24,
bool isCenter = false,
bool isShowdot = false,
@@ -72,7 +73,7 @@ class NavigationIconView {
Container(
margin: isCenter
? EdgeInsets.only(bottom: 8, right: 6)
: EdgeInsets.zero,
: iconMargin ?? EdgeInsets.zero,
child: Icon(icon,
size: iconSize,
color:
@@ -110,7 +111,7 @@ class NavigationIconView {
Container(
margin: isCenter
? EdgeInsets.only(bottom: 8, right: 6)
: EdgeInsets.zero,
: iconMargin ?? EdgeInsets.zero,
child: isShowdot
? UnreadDot(
child: Icon(icon,
@@ -122,6 +123,11 @@ class NavigationIconView {
color: isCenter
? Colors.white
: Constants.BottomIconGreyColor))
// child: Icon(icon,
// size: iconSize,
// color: isCenter
// ? Colors.white
// : Constants.BottomIconGreyColor))
],
));
}
@@ -141,7 +147,6 @@ class _HomeMainState extends State<HomeMain> {
@override
void initState() {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.light);
super.initState();
LocalNotificationUtil.instance.initState(context);
@@ -312,11 +317,11 @@ class _HomeMainState extends State<HomeMain> {
fontFamily: 'iconfont',
),
isShowdot: true,
type: 3,
iconSize: 25),
iconSize: 29),
NavigationIconView(
title: _titles[0],
isShowdot: true,
iconMargin: EdgeInsets.only(top: 2),
type: 5,
icon: IconData(
0xe66e,
@@ -338,7 +343,7 @@ class _HomeMainState extends State<HomeMain> {
0xe60b,
fontFamily: 'iconfont',
),
type: 4,
type: 6,
iconSize: 26.5),
NavigationIconView(
title: _titles[3],


+ 1
- 0
lib/home/last_chat_item.dart Parādīt failu

@@ -121,6 +121,7 @@ class _LastChatItemState extends State<LastChatItem> {
Provider.of<RefNameProvider>(context)
.getRefName(userInfo.userId, userInfo.nickName),
textScaleFactor: 1.0,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 15,
color: Colors.black,


+ 5
- 0
lib/home/new_friends.dart Parādīt failu

@@ -48,6 +48,11 @@ class _ContactItem extends StatelessWidget {
borderRadius: BorderRadius.circular(6),
child: CachedNetworkImage(
imageUrl: this.avatar,
placeholder: (context, url) => Image.asset(
Constants.DefaultHeadImgUrl,
width: Constants.ContactAvatarSize,
height: Constants.ContactAvatarSize,
),
width: Constants.ContactAvatarSize,
height: Constants.ContactAvatarSize,
));


+ 6
- 4
lib/home/unread_dot_widget.dart Parādīt failu

@@ -56,14 +56,16 @@ class _UnreadDotState extends State<UnreadDot> {
case 5:
isHasUnread = isHaveNewFriends();
break;
case 6:
isHasUnread = ChatDataMgr().unreadCountProvider.checkUnreadMsg() ||
isShowMsg() ||
ChatDataMgr().groupUnreadProvider.checkUnreadMsg();
break;
}
return Stack(
children: <Widget>[
Padding(
padding: EdgeInsets.only(right: 2),
child: widget.child,
),
widget.child,
Positioned(
right: 0,
top: 0,


+ 1
- 0
lib/main.dart Parādīt failu

@@ -376,6 +376,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
GlobalCupertinoLocalizations.delegate, // <-- needed for iOS
const FallbackCupertinoLocalisationsDelegate()
],
//locale: const Locale('en'),
supportedLocales: i18n.supportedLocales,
title: 'Chat',
onGenerateTitle: (context) {


+ 11
- 1
lib/models/friends_info.dart Parādīt failu

@@ -52,6 +52,11 @@ class FriendsInfo extends StatelessWidget {
borderRadius: BorderRadius.circular(6),
child: CachedNetworkImage(
imageUrl: this.avatar,
placeholder: (context, url) => Image.asset(
Constants.DefaultHeadImgUrl,
width: Constants.ContactAvatarSize,
height: Constants.ContactAvatarSize,
),
width: Constants.ContactAvatarSize,
height: Constants.ContactAvatarSize,
));
@@ -76,7 +81,12 @@ class FriendsInfo extends StatelessWidget {
children: <Widget>[
_avatarIcon,
SizedBox(width: 10.0),
Text(title),
Expanded(
child: Container(
child: Text(
title,
overflow: TextOverflow.ellipsis,
)))
],
),
);


Notiek ielāde…
Atcelt
Saglabāt