750 lines
32 KiB
Dart
750 lines
32 KiB
Dart
import 'package:circle_app/components/my_app_bar.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:video_player/video_player.dart';
|
|
|
|
import '../../router/app_routers.dart';
|
|
import 'logic.dart';
|
|
|
|
class Call_outPage extends StatefulWidget {
|
|
Call_outPage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<Call_outPage> createState() => _Call_outPageState();
|
|
}
|
|
|
|
class _Call_outPageState extends State<Call_outPage> {
|
|
final logic = Get.find<Call_outLogic>();
|
|
|
|
final state = Get.find<Call_outLogic>().state;
|
|
|
|
bool isShowKeyboard = false;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GetBuilder<Call_outLogic>(builder: (controller) {
|
|
var keyboardSize = MediaQuery.of(context).viewInsets.bottom;
|
|
|
|
return GestureDetector(
|
|
onTap: () {
|
|
FocusManager.instance.primaryFocus?.unfocus();
|
|
},
|
|
child: 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,
|
|
appBar: MyAppBar(
|
|
centerTitle: '圈内喊话',
|
|
actionWdiget: Image.asset(
|
|
getCircleImage('push'),
|
|
width: 54.sp,
|
|
),
|
|
onPressed: () {
|
|
logic.sendShout();
|
|
},
|
|
),
|
|
body: SafeArea(
|
|
child: Stack(
|
|
fit: StackFit.expand,
|
|
children: [
|
|
Column(
|
|
children: [
|
|
GestureDetector(
|
|
behavior: HitTestBehavior.opaque,
|
|
onTap: () async {
|
|
logic.startSelectCircleActivity();
|
|
},
|
|
child: Container(
|
|
height: 45.sp,
|
|
padding:
|
|
EdgeInsets.only(left: 17.sp, right: 17.sp),
|
|
child: Row(
|
|
children: [
|
|
Text(
|
|
'选择圈子:',
|
|
style: TextStyle(
|
|
color: Colors.white, fontSize: 16.sp),
|
|
),
|
|
Expanded(child: Container()),
|
|
logic.circleName == ''
|
|
? Container()
|
|
: Container(
|
|
padding: EdgeInsets.only(
|
|
left: 7.sp, right: 7.sp),
|
|
height: 21.sp,
|
|
alignment: Alignment.center,
|
|
decoration: BoxDecoration(
|
|
borderRadius:
|
|
BorderRadius.circular(
|
|
21 * 0.5.sp),
|
|
gradient: const LinearGradient(
|
|
begin: Alignment.centerLeft,
|
|
end: Alignment.centerRight,
|
|
colors: [
|
|
Color(0xff0AFCFF),
|
|
Color(0xffD739EA)
|
|
])),
|
|
child: Text(
|
|
logic.circleName,
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 12.sp),
|
|
),
|
|
),
|
|
Image.asset(
|
|
getHomeImage('icon_in'),
|
|
width: 24.sp,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Image.asset(
|
|
getCircleImage('line'),
|
|
width: Get.width,
|
|
fit: BoxFit.fill,
|
|
),
|
|
Expanded(
|
|
child: Container(
|
|
padding: EdgeInsets.only(top: 15.sp),
|
|
child: Stack(
|
|
children: [
|
|
Column(
|
|
children: [
|
|
SizedBox(
|
|
height: 150.sp,
|
|
child: TextField(
|
|
controller:
|
|
controller.textEditingController,
|
|
onChanged: (value) {
|
|
controller.update();
|
|
},
|
|
onTap: () {
|
|
isShowKeyboard = true;
|
|
setState(() {});
|
|
},
|
|
style: TextStyle(
|
|
color: Colors.white, fontSize: 17.0.sp),
|
|
maxLines: 32,
|
|
maxLength: 200,
|
|
decoration: InputDecoration(
|
|
hintStyle: TextStyle(
|
|
color: const Color.fromRGBO(
|
|
255, 255, 255, 0.6),
|
|
fontSize: 14.sp),
|
|
hintText: '请输入...(左下角上传图片或视频哦)',
|
|
border: InputBorder.none,
|
|
contentPadding: EdgeInsets.only(
|
|
left: 17.sp, right: 17.sp),
|
|
counter: const Text('')),
|
|
),
|
|
),
|
|
Row(
|
|
children: [
|
|
Expanded(child: Container()),
|
|
Text(
|
|
'${controller.textEditingController.text.length}/200',
|
|
style: TextStyle(
|
|
color: Colors.white, fontSize: 12.sp),
|
|
),
|
|
SizedBox(width: 15.sp,)
|
|
],
|
|
)
|
|
],
|
|
),
|
|
// Positioned(
|
|
// right: 15.sp,
|
|
// top: 100.sp,
|
|
// child:),
|
|
Container(
|
|
margin: EdgeInsets.only(top: 180.sp),
|
|
child: _imageAdapter(controller)),
|
|
Container(
|
|
margin: EdgeInsets.only(
|
|
top: 180.sp, left: 15.sp, right: 15.sp),
|
|
child: _showVideo(controller),
|
|
)
|
|
],
|
|
),
|
|
)),
|
|
if (!isShowKeyboard)
|
|
Container(
|
|
height: 60.sp,
|
|
padding: EdgeInsets.only(
|
|
left: 17.sp, right: 17.sp, bottom: 5.sp),
|
|
child: Row(
|
|
children: [
|
|
GestureDetector(
|
|
onTap: () {
|
|
logic.showImg();
|
|
},
|
|
child: Image.asset(
|
|
getCircleImage('photo'),
|
|
width: 30.sp,
|
|
),
|
|
),
|
|
const SizedBox(
|
|
width: 16,
|
|
),
|
|
GestureDetector(
|
|
onTap: () {
|
|
logic.showVideo();
|
|
},
|
|
child: Image.asset(
|
|
getCircleImage('video'),
|
|
width: 30.sp,
|
|
),
|
|
),
|
|
Expanded(
|
|
child: GestureDetector(
|
|
onTap: () {
|
|
if (controller.vip == 2) {
|
|
controller.isCheck =
|
|
!controller.isCheck;
|
|
controller.update();
|
|
} else {
|
|
showOKToast("至尊喊话为年会员特权,开通年会员即可享受哦~");
|
|
controller.showRechargeDialog();
|
|
}
|
|
},
|
|
child: Row(
|
|
mainAxisAlignment:
|
|
MainAxisAlignment.center,
|
|
children: [
|
|
Image.asset(
|
|
getCircleImage(controller.isCheck
|
|
? 'check'
|
|
: 'uncheck'),
|
|
width: 17.5.sp,
|
|
),
|
|
SizedBox(
|
|
width: 4.sp,
|
|
),
|
|
Text(
|
|
'使用至尊喊话',
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 16.sp),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
GestureDetector(
|
|
onTap: () {
|
|
navigateToContentGuidelines();
|
|
},
|
|
child: Text(
|
|
'内容规范',
|
|
style: TextStyle(
|
|
color: const Color(0xff00FFF4),
|
|
fontSize: 14.sp),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
)
|
|
],
|
|
),
|
|
if (isShowKeyboard)
|
|
Positioned(
|
|
bottom: keyboardSize,
|
|
child: Container(
|
|
width: Get.width,
|
|
height: 60.sp,
|
|
padding: EdgeInsets.only(
|
|
left: 17.sp, right: 17.sp, bottom: 5.sp),
|
|
child: Row(
|
|
children: [
|
|
GestureDetector(
|
|
onTap: () {
|
|
logic.showImg();
|
|
},
|
|
child: Image.asset(
|
|
getCircleImage('photo'),
|
|
width: 30.sp,
|
|
),
|
|
),
|
|
const SizedBox(
|
|
width: 16,
|
|
),
|
|
GestureDetector(
|
|
onTap: () {
|
|
logic.showVideo();
|
|
},
|
|
child: Image.asset(
|
|
getCircleImage('video'),
|
|
width: 30.sp,
|
|
),
|
|
),
|
|
Expanded(
|
|
child: GestureDetector(
|
|
onTap: () {
|
|
if (controller.vip == 2) {
|
|
controller.isCheck =
|
|
!controller.isCheck;
|
|
controller.update();
|
|
} else {
|
|
showOKToast("至尊喊话为年会员特权,开通年会员即可享受哦~");
|
|
controller.showRechargeDialog();
|
|
}
|
|
},
|
|
child: Row(
|
|
mainAxisAlignment:
|
|
MainAxisAlignment.center,
|
|
children: [
|
|
Image.asset(
|
|
getCircleImage(controller.isCheck
|
|
? 'check'
|
|
: 'uncheck'),
|
|
width: 17.5.sp,
|
|
),
|
|
SizedBox(
|
|
width: 4.sp,
|
|
),
|
|
Text(
|
|
'使用至尊喊话',
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 16.sp),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
GestureDetector(
|
|
onTap: () {
|
|
navigateToContentGuidelines();
|
|
},
|
|
child: Text(
|
|
'内容规范',
|
|
style: TextStyle(
|
|
color: const Color(0xff00FFF4),
|
|
fontSize: 14.sp),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
))
|
|
],
|
|
),
|
|
),
|
|
)));
|
|
});
|
|
}
|
|
|
|
Widget _showVideo(Call_outLogic controller) {
|
|
if (controller.videoPlayerController == null) {
|
|
return Container();
|
|
} else {
|
|
return _mixVideo(controller);
|
|
}
|
|
}
|
|
|
|
// Widget _maxVideo(Call_outLogic controller){
|
|
Widget _mixVideo(Call_outLogic controller) {
|
|
return SizedBox(
|
|
width: controller.videoPlayerController!.value.size.width <
|
|
controller.videoPlayerController!.value.size.height
|
|
? 135.sp
|
|
: 240.sp,
|
|
height: controller.videoPlayerController!.value.size.width <
|
|
controller.videoPlayerController!.value.size.height
|
|
? 135.sp / controller.videoPlayerController!.value.aspectRatio
|
|
: 240.sp / controller.videoPlayerController!.value.aspectRatio,
|
|
child: GestureDetector(
|
|
onTap: () {
|
|
if (controller.videoPlayerController!.value.isPlaying) {
|
|
controller.videoPlayerController!.pause();
|
|
} else {
|
|
controller.videoPlayerController!.play();
|
|
}
|
|
controller.update();
|
|
},
|
|
child: AspectRatio(
|
|
aspectRatio: controller.videoPlayerController!.value.aspectRatio,
|
|
child: Stack(
|
|
children: [
|
|
VideoPlayer(controller.videoPlayerController!),
|
|
Center(
|
|
child: controller.videoPlayerController!.value.isPlaying
|
|
? Container()
|
|
: Image(
|
|
image: AssetImage(getMineImage("icon_play")),
|
|
width: 30.sp,
|
|
height: 30.sp,
|
|
),
|
|
),
|
|
Positioned(
|
|
top: 0,
|
|
right: 0,
|
|
child: GestureDetector(
|
|
onTap: () {
|
|
// showToast("删除");
|
|
_showDelVideoDialog(Get.context!, controller);
|
|
},
|
|
child: Image(
|
|
image: AssetImage(getMineImage("icon_img_del")),
|
|
width: 20.sp,
|
|
height: 20.sp,
|
|
),
|
|
))
|
|
|
|
// ClosedCaption(text: controller.videoPlayerController!.value.caption.text),
|
|
// _ControlsOverlay(controller: controller.videoPlayerController),
|
|
// VideoProgressIndicator(controller.videoPlayerController!, allowScrubbing: true),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _imageAdapter(Call_outLogic controller) {
|
|
return GridView.builder(
|
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
|
crossAxisCount: 3, // 每行显示的项目数量
|
|
),
|
|
itemCount: controller.state.imaglist.length, // 项目的总数量,包括固定图片和接口获取的项目
|
|
itemBuilder: (BuildContext context, int index) {
|
|
return Container(
|
|
margin: EdgeInsets.all(5.sp),
|
|
child: Center(
|
|
child: _buildImageItem(
|
|
controller.state.imaglist[index], controller, index)),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
Widget _buildImageItem(String url, Call_outLogic controller, int index) {
|
|
return Stack(
|
|
children: [
|
|
ClipRRect(
|
|
borderRadius: BorderRadius.circular(0.0),
|
|
child: SizedBox(
|
|
width: double.infinity, // 设置容器宽度为屏幕宽度
|
|
height: double.infinity, // 设置容器高度为屏幕高度
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.circular(0.0),
|
|
child: GestureDetector(
|
|
onTap: () {
|
|
Get.toNamed(AppRoutes.Swiper, arguments: {
|
|
'imaglist': controller.state.imaglist,
|
|
'index': index
|
|
});
|
|
},
|
|
child: Image.network(
|
|
fit: BoxFit.cover,
|
|
url,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Positioned(
|
|
top: 5,
|
|
right: 5,
|
|
child: GestureDetector(
|
|
onTap: () {
|
|
// showToast("删除");
|
|
_showDelImgDialog(Get.context!, controller, index);
|
|
},
|
|
child: Image(
|
|
image: AssetImage(getMineImage("icon_img_del")),
|
|
width: 20.sp,
|
|
height: 20.sp,
|
|
),
|
|
))
|
|
],
|
|
);
|
|
}
|
|
|
|
void _showDelImgDialog(
|
|
BuildContext context, Call_outLogic controller, int index) {
|
|
showDialog(
|
|
context: context,
|
|
builder: (BuildContext context) {
|
|
return Dialog(
|
|
backgroundColor: Colors.transparent,
|
|
child: Container(
|
|
height: 160.sp,
|
|
padding: const EdgeInsets.all(1.0),
|
|
child: Stack(
|
|
children: [
|
|
Container(
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.rectangle,
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
gradient: const LinearGradient(
|
|
colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)],
|
|
begin: Alignment.topCenter,
|
|
end: Alignment.bottomCenter,
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.all(1.sp),
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.rectangle,
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
gradient: const LinearGradient(
|
|
colors: [Color(0xFF4C3E5F), Color(0xFF324140)],
|
|
begin: Alignment.topCenter,
|
|
end: Alignment.bottomCenter,
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(top: 24.sp),
|
|
child: Column(
|
|
children: [
|
|
Center(
|
|
child: Text(
|
|
"提示",
|
|
style:
|
|
TextStyle(color: Colors.white, fontSize: 16.sp),
|
|
),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(
|
|
top: 12.sp, left: 14.sp, right: 14.sp),
|
|
alignment: Alignment.center,
|
|
child: Text(
|
|
"是否确认删除该照片。",
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
color: const Color(0xCCF7FAFA), fontSize: 16.sp),
|
|
),
|
|
),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
GestureDetector(
|
|
onTap: () {
|
|
Navigator.pop(context);
|
|
},
|
|
child: Container(
|
|
margin: EdgeInsets.only(top: 30.sp),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(17),
|
|
gradient: const LinearGradient(
|
|
colors: [
|
|
Color(0x26FFFFFF),
|
|
Color(0x26FFFFFF),
|
|
],
|
|
begin: Alignment.centerLeft,
|
|
end: Alignment.centerRight,
|
|
),
|
|
),
|
|
padding: EdgeInsets.only(
|
|
top: 10.sp,
|
|
bottom: 10.sp,
|
|
left: 52.sp,
|
|
right: 52.sp),
|
|
child: const Text(
|
|
"否",
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 12,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
SizedBox(width: 24.sp),
|
|
GestureDetector(
|
|
onTap: () {
|
|
Navigator.pop(context);
|
|
controller.state.imaglist.removeAt(index);
|
|
controller.update();
|
|
},
|
|
child: Container(
|
|
margin: EdgeInsets.only(top: 24.sp),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(17),
|
|
gradient: const LinearGradient(
|
|
colors: [
|
|
Color(0xFF06F9FA),
|
|
Color(0xFFDC5BFD),
|
|
],
|
|
begin: Alignment.centerLeft,
|
|
end: Alignment.centerRight,
|
|
),
|
|
),
|
|
padding: EdgeInsets.only(
|
|
top: 10.sp,
|
|
bottom: 10.sp,
|
|
left: 52.sp,
|
|
right: 52.sp),
|
|
child: const Text(
|
|
"是",
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 12,
|
|
),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
)
|
|
],
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
void _showDelVideoDialog(BuildContext context, Call_outLogic controller) {
|
|
showDialog(
|
|
context: context,
|
|
builder: (BuildContext context) {
|
|
return Dialog(
|
|
backgroundColor: Colors.transparent,
|
|
child: Container(
|
|
height: 160.sp,
|
|
padding: const EdgeInsets.all(1.0),
|
|
child: Stack(
|
|
children: [
|
|
Container(
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.rectangle,
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
gradient: const LinearGradient(
|
|
colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)],
|
|
begin: Alignment.topCenter,
|
|
end: Alignment.bottomCenter,
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.all(1.sp),
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.rectangle,
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
gradient: const LinearGradient(
|
|
colors: [Color(0xFF4C3E5F), Color(0xFF324140)],
|
|
begin: Alignment.topCenter,
|
|
end: Alignment.bottomCenter,
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(top: 24.sp),
|
|
child: Column(
|
|
children: [
|
|
Center(
|
|
child: Text(
|
|
"提示",
|
|
style:
|
|
TextStyle(color: Colors.white, fontSize: 16.sp),
|
|
),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(
|
|
top: 12.sp, left: 14.sp, right: 14.sp),
|
|
alignment: Alignment.center,
|
|
child: Text(
|
|
"是否确认删除该视频。",
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
color: const Color(0xCCF7FAFA), fontSize: 16.sp),
|
|
),
|
|
),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
GestureDetector(
|
|
onTap: () {
|
|
Navigator.pop(context);
|
|
},
|
|
child: Container(
|
|
margin: EdgeInsets.only(top: 30.sp),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(17),
|
|
gradient: const LinearGradient(
|
|
colors: [
|
|
Color(0x26FFFFFF),
|
|
Color(0x26FFFFFF),
|
|
],
|
|
begin: Alignment.centerLeft,
|
|
end: Alignment.centerRight,
|
|
),
|
|
),
|
|
padding: EdgeInsets.only(
|
|
top: 10.sp,
|
|
bottom: 10.sp,
|
|
left: 52.sp,
|
|
right: 52.sp),
|
|
child: const Text(
|
|
"否",
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 12,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
SizedBox(width: 24.sp),
|
|
GestureDetector(
|
|
onTap: () {
|
|
Navigator.pop(context);
|
|
controller.videoPlayerController?.dispose();
|
|
controller.videoPlayerController = null;
|
|
controller.state.videolist = [];
|
|
controller.update();
|
|
},
|
|
child: Container(
|
|
margin: EdgeInsets.only(top: 24.sp),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(17),
|
|
gradient: const LinearGradient(
|
|
colors: [
|
|
Color(0xFF06F9FA),
|
|
Color(0xFFDC5BFD),
|
|
],
|
|
begin: Alignment.centerLeft,
|
|
end: Alignment.centerRight,
|
|
),
|
|
),
|
|
padding: EdgeInsets.only(
|
|
top: 10.sp,
|
|
bottom: 10.sp,
|
|
left: 52.sp,
|
|
right: 52.sp),
|
|
child: const Text(
|
|
"是",
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 12,
|
|
),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
)
|
|
],
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|