Browse Source

Merge remote-tracking branch 'origin/dev' into remove_uniapp

ff_new
fmk 3 years ago
parent
commit
50e08219ef
  1. 17
      lib/community/community_course.dart
  2. 19
      lib/community/community_view/class_details.dart
  3. 4
      lib/community/community_view/class_list_view.dart
  4. 22
      lib/community/community_view/home_class.dart
  5. 9
      lib/view_widget/hot_item.dart

17
lib/community/community_course.dart

@ -43,8 +43,8 @@ class _CommunityCourse extends State<CommunityCourse>
List<CourseList> classList = []; List<CourseList> classList = [];
List<CourseList> classTabList = []; List<CourseList> classTabList = [];
List<CollectClassList> collectList = []; List<CollectClassList> collectList = [];
List<CourseList> collect = [];
int checkIndex = 0; int checkIndex = 0;
Map<String,List<CourseList>> collectMap = new Map();
@override @override
void initState() { void initState() {
@ -83,6 +83,7 @@ class _CommunityCourse extends State<CommunityCourse>
refreshController.refreshCompleted(); refreshController.refreshCompleted();
} else { } else {
refreshController.refreshFailed(); refreshController.refreshFailed();
// SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
} }
EasyLoading.dismiss(); EasyLoading.dismiss();
} }
@ -164,8 +165,9 @@ class _CommunityCourse extends State<CommunityCourse>
setState(() { setState(() {
collectList.clear(); collectList.clear();
collectList.addAll(baseData.data); collectList.addAll(baseData.data);
if(collectList.length > 0) collectList.forEach((element) {
collectCourse(collectList[0].id); collectCourse(element.id);
});
}); });
} }
EasyLoading.dismiss(); EasyLoading.dismiss();
@ -185,8 +187,11 @@ class _CommunityCourse extends State<CommunityCourse>
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
setState(() { setState(() {
collect.clear(); if(!collectMap.containsKey(collectId)){
collect.addAll(baseData.data); collectMap[collectId] = [];
}
collectMap[collectId].clear();
collectMap[collectId].addAll(baseData.data);
}); });
} }
} }
@ -257,7 +262,7 @@ class _CommunityCourse extends State<CommunityCourse>
SizedBox(height: 28), SizedBox(height: 28),
/// ///
HomeClass(collect,collectList,), HomeClass(collectMap,collectList,),
/// ///
ClassTitleTab(classSelectList,(index){ ClassTitleTab(classSelectList,(index){

19
lib/community/community_view/class_details.dart

@ -180,7 +180,7 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
height: 24, height: 24,
), ),
onTap: () { onTap: () {
Navigator.of(context).pop(course.viewers+1); Navigator.of(context).pop(course != null ? course.viewers+1 :0);
}, },
), ),
], ],
@ -369,7 +369,7 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
// //
looping: false, looping: false,
// //
allowFullScreen: true, allowFullScreen: false,
// //
materialProgressColors: chewie.ChewieProgressColors( materialProgressColors: chewie.ChewieProgressColors(
playedColor: Colors.white, playedColor: Colors.white,
@ -523,21 +523,6 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
); );
} }
// ////
// _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 { _queryCourseLikes() async {

4
lib/community/community_view/class_list_view.dart

