After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 8.0 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 867 B |
After Width: | Height: | Size: 700 B |
After Width: | Height: | Size: 483 B |
After Width: | Height: | Size: 413 B |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 795 B |
After Width: | Height: | Size: 659 B |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 526 B |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 350 B |
After Width: | Height: | Size: 284 B |
After Width: | Height: | Size: 243 B |
@ -0,0 +1,278 @@
|
||||
import 'package:dio/dio.dart'; |
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter/rendering.dart'; |
||||
import 'package:flutter_easyloading/flutter_easyloading.dart'; |
||||
import 'package:huixiang/main.dart'; |
||||
import 'package:huixiang/retrofit/data/banner.dart'; |
||||
import 'package:huixiang/retrofit/data/base_data.dart'; |
||||
import 'package:huixiang/retrofit/data/brand.dart'; |
||||
import 'package:huixiang/retrofit/data/category_select_list.dart'; |
||||
import 'package:huixiang/retrofit/data/collect_class_list.dart'; |
||||
import 'package:huixiang/retrofit/data/course_list.dart'; |
||||
import 'package:huixiang/retrofit/data/page.dart'; |
||||
import 'package:huixiang/retrofit/retrofit_api.dart'; |
||||
import 'package:huixiang/utils/event_type.dart'; |
||||
import 'package:huixiang/view_widget/classic_header.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:huixiang/view_widget/store_title_tab.dart'; |
||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
||||
import 'package:shared_preferences/shared_preferences.dart'; |
||||
import 'community_view/class_list_view.dart'; |
||||
import 'community_view/class_title_tab.dart'; |
||||
import 'community_view/course_banner.dart'; |
||||
import 'community_view/home_class.dart'; |
||||
|
||||
class CommunityCourse extends StatefulWidget { |
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _CommunityCourse(); |
||||
} |
||||
} |
||||
|
||||
class _CommunityCourse extends State<CommunityCourse> |
||||
with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin { |
||||
final ScrollController scrollController = ScrollController(); |
||||
final RefreshController refreshController = RefreshController(); |
||||
|
||||
ApiService apiService; |
||||
List<GlobalKey> globaKeys = []; |
||||
List<Brand> brands = []; |
||||
List<BannerData> bannerData = []; |
||||
List<CategorySelectList> classSelectList = []; |
||||
List<CourseList> classList = []; |
||||
List<CourseList> classTabList = []; |
||||
List<CollectClassList> collectList = []; |
||||
List<CourseList> collect = []; |
||||
int checkIndex = 0; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
|
||||
eventBus.on<EventType>().listen((event) { |
||||
print("object: CommunityCourse"); |
||||
if (event.type < 3) { |
||||
setState(() {}); |
||||
} |
||||
}); |
||||
queryCourseBanner(); |
||||
classListAsync(); |
||||
collectionList(); |
||||
} |
||||
|
||||
///banner |
||||
queryCourseBanner() async { |
||||
if (apiService == null) { |
||||
SharedPreferences value = await SharedPreferences.getInstance(); |
||||
apiService = ApiService( |
||||
Dio(), |
||||
context: context, |
||||
token: value.getString("token"), |
||||
); |
||||
} |
||||
BaseData<PageInfo<BannerData>> baseData = |
||||
await apiService.queryBanner({ |
||||
"model": {"type": "COURSE_BANNER"}, |
||||
}).catchError((onError) { |
||||
refreshController.refreshFailed(); |
||||
}); |
||||
if (baseData != null && baseData.isSuccess) { |
||||
bannerData.clear(); |
||||
bannerData.addAll(baseData.data.records); |
||||
refreshController.refreshCompleted(); |
||||
} else { |
||||
refreshController.refreshFailed(); |
||||
} |
||||
EasyLoading.dismiss(); |
||||
} |
||||
|
||||
///课程分类列表 |
||||
classListAsync() async { |
||||
if (apiService == null) { |
||||
SharedPreferences value = await SharedPreferences.getInstance(); |
||||
apiService = ApiService( |
||||
Dio(), |
||||
context: context, |
||||
token: value.getString("token"), |
||||
); |
||||
} |
||||
BaseData<List<CategorySelectList>> baseData = await apiService.categoryList().catchError((onError) {}); |
||||
if (baseData != null && baseData.isSuccess) { |
||||
setState(() { |
||||
classSelectList = baseData.data; |
||||
}); |
||||
queryClassList(""); |
||||
} |
||||
EasyLoading.dismiss(); |
||||
} |
||||
|
||||
///课程列表 |
||||
queryClassList(categoryId) async { |
||||
if (apiService == null) { |
||||
SharedPreferences value = await SharedPreferences.getInstance(); |
||||
apiService = ApiService( |
||||
Dio(), |
||||
context: context, |
||||
token: value.getString("token"), |
||||
); |
||||
} |
||||
BaseData<PageInfo<CourseList>> baseData = await apiService.courseList({ |
||||
"categoryId":categoryId, |
||||
"pageNum": 1, |
||||
"pageSize":10, |
||||
"searchKey": "", |
||||
"state":0 |
||||
}).catchError((error) { |
||||
if(categoryId == ""){ |
||||
refreshController.refreshFailed(); |
||||
refreshController.loadFailed(); |
||||
} |
||||
}); |
||||
|
||||
if (baseData.isSuccess) { |
||||
if(categoryId == "") { |
||||
refreshController.refreshCompleted(); |
||||
refreshController.loadComplete(); |
||||
setState(() { |
||||
classList.clear(); |
||||
classList.addAll(baseData.data.list); |
||||
}); |
||||
if(classSelectList.length > 0) |
||||
queryClassList(classSelectList[checkIndex].id); |
||||
}else{ |
||||
setState(() { |
||||
classTabList.clear(); |
||||
classTabList.addAll(baseData.data.list); |
||||
}); |
||||
} |
||||
} |
||||
} |
||||
|
||||
///课程的合集列表 |
||||
collectionList() async { |
||||
if (apiService == null) { |
||||
SharedPreferences value = await SharedPreferences.getInstance(); |
||||
apiService = ApiService( |
||||
Dio(), |
||||
context: context, |
||||
token: value.getString("token"), |
||||
); |
||||
} |
||||
BaseData<List<CollectClassList>> baseData = await apiService.collectList().catchError((onError) {}); |
||||
if (baseData != null && baseData.isSuccess) { |
||||
setState(() { |
||||
collectList.clear(); |
||||
collectList.addAll(baseData.data); |
||||
if(collectList.length > 0) |
||||
collectCourse(collectList[0].id); |
||||
}); |
||||
} |
||||
EasyLoading.dismiss(); |
||||
} |
||||
|
||||
///合集包含的课程列表 |
||||
collectCourse(collectId) async { |
||||
if (apiService == null) { |
||||
SharedPreferences value = await SharedPreferences.getInstance(); |
||||
apiService = ApiService( |
||||
Dio(), |
||||
context: context, |
||||
token: value.getString("token"), |
||||
); |
||||
} |
||||
BaseData<List<CourseList>> baseData = await apiService.collect(collectId).catchError((error) { |
||||
}); |
||||
if (baseData != null && baseData.isSuccess) { |
||||
setState(() { |
||||
collect.clear(); |
||||
collect.addAll(baseData.data); |
||||
}); |
||||
} |
||||
} |
||||
|
||||
_onRefresh(){ |
||||
classListAsync(); |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
super.build(context); |
||||
return |
||||
Stack( |
||||
children: [ |
||||
Positioned( |
||||
child: Container( |
||||
child: SmartRefresher( |
||||
controller: refreshController, |
||||
enablePullDown: true, |
||||
enablePullUp: false, |
||||
header: MyHeader(), |
||||
physics: ClampingScrollPhysics(), |
||||
onRefresh: _onRefresh, |
||||
scrollController: scrollController, |
||||
child: Container( |
||||
child: SingleChildScrollView( |
||||
physics: NeverScrollableScrollPhysics(), |
||||
child: Container( |
||||
color: Color(0xFFF7F7F7), |
||||
margin: EdgeInsets.only(top: 16.h), |
||||
child: Column( |
||||
children: classChildItem(), |
||||
), |
||||
), |
||||
), |
||||
), |
||||
), |
||||
), |
||||
bottom:0, |
||||
top: 0, |
||||
left: 0, |
||||
right: 0, |
||||
), |
||||
if (brands != null && brands.length > 0) |
||||
Positioned( |
||||
child: Container( |
||||
color: Colors.white, |
||||
child: StoreTitleTab( |
||||
brands, |
||||
globaKeys, |
||||
scrollController, |
||||
isScroll: true, |
||||
), |
||||
), |
||||
top: 0, |
||||
left: 0, |
||||
right: 0, |
||||
), |
||||
], |
||||
); |
||||
} |
||||
|
||||
List<Widget> classChildItem() { |
||||
var widgets = <Widget>[ |
||||
///课程banner |
||||
CourseBanner(bannerData,), |
||||
|
||||
SizedBox(height: 28), |
||||
|
||||
///合集列表 |
||||
HomeClass(collect,collectList,), |
||||
|
||||
///课程导航栏 |
||||
ClassTitleTab(classSelectList,(index){ |
||||
checkIndex = index; |
||||
queryClassList(classSelectList[index].id); |
||||
}), |
||||
|
||||
///课程列表 |
||||
ClassListView(classTabList), |
||||
|
||||
]; |
||||
|
||||
return widgets; |
||||
} |
||||
|
||||
@override |
||||
bool get wantKeepAlive => true; |
||||
} |
@ -0,0 +1,615 @@
|
||||
import 'dart:io'; |
||||
|
||||
import 'package:chewie/chewie.dart'; |
||||
import 'package:dio/dio.dart'; |
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter_easyloading/flutter_easyloading.dart'; |
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/retrofit/data/base_data.dart'; |
||||
import 'package:huixiang/retrofit/data/chapter.dart'; |
||||
import 'package:huixiang/retrofit/data/course_details.dart'; |
||||
import 'package:huixiang/retrofit/retrofit_api.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:huixiang/view_widget/custom_image.dart'; |
||||
import 'package:chewie/src/chewie_progress_colors.dart' as chewie; |
||||
import 'package:huixiang/view_widget/tips_dialog.dart'; |
||||
import 'package:huixiang/web/web_view/comment_list.dart'; |
||||
import 'package:huixiang/web/web_view/input_comment.dart'; |
||||
import 'package:shared_preferences/shared_preferences.dart'; |
||||
import 'package:video_player/video_player.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
||||
class ClassDetails extends StatefulWidget { |
||||
final Map<String, dynamic> arguments; |
||||
|
||||
ClassDetails({this.arguments}); |
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _ClassDetails(); |
||||
} |
||||
} |
||||
|
||||
class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{ |
||||
VideoPlayerController videoPlayerController; |
||||
Chewie chewies; |
||||
ChewieController chewieAudioController; |
||||
ApiService apiService; |
||||
final GlobalKey commentKey = GlobalKey(); |
||||
final ScrollController scrollController = ScrollController(); |
||||
bool isKeyBoardShow = false; |
||||
var commentFocus = FocusNode(); |
||||
String parenId = "0"; |
||||
String hintText = S.current.liuxianinjingcaidepinglunba; |
||||
final GlobalKey inputKey = GlobalKey(); |
||||
final TextEditingController commentTextController = TextEditingController(); |
||||
int commentTotal = 0; |
||||
CourseDetails course; |
||||
List<Chapter> chapterList = []; |
||||
bool isShowImg = true; |
||||
int chapterIndex = 0; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
WidgetsBinding.instance.addObserver(this); |
||||
courseDetails(widget.arguments["id"]); |
||||
queryChapterList(widget.arguments["id"]); |
||||
} |
||||
|
||||
///课程章节列表 |
||||
queryChapterList(courseId) async { |
||||
if (apiService == null) { |
||||
SharedPreferences value = await SharedPreferences.getInstance(); |
||||
apiService = ApiService( |
||||
Dio(), |
||||
context: context, |
||||
token: value.getString("token"), |
||||
); |
||||
} |
||||
BaseData<List<Chapter>> baseData = await apiService.catalogList(courseId).catchError((onError) {}); |
||||
if (baseData != null && baseData.isSuccess) { |
||||
setState(() { |
||||
chapterList.clear(); |
||||
chapterList.addAll(baseData.data); |
||||
chapterIndex = 0; |
||||
initVideo(chapterList[chapterIndex].content.fileUrl); |
||||
}); |
||||
|
||||
} |
||||
EasyLoading.dismiss(); |
||||
} |
||||
|
||||
///课程详情 |
||||
courseDetails(id) async { |
||||
if (apiService == null) { |
||||
SharedPreferences value = await SharedPreferences.getInstance(); |
||||
apiService = ApiService( |
||||
Dio(), |
||||
context: context, |
||||
token: value.getString("token"), |
||||
); |
||||
} |
||||
BaseData<CourseDetails> baseData = await apiService.course(id).catchError((error) {}); |
||||
if (baseData != null && baseData.isSuccess) { |
||||
setState(() { |
||||
course = baseData.data; |
||||
}); |
||||
} |
||||
} |
||||
|
||||
|
||||
@override |
||||
void dispose() { |
||||
/** |
||||
* 页面销毁时,视频播放器也销毁 |
||||
*/ |
||||
|
||||
if (chewieAudioController != null) { |
||||
chewieAudioController.pause(); |
||||
chewieAudioController.dispose(); |
||||
chewieAudioController = null; |
||||
} |
||||
if (videoPlayerController != null) { |
||||
videoPlayerController.pause(); |
||||
videoPlayerController.dispose(); |
||||
} |
||||
super.dispose(); |
||||
} |
||||
|
||||
@override |
||||
void didChangeMetrics() { |
||||
WidgetsBinding.instance.addPostFrameCallback((_) { |
||||
if (!mounted) return; |
||||
if (MediaQuery |
||||
.of(context) |
||||
.viewInsets |
||||
.bottom == 0) { |
||||
if (isKeyBoardShow) { |
||||
FocusScope.of(context).requestFocus(FocusNode()); |
||||
if (mounted) |
||||
setState(() { |
||||
hintText = S.current.liuxianinjingcaidepinglunba; |
||||
isKeyBoardShow = false; |
||||
}); |
||||
} |
||||
} else { |
||||
if (mounted) |
||||
setState(() { |
||||
isKeyBoardShow = true; |
||||
}); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Scaffold( |
||||
body: Container( |
||||
child:Column( |
||||
children: [ |
||||
Expanded( |
||||
child: SingleChildScrollView( |
||||
physics: BouncingScrollPhysics(), |
||||
child: Column( |
||||
children: [ |
||||
Stack( |
||||
children: [ |
||||
videoWidget( |
||||
MediaQuery.of(context).size.width, |
||||
videoPlayerController != null |
||||
? (MediaQuery.of(context).size.width) / |
||||
videoPlayerController.value.aspectRatio |
||||
: MediaQuery.of(context).size.width / 2, |
||||
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( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
GestureDetector( |
||||
child: Image.asset( |
||||
"assets/image/integral_return.png", |
||||
width: 24, |
||||
height: 24, |
||||
), |
||||
onTap: () { |
||||
Navigator.of(context).pop(course.viewers+1); |
||||
}, |
||||
), |
||||
], |
||||
), |
||||
), |
||||
], |
||||
), |
||||
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( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Row( |
||||
children: [ |
||||
Container( |
||||
height: 22.h, |
||||
width: 40.w, |
||||
alignment: Alignment.center, |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(2), |
||||
border: Border.all( |
||||
width: 1, |
||||
color: Color(0xFFFF7A1A), |
||||
style: BorderStyle.solid, |
||||
), |
||||
), |
||||
child: Text( |
||||
( course?.tags != null && course.tags.length > 0 )?course.tags[0] : "", |
||||
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: [ |
||||
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(), |
||||
CommentList( |
||||
commentKey, |
||||
course?.likes ?? course?.likes?? 0, |
||||
widget.arguments["id"], |
||||
3, |
||||
isKeyBoardShow, |
||||
_reply, |
||||
_delCommentTips, |
||||
12.sp, |
||||
requestApiFinish: (total){setState(() { |
||||
commentTotal = total; |
||||
});}, |
||||
), |
||||
if (commentTotal == 0) |
||||
Container( |
||||
width: double.infinity, |
||||
alignment: Alignment.topCenter, |
||||
margin: EdgeInsets.only(top: 40), |
||||
padding: EdgeInsets.all(22.h), |
||||
child: Text( |
||||
S |
||||
.of(context) |
||||
.zanwupinglun, |
||||
style: TextStyle( |
||||
fontSize: 12, |
||||
fontWeight: FontWeight.bold, |
||||
color: Color(0xFFA0A0A0), |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
flex: 1,), |
||||
/// 富文本评论的输入框 |
||||
InputComment( |
||||
inputKey, |
||||
hintText, |
||||
isKeyBoardShow, |
||||
commentFocus, |
||||
commentTextController, |
||||
_toComment, |
||||
_queryMemberComment, |
||||
_queryCourseLikes, |
||||
isLike:course?.selfLiked, |
||||
), |
||||
], |
||||
), |
||||
), |
||||
); |
||||
} |
||||
|
||||
initVideo(videoUrl) async { |
||||
videoPlayerController = VideoPlayerController.network( |
||||
videoUrl, |
||||
)..initialize().then((value) { |
||||
chewieAudioController = ChewieController( |
||||
videoPlayerController: videoPlayerController, |
||||
aspectRatio: videoPlayerController.value.aspectRatio, |
||||
//宽高比 |
||||
autoPlay: false, |
||||
//自动播放 |
||||
looping: false, |
||||
//循环播放 |
||||
allowFullScreen: true, |
||||
// 拖动条样式颜色 |
||||
materialProgressColors: chewie.ChewieProgressColors( |
||||
playedColor: Colors.white, |
||||
handleColor: Colors.white, |
||||
backgroundColor: Colors.grey, |
||||
bufferedColor: Colors.transparent, |
||||
), |
||||
autoInitialize: true, |
||||
); |
||||
chewieAudioController.addListener(_fullScreenListener); |
||||
if (mounted) setState(() {}); |
||||
}); |
||||
} |
||||
|
||||
Future<void> _fullScreenListener() async { |
||||
if (!chewieAudioController.isFullScreen) { |
||||
Future.delayed(Duration(seconds: 1), () { |
||||
}); |
||||
} |
||||
} |
||||
|
||||
Widget videoWidget(double width, double height, src) { |
||||
print("src : $src"); |
||||
return MediaQuery( |
||||
data: MediaQuery.of(context).copyWith( |
||||
textScaleFactor: 0.9, |
||||
), |
||||
child: !isShowImg |
||||
? (chewieAudioController != null |
||||
? Container( |
||||
width: width, |
||||
height: height, |
||||
child: chewies = Chewie( |
||||
controller: chewieAudioController, |
||||
), |
||||
) |
||||
: Container( |
||||
width: width, |
||||
height: height, |
||||
)) |
||||
: GestureDetector( |
||||
onTap: (){ |
||||
setState(() { |
||||
isShowImg = false; |
||||
}); |
||||
}, |
||||
child: Container( |
||||
width: width, |
||||
height: width / 7 * 5, |
||||
color: Colors.black, |
||||
child: Stack( |
||||
children: [ |
||||
Center( |
||||
child: MImage( |
||||
src, |
||||
fit: BoxFit.cover, |
||||
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() { |
||||
return Container( |
||||
color: Colors.white, |
||||
margin: EdgeInsets.only(bottom: 16), |
||||
padding: EdgeInsets.all(16), |
||||
child: Column( |
||||
children: [ |
||||
Row( |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
children: [ |
||||
Text( |
||||
"选集", |
||||
style: TextStyle( |
||||
fontSize: 15.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Color(0xFF1A1A1A), |
||||
), |
||||
), |
||||
Text( |
||||
"共${chapterList.length}集", |
||||
style: TextStyle( |
||||
fontSize: 16.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF1A1A1A), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
Container( |
||||
height: 70.h, |
||||
margin: EdgeInsets.only(top:10), |
||||
child: ListView.builder( |
||||
scrollDirection: Axis.horizontal, |
||||
physics: BouncingScrollPhysics(), |
||||
itemCount:chapterList.length, |
||||
itemBuilder: (context, position) { |
||||
return GestureDetector( |
||||
onTap: () { |
||||
setState(() { |
||||
chapterIndex = position; |
||||
isShowImg = true; |
||||
initVideo(chapterList[position].content.fileUrl); |
||||
}); |
||||
}, |
||||
child: classSelectItem(chapterList[position],position), |
||||
); |
||||
}, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget classSelectItem(Chapter chapterList,position) { |
||||
return Container( |
||||
width: 106.w, |
||||
alignment: Alignment.center, |
||||
margin: EdgeInsets.symmetric( |
||||
horizontal: 6.w, |
||||
vertical: 3, |
||||
), |
||||
padding: EdgeInsets.all(8), |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(4), |
||||
color: position==chapterIndex ? Color(0xFF32A060): Color(0xFFE5E5E5), |
||||
), |
||||
child: Text( |
||||
chapterList?.name ?? chapterList.name ?? "", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: position == chapterIndex ? Colors.white :Color(0xFF7C7C7C), |
||||
), |
||||
), |
||||
); |
||||
} |
||||
|
||||
// ///给文章/活动点赞 |
||||
// _queryInformationLikes() async { |
||||
// BaseData baseData = await apiService.courseLikes(widget.arguments["id"]).catchError((onError) {}); |
||||
// if (baseData != null && baseData.isSuccess) { |
||||
// commentKey.currentState.setState(() {}); |
||||
// setState(() { |
||||
// comunity.likes -= 1; |
||||
// else |
||||
// comunity.likes += 1; |
||||
// |
||||
// }); |
||||
// } else { |
||||
// // SmartDialog.showToast(baseData.msg, alignment: Alignment.center); |
||||
// } |
||||
// } |
||||
|
||||
///课程点赞 |
||||
_queryCourseLikes() async { |
||||
BaseData baseData = await apiService.courseLikes(widget.arguments["id"]).catchError((onError) {}); |
||||
if (baseData != null && baseData.isSuccess) { |
||||
setState(() { |
||||
if (course.selfLiked ?? false) |
||||
course.likes -= 1; |
||||
else |
||||
course.likes += 1; |
||||
course.selfLiked = !course.selfLiked ?? false; |
||||
}); |
||||
commentKey.currentState.setState(() {}); |
||||
} else { |
||||
// SmartDialog.showToast(baseData.msg, alignment: Alignment.center); |
||||
} |
||||
} |
||||
|
||||
///发布评论 |
||||
_queryMemberComment(String content) async { |
||||
BaseData baseData = await apiService.memberComment({ |
||||
"content": content, |
||||
"parentId": parenId, |
||||
"relationalId":widget.arguments["id"], |
||||
"relationalType": 3 |
||||
}).catchError((error) {}); |
||||
if (baseData != null && baseData.isSuccess) { |
||||
CommentListState state = commentKey.currentState; |
||||
state.queryMemberCommentList(); |
||||
commentTextController.text = ""; |
||||
FocusScope.of(context).unfocus(); |
||||
// _toComment(); |
||||
} |
||||
} |
||||
|
||||
///滑动到评论列表 |
||||
_toComment() { |
||||
if (commentKey.currentContext == null) return; |
||||
RenderBox firstRenderBox = commentKey.currentContext.findRenderObject(); |
||||
Offset first = firstRenderBox.localToGlobal(Offset.zero); |
||||
scrollController.animateTo( |
||||
first.dy + |
||||
scrollController.offset - |
||||
(kToolbarHeight + MediaQuery |
||||
.of(context) |
||||
.padding |
||||
.top), |
||||
duration: Duration(milliseconds: 300), |
||||
curve: Curves.easeIn, |
||||
); |
||||
} |
||||
|
||||
///评论 回复 |
||||
_reply(memberComment) { |
||||
FocusScope.of(context).requestFocus(commentFocus); |
||||
parenId = memberComment.id; |
||||
hintText = S.of(context).huifu_("${memberComment.username}"); |
||||
} |
||||
|
||||
///删除评论 |
||||
delComment(memberComment) async { |
||||
BaseData baseData = await apiService.delComment(memberComment.id); |
||||
if (baseData != null && baseData.isSuccess) { |
||||
CommentListState state = commentKey.currentState; |
||||
state.queryMemberCommentList(); |
||||
} |
||||
} |
||||
|
||||
///删除评论的提示 |
||||
_delCommentTips(memberComment) { |
||||
SmartDialog.show(widget: Tips(() { |
||||
delComment(memberComment); |
||||
})); |
||||
} |
||||
} |
@ -0,0 +1,196 @@
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/retrofit/data/course_list.dart'; |
||||
import 'package:huixiang/utils/flutter_utils.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:huixiang/view_widget/custom_image.dart'; |
||||
|
||||
class ClassListView extends StatefulWidget { |
||||
final List<CourseList> classList; |
||||
|
||||
ClassListView(this.classList); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _ClassListView(); |
||||
} |
||||
} |
||||
|
||||
class _ClassListView extends State<ClassListView> { |
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return GridView.builder( |
||||
itemCount:widget.classList == null ? 0 : widget.classList.length, |
||||
padding: EdgeInsets.only( |
||||
left: 16.w, |
||||
right: 16.w, |
||||
top: 13.h, |
||||
bottom: 16.h, |
||||
), |
||||
shrinkWrap: true, |
||||
physics: NeverScrollableScrollPhysics(), |
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( |
||||
//一行的Widget数量 |
||||
crossAxisCount:2, |
||||
//水平子Widget之间间距 |
||||
crossAxisSpacing: 11.w, |
||||
//垂直子Widget之间间距 |
||||
mainAxisSpacing: 16.w, |
||||
//子Widget宽高比例 0.59 |
||||
childAspectRatio: |
||||
260 / (281 / 2 + (281 / 2) * AppUtils.textScale(context)), |
||||
), |
||||
itemBuilder: (context, index) { |
||||
return GestureDetector( |
||||
onTap: () { |
||||
Navigator.of(context).pushNamed('/router/class_details', |
||||
arguments: {"id": widget.classList[index].id}) |
||||
.then((value) => {widget.classList[index].viewers = value != null?value:widget.classList[index].viewers+1}); |
||||
}, |
||||
child: classListItem(widget.classList[index]), |
||||
); |
||||
}, |
||||
); |
||||
} |
||||
|
||||
Widget classListItem(CourseList classList) { |
||||
return Container( |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.vertical( |
||||
bottom: Radius.circular(4), |
||||
), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(10), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
color: Colors.white, |
||||
), |
||||
margin: EdgeInsets.symmetric( |
||||
vertical: 3, |
||||
), |
||||
child: Column( |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Stack( |
||||
alignment: Alignment(0.9, 0.9), |
||||
children: [ |
||||
Container( |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(4), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(10), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
color: Color.fromARGB(90, 0, 0, 0), |
||||
), |
||||
child: ClipRRect( |
||||
child: |
||||
Opacity( |
||||
opacity: 0.6, |
||||
child:MImage( |
||||
classList.coverImg, |
||||
width: double.infinity, |
||||
height: 120, |
||||
fit: BoxFit.cover, |
||||
errorSrc: "assets/image/default_1.png", |
||||
fadeSrc: "assets/image/default_1.png", |
||||
), |
||||
), |
||||
borderRadius: BorderRadius.vertical( |
||||
top: Radius.circular(4), |
||||
), |
||||
), |
||||
), |
||||
Container( |
||||
padding: EdgeInsets.only(left: 4), |
||||
child: Row( |
||||
children: [ |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/ketang_play.png", |
||||
width: 16.w, |
||||
height: 16.h, |
||||
color: Colors.white, |
||||
), |
||||
SizedBox(width: 5), |
||||
Text( |
||||
classList.viewers.toString(), |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Colors.white, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
SizedBox(width: 8), |
||||
// Row( |
||||
// children: [ |
||||
// Image.asset( |
||||
// "assets/image/ketang_message.png", |
||||
// width: 16.w, |
||||
// height: 16.h, |
||||
// color: Colors.white, |
||||
// ), |
||||
// SizedBox(width: 5), |
||||
// Text( |
||||
// classList.viewers.toString(), |
||||
// style: TextStyle( |
||||
// fontSize: 12.sp, |
||||
// fontWeight: MyFontWeight.regular, |
||||
// color: Colors.white, |
||||
// ), |
||||
// ), |
||||
// ], |
||||
// ), |
||||
], |
||||
), |
||||
), |
||||
], |
||||
), |
||||
Expanded(child:Container( |
||||
padding: EdgeInsets.all(10), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Text( |
||||
classList.subject, |
||||
overflow: TextOverflow.ellipsis, |
||||
maxLines: 2, |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
SizedBox(height: 2), |
||||
Text( |
||||
"讲师:${classList.author.name}", |
||||
overflow: TextOverflow.ellipsis, |
||||
maxLines: 2, |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
),) |
||||
], |
||||
), |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,71 @@
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/retrofit/data/category_select_list.dart'; |
||||
import 'package:huixiang/retrofit/data/goods_category.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:huixiang/view_widget/my_tab.dart'; |
||||
|
||||
class ClassTitleTab extends StatefulWidget { |
||||
final List<CategorySelectList> classSelectList; |
||||
final Function notifyClassSelectList; |
||||
|
||||
ClassTitleTab(this.classSelectList,this.notifyClassSelectList); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _ClassTitleTab(); |
||||
} |
||||
} |
||||
|
||||
class _ClassTitleTab extends State<ClassTitleTab> |
||||
with SingleTickerProviderStateMixin { |
||||
TabController tabController; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
if (widget.classSelectList != null && widget.classSelectList.length > 0) |
||||
tabController = TabController(length: widget.classSelectList.length, vsync: this ); |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Container( |
||||
alignment: Alignment.centerLeft, |
||||
child: DefaultTabController( |
||||
length:widget.classSelectList == null |
||||
? 0 |
||||
: widget.classSelectList.length, |
||||
child: TabBar( |
||||
isScrollable: true, |
||||
//可滚动 |
||||
indicatorColor: Color(0xff39B54A), |
||||
labelColor: Color(0xff32A060), |
||||
labelStyle: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: FontWeight.bold, |
||||
), |
||||
unselectedLabelStyle: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
), |
||||
controller: tabController, |
||||
//未选中文字颜色 |
||||
unselectedLabelColor: Color(0xff4D4D4D), |
||||
indicatorSize: TabBarIndicatorSize.label, |
||||
onTap: (index){ |
||||
widget.notifyClassSelectList(index); |
||||
}, |
||||
//指示器与文字等宽 |
||||
tabs:widget.classSelectList == null |
||||
? [] |
||||
: widget.classSelectList |
||||
.map((e) => MyTab(text: e.name)) |
||||
.toList(), |
||||
), |
||||
), |
||||
); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,119 @@
|
||||
|
||||
import 'dart:convert'; |
||||
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter_swiper/flutter_swiper.dart'; |
||||
import 'package:huixiang/retrofit/data/banner.dart'; |
||||
import 'package:huixiang/retrofit/data/base_data.dart'; |
||||
import 'package:huixiang/retrofit/data/page.dart'; |
||||
import 'package:huixiang/retrofit/retrofit_api.dart'; |
||||
import 'package:huixiang/view_widget/custom_image.dart'; |
||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
||||
|
||||
class CourseBanner extends StatefulWidget { |
||||
|
||||
final List<BannerData> bannerData; |
||||
|
||||
CourseBanner(this.bannerData); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _CourseBanner(); |
||||
} |
||||
|
||||
} |
||||
|
||||
class _CourseBanner extends State<CourseBanner> { |
||||
ApiService apiService; |
||||
final RefreshController refreshController = RefreshController(); |
||||
List<BannerData> bannerData = []; |
||||
|
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Container( |
||||
child: AspectRatio( |
||||
aspectRatio: 2.08, |
||||
child: Swiper( |
||||
viewportFraction: 0.88, |
||||
scale: 0.93, |
||||
pagination: SwiperPagination( |
||||
alignment: Alignment.bottomCenter, |
||||
builder: DotSwiperPaginationBuilder( |
||||
size: 8, |
||||
activeSize: 8, |
||||
space: 5, |
||||
activeColor: Colors.black, |
||||
color: Colors.black.withAlpha(76), |
||||
), |
||||
), |
||||
physics: BouncingScrollPhysics(), |
||||
itemBuilder: (context, position) { |
||||
return InkWell( |
||||
onTap: () { |
||||
bannerClick(widget.bannerData[position]); |
||||
}, |
||||
child: MImage( |
||||
(widget.bannerData != null && position < widget.bannerData.length) |
||||
? widget.bannerData[position].imgUrl |
||||
: "", |
||||
fit: BoxFit.cover, |
||||
radius: BorderRadius.circular(8), |
||||
errorSrc: "assets/image/default_2_1.png", |
||||
fadeSrc: "assets/image/default_2_1.png", |
||||
), |
||||
); |
||||
}, |
||||
itemCount: (widget.bannerData != null && widget.bannerData.length > 0) |
||||
? widget.bannerData.length |
||||
: 1), |
||||
), |
||||
); |
||||
} |
||||
|
||||
/// contentType 跳转类型(0:不跳转,1:积分商品,2:活动,3:文章,4:页面跳转,5:课程) |
||||
bannerClick(BannerData bannerData) async { |
||||
switch (bannerData.contentType) { |
||||
case 1: |
||||
Navigator.of(context).pushNamed('/router/integral_store_page', |
||||
arguments: {"goodsId": bannerData.content}); |
||||
break; |
||||
case 2: |
||||
Navigator.of(context) |
||||
.pushNamed('/router/web_page', arguments: { |
||||
"activityId": bannerData.content, |
||||
}); |
||||
break; |
||||
case 3: |
||||
Navigator.of(context) |
||||
.pushNamed('/router/web_page', arguments: { |
||||
"articleId": bannerData.content, |
||||
}); |
||||
break; |
||||
case 4: |
||||
String router = bannerData.content; |
||||
if (router.contains("?")) { |
||||
String params = router.substring(router.indexOf("?")); |
||||
params = params.replaceAll("?", ""); |
||||
Map map = jsonDecode(params); |
||||
Navigator.of(context).pushNamed(router, arguments: map); |
||||
} else { |
||||
Navigator.of(context).pushNamed(router); |
||||
} |
||||
break; |
||||
case 5: |
||||
Navigator.of(context) |
||||
.pushNamed('/router/class_details', arguments: { |
||||
"id": bannerData.content, |
||||
}); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,264 @@
|
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; |
||||
import 'package:huixiang/retrofit/data/collect_class_list.dart'; |
||||
import 'package:huixiang/retrofit/data/course_list.dart'; |
||||
import 'package:huixiang/retrofit/retrofit_api.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:huixiang/view_widget/custom_image.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
||||
class HomeClass extends StatefulWidget { |
||||
final List<CourseList> collect; |
||||
final List<CollectClassList> collectList; |
||||
|
||||
HomeClass(this.collect,this.collectList); |
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _HomeClass(); |
||||
} |
||||
} |
||||
|
||||
class _HomeClass extends State<HomeClass> { |
||||
ApiService apiService; |
||||
BMFCoordinate latLng; |
||||
|
||||
final TextEditingController editingController = TextEditingController(); |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return ListView.builder( |
||||
padding: EdgeInsets.zero, |
||||
itemCount:widget.collectList == null ? 0 : widget.collectList.length, |
||||
scrollDirection: Axis.vertical, |
||||
shrinkWrap: true, |
||||
physics: NeverScrollableScrollPhysics(), |
||||
itemBuilder: (context, position) { |
||||
return collectItem(widget.collectList[position]); |
||||
}, |
||||
); |
||||
} |
||||
|
||||
Widget collectItem(CollectClassList collectList) { |
||||
return Container( |
||||
width: 168, |
||||
height: 230, |
||||
margin: EdgeInsets.symmetric( |
||||
horizontal: 6.w, |
||||
vertical:10, |
||||
), |
||||
child: Column( |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Padding(padding: EdgeInsets.only(left: 16,top: 5), |
||||
child: Text( |
||||
collectList.name, |
||||
style: TextStyle( |
||||
fontSize: 15.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Colors.black, |
||||
), |
||||
),), |
||||
Container( |
||||
height: 189, |
||||
margin: EdgeInsets.only(top:10), |
||||
child: ListView.builder( |
||||
scrollDirection: Axis.horizontal, |
||||
physics: BouncingScrollPhysics(), |
||||
padding: EdgeInsets.symmetric(horizontal: 10), |
||||
itemCount:widget.collect == null ? 0 : widget.collect.length, |
||||
itemBuilder: (context, position) { |
||||
return GestureDetector( |
||||
onTap: () { |
||||
Navigator.of(context).pushNamed('/router/class_details', |
||||
arguments: {"id":widget.collect[position].id}) |
||||
.then((value) => {widget.collect[position].viewers = value != null?value:widget.collect[position].viewers+1}); |
||||
}, |
||||
child: classItem(widget.collect[position]), |
||||
); |
||||
}, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget classItem(CourseList collect) { |
||||
return Container( |
||||
width: 168, |
||||
height: 189, |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.vertical( |
||||
bottom: Radius.circular(4), |
||||
), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(10), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
color: Colors.white, |
||||
), |
||||
margin: EdgeInsets.symmetric( |
||||
horizontal:6, |
||||
), |
||||
child: Column( |
||||
children: [ |
||||
Stack( |
||||
alignment: Alignment.topRight, |
||||
children: [ |
||||
Stack( |
||||
alignment: Alignment(0.9,0.9), |
||||
children: [ |
||||
Container( |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(4), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(10), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
color: Color.fromARGB(90, 0, 0, 0), |
||||
), |
||||
child: ClipRRect( |
||||
child: Opacity( |
||||
opacity: 0.6, |
||||
child: MImage( |
||||
collect.coverImg, |
||||
width: double.infinity, |
||||
height: 120, |
||||
fit: BoxFit.cover, |
||||
errorSrc: "assets/image/default_1.png", |
||||
fadeSrc: "assets/image/default_1.png", |
||||
), |
||||
), |
||||
borderRadius: BorderRadius.vertical( |
||||
top: Radius.circular(4), |
||||
), |
||||
), |
||||
), |
||||
Container( |
||||
padding: EdgeInsets.only(left: 4), |
||||
child:Row( |
||||
children: [ |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/ketang_play.png", |
||||
width: 16.w, |
||||
height: 16.h, |
||||
color: Colors.white, |
||||
), |
||||
SizedBox(width:5), |
||||
Text( |
||||
collect.viewers.toString(), |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Colors.white, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
SizedBox(width:8), |
||||
// Row( |
||||
// children: [ |
||||
// Image.asset( |
||||
// "assets/image/ketang_message.png", |
||||
// width: 16.w, |
||||
// height: 16.h, |
||||
// color: Colors.white, |
||||
// ), |
||||
// SizedBox(width:5), |
||||
// Text( |
||||
// collect.viewers.toString(), |
||||
// style: TextStyle( |
||||
// fontSize: 12.sp, |
||||
// fontWeight: MyFontWeight.regular, |
||||
// color: Colors.white, |
||||
// ), |
||||
// ), |
||||
// ], |
||||
// ), |
||||
], |
||||
), |
||||
|
||||
), |
||||
], |
||||
), |
||||
Container( |
||||
margin: EdgeInsets.only(top: 8,right: 8), |
||||
height: 16.h, |
||||
width: 30.w, |
||||
alignment: Alignment.center, |
||||
decoration: BoxDecoration( |
||||
borderRadius: |
||||
BorderRadius.circular(2), |
||||
color: Color(0xFFFFCD00), |
||||
), |
||||
child: Text( |
||||
( collect?.tags != null && collect.tags.length > 0 )?collect.tags[0] : "", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Color(0xFF634815), |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
Expanded(child: |
||||
Container( |
||||
padding: EdgeInsets.all(10), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Expanded(child: Text( |
||||
collect.subject, |
||||
overflow: TextOverflow.ellipsis, |
||||
maxLines: 2, |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Colors.black, |
||||
), |
||||
),), |
||||
], |
||||
), |
||||
SizedBox(height:5), |
||||
Text( |
||||
"讲师:${collect.author.name}", |
||||
overflow: TextOverflow.ellipsis, |
||||
maxLines: 2, |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
),), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,162 @@
|
||||
import 'package:dio/dio.dart'; |
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/retrofit/data/activity.dart'; |
||||
import 'package:huixiang/retrofit/data/base_data.dart'; |
||||
import 'package:huixiang/retrofit/data/page.dart'; |
||||
import 'package:huixiang/retrofit/retrofit_api.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:huixiang/view_widget/item_title.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:shared_preferences/shared_preferences.dart'; |
||||
|
||||
class ShortcutOperation extends StatefulWidget { |
||||
final Function goToOrder; |
||||
|
||||
ShortcutOperation(this.goToOrder); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _ShortcutOperation(); |
||||
} |
||||
} |
||||
|
||||
class _ShortcutOperation extends State<ShortcutOperation> { |
||||
ApiService apiService; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
} |
||||
|
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Container( |
||||
height: 150.h, |
||||
margin: EdgeInsets.only(bottom:15), |
||||
child: Row( |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
children: [ |
||||
GestureDetector( |
||||
onTap: (){ |
||||
widget.goToOrder(); |
||||
}, |
||||
child: Container( |
||||
width: 106, |
||||
color: Colors.white, |
||||
margin: EdgeInsets.only(right:10), |
||||
padding: EdgeInsets.only(top: 8,bottom: 8), |
||||
child: Column( |
||||
children: [ |
||||
Text( |
||||
"现在下单", |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
fontSize: 15.sp, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
SizedBox(height: 5), |
||||
Text( |
||||
"美味等你来!", |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.regular, |
||||
fontSize: 12.sp, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
SizedBox(height: 20), |
||||
Expanded(child: Image.asset( |
||||
"assets/image/home_order.png", |
||||
width:70, |
||||
height:70, |
||||
),), |
||||
], |
||||
), |
||||
), |
||||
), |
||||
GestureDetector( |
||||
onTap: (){ |
||||
Navigator.of(context).pushNamed('/router/recharge_page'); |
||||
}, |
||||
child: Container( |
||||
width: 106, |
||||
color: Colors.white, |
||||
margin: EdgeInsets.only(right:10), |
||||
padding: EdgeInsets.only(top: 8,bottom: 8), |
||||
child: Column( |
||||
children: [ |
||||
Text( |
||||
"平台储值", |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
fontSize: 15.sp, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
SizedBox(height: 5), |
||||
Text( |
||||
"充值送会员!", |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.regular, |
||||
fontSize: 12.sp, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
SizedBox(height: 20), |
||||
Expanded(child:Image.asset( |
||||
"assets/image/home_recharge.png", |
||||
width:70, |
||||
height:70, |
||||
),), |
||||
], |
||||
), |
||||
), |
||||
), |
||||
GestureDetector( |
||||
onTap: (){ |
||||
Navigator.of(context).pushNamed('/router/roll_center_page'); |
||||
}, |
||||
child:Container( |
||||
width: 106, |
||||
color: Colors.white, |
||||
padding: EdgeInsets.only(top: 8,bottom: 8), |
||||
child: Column( |
||||
children: [ |
||||
Text( |
||||
"天天有劵", |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
fontSize: 15.sp, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
SizedBox(height: 5), |
||||
Text( |
||||
"来领超值好劵!", |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.regular, |
||||
fontSize: 12.sp, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
SizedBox(height: 20), |
||||
Expanded(child: Image.asset( |
||||
"assets/image/home_coupon.png", |
||||
width:70, |
||||
height:70, |
||||
), ), |
||||
|
||||
], |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,114 @@
|
||||
/// id : "1452472226421932032" |
||||
/// createTime : "2021-10-25 11:08:59" |
||||
/// createUser : "1" |
||||
/// updateTime : "2021-10-25 11:08:59" |
||||
/// updateUser : "1" |
||||
/// name : "4444" |
||||
/// isTop : true |
||||
/// sort : 0 |
||||
/// isDelete : 0 |
||||
|
||||
class CategorySelectList { |
||||
CategorySelectList({ |
||||
String id, |
||||
String createTime, |
||||
String createUser, |
||||
String updateTime, |
||||
String updateUser, |
||||
String name, |
||||
bool isTop, |
||||
int sort, |
||||
int isDelete,}){ |
||||
_id = id; |
||||
_createTime = createTime; |
||||
_createUser = createUser; |
||||
_updateTime = updateTime; |
||||
_updateUser = updateUser; |
||||
_name = name; |
||||
_isTop = isTop; |
||||
_sort = sort; |
||||
_isDelete = isDelete; |
||||
} |
||||
|
||||
CategorySelectList.fromJson(dynamic json) { |
||||
_id = json['id']; |
||||
_createTime = json['createTime']; |
||||
_createUser = json['createUser']; |
||||
_updateTime = json['updateTime']; |
||||
_updateUser = json['updateUser']; |
||||
_name = json['name']; |
||||
_isTop = json['isTop']; |
||||
_sort = json['sort']; |
||||
_isDelete = json['isDelete']; |
||||
} |
||||
String _id; |
||||
String _createTime; |
||||
String _createUser; |
||||
String _updateTime; |
||||
String _updateUser; |
||||
String _name; |
||||
bool _isTop; |
||||
int _sort; |
||||
int _isDelete; |
||||
|
||||
String get id => _id; |
||||
String get createTime => _createTime; |
||||
String get createUser => _createUser; |
||||
String get updateTime => _updateTime; |
||||
String get updateUser => _updateUser; |
||||
String get name => _name; |
||||
bool get isTop => _isTop; |
||||
int get sort => _sort; |
||||
int get isDelete => _isDelete; |
||||
|
||||
|
||||
set id(String value) { |
||||
_id = value; |
||||
} |
||||
|
||||
Map<String, dynamic> toJson() { |
||||
final map = <String, dynamic>{}; |
||||
map['id'] = _id; |
||||
map['createTime'] = _createTime; |
||||
map['createUser'] = _createUser; |
||||
map['updateTime'] = _updateTime; |
||||
map['updateUser'] = _updateUser; |
||||
map['name'] = _name; |
||||
map['isTop'] = _isTop; |
||||
map['sort'] = _sort; |
||||
map['isDelete'] = _isDelete; |
||||
return map; |
||||
} |
||||
|
||||
set createTime(String value) { |
||||
_createTime = value; |
||||
} |
||||
|
||||
set createUser(String value) { |
||||
_createUser = value; |
||||
} |
||||
|
||||
set updateTime(String value) { |
||||
_updateTime = value; |
||||
} |
||||
|
||||
set updateUser(String value) { |
||||
_updateUser = value; |
||||
} |
||||
|
||||
set name(String value) { |
||||
_name = value; |
||||
} |
||||
|
||||
set isTop(bool value) { |
||||
_isTop = value; |
||||
} |
||||
|
||||
set sort(int value) { |
||||
_sort = value; |
||||
} |
||||
|
||||
set isDelete(int value) { |
||||
_isDelete = value; |
||||
} |
||||
} |
@ -0,0 +1,136 @@
|
||||
/// id : "1452530820865589248" |
||||
/// createTime : "2021-10-25 15:01:49" |
||||
/// createUser : "1" |
||||
/// updateTime : "2021-11-02 17:09:56" |
||||
/// updateUser : "1" |
||||
/// courseId : "1452472611438067712" |
||||
/// name : "111" |
||||
/// content : {"coverImg":"https://pos.upload.gznl.top/0000/2021/11/3e014154-57cc-441e-9d02-aa53975979f5.png","remark":"11111111","fileUrl":"https://pos.upload.gznl.top/0000/2021/11/d87dd996-e269-46eb-b7ef-f8ceddfabef2.mp4"} |
||||
/// sort : 0 |
||||
/// isDelete : 0 |
||||
|
||||
class Chapter { |
||||
Chapter({ |
||||
String id, |
||||
String createTime, |
||||
String createUser, |
||||
String updateTime, |
||||
String updateUser, |
||||
String courseId, |
||||
String name, |
||||
Content content, |
||||
int sort, |
||||
int isDelete,}){ |
||||
_id = id; |
||||
_createTime = createTime; |
||||
_createUser = createUser; |
||||
_updateTime = updateTime; |
||||
_updateUser = updateUser; |
||||
_courseId = courseId; |
||||
_name = name; |
||||
_content = content; |
||||
_sort = sort; |
||||
_isDelete = isDelete; |
||||
} |
||||
|
||||
Chapter.fromJson(dynamic json) { |
||||
_id = json['id']; |
||||
_createTime = json['createTime']; |
||||
_createUser = json['createUser']; |
||||
_updateTime = json['updateTime']; |
||||
_updateUser = json['updateUser']; |
||||
_courseId = json['courseId']; |
||||
_name = json['name']; |
||||
_content = json['content'] != null ? Content.fromJson(json['content']) : null; |
||||
_sort = json['sort']; |
||||
_isDelete = json['isDelete']; |
||||
} |
||||
String _id; |
||||
String _createTime; |
||||
String _createUser; |
||||
String _updateTime; |
||||
String _updateUser; |
||||
String _courseId; |
||||
String _name; |
||||
Content _content; |
||||
int _sort; |
||||
int _isDelete; |
||||
|
||||
String get id => _id; |
||||
String get createTime => _createTime; |
||||
String get createUser => _createUser; |
||||
String get updateTime => _updateTime; |
||||
String get updateUser => _updateUser; |
||||
String get courseId => _courseId; |
||||
String get name => _name; |
||||
Content get content => _content; |
||||
int get sort => _sort; |
||||
int get isDelete => _isDelete; |
||||
|
||||
Map<String, dynamic> toJson() { |
||||
final map = <String, dynamic>{}; |
||||
map['id'] = _id; |
||||
map['createTime'] = _createTime; |
||||
map['createUser'] = _createUser; |
||||
map['updateTime'] = _updateTime; |
||||
map['updateUser'] = _updateUser; |
||||
map['courseId'] = _courseId; |
||||
map['name'] = _name; |
||||
if (_content != null) { |
||||
map['content'] = _content.toJson(); |
||||
} |
||||
map['sort'] = _sort; |
||||
map['isDelete'] = _isDelete; |
||||
return map; |
||||
} |
||||
|
||||
} |
||||
|
||||
/// coverImg : "https://pos.upload.gznl.top/0000/2021/11/3e014154-57cc-441e-9d02-aa53975979f5.png" |
||||
/// remark : "11111111" |
||||
/// fileUrl : "https://pos.upload.gznl.top/0000/2021/11/d87dd996-e269-46eb-b7ef-f8ceddfabef2.mp4" |
||||
|
||||
class Content { |
||||
Content({ |
||||
String coverImg, |
||||
String remark, |
||||
String fileUrl,}){ |
||||
_coverImg = coverImg; |
||||
_remark = remark; |
||||
_fileUrl = fileUrl; |
||||
} |
||||
|
||||
Content.fromJson(dynamic json) { |
||||
_coverImg = json['coverImg']; |
||||
_remark = json['remark']; |
||||
_fileUrl = json['fileUrl']; |
||||
} |
||||
String _coverImg; |
||||
String _remark; |
||||
String _fileUrl; |
||||
|
||||
String get coverImg => _coverImg; |
||||
String get remark => _remark; |
||||
String get fileUrl => _fileUrl; |
||||
|
||||
|
||||
set coverImg(String value) { |
||||
_coverImg = value; |
||||
} |
||||
|
||||
Map<String, dynamic> toJson() { |
||||
final map = <String, dynamic>{}; |
||||
map['coverImg'] = _coverImg; |
||||
map['remark'] = _remark; |
||||
map['fileUrl'] = _fileUrl; |
||||
return map; |
||||
} |
||||
|
||||
set remark(String value) { |
||||
_remark = value; |
||||
} |
||||
|
||||
set fileUrl(String value) { |
||||
_fileUrl = value; |
||||
} |
||||
} |
@ -0,0 +1,114 @@
|
||||
/// id : "1454326699855446016" |
||||
/// createTime : "2021-10-30 13:58:00" |
||||
/// createUser : "1" |
||||
/// updateTime : "2021-10-30 13:58:00" |
||||
/// updateUser : "1" |
||||
/// name : "111" |
||||
/// sort : 0 |
||||
/// enabled : true |
||||
/// isDelete : 0 |
||||
|
||||
class CollectClassList { |
||||
CollectClassList({ |
||||
String id, |
||||
String createTime, |
||||
String createUser, |
||||
String updateTime, |
||||
String updateUser, |
||||
String name, |
||||
int sort, |
||||
bool enabled, |
||||
int isDelete,}){ |
||||
_id = id; |
||||
_createTime = createTime; |
||||
_createUser = createUser; |
||||
_updateTime = updateTime; |
||||
_updateUser = updateUser; |
||||
_name = name; |
||||
_sort = sort; |
||||
_enabled = enabled; |
||||
_isDelete = isDelete; |
||||
} |
||||
|
||||
CollectClassList.fromJson(dynamic json) { |
||||
_id = json['id']; |
||||
_createTime = json['createTime']; |
||||
_createUser = json['createUser']; |
||||
_updateTime = json['updateTime']; |
||||
_updateUser = json['updateUser']; |
||||
_name = json['name']; |
||||
_sort = json['sort']; |
||||
_enabled = json['enabled']; |
||||
_isDelete = json['isDelete']; |
||||
} |
||||
String _id; |
||||
String _createTime; |
||||
String _createUser; |
||||
String _updateTime; |
||||
String _updateUser; |
||||
String _name; |
||||
int _sort; |
||||
bool _enabled; |
||||
int _isDelete; |
||||
|
||||
String get id => _id; |
||||
String get createTime => _createTime; |
||||
String get createUser => _createUser; |
||||
String get updateTime => _updateTime; |
||||
String get updateUser => _updateUser; |
||||
String get name => _name; |
||||
int get sort => _sort; |
||||
bool get enabled => _enabled; |
||||
int get isDelete => _isDelete; |
||||
|
||||
|
||||
set id(String value) { |
||||
_id = value; |
||||
} |
||||
|
||||
Map<String, dynamic> toJson() { |
||||
final map = <String, dynamic>{}; |
||||
map['id'] = _id; |
||||
map['createTime'] = _createTime; |
||||
map['createUser'] = _createUser; |
||||
map['updateTime'] = _updateTime; |
||||
map['updateUser'] = _updateUser; |
||||
map['name'] = _name; |
||||
map['sort'] = _sort; |
||||
map['enabled'] = _enabled; |
||||
map['isDelete'] = _isDelete; |
||||
return map; |
||||
} |
||||
|
||||
set createTime(String value) { |
||||
_createTime = value; |
||||
} |
||||
|
||||
set createUser(String value) { |
||||
_createUser = value; |
||||
} |
||||
|
||||
set updateTime(String value) { |
||||
_updateTime = value; |
||||
} |
||||
|
||||
set updateUser(String value) { |
||||
_updateUser = value; |
||||
} |
||||
|
||||
set name(String value) { |
||||
_name = value; |
||||
} |
||||
|
||||
set sort(int value) { |
||||
_sort = value; |
||||
} |
||||
|
||||
set enabled(bool value) { |
||||
_enabled = value; |
||||
} |
||||
|
||||
set isDelete(int value) { |
||||
_isDelete = value; |
||||
} |
||||
} |
@ -0,0 +1,222 @@
|
||||
/// id : "1455102859841372160" |
||||
/// createTime : "2021-11-01 17:22:11" |
||||
/// createUser : "1" |
||||
/// updateTime : "2021-11-01 17:22:11" |
||||
/// updateUser : "1" |
||||
/// categoryId : "1452472226421932032" |
||||
/// subject : "后会无期" |
||||
/// tags : ["11"] |
||||
/// coverImg : "https://pos.upload.gznl.top/0000/2021/11/d8305d15-1a39-4b08-a172-eba7f18b9968.jpg" |
||||
/// author : {"name":"1","avatar":"1"} |
||||
/// introduce : "1" |
||||
/// viewers : 0 |
||||
/// likes : 0 |
||||
/// state : true |
||||
/// isDelete : 0 |
||||
|
||||
class CourseDetails { |
||||
CourseDetails({ |
||||
String id, |
||||
String createTime, |
||||
String createUser, |
||||
String updateTime, |
||||
String updateUser, |
||||
String categoryId, |
||||
String subject, |
||||
List<String> tags, |
||||
String coverImg, |
||||
Author author, |
||||
String introduce, |
||||
int viewers, |
||||
int likes, |
||||
bool selfLiked, |
||||
bool state, |
||||
int isDelete,}){ |
||||
_id = id; |
||||
_createTime = createTime; |
||||
_createUser = createUser; |
||||
_updateTime = updateTime; |
||||
_updateUser = updateUser; |
||||
_categoryId = categoryId; |
||||
_subject = subject; |
||||
_tags = tags; |
||||
_coverImg = coverImg; |
||||
_author = author; |
||||
_introduce = introduce; |
||||
_viewers = viewers; |
||||
_likes = likes; |
||||
_selfLiked = selfLiked; |
||||
_state = state; |
||||
_isDelete = isDelete; |
||||
} |
||||
|
||||
CourseDetails.fromJson(dynamic json) { |
||||
_id = json['id']; |
||||
_createTime = json['createTime']; |
||||
_createUser = json['createUser']; |
||||
_updateTime = json['updateTime']; |
||||
_updateUser = json['updateUser']; |
||||
_categoryId = json['categoryId']; |
||||
_subject = json['subject']; |
||||
_tags = json['tags'] != null ? json['tags'].cast<String>() : []; |
||||
_coverImg = json['coverImg']; |
||||
_author = json['author'] != null ? Author.fromJson(json['author']) : null; |
||||
_introduce = json['introduce']; |
||||
_viewers = json['viewers']; |
||||
_likes = json['likes']; |
||||
_selfLiked = json['selfLiked']; |
||||
_state = json['state']; |
||||
_isDelete = json['isDelete']; |
||||
} |
||||
String _id; |
||||
String _createTime; |
||||
String _createUser; |
||||
String _updateTime; |
||||
String _updateUser; |
||||
String _categoryId; |
||||
String _subject; |
||||
List<String> _tags; |
||||
String _coverImg; |
||||
Author _author; |
||||
String _introduce; |
||||
int _viewers; |
||||
int _likes; |
||||
bool _selfLiked; |
||||
bool _state; |
||||
int _isDelete; |
||||
|
||||
String get id => _id; |
||||
String get createTime => _createTime; |
||||
String get createUser => _createUser; |
||||
String get updateTime => _updateTime; |
||||
String get updateUser => _updateUser; |
||||
String get categoryId => _categoryId; |
||||
String get subject => _subject; |
||||
List<String> get tags => _tags; |
||||
String get coverImg => _coverImg; |
||||
Author get author => _author; |
||||
String get introduce => _introduce; |
||||
int get viewers => _viewers; |
||||
int get likes => _likes; |
||||
bool get selfLiked => _selfLiked; |
||||
bool get state => _state; |
||||
int get isDelete => _isDelete; |
||||
|
||||
|
||||
set id(String value) { |
||||
_id = value; |
||||
} |
||||
|
||||
Map<String, dynamic> toJson() { |
||||
final map = <String, dynamic>{}; |
||||
map['id'] = _id; |
||||
map['createTime'] = _createTime; |
||||
map['createUser'] = _createUser; |
||||
map['updateTime'] = _updateTime; |
||||
map['updateUser'] = _updateUser; |
||||
map['categoryId'] = _categoryId; |
||||
map['subject'] = _subject; |
||||
map['tags'] = _tags; |
||||
map['coverImg'] = _coverImg; |
||||
if (_author != null) { |
||||
map['author'] = _author.toJson(); |
||||
} |
||||
map['introduce'] = _introduce; |
||||
map['viewers'] = _viewers; |
||||
map['likes'] = _likes; |
||||
map['selfLiked'] = _selfLiked; |
||||
map['state'] = _state; |
||||
map['isDelete'] = _isDelete; |
||||
return map; |
||||
} |
||||
|
||||
set createTime(String value) { |
||||
_createTime = value; |
||||
} |
||||
|
||||
set createUser(String value) { |
||||
_createUser = value; |
||||
} |
||||
|
||||
set updateTime(String value) { |
||||
_updateTime = value; |
||||
} |
||||
|
||||
set updateUser(String value) { |
||||
_updateUser = value; |
||||
} |
||||
|
||||
set categoryId(String value) { |
||||
_categoryId = value; |
||||
} |
||||
|
||||
set subject(String value) { |
||||
_subject = value; |
||||
} |
||||
|
||||
set tags(List<String> value) { |
||||
_tags = value; |
||||
} |
||||
|
||||
set coverImg(String value) { |
||||
_coverImg = value; |
||||
} |
||||
|
||||
set author(Author value) { |
||||
_author = value; |
||||
} |
||||
|
||||
set introduce(String value) { |
||||
_introduce = value; |
||||
} |
||||
|
||||
set viewers(int value) { |
||||
_viewers = value; |
||||
} |
||||
|
||||
set likes(int value) { |
||||
_likes = value; |
||||
} |
||||
|
||||
set selfLiked(bool value) { |
||||
_selfLiked = value; |
||||
} |
||||
|
||||
set state(bool value) { |
||||
_state = value; |
||||
} |
||||
|
||||
set isDelete(int value) { |
||||
_isDelete = value; |
||||
} |
||||
} |
||||
|
||||
/// name : "1" |
||||
/// avatar : "1" |
||||
|
||||
class Author { |
||||
Author({ |
||||
String name, |
||||
String avatar,}){ |
||||
_name = name; |
||||
_avatar = avatar; |
||||
} |
||||
|
||||
Author.fromJson(dynamic json) { |
||||
_name = json['name']; |
||||
_avatar = json['avatar']; |
||||
} |
||||
String _name; |
||||
String _avatar; |
||||
|
||||
String get name => _name; |
||||
String get avatar => _avatar; |
||||
|
||||
Map<String, dynamic> toJson() { |
||||
final map = <String, dynamic>{}; |
||||
map['name'] = _name; |
||||
map['avatar'] = _avatar; |
||||
return map; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,220 @@
|
||||
/// id : "1452470112895369216" |
||||
/// createTime : "2021-10-25 11:00:35" |
||||
/// createUser : "1" |
||||
/// updateTime : "2021-10-25 11:00:35" |
||||
/// updateUser : "1" |
||||
/// categoryId : "1452453250065235968" |
||||
/// subject : "11" |
||||
/// tags : ["11"] |
||||
/// coverImg : "https://pos.upload.gznl.top/0000/2021/10/61dda29b-19cf-4d47-b6c7-c07f895beeaa.jpg" |
||||
/// author : {"name":"11","avatar":"11"} |
||||
/// introduce : "11" |
||||
/// viewers : 0 |
||||
/// likes : 0 |
||||
/// state : true |
||||
/// isDelete : 0 |
||||
|
||||
class CourseList { |
||||
CourseList({ |
||||
String id, |
||||
String createTime, |
||||
String createUser, |
||||
String updateTime, |
||||
String updateUser, |
||||
String categoryId, |
||||
String subject, |
||||
List<String> tags, |
||||
String coverImg, |
||||
Author author, |
||||
String introduce, |
||||
int viewers, |
||||
int likes, |
||||
bool state, |
||||
int isDelete,}){ |
||||
_id = id; |
||||
_createTime = createTime; |
||||
_createUser = createUser; |
||||
_updateTime = updateTime; |
||||
_updateUser = updateUser; |
||||
_categoryId = categoryId; |
||||
_subject = subject; |
||||
_tags = tags; |
||||
_coverImg = coverImg; |
||||
_author = author; |
||||
_introduce = introduce; |
||||
_viewers = viewers; |
||||
_likes = likes; |
||||
_state = state; |
||||
_isDelete = isDelete; |
||||
} |
||||
|
||||
CourseList.fromJson(dynamic json) { |
||||
_id = json['id']; |
||||
_createTime = json['createTime']; |
||||
_createUser = json['createUser']; |
||||
_updateTime = json['updateTime']; |
||||
_updateUser = json['updateUser']; |
||||
_categoryId = json['categoryId']; |
||||
_subject = json['subject']; |
||||
_tags = json['tags'] != null ? json['tags'].cast<String>() : []; |
||||
_coverImg = json['coverImg']; |
||||
_author = json['author'] != null ? Author.fromJson(json['author']) : null; |
||||
_introduce = json['introduce']; |
||||
_viewers = json['viewers']; |
||||
_likes = json['likes']; |
||||
_state = json['state']; |
||||
_isDelete = json['isDelete']; |
||||
} |
||||
String _id; |
||||
String _createTime; |
||||
String _createUser; |
||||
String _updateTime; |
||||
String _updateUser; |
||||
String _categoryId; |
||||
String _subject; |
||||
List<String> _tags; |
||||
String _coverImg; |
||||
Author _author; |
||||
String _introduce; |
||||
int _viewers; |
||||
int _likes; |
||||
bool _state; |
||||
int _isDelete; |
||||
|
||||
String get id => _id; |
||||
String get createTime => _createTime; |
||||
String get createUser => _createUser; |
||||
String get updateTime => _updateTime; |
||||
String get updateUser => _updateUser; |
||||
String get categoryId => _categoryId; |
||||
String get subject => _subject; |
||||
List<String> get tags => _tags; |
||||
String get coverImg => _coverImg; |
||||
Author get author => _author; |
||||
String get introduce => _introduce; |
||||
int get viewers => _viewers; |
||||
int get likes => _likes; |
||||
bool get state => _state; |
||||
int get isDelete => _isDelete; |
||||
|
||||
|
||||
set id(String value) { |
||||
_id = value; |
||||
} |
||||
|
||||
Map<String, dynamic> toJson() { |
||||
final map = <String, dynamic>{}; |
||||
map['id'] = _id; |
||||
map['createTime'] = _createTime; |
||||
map['createUser'] = _createUser; |
||||
map['updateTime'] = _updateTime; |
||||
map['updateUser'] = _updateUser; |
||||
map['categoryId'] = _categoryId; |
||||
map['subject'] = _subject; |
||||
map['tags'] = _tags; |
||||
map['coverImg'] = _coverImg; |
||||
if (_author != null) { |
||||
map['author'] = _author.toJson(); |
||||
} |
||||
map['introduce'] = _introduce; |
||||
map['viewers'] = _viewers; |
||||
map['likes'] = _likes; |
||||
map['state'] = _state; |
||||
map['isDelete'] = _isDelete; |
||||
return map; |
||||
} |
||||
|
||||
set createTime(String value) { |
||||
_createTime = value; |
||||
} |
||||
|
||||
set createUser(String value) { |
||||
_createUser = value; |
||||
} |
||||
|
||||
set updateTime(String value) { |
||||
_updateTime = value; |
||||
} |
||||
|
||||
set updateUser(String value) { |
||||
_updateUser = value; |
||||
} |
||||
|
||||
set categoryId(String value) { |
||||
_categoryId = value; |
||||
} |
||||
|
||||
set subject(String value) { |
||||
_subject = value; |
||||
} |
||||
|
||||
set tags(List<String> value) { |
||||
_tags = value; |
||||
} |
||||
|
||||
set coverImg(String value) { |
||||
_coverImg = value; |
||||
} |
||||
|
||||
set author(Author value) { |
||||
_author = value; |
||||
} |
||||
|
||||
set introduce(String value) { |
||||
_introduce = value; |
||||
} |
||||
|
||||
set viewers(int value) { |
||||
_viewers = value; |
||||
} |
||||
|
||||
set likes(int value) { |
||||
_likes = value; |
||||
} |
||||
|
||||
set state(bool value) { |
||||
_state = value; |
||||
} |
||||
|
||||
set isDelete(int value) { |
||||
_isDelete = value; |
||||
} |
||||
} |
||||
|
||||
/// name : "11" |
||||
/// avatar : "11" |
||||
|
||||
class Author { |
||||
Author({ |
||||
String name, |
||||
String avatar,}){ |
||||
_name = name; |
||||
_avatar = avatar; |
||||
} |
||||
|
||||
Author.fromJson(dynamic json) { |
||||
_name = json['name']; |
||||
_avatar = json['avatar']; |
||||
} |
||||
String _name; |
||||
String _avatar; |
||||
|
||||
String get name => _name; |
||||
String get avatar => _avatar; |
||||
|
||||
|
||||
set name(String value) { |
||||
_name = value; |
||||
} |
||||
|
||||
Map<String, dynamic> toJson() { |
||||
final map = <String, dynamic>{}; |
||||
map['name'] = _name; |
||||
map['avatar'] = _avatar; |
||||
return map; |
||||
} |
||||
|
||||
set avatar(String value) { |
||||
_avatar = value; |
||||
} |
||||
} |