|
|
|
@ -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, |
|
|
|
@ -65,21 +65,21 @@ class _HomeClass extends State<HomeClass> {
|
|
|
|
|
), |
|
|
|
|
),), |
|
|
|
|
Container( |
|
|
|
|
height: 189, |
|
|
|
|
height: 195, |
|
|
|
|
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, |
|
|
|
|
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]), |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
@ -92,7 +92,7 @@ class _HomeClass extends State<HomeClass> {
|
|
|
|
|
Widget classItem(CourseList collect) { |
|
|
|
|
return Container( |
|
|
|
|
width: 168, |
|
|
|
|
height: 189, |
|
|
|
|
height: 195, |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
borderRadius: BorderRadius.vertical( |
|
|
|
|
bottom: Radius.circular(4), |
|
|
|
@ -222,7 +222,7 @@ class _HomeClass extends State<HomeClass> {
|
|
|
|
|
), |
|
|
|
|
Expanded(child: |
|
|
|
|
Container( |
|
|
|
|
padding: EdgeInsets.all(10), |
|
|
|
|
padding: EdgeInsets.all(8), |
|
|
|
|
child: Column( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
@ -243,7 +243,7 @@ class _HomeClass extends State<HomeClass> {
|
|
|
|
|
),), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
SizedBox(height:5), |
|
|
|
|
SizedBox(height:2), |
|
|
|
|
Text( |
|
|
|
|
"讲师:${collect.author.name}", |
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|