w-R
3 years ago
13 changed files with 218 additions and 31 deletions
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 812 B |
@ -0,0 +1,165 @@ |
|||||||
|
import 'package:flutter/cupertino.dart'; |
||||||
|
import 'package:flutter/material.dart'; |
||||||
|
import 'package:flutter/widgets.dart'; |
||||||
|
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; |
||||||
|
import 'package:huixiang/retrofit/data/article.dart'; |
||||||
|
import 'package:huixiang/retrofit/data/collect_class_list.dart'; |
||||||
|
import 'package:huixiang/retrofit/data/course_list.dart'; |
||||||
|
import 'package:huixiang/retrofit/data/headlines_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'; |
||||||
|
import 'package:huixiang/view_widget/new_people_reward.dart'; |
||||||
|
|
||||||
|
class ActivityTopList extends StatefulWidget { |
||||||
|
final List<Article> articleTop; |
||||||
|
|
||||||
|
ActivityTopList(this.articleTop); |
||||||
|
|
||||||
|
@override |
||||||
|
State<StatefulWidget> createState() { |
||||||
|
return _ActivityTopList(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
class _ActivityTopList extends State<ActivityTopList> { |
||||||
|
ApiService apiService; |
||||||
|
BMFCoordinate latLng; |
||||||
|
|
||||||
|
final TextEditingController editingController = TextEditingController(); |
||||||
|
|
||||||
|
@override |
||||||
|
void initState() { |
||||||
|
super.initState(); |
||||||
|
} |
||||||
|
|
||||||
|
@override |
||||||
|
Widget build(BuildContext context) { |
||||||
|
return Container( |
||||||
|
height: 220.h, |
||||||
|
margin: EdgeInsets.only(top: 10), |
||||||
|
child: ListView.builder( |
||||||
|
scrollDirection: Axis.horizontal, |
||||||
|
physics: BouncingScrollPhysics(), |
||||||
|
padding: EdgeInsets.symmetric(horizontal: 10), |
||||||
|
itemCount: widget.articleTop == null ? 0 : widget.articleTop.length, |
||||||
|
itemBuilder: (context, position) { |
||||||
|
return GestureDetector( |
||||||
|
onTap: () { |
||||||
|
Navigator.of(context).pushNamed( |
||||||
|
'/router/headlines_column_details', |
||||||
|
arguments: {"id": widget.articleTop[position].id}); |
||||||
|
}, |
||||||
|
child: headlinesCollectionItem(widget.articleTop[position], position), |
||||||
|
); |
||||||
|
}, |
||||||
|
), |
||||||
|
); |
||||||
|
} |
||||||
|
|
||||||
|
Widget headlinesCollectionItem(Article articles, index) { |
||||||
|
return Container( |
||||||
|
width: 320.w, |
||||||
|
height: 220.h, |
||||||
|
decoration: BoxDecoration( |
||||||
|
borderRadius: BorderRadius.circular(4), |
||||||
|
boxShadow: [ |
||||||
|
BoxShadow( |
||||||
|
color: Colors.black.withAlpha(10), |
||||||
|
offset: Offset(0, 3), |
||||||
|
blurRadius: 14, |
||||||
|
spreadRadius: 0, |
||||||
|
) |
||||||
|
], |
||||||
|
color: Colors.black, |
||||||
|
), |
||||||
|
margin: EdgeInsets.symmetric( |
||||||
|
horizontal: 6, |
||||||
|
), |
||||||
|
child: Stack( |
||||||
|
alignment: Alignment.bottomLeft, |
||||||
|
children: [ |
||||||
|
Stack( |
||||||
|
children: [ |
||||||
|
ClipRRect( |
||||||
|
child: Opacity( |
||||||
|
opacity: 0.8, |
||||||
|
child: MImage( |
||||||
|
widget?.articleTop[index]?.coverImg ?? "", |
||||||
|
width: 320.w, |
||||||
|
height: 220.h, |
||||||
|
fit: BoxFit.cover, |
||||||
|
errorSrc: "assets/image/default_1.png", |
||||||
|
fadeSrc: "assets/image/default_1.png", |
||||||
|
), |
||||||
|
), |
||||||
|
borderRadius: BorderRadius.vertical( |
||||||
|
top: Radius.circular(4), |
||||||
|
bottom: Radius.circular(4), |
||||||
|
), |
||||||
|
), |
||||||
|
Container( |
||||||
|
padding: EdgeInsets.only(left: 12.w, right: 12.w, top: 8), |
||||||
|
alignment: Alignment.topLeft, |
||||||
|
child: Row( |
||||||
|
children: [ |
||||||
|
Image.asset( |
||||||
|
"assets/image/activity_hot.png", |
||||||
|
width: 20, |
||||||
|
height: 20, |
||||||
|
fit: BoxFit.fill, |
||||||
|
), |
||||||
|
SizedBox( |
||||||
|
width: 4.w, |
||||||
|
), |
||||||
|
Expanded( |
||||||
|
child: Text( |
||||||
|
"精选好文", |
||||||
|
overflow: TextOverflow.ellipsis, |
||||||
|
maxLines: 2, |
||||||
|
style: TextStyle( |
||||||
|
fontSize: 14.sp, |
||||||
|
fontWeight: MyFontWeight.semi_bold, |
||||||
|
color: Colors.white, |
||||||
|
), |
||||||
|
), |
||||||
|
), |
||||||
|
], |
||||||
|
)), |
||||||
|
], |
||||||
|
), |
||||||
|
Positioned( |
||||||
|
top:130, |
||||||
|
left: 12, |
||||||
|
child: Column( |
||||||
|
crossAxisAlignment: CrossAxisAlignment.start, |
||||||
|
children: [ |
||||||
|
Text( |
||||||
|
widget?.articleTop[index]?.mainTitle ?? "", |
||||||
|
overflow: TextOverflow.ellipsis, |
||||||
|
maxLines: 2, |
||||||
|
style: TextStyle( |
||||||
|
fontSize: 14.sp, |
||||||
|
fontWeight: MyFontWeight.semi_bold, |
||||||
|
color: Colors.white, |
||||||
|
), |
||||||
|
), |
||||||
|
Text( |
||||||
|
widget?.articleTop[index]?.viceTitle ?? "", |
||||||
|
overflow: TextOverflow.ellipsis, |
||||||
|
maxLines: 2, |
||||||
|
style: TextStyle( |
||||||
|
fontSize: 14.sp, |
||||||
|
fontWeight: MyFontWeight.semi_bold, |
||||||
|
color: Colors.white, |
||||||
|
), |
||||||
|
), |
||||||
|
], |
||||||
|
)) |
||||||
|
|
||||||
|
], |
||||||
|
), |
||||||
|
); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue