Browse Source

更改细节bug

ff_new
w-R 3 years ago
parent
commit
dff9102cb1
  1. 543
      lib/community/community_view/class_details.dart
  2. 1
      lib/settlement/settlement.dart
  3. 11
      lib/store/store_view/product_sku.dart

543
lib/community/community_view/class_details.dart

@ -25,13 +25,14 @@ class ClassDetails extends StatefulWidget {
final Map<String, dynamic> arguments; final Map<String, dynamic> arguments;
ClassDetails({this.arguments}); ClassDetails({this.arguments});
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
return _ClassDetails(); return _ClassDetails();
} }
} }
class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver {
VideoPlayerController videoPlayerController; VideoPlayerController videoPlayerController;
Chewie chewies; Chewie chewies;
ChewieController chewieAudioController; ChewieController chewieAudioController;
@ -68,7 +69,8 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
token: value.getString("token"), token: value.getString("token"),
); );
} }
BaseData<List<Chapter>> baseData = await apiService.catalogList(courseId).catchError((onError) {}); BaseData<List<Chapter>> baseData =
await apiService.catalogList(courseId).catchError((onError) {});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
setState(() { setState(() {
chapterList.clear(); chapterList.clear();
@ -76,7 +78,6 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
chapterIndex = 0; chapterIndex = 0;
initVideo(chapterList[chapterIndex].content.fileUrl); initVideo(chapterList[chapterIndex].content.fileUrl);
}); });
} }
EasyLoading.dismiss(); EasyLoading.dismiss();
} }
@ -91,7 +92,8 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
token: value.getString("token"), token: value.getString("token"),
); );
} }
BaseData<CourseDetails> baseData = await apiService.course(id).catchError((error) {}); BaseData<CourseDetails> baseData =
await apiService.course(id).catchError((error) {});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
setState(() { setState(() {
course = baseData.data; course = baseData.data;
@ -99,7 +101,6 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
} }
} }
@override @override
void dispose() { void dispose() {
/** /**
@ -122,10 +123,7 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
void didChangeMetrics() { void didChangeMetrics() {
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
if (!mounted) return; if (!mounted) return;
if (MediaQuery if (MediaQuery.of(context).viewInsets.bottom == 0) {
.of(context)
.viewInsets
.bottom == 0) {
if (isKeyBoardShow) { if (isKeyBoardShow) {
FocusScope.of(context).requestFocus(FocusNode()); FocusScope.of(context).requestFocus(FocusNode());
if (mounted) if (mounted)
@ -147,198 +145,211 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
body: Container( body: Container(
child:Column( child: Column(
children: [ children: [
Expanded( Expanded(
child: SingleChildScrollView( child: SingleChildScrollView(
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
child: Column( child: Column(
children: [ children: [
Stack( Stack(
children: [ children: [
videoWidget( videoWidget(
MediaQuery.of(context).size.width, MediaQuery.of(context).size.width,
videoPlayerController != null videoPlayerController != null
? (MediaQuery.of(context).size.width) / ? (MediaQuery.of(context).size.width) /
videoPlayerController.value.aspectRatio videoPlayerController.value.aspectRatio
: MediaQuery.of(context).size.width / 2, : MediaQuery.of(context).size.width / 2,
chapterList.length>chapterIndex?chapterList[chapterIndex].content.coverImg:"", chapterList.length > chapterIndex
), ? chapterList[chapterIndex].content.coverImg
Container( : "",
margin: EdgeInsets.only(top: 40.h, left: 16.w, right: 16.w),
decoration: BoxDecoration(
color: Colors.transparent,
), ),
child: Row( Container(
mainAxisAlignment: MainAxisAlignment.spaceBetween, margin: EdgeInsets.only(
crossAxisAlignment: CrossAxisAlignment.center, top: 40.h, left: 16.w, right: 16.w),
children: [ decoration: BoxDecoration(
GestureDetector( color: Colors.transparent,
child: Image.asset( ),
"assets/image/integral_return.png", child: Row(
width: 24, mainAxisAlignment: MainAxisAlignment.spaceBetween,
height: 24, crossAxisAlignment: CrossAxisAlignment.center,
children: [
GestureDetector(
child: Image.asset(
"assets/image/integral_return.png",
width: 24,
height: 24,
),
onTap: () {
Navigator.of(context).pop(
course != null ? course.viewers + 1 : 0);
},
), ),
onTap: () { ],
Navigator.of(context).pop(course != null ? course.viewers+1 :0); ),
},
),
],
), ),
),
],
),
Container(
height: 123,
margin: EdgeInsets.only(bottom: 16.h),
padding: EdgeInsets.only(left: 16,top: 16,right: 10),
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 2),
blurRadius: 14,
spreadRadius: 0,
)
], ],
), ),
child: Column( Container(
mainAxisAlignment: MainAxisAlignment.start, height: 123,
crossAxisAlignment: CrossAxisAlignment.start, margin: EdgeInsets.only(bottom: 16.h),
children: [ padding: EdgeInsets.only(left: 16, top: 16, right: 10),
Row( decoration: BoxDecoration(
children: [ color: Colors.white,
Container( boxShadow: [
height: 22.h, BoxShadow(
width: 40.w, color: Colors.black.withAlpha(12),
alignment: Alignment.center, offset: Offset(0, 2),
decoration: BoxDecoration( blurRadius: 14,
borderRadius: BorderRadius.circular(2), spreadRadius: 0,
border: Border.all( )
width: 1, ],
color: Color(0xFFFF7A1A), ),
style: BorderStyle.solid, child: Column(
), mainAxisAlignment: MainAxisAlignment.start,
), crossAxisAlignment: CrossAxisAlignment.start,
child: Text( children: [
( course?.tags != null && course.tags.length > 0 )?course.tags[0] : "", Row(
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFFFF7A1A),
),
),
),
SizedBox(
width: 6.w,
),
Expanded(
child: Text(
course != null ?course.subject:"",
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF1A1A1A),
),
),
flex: 1,
)
],
),
SizedBox(
height:10.h,
),
Padding(padding: EdgeInsets.only(right: 16),
child: Row(
children: [ children: [
Expanded( Container(
child: Text( height: 22.h,
"讲师:${course !=null ? course.author.name :""}", width: 40.w,
overflow: TextOverflow.ellipsis, alignment: Alignment.center,
maxLines: 2, decoration: BoxDecoration(
style: TextStyle( borderRadius: BorderRadius.circular(2),
fontSize: 12.sp, border: Border.all(
fontWeight: MyFontWeight.regular, width: 1,
color: Colors.black, color: Color(0xFFFF7A1A),
), style: BorderStyle.solid,
)), ),
Text( ),
"播放次数:", child: Text(
style: TextStyle( (course?.tags != null &&
fontSize: 12.sp, course.tags.length > 0)
fontWeight: MyFontWeight.regular, ? course.tags[0]
color: Color(0xFF808080), : "",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFFFF7A1A),
),
), ),
), ),
SizedBox( SizedBox(
width:4, width: 6.w,
), ),
Text( Expanded(
course != null ? course.viewers.toString() :"", child: Text(
overflow: TextOverflow.ellipsis, course != null ? course.subject : "",
maxLines: 2, overflow: TextOverflow.ellipsis,
style: TextStyle( maxLines: 2,
fontSize: 12.sp, style: TextStyle(
fontWeight: MyFontWeight.regular, fontSize: 16.sp,
color: Color(0xFF808080), fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF1A1A1A),
),
), ),
), flex: 1,
)
], ],
),),
SizedBox(
height:10.h,
),
Text(
course != null ?course.introduce:"",
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Colors.black,
), ),
), SizedBox(
], height: 10.h,
),
Padding(
padding: EdgeInsets.only(right: 16),
child: Row(
children: [
Expanded(
child: Text(
"讲师:${course != null ? course.author.name : ""}",
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Colors.black,
),
)),
Text(
"播放次数:",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF808080),
),
),
SizedBox(
width: 4,
),
Text(
course != null
? course.viewers.toString()
: "",
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF808080),
),
),
],
),
),
SizedBox(
height: 10.h,
),
Text(
course != null ? course.introduce : "",
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Colors.black,
),
),
],
),
), ),
), anthology(),
anthology(), CommentList(
CommentList( commentKey,
commentKey, course?.likes ?? course?.likes ?? 0,
course?.likes ?? course?.likes?? 0, widget.arguments["id"],
widget.arguments["id"], 3,
3, isKeyBoardShow,
isKeyBoardShow, _reply,
_reply, _delCommentTips,
_delCommentTips, 12.sp,
12.sp, requestApiFinish: (total) {
requestApiFinish: (total){setState(() { setState(() {
commentTotal = total; commentTotal = total;
});}, });
), },
if (commentTotal == 0) ),
Container( if (commentTotal == 0)
width: double.infinity, Container(
alignment: Alignment.topCenter, width: double.infinity,
margin: EdgeInsets.only(top: 40), alignment: Alignment.topCenter,
padding: EdgeInsets.all(22.h), margin: EdgeInsets.only(top: 40),
child: Text( padding: EdgeInsets.all(22.h),
S child: Text(
.of(context) S.of(context).zanwupinglun,
.zanwupinglun, style: TextStyle(
style: TextStyle( fontSize: 12,
fontSize: 12, fontWeight: FontWeight.bold,
fontWeight: FontWeight.bold, color: Color(0xFFA0A0A0),
color: Color(0xFFA0A0A0), ),
), ),
), ),
), ],
], ),
), ),
flex: 1,
), ),
flex: 1,),
/// ///
InputComment( InputComment(
inputKey, inputKey,
@ -349,7 +360,7 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
_toComment, _toComment,
_queryMemberComment, _queryMemberComment,
_queryCourseLikes, _queryCourseLikes,
isLike:course?.selfLiked, isLike: course?.selfLiked,
), ),
], ],
), ),
@ -361,91 +372,95 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
videoPlayerController = VideoPlayerController.network( videoPlayerController = VideoPlayerController.network(
videoUrl, videoUrl,
)..initialize().then((value) { )..initialize().then((value) {
chewieAudioController = ChewieController( chewieAudioController = ChewieController(
videoPlayerController: videoPlayerController, videoPlayerController: videoPlayerController,
aspectRatio: videoPlayerController.value.aspectRatio, aspectRatio: videoPlayerController.value.aspectRatio,
// //
autoPlay: false, autoPlay: false,
// //
looping: false, looping: false,
// //
allowFullScreen: true, allowFullScreen: true,
// //
materialProgressColors: chewie.ChewieProgressColors( materialProgressColors: chewie.ChewieProgressColors(
playedColor: Colors.white, playedColor: Colors.white,
handleColor: Colors.white, handleColor: Colors.white,
backgroundColor: Colors.grey, backgroundColor: Colors.grey,
bufferedColor: Colors.transparent, bufferedColor: Colors.transparent,
), ),
autoInitialize: true, autoInitialize: true,
); );
chewieAudioController.addListener(_fullScreenListener); chewieAudioController.addListener(_fullScreenListener);
if (mounted) setState(() {}); if (mounted) setState(() {});
}); });
} }
Future<void> _fullScreenListener() async { Future<void> _fullScreenListener() async {
if (!chewieAudioController.isFullScreen) { if (!chewieAudioController.isFullScreen) {
Future.delayed(Duration(seconds: 1), () { Future.delayed(Duration(seconds: 1), () {});
});
} }
} }
Widget videoWidget(double width, double height, src) { Widget videoWidget(double width, double height, src) {
print("src : $src"); print("src : $src");
return MediaQuery( return MediaQuery(
data: MediaQuery.of(context).copyWith( data: MediaQuery.of(context).copyWith(
textScaleFactor: 0.9, textScaleFactor: 0.9,
),
child: !isShowImg
? (chewieAudioController != null
? Container(
width: width,
height: height,
child: chewies = Chewie(
controller: chewieAudioController,
), ),
) child: Stack(children: [
: Container( (chewieAudioController != null
width: width, ? Container(
height: height, width: width,
)) height: height,
: GestureDetector( child: chewies = Chewie(
onTap: (){ controller: chewieAudioController,
setState(() { ),
isShowImg = false; )
}); : Container(
}, width: width,
child: Container( height: height,
width: width, )),
height: width / 7 * 5, if(isShowImg)
color: Colors.black, GestureDetector(
child: Stack( onTap: () {
children: [ setState(() {
Center( isShowImg = false;
child: MImage( if(chewieAudioController != null)
src, chewieAudioController.play();
fit: BoxFit.cover, });
errorSrc: "assets/image/default_2_1.png", },
fadeSrc: "assets/image/default_2_1.png", child: Container(
), width: width,
), height: height,
Center( color: Colors.black,
child: Icon( child: Stack(
Icons.play_circle_outline, children: [
color: Colors.white, Center(
size: 60, child: MImage(
), src,
width:width,
height: height,
fit: BoxFit.fill,
errorSrc: "assets/image/default_2_1.png",
fadeSrc: "assets/image/default_2_1.png",
),
),
Center(
child: Icon(
Icons.play_circle_outline,
color: Colors.white,
size: 60,
),
),
],
), ),
], ),
), ),
), ]));
),
);
} }
Widget anthology() { Widget anthology() {
return Container( return Container(
color: Colors.white, color: Colors.white,
margin: EdgeInsets.only(bottom: 16), margin: EdgeInsets.only(bottom: 16),
padding: EdgeInsets.all(16), padding: EdgeInsets.all(16),
@ -475,21 +490,23 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
), ),
Container( Container(
height: 70.h, height: 70.h,
margin: EdgeInsets.only(top:10), margin: EdgeInsets.only(top: 10),
child: ListView.builder( child: ListView.builder(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
itemCount:chapterList.length, itemCount: chapterList.length,
itemBuilder: (context, position) { itemBuilder: (context, position) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
setState(() { setState(() {
chapterIndex = position; chapterIndex = position;
isShowImg = true; isShowImg = true;
if(chewieAudioController != null)
chewieAudioController.pause();
initVideo(chapterList[position].content.fileUrl); initVideo(chapterList[position].content.fileUrl);
}); });
}, },
child: classSelectItem(chapterList[position],position), child: classSelectItem(chapterList[position], position),
); );
}, },
), ),
@ -499,7 +516,7 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
); );
} }
Widget classSelectItem(Chapter chapterList,position) { Widget classSelectItem(Chapter chapterList, position) {
return Container( return Container(
width: 106.w, width: 106.w,
alignment: Alignment.center, alignment: Alignment.center,
@ -510,23 +527,24 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
padding: EdgeInsets.all(8), padding: EdgeInsets.all(8),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4), borderRadius: BorderRadius.circular(4),
color: position==chapterIndex ? Color(0xFF32A060): Color(0xFFE5E5E5), color: position == chapterIndex ? Color(0xFF32A060) : Color(0xFFE5E5E5),
), ),
child: Text( child: Text(
chapterList?.name ?? chapterList.name ?? "", chapterList?.name ?? chapterList.name ?? "",
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
color: position == chapterIndex ? Colors.white :Color(0xFF7C7C7C), color: position == chapterIndex ? Colors.white : Color(0xFF7C7C7C),
), ),
), ),
); );
} }
/// ///
_queryCourseLikes() async { _queryCourseLikes() async {
BaseData baseData = await apiService.courseLikes(widget.arguments["id"]).catchError((onError) {}); BaseData baseData = await apiService
.courseLikes(widget.arguments["id"])
.catchError((onError) {});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
setState(() { setState(() {
if (course.selfLiked ?? false) if (course.selfLiked ?? false)
@ -546,7 +564,7 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
BaseData baseData = await apiService.memberComment({ BaseData baseData = await apiService.memberComment({
"content": content, "content": content,
"parentId": parenId, "parentId": parenId,
"relationalId":widget.arguments["id"], "relationalId": widget.arguments["id"],
"relationalType": 3 "relationalType": 3
}).catchError((error) {}); }).catchError((error) {});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
@ -566,10 +584,7 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
scrollController.animateTo( scrollController.animateTo(
first.dy + first.dy +
scrollController.offset - scrollController.offset -
(kToolbarHeight + MediaQuery (kToolbarHeight + MediaQuery.of(context).padding.top),
.of(context)
.padding
.top),
duration: Duration(milliseconds: 300), duration: Duration(milliseconds: 300),
curve: Curves.easeIn, curve: Curves.easeIn,
); );

1
lib/settlement/settlement.dart

@ -333,6 +333,7 @@ class _Settlement extends State<Settlement> {
"id": orderId, "id": orderId,
}, },
); );
Navigator.of(context).pop();
} }
@override @override

11
lib/store/store_view/product_sku.dart

@ -50,9 +50,14 @@ class _ProductSku extends State<ProductSku> {
buildCount() { buildCount() {
count = 1; count = 1;
ProductSkuVOListBean productSku = widget.miNiDetail.productSkuVOList.firstWhere((element) { ProductSkuVOListBean productSku;
return skuY(element, selectSkus); try {
}); productSku = widget.miNiDetail.productSkuVOList.firstWhere((element) {
return skuY(element, selectSkus);
});
}catch(ex){
return;
}
if (productSku == null) return; if (productSku == null) return;
String skuId = productSku.id; String skuId = productSku.id;
if (widget.shopCarGoods == null || widget.shopCarGoods.shoppingCartSkuItemList == null) return; if (widget.shopCarGoods == null || widget.shopCarGoods.shoppingCartSkuItemList == null) return;

Loading…
Cancel
Save