记忆卡.
This commit is contained in:
parent
b2662dbe5b
commit
2d931437bd
BIN
assets/images/ic_memory_card.png
Normal file
BIN
assets/images/ic_memory_card.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 46 KiB |
17
lib/beans/invite_new_bean.dart
Normal file
17
lib/beans/invite_new_bean.dart
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'invite_new_bean.g.dart';
|
||||
|
||||
///标签
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class InviteNewBean {
|
||||
String? imgUrl;
|
||||
int? type;
|
||||
|
||||
|
||||
InviteNewBean(this.imgUrl, this.type);
|
||||
|
||||
factory InviteNewBean.fromJson(Map<String, dynamic> json) => _$InviteNewBeanFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$InviteNewBeanToJson(this);
|
||||
}
|
||||
19
lib/beans/invite_new_bean.g.dart
Normal file
19
lib/beans/invite_new_bean.g.dart
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'invite_new_bean.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
InviteNewBean _$InviteNewBeanFromJson(Map<String, dynamic> json) =>
|
||||
InviteNewBean(
|
||||
json['imgUrl'] as String?,
|
||||
(json['type'] as num?)?.toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$InviteNewBeanToJson(InviteNewBean instance) =>
|
||||
<String, dynamic>{
|
||||
'imgUrl': instance.imgUrl,
|
||||
'type': instance.type,
|
||||
};
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import 'invite_new_bean.dart';
|
||||
import 'me_character_info_bean.dart';
|
||||
|
||||
part 'user_info_bean.g.dart';
|
||||
|
|
@ -14,6 +15,9 @@ class UserInfoBean {
|
|||
int? remainingChatCount;
|
||||
List<MeCharacterInfoBean>? characterInfo;
|
||||
int? memoryCardCount;
|
||||
InviteNewBean? inviteNewUser;
|
||||
int? hasTalked;
|
||||
int? photographs;
|
||||
|
||||
UserInfoBean(this.currency, this.userIconUrl, this.userId, this.nickName, this.remainingChatCount, this.characterInfo, this.memoryCardCount);
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,13 @@ UserInfoBean _$UserInfoBeanFromJson(Map<String, dynamic> json) => UserInfoBean(
|
|||
?.map((e) => MeCharacterInfoBean.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
(json['memoryCardCount'] as num?)?.toInt(),
|
||||
);
|
||||
)
|
||||
..inviteNewUser = json['inviteNewUser'] == null
|
||||
? null
|
||||
: InviteNewBean.fromJson(
|
||||
json['inviteNewUser'] as Map<String, dynamic>)
|
||||
..hasTalked = (json['hasTalked'] as num?)?.toInt()
|
||||
..photographs = (json['photographs'] as num?)?.toInt();
|
||||
|
||||
Map<String, dynamic> _$UserInfoBeanToJson(UserInfoBean instance) =>
|
||||
<String, dynamic>{
|
||||
|
|
@ -27,4 +33,7 @@ Map<String, dynamic> _$UserInfoBeanToJson(UserInfoBean instance) =>
|
|||
'remainingChatCount': instance.remainingChatCount,
|
||||
'characterInfo': instance.characterInfo?.map((e) => e.toJson()).toList(),
|
||||
'memoryCardCount': instance.memoryCardCount,
|
||||
'inviteNewUser': instance.inviteNewUser?.toJson(),
|
||||
'hasTalked': instance.hasTalked,
|
||||
'photographs': instance.photographs,
|
||||
};
|
||||
|
|
|
|||
85
lib/dialog/memory_card_dialog.dart
Normal file
85
lib/dialog/memory_card_dialog.dart
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../network/NetworkConfig.dart';
|
||||
|
||||
class MemoryCardDialog extends StatefulWidget {
|
||||
Function onTap;
|
||||
|
||||
MemoryCardDialog({required this.onTap});
|
||||
|
||||
@override
|
||||
State<MemoryCardDialog> createState() => _MemoryCardDialogState();
|
||||
}
|
||||
|
||||
class _MemoryCardDialogState extends State<MemoryCardDialog> {
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Material(
|
||||
type: MaterialType.transparency, //透明类型
|
||||
color: Color(0x1A000000),
|
||||
child: Container(
|
||||
decoration:
|
||||
BoxDecoration(color: Color(0xFF19191A), borderRadius: BorderRadius.only(topLeft: Radius.circular(7), topRight: Radius.circular(7))),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
width: 24.7,
|
||||
height: 3,
|
||||
margin: EdgeInsets.only(top: 12),
|
||||
decoration: BoxDecoration(color: Color(0xFF272734), borderRadius: BorderRadius.all(Radius.circular(7))),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 38, left: 22, bottom: 19),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(color: Color(0xFF2A2A2A), borderRadius: BorderRadius.all(Radius.circular(7))),
|
||||
child: Image(
|
||||
width: 155,
|
||||
height: 100,
|
||||
image: AssetImage('assets/images/ic_memory_card.png'),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 30),
|
||||
child: Text(
|
||||
"x ${NetworkConfig.userInfoBean?.memoryCardCount}",
|
||||
style: TextStyle(color: Color(0xFFFF9000)),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
widget.onTap();
|
||||
},
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: 40,
|
||||
margin: EdgeInsets.all(18),
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFFF9000),
|
||||
borderRadius: BorderRadius.all(Radius.circular(7)),
|
||||
),
|
||||
child: Text(
|
||||
'使用记忆提升卡',
|
||||
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
import '../beans/user_info_bean.dart';
|
||||
|
||||
class NetworkConfig {
|
||||
static String ServerDomain_Online = BASE_URLS[SELECT_INDEX];
|
||||
static String deviceID = ""; //设备ID
|
||||
|
|
@ -25,6 +27,7 @@ class NetworkConfig {
|
|||
static String userName = "";
|
||||
static String Version = "1.0.0";
|
||||
static String Language = "en";
|
||||
static UserInfoBean? userInfoBean;
|
||||
|
||||
static const String accountLogin = "api/Account/AccountLogIn"; //登录
|
||||
static const String sendPhoneNumber = "api/Account/SendPhoneNumber"; //获取验证码
|
||||
|
|
|
|||
|
|
@ -13,7 +13,9 @@ import '../../beans/send_message_bean.dart';
|
|||
import '../../common/func.dart';
|
||||
import '../../custom/custom_popup.dart';
|
||||
import '../../dialog/delete_dialog.dart';
|
||||
import '../../dialog/memory_card_dialog.dart';
|
||||
import '../../dialog/restart_chat_dialog.dart';
|
||||
import '../../network/NetworkConfig.dart';
|
||||
import 'chat_info_page.dart';
|
||||
import 'chat_model.dart';
|
||||
|
||||
|
|
@ -341,25 +343,25 @@ class _ChatPageState extends State<ChatPage> {
|
|||
),
|
||||
|
||||
///关注
|
||||
Positioned(
|
||||
right: 0,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
isHalf = !isHalf;
|
||||
setState(() {});
|
||||
},
|
||||
child: Container(
|
||||
width: 50,
|
||||
height: 24,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(color: Color(0x33000000), borderRadius: BorderRadius.all(Radius.circular(12))),
|
||||
child: Text(
|
||||
'+ 关注',
|
||||
style: TextStyle(fontSize: 12, color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// Positioned(
|
||||
// right: 0,
|
||||
// child: GestureDetector(
|
||||
// onTap: () {
|
||||
// isHalf = !isHalf;
|
||||
// setState(() {});
|
||||
// },
|
||||
// child: Container(
|
||||
// width: 50,
|
||||
// height: 24,
|
||||
// alignment: Alignment.center,
|
||||
// decoration: BoxDecoration(color: Color(0x33000000), borderRadius: BorderRadius.all(Radius.circular(12))),
|
||||
// child: Text(
|
||||
// '+ 关注',
|
||||
// style: TextStyle(fontSize: 12, color: Colors.white),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
@ -567,8 +569,15 @@ class _ChatPageState extends State<ChatPage> {
|
|||
setState(() {
|
||||
isMore = false;
|
||||
});
|
||||
// EasyLoading.show(status: 'loading...');
|
||||
// _viewmodel.delChat(widget.characterId);
|
||||
if (NetworkConfig.userInfoBean!.memoryCardCount! > 0) {
|
||||
FunctionUtil.bottomSheetDialog(context, MemoryCardDialog(
|
||||
onTap: () {
|
||||
EasyLoading.showToast("status");
|
||||
},
|
||||
));
|
||||
} else {
|
||||
Navigator.pushNamed(context, "/ShopPage");
|
||||
}
|
||||
},
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
|
@ -758,7 +767,7 @@ class _ChatPageState extends State<ChatPage> {
|
|||
child: Text(
|
||||
chatList[index].content!,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontSize: 14,
|
||||
color: Color(0xFFE8E8E8),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import '../../beans/send_message_bean.dart';
|
|||
import '../../common/func.dart';
|
||||
import '../../custom/custom_popup.dart';
|
||||
import '../../dialog/delete_dialog.dart';
|
||||
import '../../dialog/memory_card_dialog.dart';
|
||||
import '../../dialog/restart_chat_dialog.dart';
|
||||
import '../../network/NetworkConfig.dart';
|
||||
import '../chat/chat_info_page.dart';
|
||||
|
|
@ -565,6 +566,15 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
|
|||
});
|
||||
// EasyLoading.show(status: 'loading...');
|
||||
// _viewmodel.delChat(widget.characterId);
|
||||
if (NetworkConfig.userInfoBean!.memoryCardCount! > 0) {
|
||||
FunctionUtil.bottomSheetDialog(context, MemoryCardDialog(
|
||||
onTap: () {
|
||||
EasyLoading.showToast("status");
|
||||
},
|
||||
));
|
||||
} else {
|
||||
Navigator.pushNamed(context, "/ShopPage");
|
||||
}
|
||||
},
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
|
@ -758,7 +768,7 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
|
|||
child: Text(
|
||||
chatList[index].content!,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontSize: 14,
|
||||
color: Color(0xFFE8E8E8),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import 'package:talk/network/NetworkConfig.dart';
|
|||
import 'package:talk/network/RequestCenter.dart';
|
||||
|
||||
import '../../beans/login_bean.dart';
|
||||
import '../../beans/user_info_bean.dart';
|
||||
import '../../network/BaseEntity.dart';
|
||||
|
||||
class LoginModel {
|
||||
|
|
@ -59,6 +60,8 @@ class LoginModel {
|
|||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
await prefs.setString('token', loginBean.token!);
|
||||
|
||||
getUserInfo();
|
||||
|
||||
streamController.sink.add({
|
||||
'code': "login", //有数据
|
||||
'data': dataEntity.message,
|
||||
|
|
@ -73,4 +76,27 @@ class LoginModel {
|
|||
print("errorEntity==${errorEntity.message}");
|
||||
});
|
||||
}
|
||||
|
||||
///用户信息
|
||||
Future<void> getUserInfo() async {
|
||||
RequestCenter.instance.requestGet(NetworkConfig.getUserInfo, {}, (BaseEntity dataEntity) {
|
||||
if (dataEntity.code == 0) {
|
||||
UserInfoBean userInfoBean = UserInfoBean.fromJson(dataEntity.data);
|
||||
NetworkConfig.userInfoBean = userInfoBean;
|
||||
|
||||
streamController.sink.add({
|
||||
'code': "getUserInfo", //有数据
|
||||
'data': userInfoBean,
|
||||
});
|
||||
} else {
|
||||
streamController.sink.add({
|
||||
'code': "error", //
|
||||
'data': dataEntity.message,
|
||||
});
|
||||
}
|
||||
}, (ErrorEntity errorEntity) {
|
||||
print("errorEntity==${errorEntity.message}");
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,6 +85,10 @@ class _LoginPageState extends State<LoginPage> {
|
|||
break;
|
||||
case "login":
|
||||
EasyLoading.showToast(newData['data']);
|
||||
break;
|
||||
|
||||
case "getUserInfo":
|
||||
EasyLoading.dismiss();
|
||||
Navigator.pushReplacementNamed(context, "/HomePage");
|
||||
break;
|
||||
|
||||
|
|
@ -204,7 +208,7 @@ class _LoginPageState extends State<LoginPage> {
|
|||
onTap: () {
|
||||
if (phoneText != "" && codeText != "") {
|
||||
if (isCheck) {
|
||||
EasyLoading.showToast("登录");
|
||||
EasyLoading.show(status: "'loading...'");
|
||||
_viewmodel.login(phoneText, codeText, 1, "");
|
||||
} else {
|
||||
EasyLoading.showToast("请选中协议");
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ class MeModel {
|
|||
RequestCenter.instance.requestGet(NetworkConfig.getUserInfo, {}, (BaseEntity dataEntity) {
|
||||
if (dataEntity.code == 0) {
|
||||
UserInfoBean userInfoBean = UserInfoBean.fromJson(dataEntity.data);
|
||||
NetworkConfig.userInfoBean = userInfoBean;
|
||||
|
||||
streamController.sink.add({
|
||||
'code': "getUserInfo", //有数据
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user