Browse Source

更改细节bug

ff_new
w-R 3 years ago
parent
commit
9b82b67a9f
  1. 17
      lib/community/community_course.dart
  2. 15
      lib/community/community_view/class_details.dart
  3. 14
      lib/community/community_view/home_class.dart
  4. 9
      lib/view_widget/hot_item.dart

17
lib/community/community_course.dart

@ -3,7 +3,6 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/main.dart';
import 'package:huixiang/retrofit/data/banner.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
@ -44,8 +43,8 @@ class _CommunityCourse extends State<CommunityCourse>
List<CourseList> classList = [];
List<CourseList> classTabList = [];
List<CollectClassList> collectList = [];
List<CourseList> collect = [];
int checkIndex = 0;
Map<String,List<CourseList>> collectMap = new Map();
@override
void initState() {
@ -166,8 +165,9 @@ class _CommunityCourse extends State<CommunityCourse>
setState(() {
collectList.clear();
collectList.addAll(baseData.data);
if(collectList.length > 0)
collectCourse(collectList[0].id);
collectList.forEach((element) {
collectCourse(element.id);
});
});
}
EasyLoading.dismiss();
@ -187,8 +187,11 @@ class _CommunityCourse extends State<CommunityCourse>
});
if (baseData != null && baseData.isSuccess) {
setState(() {
collect.clear();
collect.addAll(baseData.data);
if(!collectMap.containsKey(collectId)){
collectMap[collectId] = [];
}
collectMap[collectId].clear();
collectMap[collectId].addAll(baseData.data);
});
}
}
@ -259,7 +262,7 @@ class _CommunityCourse extends State<CommunityCourse>
SizedBox(height: 28),
///
HomeClass(collect,collectList,),
HomeClass(collectMap,collectList,),
///
ClassTitleTab(classSelectList,(index){

15
lib/community/community_view/class_details.dart

@ -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 {

14
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';
class HomeClass extends StatefulWidget {
final List<CourseList> collect;
final Map<String,List<CourseList>> collectMap;
final List<CollectClassList> collectList;
HomeClass(this.collect,this.collectList);
HomeClass(this.collectMap,this.collectList);
@override
State<StatefulWidget> createState() {
return _HomeClass();
@ -47,7 +47,7 @@ class _HomeClass extends State<HomeClass> {
Widget collectItem(CollectClassList collectList) {
return Container(
width: 168,
height: 230,
// height: 250,
margin: EdgeInsets.symmetric(
horizontal: 6.w,
vertical:10,
@ -71,15 +71,15 @@ class _HomeClass extends State<HomeClass> {
scrollDirection: Axis.horizontal,
physics: BouncingScrollPhysics(),
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) {
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});
arguments: {"id":widget.collectMap[collectList.id][position].id})
.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]),
);
},
),

9
lib/view_widget/hot_item.dart

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

Loading…
Cancel
Save