circle_app/circle_app/lib/app/msg/view.dart

226 lines
6.3 KiB
Dart

import 'package:circle_app/router/app_routers.dart';
import 'package:circle_app/util/util.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart';
import 'TIMUIKitConversation/tim_uikit_conversation.dart';
import 'logic.dart';
class MsgPage extends StatelessWidget {
MsgPage({Key? key}) : super(key: key);
final logic = Get.put(MsgLogic());
@override
Widget build(BuildContext context) {
return Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.fill,
image: AssetImage(getBaseImage('home_back')))),
child: Scaffold(
resizeToAvoidBottomInset:false,
backgroundColor: Colors.transparent,
body: SafeArea(
child: GetBuilder(builder: (MsgLogic controller) {
return Column(
children: [
navigatorItem(),
tipWidget(),
reconmandWidget(),
Text(controller.state.msg),
Expanded(child: msgWdiget(context))
],
);
}),
),
));
}
navigatorItem() {
return Container(
width: Get.width,
padding: EdgeInsets.only(left: 18.sp, right: 18.sp),
height: 44.sp,
child: Stack(
alignment: Alignment.center,
children: [
Positioned(
left: 0,
child: GestureDetector(
child: Image.asset(
getMsgImage('msg_love'),
width: 30.sp,
),
)),
ShaderMask(
shaderCallback: (Rect bounds) {
return const LinearGradient(
begin: Alignment(0.0, -1.0),
end: Alignment.bottomCenter,
colors: [Color(0xff71F3F2), Color(0xffF657FF)],
).createShader(Offset.zero & bounds.size);
},
child: Text(
'消息',
style: TextStyle(
fontSize: 18.sp,
fontWeight: FontWeight.w600,
color: Colors.white,
shadows: [
Shadow(color: Color(0xffF657FF), offset: Offset(0.0, -1))
]),
),
),
Positioned(
right: 0,
child: GestureDetector(
child: Image.asset(
getMsgImage('msg_pipei'),
width: 85.sp,
),
)),
],
),
);
}
tipWidget() {
return Container(
margin: EdgeInsets.only(top: 18.sp, bottom: 15.sp),
padding: EdgeInsets.only(left: 16.sp, right: 18.sp),
width: Get.width,
height: 20,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'想要聊天的圈友',
style: TextStyle(
color: Colors.white,
fontSize: 16.sp,
fontWeight: FontWeight.w500),
),
GestureDetector(
onTap: () {
V2TimConversation conv = V2TimConversation(type: 1,userID: '10040818',conversationID: 'c2c_10040818',showName: '456');
Get.toNamed(AppRoutes.Chat,arguments: conv);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ShaderMask(
shaderCallback: (Rect bounds) {
return const LinearGradient(
begin: Alignment.centerRight,
end: Alignment.centerLeft,
colors: [Color(0xff71F3F2), Color(0xffF657FF)],
).createShader(Offset.zero & bounds.size);
},
child: Text(
'n人等您聊',
style: TextStyle(
fontSize: 16.sp,
fontWeight: FontWeight.w600,
color: Colors.white),
),
),
Image.asset(
getMsgImage('msg_arr'),
width: 24.sp,
)
],
),
)
],
),
);
}
reconmandWidget() {
return Container(
padding: EdgeInsets.only(left: 16.sp, right: 18.sp),
width: Get.width,
child: Row(
children: [
Container(
child: Column(
children: [
Image.asset(
getMsgImage('msg_first'),
width: 50.sp,
),
SizedBox(
height: 4.sp,
),
Text(
'抢占第一',
style: TextStyle(color: Colors.white, fontSize: 12.sp),
),
],
),
),
Expanded(
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Container(
// width: 50.sp * 10,
child: Row(
children: [
peopleWidget(),
peopleWidget(),
peopleWidget(),
peopleWidget(),
peopleWidget(),
peopleWidget(),
peopleWidget(),
peopleWidget(),
peopleWidget(),
peopleWidget(),
],
),
),
))
],
),
);
}
peopleWidget() {
return Container(
margin: EdgeInsets.only(left: 18.sp),
child: Column(
children: [
Image.asset(
getMsgImage('msg_first'),
width: 50.sp,
),
SizedBox(
height: 4.sp,
),
Text(
'抢占第一',
style: TextStyle(color: Colors.white, fontSize: 12.sp),
),
],
),
);
}
msgWdiget(context) {
return TIMConversation(
onTapItem: (selectedConv) {
Get.toNamed(AppRoutes.Chat);
},
);
}
Widget msgItem(conv,status){
return Container();
}
}