You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

152 lines
5.0 KiB

import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/article.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/icon_text.dart';
class HotArticleItem extends StatelessWidget {
final Article article;
HotArticleItem({this.article});
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
Navigator.of(context)
.pushNamed('/router/store_detail_page', arguments: {
"articleId": article.id
});
},
child: hotItem(context),
);
}
Widget hotItem(BuildContext context) {
return Container(
padding: EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
)
],
borderRadius: BorderRadius.circular(4),
),
child: Row(
children: [
Visibility(
visible: article != null &&
article.coverImg != null &&
article.coverImg != "",
child: Row(
children: [
Stack(
alignment: Alignment.center,
children: [
MImage(
article != null ? article.coverImg : "",
fit: BoxFit.cover,
radius: BorderRadius.circular(2),
aspectRatio: 1,
errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
),
Visibility(
visible: (article != null &&
article.coverImg != "" &&
article.coverImg.endsWith(".mp4")),
child: Icon(
Icons.play_circle_outline,
size: 24,
color: Colors.white,
),
),
],
),
SizedBox(
width: 12,
),
],
),
),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
article != null ? article.mainTitle : "",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.sp,
color: Colors.black,
),
),
Text(
article != null ? (article.viceTitle ?? "") : "",
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFF353535),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Row(
children: [
IconText(
article != null
? (article.createTime.split(" ")[0])
: "",
textStyle: TextStyle(
fontSize: 10.sp,
color: Color(0xFFB2B2B2),
),
leftIcon: Icons.access_time_rounded,
iconSize: 10,
iconColor: Color(0xFFB2B2B2),
),
SizedBox(width: 8,),
Image.asset(
"assets/image/icon_zan.png",
width: 14.w,
height: 14.h,
),
Text("58",style: TextStyle(fontSize:10,color:Color(0xffB9B9B9)),)
],
),
flex: 1,
),
Text(
S.of(context).zuozhe(
(article != null && article.author != null)
? article.author.name
: ""),
style: TextStyle(
fontSize: 10.sp,
color: Color(0xFFB2B2B2),
),
),
],
),
],
),
),
],
),
);
}
}