@ -38,7 +38,7 @@ class _ClassListView extends State<ClassListView> {
mainAxisSpacing: 16.w, mainAxisSpacing: 16.w,
//Widget宽高比例 0.59 //Widget宽高比例 0.59
childAspectRatio: childAspectRatio:
260 / (281 / 2 + (281 / 2) * AppUtils.textScale(context)), 225 / (281 / 2 + (281 / 2) * AppUtils.textScale(context)),
), ),
itemBuilder: (context, index) { itemBuilder: (context, index) {
return GestureDetector( return GestureDetector(
@ -160,7 +160,7 @@ class _ClassListView extends State<ClassListView> {
], ],
), ),
Expanded(child:Container( Expanded(child:Container(
padding: EdgeInsets.all(10), padding: EdgeInsets.all(5),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,

22
lib/community/community_view/home_class.dart

@ -9,10 +9,10 @@ import 'package:huixiang/view_widget/custom_image.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
class HomeClass extends StatefulWidget { class HomeClass extends StatefulWidget {
final List<CourseList> collect; final Map<String,List<CourseList>> collectMap;
final List<CollectClassList> collectList; final List<CollectClassList> collectList;
HomeClass(this.collect,this.collectList); HomeClass(this.collectMap,this.collectList);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
return _HomeClass(); return _HomeClass();
@ -47,7 +47,7 @@ class _HomeClass extends State<HomeClass> {
Widget collectItem(CollectClassList collectList) { Widget collectItem(CollectClassList collectList) {
return Container( return Container(
width: 168, width: 168,
height: 230, // height: 250,
margin: EdgeInsets.symmetric( margin: EdgeInsets.symmetric(
horizontal: 6.w, horizontal: 6.w,
vertical:10, vertical:10,
@ -65,21 +65,21 @@ class _HomeClass extends State<HomeClass> {
), ),
),), ),),
Container( Container(
height: 189, height: 195,
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(),
padding: EdgeInsets.symmetric(horizontal: 10), padding: EdgeInsets.symmetric(horizontal: 10),
itemCount:widget.collect == null ? 0 : widget.collect.length, itemCount:widget.collectMap[collectList.id] == null ? 0 : widget.collectMap[collectList.id].length,
itemBuilder: (context, position) { itemBuilder: (context, position) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
Navigator.of(context).pushNamed('/router/class_details', Navigator.of(context).pushNamed('/router/class_details',
arguments: {"id":widget.collect[position].id}) arguments: {"id":widget.collectMap[collectList.id][position].id})
.then((value) => {widget.collect[position].viewers = value != null?value:widget.collect[position].viewers+1}); .then((value) => {widget.collectMap[collectList.id][position].viewers = value != null?value:widget.collectMap[collectList.id][position].viewers+1});
}, },
child: classItem(widget.collect[position]), child: classItem(widget.collectMap[collectList.id][position]),
); );
}, },
), ),
@ -92,7 +92,7 @@ class _HomeClass extends State<HomeClass> {
Widget classItem(CourseList collect) { Widget classItem(CourseList collect) {
return Container( return Container(
width: 168, width: 168,
height: 189, height: 195,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.vertical( borderRadius: BorderRadius.vertical(
bottom: Radius.circular(4), bottom: Radius.circular(4),
@ -222,7 +222,7 @@ class _HomeClass extends State<HomeClass> {
), ),
Expanded(child: Expanded(child:
Container( Container(
padding: EdgeInsets.all(10), padding: EdgeInsets.all(8),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -243,7 +243,7 @@ class _HomeClass extends State<HomeClass> {
),), ),),
], ],
), ),
SizedBox(height:5), SizedBox(height:2),
Text( Text(
"讲师:${collect.author.name}", "讲师:${collect.author.name}",
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,

9
lib/view_widget/hot_item.dart

@ -169,7 +169,7 @@ class _HotArticleItem extends State<HotArticleItem> {
), ),
), ),
SizedBox(width: 12.w,), SizedBox(width: 12.w,),
Visibility( Expanded(child: Visibility(
visible: widget.article != null && visible: widget.article != null &&
widget.article.coverImg != null && widget.article.coverImg != null &&
widget.article.coverImg != "", widget.article.coverImg != "",
@ -193,7 +193,8 @@ class _HotArticleItem extends State<HotArticleItem> {
), ),
], ],
), ),
), ),),
SizedBox(width:5.w,), SizedBox(width:5.w,),
], ],
)), )),
@ -484,7 +485,7 @@ class _HotArticleItem extends State<HotArticleItem> {
), ),
), ),
SizedBox( SizedBox(
width: 32.w, width:22.w,
), ),
Container( Container(
alignment: Alignment.topRight, alignment: Alignment.topRight,
@ -508,7 +509,7 @@ class _HotArticleItem extends State<HotArticleItem> {
), ),
), ),
SizedBox( SizedBox(
width: 32.w, width:22.w,
), ),
Container( Container(
alignment: Alignment.topRight, alignment: Alignment.topRight,

Loading…
Cancel
Save