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/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 HeadlinesCollection extends StatefulWidget { final List headlines; final List
articles; HeadlinesCollection(this.headlines,this.articles); @override State createState() { return _HeadlinesCollection(); } } class _HeadlinesCollection extends State { ApiService apiService; BMFCoordinate latLng; final TextEditingController editingController = TextEditingController(); @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return Container( height: 60.h, margin: EdgeInsets.only(top:10), child: ListView.builder( scrollDirection: Axis.horizontal, physics: BouncingScrollPhysics(), padding: EdgeInsets.symmetric(horizontal: 10), itemCount:widget.headlines == null ? 0 : widget.headlines.length, itemBuilder: (context, position) { return GestureDetector( onTap: () { Navigator.of(context).pushNamed( '/router/headlines_column_details', arguments: {"id":widget.headlines[position].id}); }, child: headlinesCollectionItem(widget.headlines[position]), ); }, ), ); } Widget headlinesCollectionItem(HeadlinesList headlines) { return Container( width: 225.w, height:60.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( children: [ ClipRRect( child: Opacity( opacity: 0.8, child: MImage( headlines?.coverImg ?? "", width: 225.w, height: 60.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), child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ Expanded(child: Row( children: [ Container( margin: EdgeInsets.only(right:4), padding:EdgeInsets.only(left:2,right:2), height:22.h, alignment: Alignment.center, decoration: BoxDecoration( borderRadius: BorderRadius.circular(2), color: Color(0xFF32A060), ), child: Text( "专栏", style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.medium, color: Colors.white, ), ), ), Expanded(child:Text( headlines?.name ?? "", overflow: TextOverflow.ellipsis, maxLines: 2, style: TextStyle( fontSize: 15.sp, fontWeight: MyFontWeight.semi_bold, color: Colors.white, ), ),), ],)), // Row( // children: [ // Expanded(child:Text( // "更新3篇", // style: TextStyle( // fontSize: 12.sp, // fontWeight: MyFontWeight.medium, // color: Colors.white, // ), // )), // Text( // "查看专栏", // style: TextStyle( // fontSize: 12.sp, // fontWeight: MyFontWeight.regular, // color: Colors.white, // ), // ), // SizedBox(width: 2), // Image.asset( // "assets/image/t_right.png", // width: 14, // height: 14, // ), // ],), ],), ), ], ), ); } }