This commit is contained in:
18631081161 2024-07-26 13:26:09 +08:00
parent ef31d9a2e6
commit 9df37f33b0
17 changed files with 591 additions and 251 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

View File

@ -0,0 +1,93 @@
import 'package:flutter/material.dart';
class RestartChatDialog extends StatefulWidget {
Function onTap;
RestartChatDialog({required this.onTap});
@override
State<RestartChatDialog> createState() => _RestartChatDialogState();
}
class _RestartChatDialogState extends State<RestartChatDialog> {
@override
void initState() {
// TODO: implement initState
super.initState();
}
@override
Widget build(BuildContext context) {
return Material(
type: MaterialType.transparency, //
color: Color(0x1A000000),
child: Center(
child: ClipRRect(
borderRadius: BorderRadius.circular(7.0),
child: Container(
width: 247,
color: Color(0xFF272727),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
margin: EdgeInsets.only(top: 28),
child: Text(
'确认重启聊天吗?\n聊天记录都将清空!',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 15, color: Color(0xFFBABABA)),
),
),
Container(
margin: EdgeInsets.only(top: 38, left: 22, right: 22, bottom: 19),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: Container(
width: 80,
height: 28,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(14)),
border: Border.all(color: Color(0xFFFF9000), width: 1),
),
child: Text(
'取消',
style: TextStyle(color: Color(0xFFFF9000), fontSize: 12),
),
),
),
GestureDetector(
onTap: () {
Navigator.pop(context);
widget.onTap();
},
child: Container(
width: 80,
height: 28,
alignment: Alignment.center,
decoration: BoxDecoration(
color: Color(0xFFFF9000),
borderRadius: BorderRadius.all(Radius.circular(14)),
),
child: Text(
'确定',
style: TextStyle(color: Colors.black, fontSize: 12),
),
),
),
],
),
),
],
),
),
),
),
);
}
}

View File

@ -7,6 +7,7 @@ import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:talk/tools/home/test_page.dart';
import 'package:talk/tools/home_page.dart';
import 'package:talk/tools/login/login_page.dart';
import 'package:talk/tools/me/about_page.dart';
import 'package:talk/tools/me/setting_page.dart';
import 'package:talk/tools/search/search_page.dart';
import 'package:talk/tools/shop/account_page.dart';
@ -45,6 +46,8 @@ class _ChatAppState extends State<ChatApp> {
void initState() {
// TODO: implement initState
super.initState();
//
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.light);
}
@override
@ -62,6 +65,7 @@ class _ChatAppState extends State<ChatApp> {
'/ShopPage': (BuildContext context) => const ShopPage(),
'/SettingPage': (BuildContext context) => const SettingPage(),
'/TestPage': (BuildContext context) => const TestPage(),
'/AboutPage': (BuildContext context) => const AboutPage(),
},
debugShowMaterialGrid: false,
//

View File

