fmk
3 years ago
22 changed files with 587 additions and 111 deletions
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 113 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 284 KiB |
After Width: | Height: | Size: 812 B |
After Width: | Height: | Size: 36 KiB |
@ -0,0 +1,169 @@
|
||||
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: 340.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:Column( |
||||
children: [ |
||||
Stack( |
||||
alignment: Alignment.bottomLeft, |
||||
children: [ |
||||
Stack( |
||||
children: [ |
||||
ClipRRect( |
||||
child: Opacity( |
||||
opacity: 0.8, |
||||
child: MImage( |
||||
widget?.articleTop[index]?.coverImg ?? "", |
||||
width: 340.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, |
||||
), |
||||
), |
||||
), |
||||
], |
||||
)), |
||||
], |
||||
), |
||||
Padding(padding:EdgeInsets.only(left: 12.w, right: 12.w, bottom: 8), |
||||
child: Column( |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Text( |
||||
widget?.articleTop[index]?.mainTitle ?? "", |
||||
overflow: TextOverflow.ellipsis, |
||||
maxLines: 2, |
||||
style: TextStyle( |
||||
fontSize: 16.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Colors.white, |
||||
), |
||||
), |
||||
SizedBox(height: 5.h), |
||||
Opacity(opacity:0.8, |
||||
child: Text( |
||||
widget?.articleTop[index]?.viceTitle ?? "", |
||||
overflow: TextOverflow.ellipsis, |
||||
maxLines: 2, |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Colors.white, |
||||
), |
||||
),) |
||||
|
||||
], |
||||
)), |
||||
], |
||||
), |
||||
], |
||||
) |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,203 @@
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/retrofit/data/login_info.dart'; |
||||
import 'package:huixiang/utils/flutter_utils.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:huixiang/view_widget/receive_success.dart'; |
||||
import 'package:huixiang/view_widget/round_button.dart'; |
||||
import 'package:huixiang/view_widget/separator.dart'; |
||||
|
||||
class ActivityCoupons extends StatefulWidget { |
||||
// final List<NewUserCouponList> newUserCouponList; |
||||
// |
||||
// ActivityCoupons(this.newUserCouponList); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _ActivityCoupons(); |
||||
} |
||||
} |
||||
|
||||
class _ActivityCoupons extends State<ActivityCoupons> { |
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Container( |
||||
margin: EdgeInsets.only(top:150.h), |
||||
height: MediaQuery.of(context).size.height / 2, |
||||
child: Column( |
||||
children: [ |
||||
Container( |
||||
width: double.infinity, |
||||
height:MediaQuery.of(context).size.height / 2, |
||||
padding: EdgeInsets.only(top: 210.h), |
||||
margin: EdgeInsets.only(top: 20.h, left: 20, right: 20), |
||||
decoration: BoxDecoration( |
||||
image: DecorationImage( |
||||
fit: BoxFit.fill, |
||||
image: AssetImage("assets/image/activity_q.png"), |
||||
), |
||||
), |
||||
child: Column( |
||||
children: [ |
||||
Expanded( |
||||
child: reward(), |
||||
), |
||||
GestureDetector( |
||||
onTap: () { |
||||
Navigator.of(context).pop(); |
||||
SmartDialog.showToast("领取成功",alignment: Alignment.center); |
||||
}, |
||||
child: Container( |
||||
margin: EdgeInsets.only( |
||||
left: 60.w, right: 60.w, top: 20.h, bottom:20.h), |
||||
decoration: BoxDecoration( |
||||
gradient: new LinearGradient( |
||||
begin: Alignment.centerLeft, |
||||
end: Alignment.centerRight, |
||||
colors: [ |
||||
Color(0xFFFFDCA1), |
||||
Color(0xFFFAE4C0), |
||||
]), |
||||
borderRadius: BorderRadius.circular(22.5), |
||||
), |
||||
width: MediaQuery.of(context).size.width, |
||||
height: 40, |
||||
alignment: Alignment.center, |
||||
child: Text( |
||||
"立即领取", |
||||
style: TextStyle( |
||||
fontWeight: FontWeight.bold, |
||||
fontSize: 14.sp, |
||||
color: Color(0xFF4A4748), |
||||
), |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
SizedBox(height: 35), |
||||
GestureDetector( |
||||
onTap: () { |
||||
setState(() { |
||||
Navigator.of(context).pop(); |
||||
}); |
||||
}, |
||||
child: Image.asset( |
||||
"assets/image/yq_qx.png", |
||||
width: 34, |
||||
height: 34, |
||||
), |
||||
) |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget reward() { |
||||
return ListView.builder( |
||||
padding: EdgeInsets.zero, |
||||
itemCount: 4, |
||||
scrollDirection: Axis.vertical, |
||||
shrinkWrap: true, |
||||
physics: BouncingScrollPhysics(), |
||||
itemBuilder: (context, position) { |
||||
return GestureDetector( |
||||
onTap: () {}, |
||||
child: rewardItem(), |
||||
); |
||||
}, |
||||
); |
||||
} |
||||
|
||||
Widget rewardItem() { |
||||
return Container( |
||||
height: 69.h, |
||||
width: double.infinity, |
||||
decoration: BoxDecoration( |
||||
image: DecorationImage( |
||||
fit: BoxFit.fill, |
||||
image: AssetImage("assets/image/xin_rq.png"), |
||||
), |
||||
), |
||||
margin: EdgeInsets.symmetric(horizontal: 60, vertical: 5), |
||||
padding: EdgeInsets.only(left: 16.w, right: 25.w), |
||||
child: Row( |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
children: [ |
||||
Text.rich( |
||||
TextSpan( |
||||
children: [ |
||||
TextSpan( |
||||
text: "¥", |
||||
style: TextStyle( |
||||
fontSize: 25.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFFDE5F3B), |
||||
), |
||||
), |
||||
TextSpan( |
||||
// text: double.tryParse( |
||||
// "${newUserCouponList.discountAmount}" ?? "0") |
||||
// .toInt() |
||||
// .toString() ?? |
||||
// "", |
||||
text: "10", |
||||
style: TextStyle( |
||||
fontSize: 35.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFFDE5F3B), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
Expanded(child:Padding( |
||||
padding: EdgeInsets.only(top: 4, bottom: 4,left:10), |
||||
child: Column( |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
children: [ |
||||
Text( |
||||
"海峡姐妹茶吧", |
||||
overflow: TextOverflow.ellipsis, |
||||
maxLines: 2, |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFF181818), |
||||
), |
||||
), |
||||
Text( |
||||
"10元代金劵一张", |
||||
overflow: TextOverflow.ellipsis, |
||||
maxLines: 2, |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Color(0xFFD3623D), |
||||
), |
||||
), |
||||
Text( |
||||
// "有效期至:${(newUserCouponList.useEndTime != null && newUserCouponList.useEndTime != "") |
||||
// ? newUserCouponList.useEndTime.split(" ")[0] |
||||
// : "$newUserCouponList.useEndTime"}", |
||||
"有效期至:2021-07-30", |
||||
overflow: TextOverflow.ellipsis, |
||||
maxLines: 2, |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF727272), |
||||
), |
||||
) |
||||
], |
||||
))), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
} |
Loading…
Reference in new issue