Browse Source

更改

master
w-R 3 years ago
parent
commit
2a2b1ff269
  1. 121
      lib/home/home_view/featured_acticvity.dart
  2. 2
      lib/web/web_page.dart

121
lib/home/home_view/featured_acticvity.dart

@ -39,13 +39,12 @@ class _FeaturedActivity extends State<FeaturedActivity> {
"searchKey": "", "searchKey": "",
"type": 1, "type": 1,
"state": 1 "state": 1
}).catchError((error) { }).catchError((error) {});
});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
activityList = baseData.data.list; activityList = baseData.data.list;
if(activityList != null && activityList.length == 1) if (activityList != null && activityList.length == 1)
activityList.add(activityList[0]); activityList.add(activityList[0]);
if(activityList != null && activityList.length == 2) if (activityList != null && activityList.length == 2)
activityList.add(activityList[1]); activityList.add(activityList[1]);
} }
} }
@ -69,64 +68,66 @@ class _FeaturedActivity extends State<FeaturedActivity> {
margin: EdgeInsets.symmetric(horizontal: 9.w), margin: EdgeInsets.symmetric(horizontal: 9.w),
child: Row( child: Row(
children: [ children: [
if(activityList != null && activityList.length > 0) if (activityList != null && activityList.length > 0)
Container( Container(
child: stackItem(18.sp,activityList[0]), child: stackItem(18.sp, activityList[0]),
margin: EdgeInsets.symmetric(horizontal: 5.w), margin: EdgeInsets.symmetric(horizontal: 5.w),
width: (MediaQuery.of(context).size.width - 42) / 2, width: (MediaQuery.of(context).size.width - 42) / 2,
height: 190.h, height: 190.h,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4), borderRadius: BorderRadius.circular(4),
color: Colors.red, color: Colors.red,
image: DecorationImage( image: DecorationImage(
image: NetworkImage( image: NetworkImage(
activityList[0].coverImg, activityList[0].coverImg,
),
fit: BoxFit.cover,
), ),
fit: BoxFit.cover,
), ),
), ),
), if (activityList != null && activityList.length > 1)
if(activityList != null && activityList.length > 1) Container(
Container( child: Column(
child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [
children: [ Container(
Container( child: stackItem(12.sp, activityList[1]),
child: stackItem(12.sp,activityList[1]), margin: EdgeInsets.symmetric(horizontal: 5.w),
margin: EdgeInsets.symmetric(horizontal: 5.w), width: (MediaQuery.of(context).size.width - 42) / 2,
width: (MediaQuery.of(context).size.width - 42) / 2, height: 190.h / 2,
height: 190.h / 2, decoration: BoxDecoration(
decoration: BoxDecoration( borderRadius: BorderRadius.circular(4),
borderRadius: BorderRadius.circular(4), color: Colors.green,
color: Colors.green, image: DecorationImage(
image: DecorationImage( image: NetworkImage(
image: NetworkImage( activityList[2].coverImg,
activityList[1].coverImg, ),
fit: BoxFit.cover,
), ),
fit: BoxFit.cover,
), ),
), ),
), SizedBox(
SizedBox(height: 5,), height: 5,
Container( ),
child: stackItem(12.sp,activityList[2]), Container(
margin: EdgeInsets.symmetric(horizontal: 5.w), child: stackItem(12.sp, activityList[2]),
width: (MediaQuery.of(context).size.width - 42) / 2, margin: EdgeInsets.symmetric(horizontal: 5.w),
height: 190.h / 2, width: (MediaQuery.of(context).size.width - 42) / 2,
decoration: BoxDecoration( height: 190.h / 2,
borderRadius: BorderRadius.circular(4), decoration: BoxDecoration(
color: Colors.blue, borderRadius: BorderRadius.circular(4),
image: DecorationImage( color: Colors.blue,
image: NetworkImage( image: DecorationImage(
activityList[2].coverImg, image: NetworkImage(
activityList[2].coverImg,
),
fit: BoxFit.cover,
), ),
fit: BoxFit.cover,
), ),
), )
), ],
], ),
), ),
),
], ],
), ),
), ),
@ -137,7 +138,7 @@ class _FeaturedActivity extends State<FeaturedActivity> {
); );
} }
Widget stackItem(double textSize,Activity activity) { Widget stackItem(double textSize, Activity activity) {
return Column( return Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -149,6 +150,8 @@ class _FeaturedActivity extends State<FeaturedActivity> {
children: [ children: [
Text( Text(
activity.mainTitle, activity.mainTitle,
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle( style: TextStyle(
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
fontSize: textSize, fontSize: textSize,
@ -181,7 +184,13 @@ class _FeaturedActivity extends State<FeaturedActivity> {
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(20),
), ),
alignment: Alignment.center, alignment: Alignment.center,
child: Row( child:
GestureDetector(
onTap: (){
Navigator.of(context).pushNamed('/router/web_page',
arguments: {"activityId": activity.id});
},
child:Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
@ -199,7 +208,7 @@ class _FeaturedActivity extends State<FeaturedActivity> {
size: 12, size: 12,
), ),
], ],
), )),
), ),
], ],
); );

2
lib/web/web_page.dart

@ -271,7 +271,7 @@ class _WebPage extends State<WebPage> with WidgetsBindingObserver {
/// ///
CommentList( CommentList(
commentKey, commentKey,
article?.likes ?? activity?.likes ?? "0", article?.likes ?? activity?.likes.toString() ?? "0",
article?.id ?? activity?.id, article?.id ?? activity?.id,
isKeyBoardShow, isKeyBoardShow,
_reply, _reply,

Loading…
Cancel
Save