@ -10,7 +10,10 @@ import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
import '../../beans/character_info_bean.dart';
import '../../beans/chat_info_bean.dart';
import '../../beans/send_message_bean.dart';
import '../../common/func.dart';
import '../../custom/custom_popup.dart';
import '../../dialog/delete_dialog.dart';
import '../../dialog/restart_chat_dialog.dart';
import 'chat_info_page.dart';
import 'chat_model.dart';
@ -174,6 +177,15 @@ class _ChatPageState extends State<ChatPage> {
@override
Widget build(BuildContext context) {
final size = MediaQuery.of(context).size;
final h311 = size.width / 1.1575562700964;
final h30 = size.width / 12;
final h35 = size.width / 10.285714285714;
final h23 = size.width / 15.652173913043;
final w27 = size.width / 13.333333333333;
final h70 = size.width / 5.1428571428571;
final l50 = size.width / 7.2;
return Scaffold(
backgroundColor: Color(0xFF121213),
body: Stack(
@ -191,7 +203,7 @@ class _ChatPageState extends State<ChatPage> {
bottom: 0,
child: Container(
width: MediaQuery.of(context).size.width,
height: 311.67,
height: h311,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Color(0x00000000), Color(0xFF0C0909)], //
@ -222,7 +234,7 @@ class _ChatPageState extends State<ChatPage> {
///title
Container(
width: double.infinity,
height: 30,
height: h30,
margin: EdgeInsets.only(top: 10, left: 16, right: 16),
child: Stack(
alignment: Alignment.center,
@ -236,7 +248,7 @@ class _ChatPageState extends State<ChatPage> {
Positioned(
left: 0,
child: Container(
height: 30,
height: h30,
decoration: BoxDecoration(color: Color(0x33000000), borderRadius: BorderRadius.all(Radius.circular(14))),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
@ -274,7 +286,7 @@ class _ChatPageState extends State<ChatPage> {
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
width: 35,
width: h35,
child: Text(
"${characterInfoBean?.characterName}",
overflow: TextOverflow.ellipsis,
@ -282,7 +294,7 @@ class _ChatPageState extends State<ChatPage> {
),
),
SizedBox(
width: 35,
width: h35,
child: Text(
'${characterInfoBean?.lookCount} 聊过',
style: TextStyle(fontSize: 7, color: Colors.white),
@ -436,8 +448,8 @@ class _ChatPageState extends State<ChatPage> {
Container(
margin: const EdgeInsets.only(right: 7),
child: text == ""
? const Image(
width: 27,
? Image(
width: w27,
image: AssetImage('assets/images/ic_send_n.png'),
)
: GestureDetector(
@ -453,7 +465,7 @@ class _ChatPageState extends State<ChatPage> {
setState(() {});
},
child: Image(
width: 27,
width: w27,
image: AssetImage('assets/images/ic_send.png'),
),
),
@ -485,7 +497,7 @@ class _ChatPageState extends State<ChatPage> {
child: Container(
margin: EdgeInsets.only(left: 14),
child: Image(
width: 27,
width: w27,
image: AssetImage('assets/images/ic_more.png'),
),
),
@ -496,37 +508,42 @@ class _ChatPageState extends State<ChatPage> {
isMore
? Container(
height: 50,
height: h70,
alignment: Alignment.centerLeft,
margin: const EdgeInsets.only(left: 16, right: 16, bottom: 20),
margin: EdgeInsets.only(left: 16, right: 16, bottom: 20),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
// Container(
// margin: EdgeInsets.only(left: 23),
// child: Column(
// mainAxisSize: MainAxisSize.min,
// children: [
// Image(width: 26, image: AssetImage('assets/images/ic_album.png')),
// Container(
// margin: EdgeInsets.only(top: 9),
// child: Text(
// '角色相册',
// style: TextStyle(fontSize: 10, color: Color(0xFFA2A2A2)),
// ),
// ),
// ],
// ),
// ),
Container(
margin: EdgeInsets.only(left: 23),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Image(width: 26, image: AssetImage('assets/images/ic_album.png')),
Container(
margin: EdgeInsets.only(top: 9),
child: Text(
'角色相册',
style: TextStyle(fontSize: 10, color: Color(0xFFA2A2A2)),
),
),
],
),
),
Container(
margin: EdgeInsets.only(left: 23),
margin: EdgeInsets.only(left: h23),
child: GestureDetector(
onTap: () {
setState(() {
isMore = false;
});
EasyLoading.show(status: 'loading...');
_viewmodel.delChat(widget.characterId);
FunctionUtil.popDialog(context, RestartChatDialog(
onTap: () {
EasyLoading.show(status: 'loading...');
_viewmodel.delChat(widget.characterId);
},
));
},
child: Column(
mainAxisSize: MainAxisSize.min,
@ -544,7 +561,7 @@ class _ChatPageState extends State<ChatPage> {
),
),
Container(
margin: EdgeInsets.only(left: 23),
margin: EdgeInsets.only(left: l50),
child: GestureDetector(
onTap: () {
setState(() {
@ -592,7 +609,7 @@ class _ChatPageState extends State<ChatPage> {
return Center(
key: key,
child: Container(
margin: EdgeInsets.only(left: 16, right: 16, bottom: 20),
margin: EdgeInsets.only(left: 12, right: 12, bottom: 20),
padding: EdgeInsets.only(left: 20, right: 20, top: 12, bottom: 12),
decoration: BoxDecoration(color: Color(0x99000000), borderRadius: BorderRadius.all(Radius.circular(13))),
child: ExpandableText(
@ -675,7 +692,7 @@ class _ChatPageState extends State<ChatPage> {
margin: const EdgeInsets.symmetric(vertical: 4, horizontal: 12),
padding: const EdgeInsets.all(11.0),
decoration: const BoxDecoration(
color: Color(0x99FF9000),
color: Color(0xFFFF9000),
borderRadius: BorderRadius.only(
topRight: Radius.circular(16.0), bottomLeft: Radius.circular(16.0), bottomRight: Radius.circular(16.0)),
),
@ -683,7 +700,7 @@ class _ChatPageState extends State<ChatPage> {
chatList[index].content!,
style: const TextStyle(
fontSize: 14,
color: Color(0xFFE8E8E8),
color: Colors.black,
),
),
),
@ -766,9 +783,9 @@ class _ChatPageState extends State<ChatPage> {
Expanded(
child: GestureDetector(
onTap: () {
customController.hideMenu();
EasyLoading.showToast("内容已复制");
Clipboard.setData(ClipboardData(text: content));
customController.hideMenu();
},
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
@ -788,7 +805,11 @@ class _ChatPageState extends State<ChatPage> {
child: GestureDetector(
onTap: () {
customController.hideMenu();
deleteChat(id, index);
FunctionUtil.popDialog(context, DeleteDialog(
onTap: () {
deleteChat(id, index);
},
));
},
child: Column(
mainAxisAlignment: MainAxisAlignment.center,

View File

@ -75,15 +75,27 @@ class _MultiplexPageState extends State<MultiplexPage> {
}
_item(index, CategoryInfoListBean data) {
final size = MediaQuery.of(context).size;
final w130 = size.width / 2.7692307692307;
final h50 = size.width / 7.2;
final b23 = size.width / 15.652173913043;
final w83 = size.width / 4.3373493975903;
final h115 = size.width / 3.1304347826086;
final l101 = size.width / 3.5643564356435;
final t45 = size.width / 8;
final w200 = size.width / 1.8;
final l102 = size.width / 3.5294117647058;
final h70 = size.width / 5.1428571428571;
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
goChatPage(data.id.toString());
},
child: Container(
height: 130,
width: 50,
margin: EdgeInsets.only(bottom: 23),
height: w130,
width: h50,
margin: EdgeInsets.only(bottom: b23),
decoration: BoxDecoration(
color: Color(0xFF202021),
borderRadius: BorderRadius.all(Radius.circular(7)),
@ -94,30 +106,29 @@ class _MultiplexPageState extends State<MultiplexPage> {
children: [
Positioned(
left: 7,
child:
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(15)),
child: CachedNetworkImage(
width: 83,
height: 115,
fit: BoxFit.cover,
imageUrl: data.iconImage!,
errorWidget: (context, url, error) => const Icon(Icons.error),
),
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(15)),
child: CachedNetworkImage(
width: w83,
height: h115,
fit: BoxFit.cover,
imageUrl: data.bgImage!,
errorWidget: (context, url, error) => const Icon(Icons.error),
),
),
),
Positioned(
left: 101,
left: l101,
top: 19,
child: Text(
'${data.name}',
style: TextStyle(color: Colors.white, fontSize: 14),
)),
Positioned(
left: 101,
top: 45,
left: l101,
top: t45,
child: SizedBox(
width: 200,
width: w200,
height: 16,
child: ListView.builder(
itemCount: data.label?.length,
@ -127,7 +138,8 @@ class _MultiplexPageState extends State<MultiplexPage> {
alignment: Alignment.center,
padding: EdgeInsets.symmetric(horizontal: 11),
margin: EdgeInsets.only(right: 5),
decoration: BoxDecoration(border: Border.all(color: Color(0xFFFF9000)), borderRadius: BorderRadius.all(Radius.circular(7))),
decoration: BoxDecoration(
border: Border.all(color: Color(0xFFFF9000), width: 0.33), borderRadius: BorderRadius.all(Radius.circular(7))),
child: Text(
'${data.label?[index].name}',
style: TextStyle(fontSize: 10, color: Color(0xFFFF9000)),
@ -136,10 +148,10 @@ class _MultiplexPageState extends State<MultiplexPage> {
}),
)),
Positioned(
left: 102,
top: 70,
left: l102,
top: h70,
child: Container(
width: 200,
width: w200,
child: Text(
maxLines: 3,
'${data.biography}',

View File

@ -285,7 +285,12 @@ class _RecommendPageState extends State<RecommendPage> with AutomaticKeepAliveCl
alignment: Alignment.center,
padding: EdgeInsets.symmetric(horizontal: 11),
margin: EdgeInsets.only(right: 5),
decoration: BoxDecoration(border: Border.all(color: Color(0xFFFF9000)), borderRadius: BorderRadius.all(Radius.circular(7))),
decoration: BoxDecoration(
border: Border.all(
color: Color(0xFFFF9000),
width: 0.33,
),
borderRadius: BorderRadius.all(Radius.circular(7))),
child: Text(
'${data.label?[index].name}',
style: TextStyle(fontSize: 10, color: Color(0xFFFF9000)),

View File

@ -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/restart_chat_dialog.dart';
import '../../network/NetworkConfig.dart';
import '../chat/chat_info_page.dart';
import '../chat/chat_model.dart';
@ -181,8 +182,11 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
final h311 = size.width / 1.1575562700964;
final h30 = size.width / 12;
final h35 = size.width / 10.285714285714;
final h23 = size.width / 15.652173913043;
final w27 = size.width / 13.333333333333;
final h70 = size.width / 5.1428571428571;
final l50 = size.width / 7.2;
super.build(context);
return Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: Color(0xFF121213),
@ -230,7 +234,7 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
left: 0,
child: Container(
height: h30,
decoration: BoxDecoration(color: Color(0x33000000), borderRadius: BorderRadius.all(Radius.circular(14))),
decoration: BoxDecoration(color: Color(0x33000000), borderRadius: BorderRadius.all(Radius.circular(20))),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
@ -250,8 +254,8 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
margin: EdgeInsets.only(left: 2),
child: ClipOval(
child: CachedNetworkImage(
width: 23,
height: 23,
width: h23,
height: h23,
imageUrl: '${characterInfoBean.icon}',
errorWidget: (context, url, error) => const Icon(Icons.error),
),
@ -432,8 +436,8 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
Container(
margin: const EdgeInsets.only(right: 7),
child: text == ""
? const Image(
width: 27,
? Image(
width: w27,
image: AssetImage('assets/images/ic_send_n.png'),
)
: GestureDetector(
@ -453,7 +457,7 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
setState(() {});
},
child: Image(
width: 27,
width: w27,
image: AssetImage('assets/images/ic_send.png'),
),
),
@ -489,7 +493,7 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
child: Container(
margin: EdgeInsets.only(left: 14),
child: Image(
width: 27,
width: w27,
image: !isMore ? AssetImage('assets/images/ic_more.png') : AssetImage('assets/images/ic_more_no.png'),
),
),
@ -500,40 +504,42 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
isMore
? Container(
height: 70,
height: h70,
alignment: Alignment.centerLeft,
margin: EdgeInsets.only(
left: 16,
right: 16,
),
margin: EdgeInsets.only(left: 16, right: 16, bottom: 20),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
// Container(
// margin: EdgeInsets.only(left: 23),
// child: Column(
// mainAxisSize: MainAxisSize.min,
// children: [
// Image(width: 26, image: AssetImage('assets/images/ic_album.png')),
// Container(
// margin: EdgeInsets.only(top: 9),
// child: Text(
// '角色相册',
// style: TextStyle(fontSize: 10, color: Color(0xFFA2A2A2)),
// ),
// ),
// ],
// ),
// ),
Container(
margin: EdgeInsets.only(left: 23),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Image(width: 26, image: AssetImage('assets/images/ic_album.png')),
Container(
margin: EdgeInsets.only(top: 9),
child: Text(
'角色相册',
style: TextStyle(fontSize: 10, color: Color(0xFFA2A2A2)),
),
),
],
),
),
Container(
margin: EdgeInsets.only(left: 23),
margin: EdgeInsets.only(left: h23),
child: GestureDetector(
onTap: () {
setState(() {
isMore = false;
});
EasyLoading.show(status: 'loading...');
_viewmodel.delChat(widget.characterId);
FunctionUtil.popDialog(context, RestartChatDialog(
onTap: () {
EasyLoading.show(status: 'loading...');
_viewmodel.delChat(widget.characterId);
},
));
},
child: Column(
mainAxisSize: MainAxisSize.min,
@ -551,7 +557,7 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
),
),
Container(
margin: EdgeInsets.only(left: 23),
margin: EdgeInsets.only(left: l50),
child: GestureDetector(
onTap: () {
setState(() {
@ -589,6 +595,11 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
///
_item(index) {
final size = MediaQuery.of(context).size;
final b20 = size.width / 18;
final l50 = size.width / 7.2;
final w135 = size.width / 2.666666666;
final h40 = size.width / 9;
// if (index == 0) {
// return Container();
// }
@ -633,6 +644,7 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
},
child: Container(
padding: const EdgeInsets.only(left: 9, right: 9, top: 6, bottom: 6),
margin: EdgeInsets.only(bottom: b20),
decoration: const BoxDecoration(
color: Color(0xCC000000),
borderRadius: BorderRadius.all(Radius.circular(15)),
@ -640,7 +652,7 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(chatList[index].content!, style: TextStyle(color: Color(0xFFB6B6B6), fontSize: 10)),
Text(chatList[index].content!, style: const TextStyle(color: Color(0xFFB6B6B6), fontSize: 10)),
Container(
margin: const EdgeInsets.only(left: 10),
child: const Text("立即增加", style: TextStyle(color: Color(0xFFFF9000), fontSize: 10)),
@ -666,12 +678,12 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
children: [
ConstrainedBox(
constraints: BoxConstraints(
maxWidth: MediaQuery.of(context).size.width - 50, //
maxWidth: MediaQuery.of(context).size.width - l50, //
),
child: CustomPopup(
controller: customController,
menuBuilder: () {
return popupView(chatList[index].id!, chatList[index].content!, index, customController);
return popupView(chatList[index].id!, chatList[index].content!, index, customController, w135, h40);
},
barrierColor: Colors.transparent,
//
@ -680,7 +692,7 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
margin: const EdgeInsets.symmetric(vertical: 4, horizontal: 12),
padding: const EdgeInsets.all(11.0),
decoration: const BoxDecoration(
color: Color(0x99FF9000),
color: Color(0xFFFF9000),
borderRadius: BorderRadius.only(
topRight: Radius.circular(16.0), bottomLeft: Radius.circular(16.0), bottomRight: Radius.circular(16.0)),
),
@ -688,7 +700,7 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
chatList[index].content!,
style: const TextStyle(
fontSize: 14,
color: Color(0xFFE8E8E8),
color: Colors.black,
),
),
),
@ -733,7 +745,7 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
children: [
ConstrainedBox(
constraints: BoxConstraints(
maxWidth: MediaQuery.of(context).size.width - 50, //
maxWidth: MediaQuery.of(context).size.width - l50, //
),
child: Container(
margin: const EdgeInsets.symmetric(vertical: 4, horizontal: 12),
@ -757,10 +769,10 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
);
}
popupView(int id, String content, index, customController) {
popupView(int id, String content, index, customController, w135, h40) {
return Container(
width: 135,
height: 40,
width: w135,
height: h40,
decoration: BoxDecoration(
color: Color(0xFF222222),
borderRadius: BorderRadius.all(Radius.circular(2)),

View File

@ -53,79 +53,6 @@ class _HomePageState extends State<HomePage> with SingleTickerProviderStateMixin
MePage(),
],
),
// Positioned(
// bottom: 0,
// child: Container(
// width: MediaQuery.of(context).size.width,
// height: 60,
// color: Color(currentIndex != 0 ? 0xFF121213 : 0x121213),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceAround,
// children: [
// GestureDetector(
// onTap: () {
// currentIndex = 0;
// _tabController.animateTo(0);
// setState(() {});
// },
// child: Text(
// '首页',
// style: TextStyle(color: Color(currentIndex == 0 ? 0xFFFFFFFF : 0xFF7E7E7E)),
// ),
// ),
// GestureDetector(
// onTap: () {
// if (NetworkConfig.userId == "") {
// Navigator.of(context).pushNamed('/LoginPage');
// return;
// }
//
// currentIndex = 1;
// _tabController.animateTo(1);
// setState(() {});
// },
// child: Text(
// '发现',
// style: TextStyle(color: Color(currentIndex == 1 ? 0xFFFFFFFF : 0xFF7E7E7E)),
// ),
// ),
// Image(
// width: 32,
// image: AssetImage('assets/images/ic_create.png'),
// ),
// GestureDetector(
// onTap: () {
// if (NetworkConfig.userId == "") {
// Navigator.of(context).pushNamed('/LoginPage');
// return;
// }
// currentIndex = 2;
// _tabController.animateTo(2);
// setState(() {});
// },
// child: Text(
// '消息',
// style: TextStyle(color: Color(currentIndex == 2 ? 0xFFFFFFFF : 0xFF7E7E7E)),
// ),
// ),
// GestureDetector(
// onTap: () {
// if (NetworkConfig.userId == "") {
// Navigator.of(context).pushNamed('/LoginPage');
// return;
// }
// currentIndex = 3;
// _tabController.animateTo(3);
// setState(() {});
// },
// child: Text(
// '我的',
// style: TextStyle(color: Color(currentIndex == 3 ? 0xFFFFFFFF : 0xFF7E7E7E)),
// ),
// ),
// ],
// ),
// ))
],
),
bottomNavigationBar: Theme(

View File

@ -0,0 +1,72 @@
import 'package:flutter/material.dart';
import 'package:package_info_plus/package_info_plus.dart';
class AboutPage extends StatefulWidget {
const AboutPage({super.key});
@override
State<AboutPage> createState() => _AboutPageState();
}
class _AboutPageState extends State<AboutPage> {
String version = '';
@override
void initState() {
// TODO: implement initState
super.initState();
getCode();
}
getCode() async {
PackageInfo packageInfo = await PackageInfo.fromPlatform();
String appName = packageInfo.appName;
String packageName = packageInfo.packageName;
version = packageInfo.version;
String buildNumber = packageInfo.buildNumber;
setState(() {});
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color(0xFF121213),
appBar: AppBar(
backgroundColor: Color(0xFF121213),
scrolledUnderElevation: 0.0,
title: Text(
'关于',
style: TextStyle(fontSize: 16, color: Colors.white),
),
centerTitle: true,
leading: IconButton(
iconSize: 18,
icon: Icon(Icons.arrow_back_ios_sharp),
color: Colors.white,
onPressed: () {
//
Navigator.pop(context);
},
),
),
body: Column(
children: [
Container(
alignment: Alignment.center,
margin: EdgeInsets.only(top: 68),
child: Image(width: 70, height: 70, image: AssetImage('assets/images/ic_launcher.png')),
),
Container(
margin: EdgeInsets.only(top: 17),
child: Text(
version,
style: TextStyle(fontSize: 12, color: Color(0xFF858585)),
),
)
],
),
);
}
}

View File

@ -0,0 +1,75 @@
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
///
class AgreementPage extends StatefulWidget {
String title;
String url;
AgreementPage({required this.title, required this.url});
@override
State<AgreementPage> createState() => _AgreementPageState();
}
class _AgreementPageState extends State<AgreementPage> {
late WebViewController controller;
@override
void initState() {
// TODO: implement initState
super.initState();
controller = WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setBackgroundColor(const Color(0x00000000))
..setNavigationDelegate(
NavigationDelegate(
onProgress: (int progress) {
// Update loading bar.
},
onPageStarted: (String url) {},
onPageFinished: (String url) {},
onHttpError: (HttpResponseError error) {},
onWebResourceError: (WebResourceError error) {},
onNavigationRequest: (NavigationRequest request) {
// if (request.url.startsWith('https://www.youtube.com/')) {
// return NavigationDecision.prevent;
// }
return NavigationDecision.navigate;
},
),
)
..loadRequest(Uri.parse(widget.url));
}
@override
void dispose() {
// TODO: implement dispose
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Color(0xFF121213),
scrolledUnderElevation: 0.0,
title: Text(
widget.title,
style: TextStyle(fontSize: 16, color: Colors.white),
),
centerTitle: true,
leading: IconButton(
iconSize: 18,
icon: Icon(Icons.arrow_back_ios_sharp),
color: Colors.white,
onPressed: () {
//
Navigator.pop(context);
},
),
),
body: WebViewWidget(controller: controller),
);
}
}

View File

@ -59,6 +59,13 @@ class _MePageState extends State<MePage> {
@override
Widget build(BuildContext context) {
final size = MediaQuery.of(context).size;
final w21 = size.width / 17.142857142857;
final t38 = size.width / 9.4736842105263;
final w58 = size.width / 6.2068965517241;
final l80 = size.width / 4.5;
final h50 = size.width / 7.2;
return Scaffold(
backgroundColor: Color(0xFF121213),
body: SingleChildScrollView(
@ -87,8 +94,8 @@ class _MePageState extends State<MePage> {
Navigator.pushNamed(context, '/SettingPage');
},
child: Image(
width: 21,
height: 21,
width: w21,
height: w21,
image: AssetImage('assets/images/ic_setting.png'),
),
))
@ -98,27 +105,27 @@ class _MePageState extends State<MePage> {
Container(
width: double.infinity,
margin: EdgeInsets.only(left: 18, right: 18, top: 38),
margin: EdgeInsets.only(left: 18, right: 18, top: t38),
child: Stack(
children: [
ClipOval(
child: CachedNetworkImage(
width: 58,
height: 58,
width: w58,
height: w58,
imageUrl: userInfoBean.userIconUrl!,
errorWidget: (context, url, error) => const Icon(Icons.error),
),
),
Positioned(
top: 5,
left: 80,
left: l80,
child: Text(
'${userInfoBean.nickName}',
style: TextStyle(fontSize: 15, color: Color(0xFFE1E1E1)),
)),
Positioned(
bottom: 6,
left: 80,
left: l80,
child: Text(
'id ${userInfoBean.userId}',
style: TextStyle(fontSize: 13, color: Color(0xFF4D4D4D)),
@ -141,12 +148,9 @@ class _MePageState extends State<MePage> {
// style: TextStyle(color: Color(0xFF4D4D4D), fontSize: 12),
// ),
// ),
Container(
// margin: EdgeInsets.only(left: 18),
child: Text(
'${userInfoBean.remainingChatCount}',
style: TextStyle(color: Colors.white, fontSize: 16),
),
Text(
'${userInfoBean.remainingChatCount}',
style: TextStyle(color: Colors.white, fontSize: 16),
),
Container(
margin: EdgeInsets.only(left: 6),
@ -171,7 +175,7 @@ class _MePageState extends State<MePage> {
Navigator.pushNamed(context, '/AccountPage');
},
child: Container(
height: 38,
height: t38,
decoration: BoxDecoration(color: Color(0xFF2A2A2A), borderRadius: BorderRadius.all(Radius.circular(13))),
child: Row(
children: [
@ -202,7 +206,7 @@ class _MePageState extends State<MePage> {
Navigator.pushNamed(context, '/ShopPage');
},
child: Container(
height: 38,
height: t38,
decoration: BoxDecoration(color: Color(0xFF2A2A2A), borderRadius: BorderRadius.all(Radius.circular(13))),
child: Row(
children: [
@ -215,9 +219,9 @@ class _MePageState extends State<MePage> {
),
),
Container(
margin: EdgeInsets.only(left: 24),
margin: EdgeInsets.only(left: 35),
child: Text(
'货币商城',
'商城',
style: TextStyle(color: Color(0xFFE1E1E1), fontSize: 13),
),
),
@ -231,7 +235,7 @@ class _MePageState extends State<MePage> {
),
Container(
height: 50,
height: h50,
margin: EdgeInsets.symmetric(horizontal: 16),
child: GestureDetector(
onTap: () {

View File

@ -1,5 +1,7 @@
import 'package:flutter/material.dart';
import 'agreement_page.dart';
class SettingPage extends StatefulWidget {
const SettingPage({super.key});
@ -37,60 +39,92 @@ class _SettingApgeState extends State<SettingPage> {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
height: 50,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'关于',
style: TextStyle(fontSize: 13, color: Colors.white),
),
Icon(
Icons.keyboard_arrow_right,
color: Color(0xFF6F6F6F),
),
],
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.pushNamed(context, '/AboutPage');
},
child: SizedBox(
height: 50,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'关于',
style: TextStyle(fontSize: 13, color: Colors.white),
),
Icon(
Icons.keyboard_arrow_right,
color: Color(0xFF6F6F6F),
),
],
),
),
),
Container(
height: 0.33,
color: Color(0xFF3A3A3A),
),
Container(
height: 50,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'用户协议',
style: TextStyle(fontSize: 13, color: Colors.white),
),
Icon(
Icons.keyboard_arrow_right,
color: Color(0xFF6F6F6F),
),
],
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AgreementPage(
title: "用户协议",
url: "https://shhuanmeng.com/yonghuxieyi.html",
)),
);
},
child: Container(
height: 50,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'用户协议',
style: TextStyle(fontSize: 13, color: Colors.white),
),
Icon(
Icons.keyboard_arrow_right,
color: Color(0xFF6F6F6F),
),
],
),
),
),
Container(
height: 0.33,
color: Color(0xFF3A3A3A),
),
Container(
height: 50,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'隐私协议',
style: TextStyle(fontSize: 13, color: Colors.white),
),
Icon(
Icons.keyboard_arrow_right,
color: Color(0xFF6F6F6F),
),
],
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AgreementPage(
title: "隐私协议",
url: "https://shhuanmeng.com/yinsixieyi.html",
)),
);
},
child: Container(
height: 50,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'隐私协议',
style: TextStyle(fontSize: 13, color: Colors.white),
),
Icon(
Icons.keyboard_arrow_right,
color: Color(0xFF6F6F6F),
),
],
),
),
),
Container(

View File

@ -39,4 +39,27 @@ class MessageModel {
print("errorEntity==${errorEntity.message}");
});
}
///()
Future<void> delChat(characterId) async {
RequestCenter.instance.request(NetworkConfig.delChat, {
"characterId": characterId,
}, (BaseEntity dataEntity) {
print("dataEntity==$dataEntity");
if (dataEntity.code == 0) {
streamController.sink.add({
'code': "delChat", //
'data': dataEntity.data
});
} else {
streamController.sink.add({
'code': "-1", //
'data': dataEntity.message
});
}
}, (ErrorEntity errorEntity) {
print("errorEntity==${errorEntity.message}");
});
}
}

View File

@ -4,9 +4,12 @@ import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:intl/intl.dart';
import 'package:talk/beans/message_bean.dart';
import 'package:talk/tools/message/message_model.dart';
import '../../common/func.dart';
import '../../dialog/restart_chat_dialog.dart';
import '../chat/chat_page.dart';
///
@ -24,6 +27,8 @@ class _MessagePageState extends State<MessagePage> {
final MessageModel _viewmodel = MessageModel();
int delIndex = 0;
@override
void initState() {
// TODO: implement initState
@ -36,8 +41,12 @@ class _MessagePageState extends State<MessagePage> {
case "getChatHistoryList":
messageList = newData['data'];
break;
case "delChat": //
if (newData['data']) {
messageList.removeAt(delIndex);
}
break;
default:
EasyLoading.dismiss();
EasyLoading.showToast(newData['data']);
break;
}
@ -84,7 +93,7 @@ class _MessagePageState extends State<MessagePage> {
child: ListView.builder(
itemCount: messageList.length,
itemBuilder: (BuildContext context, int index) {
return _item(messageList[index], context);
return _item(messageList[index], context, index);
}),
),
))
@ -95,14 +104,22 @@ class _MessagePageState extends State<MessagePage> {
);
}
_item(MessageBean data, BuildContext context) {
_item(MessageBean data, BuildContext context, index) {
final size = MediaQuery.of(context).size;
final h50 = size.width / 7.2;
final b20 = size.width / 18;
final w40 = size.width / 9;
final l68 = size.width / 5.2941176470588;
final t25 = size.width / 14.4;
final w160 = size.width / 2.25;
return Slidable(
//
endActionPane: ActionPane(
key: Key(UniqueKey().toString()),
//
extentRatio: 0.3,
dragDismissible: false,
// dragDismissible: false,
//
// DrawerMotion() StretchMotion()
// motion: ScrollMotion(),
@ -110,7 +127,15 @@ class _MessagePageState extends State<MessagePage> {
motion: BehindMotion(),
children: [
SlidableAction(
onPressed: doNothing(context, data.id),
onPressed: (BuildContext context) {
FunctionUtil.popDialog(context, RestartChatDialog(
onTap: () {
delIndex = index;
EasyLoading.show(status: 'loading...');
_viewmodel.delChat(data.id);
},
));
},
backgroundColor: Color(0xFFFF9000),
foregroundColor: Colors.black,
label: '删除',
@ -130,8 +155,8 @@ class _MessagePageState extends State<MessagePage> {
);
},
child: Container(
height: 50,
margin: EdgeInsets.only(bottom: 10),
height: h50,
margin: EdgeInsets.only(bottom: b20),
child: Stack(
alignment: Alignment.center,
children: [
@ -140,25 +165,25 @@ class _MessagePageState extends State<MessagePage> {
left: 16,
child: ClipOval(
child: CachedNetworkImage(
width: 40,
height: 40,
width: w40,
height: w40,
imageUrl: data.iconImage!,
errorWidget: (context, url, error) => const Icon(Icons.error),
),
),
),
Positioned(
left: 68,
left: l68,
top: 6,
child: Text(
data.name!,
style: TextStyle(fontSize: 13, color: Color(0xFFE1E1E1)),
)),
Positioned(
left: 68,
top: 25,
left: l68,
top: t25,
child: Container(
width: 160,
width: w160,
child: Text(
'${data.lastMessage}',
maxLines: 1,
@ -171,7 +196,7 @@ class _MessagePageState extends State<MessagePage> {
top: 6,
child: Container(
child: Text(
'${data.lastContactTime}',
'${getHM(data.lastContactTime)}',
style: TextStyle(fontSize: 10, color: Color(0xFF8D8D8D)),
),
)),
@ -181,8 +206,38 @@ class _MessagePageState extends State<MessagePage> {
),
);
}
}
doNothing(BuildContext context, id) {
// EasyLoading.showToast("删除");
doNothing(BuildContext context, id, index) {
print("object");
delIndex = index;
EasyLoading.show(status: 'loading...');
_viewmodel.delChat(id);
EasyLoading.showToast("status");
}
///
getHM(dateTimeString) {
DateTime inputDateTime = DateTime.parse(dateTimeString);
DateTime now = DateTime.now();
bool isToday = inputDateTime.year == now.year && inputDateTime.month == now.month && inputDateTime.day == now.day;
bool isThisYear = inputDateTime.year == now.year;
String formattedDateTime;
if (isToday) {
//
final DateFormat timeFormatter = DateFormat('HH:mm');
formattedDateTime = timeFormatter.format(inputDateTime);
} else if (isThisYear) {
// -
final DateFormat dateFormatter = DateFormat('MM-dd HH:mm');
formattedDateTime = dateFormatter.format(inputDateTime);
} else {
// --
final DateFormat fullDateFormatter = DateFormat('yyyy-MM-dd HH:mm');
formattedDateTime = fullDateFormatter.format(inputDateTime);
}
return formattedDateTime;
}
}

View File

@ -60,7 +60,7 @@ class ShopModel {
});
}
///
///
Future<void> getMallItem() async {
RequestCenter.instance.requestGet(NetworkConfig.getMallItem, {}, (BaseEntity dataEntity) {
if (dataEntity.code == 0) {

View File

@ -28,6 +28,7 @@ dependencies:
dio: ^5.4.3+1
intl: ^0.19.0
cupertino_icons: ^1.0.6
flutter_easyloading: ^3.0.5
flutter_spinkit: ^5.2.1
@ -47,6 +48,8 @@ dependencies:
card_swiper: ^3.0.1
flutter_slidable: ^3.1.0
flutter_keyboard_visibility: ^6.0.0
webview_flutter: ^4.8.0
package_info_plus: ^8.0.0
dev_dependencies:
flutter_test: