fmk
3 years ago
24 changed files with 2502 additions and 2129 deletions
@ -0,0 +1,84 @@
|
||||
|
||||
|
||||
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter_swiper/flutter_swiper.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/retrofit/data/brand.dart'; |
||||
import 'package:huixiang/view_widget/custom_image.dart'; |
||||
import 'package:huixiang/view_widget/item_title.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
||||
class BrandView extends StatefulWidget { |
||||
|
||||
final List<Brand> brandData; |
||||
|
||||
BrandView(this.brandData); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _BrandView(); |
||||
} |
||||
|
||||
} |
||||
|
||||
class _BrandView extends State<BrandView> { |
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Column( |
||||
children: [ |
||||
ItemTitle( |
||||
text: S.of(context).pinpaijieshao, |
||||
imgPath: "assets/image/icon_brand_introduction.png", |
||||
), |
||||
brands(), |
||||
], |
||||
); |
||||
} |
||||
|
||||
|
||||
brands() { |
||||
return Container( |
||||
height: 90.h, |
||||
margin: EdgeInsets.only(bottom: 18.h), |
||||
child: Swiper( |
||||
physics: BouncingScrollPhysics(), |
||||
viewportFraction: 0.32, |
||||
scale: 0.7, |
||||
loop: true, |
||||
itemBuilder: (context, position) { |
||||
return Container( |
||||
// height: 60.h, |
||||
// width: 120.w, |
||||
margin: EdgeInsets.symmetric(horizontal: 3.w, vertical: 15.h), |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(37), |
||||
offset: Offset(0, 2), |
||||
blurRadius: 5, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
borderRadius: BorderRadius.circular(8), |
||||
), |
||||
child: MImage( |
||||
widget.brandData != null ? widget.brandData[position].image : "", |
||||
radius: BorderRadius.circular(8), |
||||
fit: BoxFit.cover, |
||||
errorSrc: "assets/image/default_2_1.png", |
||||
fadeSrc: "assets/image/default_2_1.png", |
||||
), |
||||
); |
||||
}, |
||||
itemCount: |
||||
(widget.brandData != null && widget.brandData.length > 0) ? widget.brandData.length : 0, |
||||
), |
||||
); |
||||
} |
||||
|
||||
|
||||
} |
||||
|
||||
|
@ -0,0 +1,143 @@
|
||||
|
||||
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/retrofit/data/founder.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:huixiang/view_widget/custom_image.dart'; |
||||
import 'package:huixiang/view_widget/item_title.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
||||
class FounderStore extends StatefulWidget { |
||||
|
||||
final Founder founder; |
||||
|
||||
FounderStore(this.founder); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _FounderStore(); |
||||
} |
||||
|
||||
} |
||||
|
||||
class _FounderStore extends State<FounderStore> { |
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Column( |
||||
children: [ |
||||
ItemTitle( |
||||
text: S.of(context).chuangshirendegushi1, |
||||
imgPath: "assets/image/icon_founder.png", |
||||
), |
||||
GestureDetector( |
||||
onTap: () { |
||||
Navigator.of(context) |
||||
.pushNamed('/router/founder_story_page'); |
||||
}, |
||||
child: founderStore(), |
||||
), |
||||
], |
||||
); |
||||
} |
||||
|
||||
|
||||
Widget founderStore() { |
||||
return Container( |
||||
margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 22.h, bottom: 28.h), |
||||
decoration: BoxDecoration( |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(25), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
), |
||||
], |
||||
), |
||||
child: Stack( |
||||
alignment: Alignment.bottomCenter, |
||||
clipBehavior: Clip.hardEdge, |
||||
children: [ |
||||
MImage( |
||||
widget.founder != null ? widget.founder.imgUrl : "", |
||||
aspectRatio: 2, |
||||
radius: BorderRadius.circular(4.w), |
||||
fit: BoxFit.cover, |
||||
errorSrc: "assets/image/default_2_1.png", |
||||
fadeSrc: "assets/image/default_2_1.png", |
||||
), |
||||
Container( |
||||
padding: EdgeInsets.all(8.w), |
||||
decoration: BoxDecoration( |
||||
color: Colors.black.withAlpha(153), |
||||
borderRadius: BorderRadius.only( |
||||
bottomLeft: Radius.circular(4.w), |
||||
bottomRight: Radius.circular(4.w), |
||||
), |
||||
), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
crossAxisAlignment: CrossAxisAlignment.baseline, |
||||
textBaseline: TextBaseline.alphabetic, |
||||
children: [ |
||||
Expanded( |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.end, |
||||
crossAxisAlignment: CrossAxisAlignment.baseline, |
||||
textBaseline: TextBaseline.alphabetic, |
||||
children: [ |
||||
Expanded( |
||||
child: Row( |
||||
children: [ |
||||
Text( |
||||
S.of(context).chuangshirendegushi, |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: FontWeight.bold, |
||||
color: Colors.white, |
||||
), |
||||
), |
||||
Text( |
||||
widget.founder != null ? widget.founder.name : "", |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: FontWeight.bold, |
||||
color: Colors.white, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
flex: 1, |
||||
), |
||||
Row( |
||||
children: [ |
||||
Text( |
||||
S.of(context).chakanxiangqing, |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Colors.white, |
||||
), |
||||
), |
||||
Icon( |
||||
Icons.keyboard_arrow_right, |
||||
size: 12, |
||||
color: Colors.white, |
||||
), |
||||
], |
||||
), |
||||
], |
||||
), |
||||
flex: 1, |
||||
), |
||||
], |
||||
), |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,101 @@
|
||||
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter_swiper/flutter_swiper.dart'; |
||||
import 'package:huixiang/retrofit/data/banner.dart'; |
||||
import 'package:huixiang/view_widget/custom_image.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
||||
class HomeBanner extends StatefulWidget { |
||||
|
||||
final List<BannerData> bannerData; |
||||
final SwiperController controller; |
||||
|
||||
HomeBanner(this.bannerData, this.controller); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _HomeBanner(); |
||||
} |
||||
|
||||
} |
||||
|
||||
class _HomeBanner extends State<HomeBanner> { |
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Container( |
||||
child: AspectRatio( |
||||
aspectRatio: 2, |
||||
child: Swiper( |
||||
pagination: SwiperPagination( |
||||
margin: EdgeInsets.only(bottom: 20.h), |
||||
alignment: Alignment.bottomCenter, |
||||
builder: DotSwiperPaginationBuilder( |
||||
size: 8, |
||||
activeSize: 8, |
||||
space: 5, |
||||
activeColor: Colors.white, |
||||
color: Colors.white.withAlpha(76), |
||||
), |
||||
), |
||||
controller: widget.controller, |
||||
physics: BouncingScrollPhysics(), |
||||
itemBuilder: (context, position) { |
||||
return InkWell( |
||||
onTap: () { |
||||
bannerClick(widget.bannerData[position]); |
||||
}, |
||||
child: Container( |
||||
margin: EdgeInsets.all(16), |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(8), |
||||
), |
||||
child: MImage( |
||||
(widget.bannerData != null && position < widget.bannerData.length) |
||||
? widget.bannerData[position].imgUrl ?? "" |
||||
: "", |
||||
radius: BorderRadius.circular(8), |
||||
fit: BoxFit.cover, |
||||
errorSrc: "assets/image/default_2_1.png", |
||||
fadeSrc: "assets/image/default_2_1.png", |
||||
), |
||||
), |
||||
); |
||||
}, |
||||
itemCount: (widget.bannerData != null && widget.bannerData.length > 0) |
||||
? widget.bannerData.length |
||||
: 1, |
||||
), |
||||
), |
||||
); |
||||
} |
||||
|
||||
/// contentType 跳转类型(0:不跳转,1:积分商品,2:活动,3:文章) |
||||
bannerClick(BannerData bannerData) async { |
||||
switch (bannerData.contentType) { |
||||
case 1: |
||||
Navigator.of(context).pushNamed('/router/integral_store_page', |
||||
arguments: {"goodsId": bannerData.content}); |
||||
break; |
||||
case 2: |
||||
Navigator.of(context) |
||||
.pushNamed('/router/store_detail_page', arguments: { |
||||
"activityId": bannerData.content, |
||||
}); |
||||
break; |
||||
case 3: |
||||
Navigator.of(context) |
||||
.pushNamed('/router/store_detail_page', arguments: { |
||||
"articleId": bannerData.content, |
||||
}); |
||||
break; |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,205 @@
|
||||
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/retrofit/data/goods.dart'; |
||||
import 'package:huixiang/utils/flutter_utils.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:huixiang/view_widget/border_text.dart'; |
||||
import 'package:huixiang/view_widget/custom_image.dart'; |
||||
import 'package:huixiang/view_widget/item_title.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
||||
class HomeIntegralStore extends StatefulWidget { |
||||
|
||||
final GestureTapCallback callback; |
||||
final List<Goods> gooods; |
||||
|
||||
HomeIntegralStore(this.gooods, this.callback); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _HomeIntegralStore(); |
||||
} |
||||
|
||||
} |
||||
|
||||
class _HomeIntegralStore extends State<HomeIntegralStore> { |
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Container( |
||||
margin: EdgeInsets.only( |
||||
left: 16.5.w, right: 16.5.w, bottom: 40.h, top: 10.h), |
||||
padding: EdgeInsets.only(bottom: 10.h, top: 16.h), |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(4), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
color: Colors.white, |
||||
), |
||||
child: Column( |
||||
children: [ |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Expanded( |
||||
flex: 1, |
||||
child: ItemTitle( |
||||
text: S.of(context).jifenshangcheng, |
||||
imgPath: "assets/image/icon_points_mall.png", |
||||
), |
||||
), |
||||
GestureDetector( |
||||
onTap: widget.callback, |
||||
child: Container( |
||||
padding: EdgeInsets.symmetric( |
||||
vertical: 3.h, horizontal: 8.w,), |
||||
margin: EdgeInsets.only(right: 16.w), |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(11.5), |
||||
color: Color(0xFF32A060), |
||||
), |
||||
child: Row( |
||||
children: [ |
||||
Text( |
||||
"GO", |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: FontWeight.bold, |
||||
color: Colors.white, |
||||
), |
||||
), |
||||
Icon( |
||||
Icons.chevron_right, |
||||
color: Colors.white, |
||||
size: 18, |
||||
), |
||||
], |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
SizedBox( |
||||
height: 14.h, |
||||
), |
||||
Divider( |
||||
// indent: 0.0, |
||||
thickness: 1, |
||||
color: Color(0xffF2F2F2), |
||||
), |
||||
integralStore(), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget integralStore() { |
||||
return GridView.builder( |
||||
itemCount: widget.gooods != null ? widget.gooods.length : 0, |
||||
padding: EdgeInsets.all(13.w), |
||||
shrinkWrap: true, |
||||
physics: NeverScrollableScrollPhysics(), |
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( |
||||
//一行的Widget数量 |
||||
crossAxisCount: 2, |
||||
//水平子Widget之间间距 |
||||
crossAxisSpacing: 13, |
||||
//垂直子Widget之间间距 |
||||
mainAxisSpacing: 16, |
||||
//子Widget宽高比例 |
||||
childAspectRatio: AppUtils.textScale(context) > 1 |
||||
? (1 - ((AppUtils.textScale(context) - 1))) |
||||
: 0.85, |
||||
), |
||||
itemBuilder: (contetx, index) { |
||||
return GestureDetector( |
||||
onTap: () { |
||||
Navigator.of(context).pushNamed('/router/integral_store_page', |
||||
arguments: {"goodsId": widget.gooods[index].id}); |
||||
}, |
||||
child: buildItem(widget.gooods[index]), |
||||
); |
||||
}, |
||||
); |
||||
} |
||||
|
||||
|
||||
Widget buildItem(Goods goods) { |
||||
return Container( |
||||
alignment: Alignment.center, |
||||
child: Column( |
||||
children: [ |
||||
MImage( |
||||
goods.mainImgPath, |
||||
aspectRatio: 5 / 3, |
||||
radius: BorderRadius.circular(4), |
||||
fit: BoxFit.cover, |
||||
errorSrc: "assets/image/default_1.png", |
||||
fadeSrc: "assets/image/default_1.png", |
||||
), |
||||
SizedBox( |
||||
height: 4.h, |
||||
), |
||||
Container( |
||||
margin: EdgeInsets.only(left: 8.w, right: 8.w), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
SizedBox( |
||||
height: 14.h, |
||||
), |
||||
Row( |
||||
children: [ |
||||
Expanded( |
||||
flex: 1, |
||||
child: Text( |
||||
goods.name, |
||||
overflow: TextOverflow.ellipsis, |
||||
style: TextStyle( |
||||
color: Color(0xff353535), |
||||
fontWeight: MyFontWeight.regular, |
||||
fontSize: 14.sp, |
||||
), |
||||
), |
||||
), |
||||
BorderText( |
||||
padding: EdgeInsets.all(2.h), |
||||
text: S.of(context).haowu, |
||||
fontSize: 12.sp, |
||||
fontWeight: FontWeight.bold, |
||||
textColor: Color(0xFF32A060), |
||||
borderColor: Color(0xFF32A060), |
||||
borderWidth: 1.w, |
||||
), |
||||
], |
||||
), |
||||
SizedBox( |
||||
height: 5.h, |
||||
), |
||||
Text( |
||||
goods.description, |
||||
overflow: TextOverflow.ellipsis, |
||||
maxLines: 2, |
||||
style: TextStyle( |
||||
color: Color(0xFF727272), |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
) |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,68 @@
|
||||
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/retrofit/data/article.dart'; |
||||
import 'package:huixiang/view_widget/hot_item.dart'; |
||||
import 'package:huixiang/view_widget/item_title.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
||||
class HotArticle extends StatefulWidget { |
||||
|
||||
final List<Article> articles; |
||||
|
||||
HotArticle(this.articles); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _HotArticle(); |
||||
} |
||||
|
||||
} |
||||
|
||||
class _HotArticle extends State<HotArticle> { |
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Column( |
||||
children: [ |
||||
ItemTitle( |
||||
text: S.of(context).huixiangtoutiao, |
||||
imgPath: "assets/image/icon_today_video.png", |
||||
moreText: S.of(context).chakangengduo, |
||||
onTap: () { |
||||
Navigator.of(context) |
||||
.pushNamed('/router/hot_article_page'); |
||||
}, |
||||
), |
||||
hotList(), |
||||
], |
||||
); |
||||
} |
||||
|
||||
|
||||
Widget hotList() { |
||||
return Container( |
||||
child: ListView.builder( |
||||
shrinkWrap: true, |
||||
itemCount: widget.articles != null |
||||
? ((widget.articles.length > 3) ? 3 : widget.articles.length) |
||||
: 0, |
||||
physics: BouncingScrollPhysics(), |
||||
scrollDirection: Axis.vertical, |
||||
padding: EdgeInsets.symmetric(vertical: 12.h), |
||||
itemBuilder: (context, position) { |
||||
return AspectRatio( |
||||
aspectRatio: position == 0 ? 1.38 : 3.56, |
||||
child: Container( |
||||
height: position == 0 ? 247.h : 96.h, |
||||
margin: EdgeInsets.symmetric(vertical: 6.h, horizontal: 16.w), |
||||
child: HotArticleItem( |
||||
article: widget.articles[position], isHot: position == 0), |
||||
), |
||||
); |
||||
}, |
||||
), |
||||
); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,108 @@
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/utils/flutter_utils.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:huixiang/view_widget/item_title.dart'; |
||||
import 'package:shared_preferences/shared_preferences.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
||||
class SignView extends StatelessWidget { |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Column( |
||||
children: [ |
||||
SizedBox( |
||||
height: 20.h, |
||||
), |
||||
ItemTitle( |
||||
text: S.of(context).jinrihuiyuanrenwu, |
||||
imgPath: "assets/image/icon_today_task.png", |
||||
moreText: S.of(context).renwuzhongxin, |
||||
onTap: () { |
||||
SharedPreferences.getInstance().then((value) { |
||||
if (value.getString('token') == null || |
||||
value.getString('token') == "") { |
||||
AppUtils.loginTips(context); |
||||
} else { |
||||
Navigator.of(context).pushNamed('/router/integral_page'); |
||||
} |
||||
}); |
||||
}, |
||||
), |
||||
InkWell( |
||||
onTap: () { |
||||
SharedPreferences.getInstance().then((value) { |
||||
if (value.getString('token') == null || |
||||
value.getString('token') == "") { |
||||
AppUtils.loginTips(context); |
||||
} else { |
||||
Navigator.of(context).pushNamed('/router/integral_page'); |
||||
} |
||||
}); |
||||
}, |
||||
child: signIn(context), |
||||
), |
||||
SizedBox( |
||||
height: 12.h, |
||||
), |
||||
], |
||||
); |
||||
} |
||||
|
||||
///签到view |
||||
Widget signIn(BuildContext context) { |
||||
return Container( |
||||
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 8.h), |
||||
margin: 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( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/icon_calendar_today_sharp.png", |
||||
width: 20.w, |
||||
height: 20.h, |
||||
), |
||||
SizedBox( |
||||
width: 8.w, |
||||
), |
||||
Text( |
||||
S.of(context).qiandaolingqujinfen, |
||||
style: TextStyle( |
||||
color: Colors.black, |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
Text( |
||||
S.of(context).quqiandao, |
||||
style: TextStyle( |
||||
color: Color(0xFF727272), |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,94 @@
|
||||
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter_swiper/flutter_swiper.dart'; |
||||
import 'package:huixiang/retrofit/data/banner.dart'; |
||||
import 'package:huixiang/view_widget/custom_image.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
||||
class HuiXiangBanner extends StatefulWidget { |
||||
|
||||
final List<BannerData> bannerData; |
||||
|
||||
HuiXiangBanner(this.bannerData); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _HuiXiangBanner(); |
||||
} |
||||
|
||||
} |
||||
|
||||
class _HuiXiangBanner extends State<HuiXiangBanner> { |
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Container( |
||||
child: AspectRatio( |
||||
aspectRatio: 2.08, |
||||
child: Swiper( |
||||
viewportFraction: 0.88, |
||||
scale: 0.93, |
||||
pagination: SwiperPagination( |
||||
alignment: Alignment.bottomCenter, |
||||
builder: DotSwiperPaginationBuilder( |
||||
size: 8, |
||||
activeSize: 8, |
||||
space: 5, |
||||
activeColor: Colors.black, |
||||
color: Colors.black.withAlpha(76), |
||||
), |
||||
), |
||||
physics: BouncingScrollPhysics(), |
||||
itemBuilder: (context, position) { |
||||
return InkWell( |
||||
onTap: () { |
||||
bannerClick(widget.bannerData[position]); |
||||
}, |
||||
child: MImage( |
||||
(widget.bannerData != null && position < widget.bannerData.length) |
||||
? widget.bannerData[position].imgUrl |
||||
: "", |
||||
fit: BoxFit.cover, |
||||
radius: BorderRadius.circular(8), |
||||
errorSrc: "assets/image/default_2_1.png", |
||||
fadeSrc: "assets/image/default_2_1.png", |
||||
), |
||||
); |
||||
}, |
||||
itemCount: (widget.bannerData != null && widget.bannerData.length > 0) |
||||
? widget.bannerData.length |
||||
: 1), |
||||
), |
||||
); |
||||
} |
||||
|
||||
/// contentType 跳转类型(0:不跳转,1:积分商品,2:活动,3:文章) |
||||
bannerClick(BannerData bannerData) async { |
||||
switch (bannerData.contentType) { |
||||
case 1: |
||||
Navigator.of(context).pushNamed('/router/integral_store_page', |
||||
arguments: {"goodsId": bannerData.content}); |
||||
break; |
||||
case 2: |
||||
Navigator.of(context) |
||||
.pushNamed('/router/store_detail_page', arguments: { |
||||
"activityId": bannerData.content, |
||||
}); |
||||
break; |
||||
case 3: |
||||
Navigator.of(context) |
||||
.pushNamed('/router/store_detail_page', arguments: { |
||||
"articleId": bannerData.content, |
||||
}); |
||||
break; |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,306 @@
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/retrofit/data/brand_data.dart'; |
||||
import 'package:huixiang/utils/MyPainter.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:huixiang/view_widget/custom_image.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
||||
class OriginInfo extends StatefulWidget { |
||||
final BrandData brandData; |
||||
|
||||
OriginInfo(this.brandData); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _OriginInfo(); |
||||
} |
||||
} |
||||
|
||||
class _OriginInfo extends State<OriginInfo> { |
||||
var isShowMore = false; |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Container( |
||||
margin: EdgeInsets.only(bottom: 20.h, top: 16.h), |
||||
padding: EdgeInsets.all(16), |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 2), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
GestureDetector( |
||||
onTap: () { |
||||
Navigator.of(context).pushNamed('/router/founder_story_page'); |
||||
}, |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
ClipOval( |
||||
child: MImage( |
||||
widget.brandData == null |
||||
? "" |
||||
: widget.brandData.originAvatar, |
||||
fit: BoxFit.cover, |
||||
width: 60, |
||||
height: 60, |
||||
errorSrc: "assets/image/default_1.png", |
||||
fadeSrc: "assets/image/default_1.png", |
||||
), |
||||
clipBehavior: Clip.hardEdge, |
||||
), |
||||
SizedBox( |
||||
width: 16.w, |
||||
), |
||||
Expanded( |
||||
child: Container( |
||||
child: Column( |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Text.rich( |
||||
TextSpan(children: [ |
||||
TextSpan( |
||||
text: widget.brandData == null |
||||
? "" |
||||
: widget.brandData.originator, |
||||
style: TextStyle( |
||||
fontWeight: FontWeight.bold, |
||||
fontSize: 14.sp, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
TextSpan( |
||||
text: " ${S.of(context).jituanchuangbanren}", |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
]), |
||||
textDirection: TextDirection.ltr, |
||||
), |
||||
Text( |
||||
widget.brandData == null |
||||
? "" |
||||
: widget.brandData.originDesc, |
||||
overflow: isShowMore |
||||
? TextOverflow.visible |
||||
: TextOverflow.ellipsis, |
||||
maxLines: isShowMore ? 10 : 2, |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
SizedBox(height: 3.h), |
||||
GestureDetector( |
||||
onTap: () { |
||||
setState(() { |
||||
isShowMore = !isShowMore; |
||||
}); |
||||
}, |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.end, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
mainAxisSize: MainAxisSize.max, |
||||
children: [ |
||||
Text( |
||||
S.of(context).gengduo, |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
Icon( |
||||
(isShowMore != null && !isShowMore) |
||||
? Icons.chevron_right |
||||
: Icons.keyboard_arrow_up, |
||||
color: Colors.black, |
||||
size: 18, |
||||
), |
||||
], |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
flex: 1, |
||||
), |
||||
], |
||||
), |
||||
), |
||||
SizedBox( |
||||
height: 40.h, |
||||
), |
||||
InkWell( |
||||
onTap: () { |
||||
Navigator.of(context).pushNamed('/router/founder_story_page'); |
||||
}, |
||||
child: Text( |
||||
widget.brandData == null ? "" : widget.brandData.company, |
||||
style: TextStyle( |
||||
fontSize: 16.sp, |
||||
fontWeight: FontWeight.bold, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
), |
||||
SizedBox( |
||||
height: 20.h, |
||||
), |
||||
InkWell( |
||||
onTap: () { |
||||
Navigator.of(context).pushNamed('/router/founder_story_page'); |
||||
}, |
||||
child: Text( |
||||
widget.brandData == null ? "" : widget.brandData.companyDesc, |
||||
textAlign: TextAlign.justify, |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
), |
||||
SizedBox( |
||||
height: 40.h, |
||||
), |
||||
Text( |
||||
S.of(context).linian, |
||||
style: TextStyle( |
||||
fontSize: 16.sp, |
||||
fontWeight: FontWeight.bold, |
||||
color: Colors.black, |
||||
), |
||||
), |
||||
SizedBox( |
||||
height: 20.h, |
||||
), |
||||
InkWell( |
||||
onTap: () { |
||||
Navigator.of(context).pushNamed('/router/founder_story_page'); |
||||
}, |
||||
child: Column( |
||||
children: [ |
||||
Row( |
||||
children: [ |
||||
_ideaWidget("友爱", "assets/image/icon_idea_ya.png"), |
||||
_ideaWidget("纯净", "assets/image/icon_idea_cj.png"), |
||||
_ideaWidget("健康", "assets/image/icon_idea_jk.png"), |
||||
], |
||||
), |
||||
SizedBox( |
||||
height: 18.h, |
||||
), |
||||
Row( |
||||
children: [ |
||||
_ideaWidget("有机", "assets/image/icon_idea_yj.png"), |
||||
_ideaWidget("环保", "assets/image/icon_idea_hb.png"), |
||||
_ideaWidget("智慧", "assets/image/icon_idea_zh.png"), |
||||
], |
||||
), |
||||
], |
||||
), |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget _ideaWidget(var text, String img) { |
||||
return Expanded( |
||||
flex: 1, |
||||
child: Stack( |
||||
alignment: Alignment.center, |
||||
children: [ |
||||
Container( |
||||
width: 63.h, |
||||
height: 63.h, |
||||
child: Stack( |
||||
alignment: Alignment.center, |
||||
children: [ |
||||
Align( |
||||
child: CircleAvatar( |
||||
child: Image.asset(img), |
||||
radius: 100, |
||||
), |
||||
), |
||||
Text( |
||||
text, |
||||
style: TextStyle( |
||||
fontSize: 18, |
||||
fontWeight: MyFontWeight.light, |
||||
color: Colors.white, |
||||
), |
||||
) |
||||
], |
||||
), |
||||
), |
||||
Container( |
||||
width: 73, |
||||
height: 73.h, |
||||
child: CustomPaint( |
||||
painter: MyPainter( |
||||
lineColor: Color(0xff32A060), |
||||
width: 2, |
||||
isDividerRound: true, |
||||
), |
||||
), |
||||
) |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget idea(key, value) { |
||||
return Expanded( |
||||
flex: 1, |
||||
child: Stack( |
||||
alignment: Alignment.center, |
||||
children: [ |
||||
Container( |
||||
width: 63.w, |
||||
height: 63.h, |
||||
child: CircleAvatar( |
||||
radius: 100, |
||||
backgroundImage: NetworkImage(value), |
||||
child: Container( |
||||
alignment: Alignment.center, |
||||
child: Text( |
||||
key, |
||||
style: TextStyle( |
||||
fontSize: 16.sp, |
||||
fontWeight: MyFontWeight.light, |
||||
color: Colors.white, |
||||
), |
||||
), |
||||
), |
||||
), |
||||
), |
||||
Container( |
||||
width: 73.w, |
||||
height: 73.h, |
||||
child: CustomPaint( |
||||
painter: MyPainter( |
||||
lineColor: Color(0xff32A060), |
||||
width: 2.w, |
||||
isDividerRound: true, |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,152 @@
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/retrofit/data/user_info.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:huixiang/view_widget/custom_image.dart'; |
||||
import 'package:shared_preferences/shared_preferences.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
||||
class PointMallUser extends StatefulWidget { |
||||
final UserInfo userInfo; |
||||
|
||||
PointMallUser(this.userInfo); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _PointMallUser(); |
||||
} |
||||
} |
||||
|
||||
class _PointMallUser extends State<PointMallUser> { |
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return InkWell( |
||||
onTap: () { |
||||
SharedPreferences.getInstance().then((value) { |
||||
if (value.getString("token") == null || |
||||
value.getString("token") == "") { |
||||
Navigator.of(context) |
||||
.pushNamed('/router/login_page', arguments: {"login": "login"}); |
||||
} |
||||
}); |
||||
}, |
||||
child: Container( |
||||
margin: EdgeInsets.all(16), |
||||
child: Row( |
||||
children: [ |
||||
MImage( |
||||
widget.userInfo != null ? widget.userInfo.headimg : "", |
||||
width: 50, |
||||
height: 50, |
||||
isCircle: true, |
||||
fit: BoxFit.cover, |
||||
errorSrc: "assets/image/default_user.png", |
||||
fadeSrc: "assets/image/default_user.png", |
||||
), |
||||
Expanded( |
||||
child: Container( |
||||
margin: EdgeInsets.only(left: 15.w), |
||||
height: 50.h, |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
widget.userInfo == null |
||||
? Text( |
||||
S.of(context).denglu, |
||||
style: TextStyle( |
||||
fontSize: 16.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Color(0xFF353535), |
||||
), |
||||
) |
||||
: Row( |
||||
children: [ |
||||
Text( |
||||
widget.userInfo.nickname, |
||||
style: TextStyle( |
||||
fontSize: 16.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
SizedBox( |
||||
width: 4.w, |
||||
), |
||||
Image.asset( |
||||
"assets/image/icon_user.png", |
||||
width: 18.w, |
||||
height: 18.h, |
||||
), |
||||
], |
||||
), |
||||
SizedBox( |
||||
height: 2.h, |
||||
), |
||||
widget.userInfo == null |
||||
? Text( |
||||
S.of(context).weidengluxinxi, |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF2F2F2F), |
||||
), |
||||
) |
||||
: Text( |
||||
widget.userInfo == null |
||||
? "" |
||||
: "NO.${widget.userInfo.vipNo}", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF2F2F2F), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
flex: 1, |
||||
), |
||||
widget.userInfo == null |
||||
? Icon( |
||||
Icons.keyboard_arrow_right, |
||||
size: 20, |
||||
color: Colors.black, |
||||
) |
||||
: Container( |
||||
margin: EdgeInsets.only(left: 15.w), |
||||
height: 50.h, |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, |
||||
crossAxisAlignment: CrossAxisAlignment.end, |
||||
children: [ |
||||
Text( |
||||
S.of(context).yiyoujifen, |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Color(0xFF4C4C4C), |
||||
), |
||||
), |
||||
SizedBox( |
||||
height: 4.h, |
||||
), |
||||
Text( |
||||
(widget.userInfo != null) |
||||
? "${widget.userInfo.points}" |
||||
: "", |
||||
style: TextStyle( |
||||
fontSize: 16.sp, |
||||
color: Color(0xFFF8BA61), |
||||
fontWeight: FontWeight.bold, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
) |
||||
], |
||||
), |
||||
), |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,111 @@
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/retrofit/data/goods_category.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:huixiang/view_widget/item_title.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
||||
class PointsGoodsTitle extends StatefulWidget { |
||||
final ValueChanged<int> onTap; |
||||
final Function(int orderType, bool orderDesc) sortChange; |
||||
final List<GoodsCategory> gooodsCategorys; |
||||
|
||||
PointsGoodsTitle(this.gooodsCategorys, this.sortChange, this.onTap); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _PointsGoodsTitle(); |
||||
} |
||||
} |
||||
|
||||
class _PointsGoodsTitle extends State<PointsGoodsTitle> { |
||||
|
||||
var _itemText = S.current.morenpaixu; |
||||
List<String> sortString = [ |
||||
S.current.morenpaixu, |
||||
S.current.jifengaodaodi, |
||||
S.current.jifendidaogao, |
||||
]; |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Column( |
||||
children: [ |
||||
ItemTitle( |
||||
text: S.of(context).jifenshangcheng, |
||||
imgPath: "assets/image/icon_points_mall.png", |
||||
moreText: _itemText, |
||||
moreType: 1, |
||||
items: sortString |
||||
.map( |
||||
(e) => DropdownMenuItem( |
||||
value: e, |
||||
child: Text( |
||||
e, |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Color(0xff353535), |
||||
), |
||||
), |
||||
), |
||||
) |
||||
.toList(), |
||||
onChanged: _sortChange, |
||||
), |
||||
Container( |
||||
alignment: Alignment.centerLeft, |
||||
child: DefaultTabController( |
||||
length: widget.gooodsCategorys == null |
||||
? 0 |
||||
: widget.gooodsCategorys.length, |
||||
child: TabBar( |
||||
isScrollable: true, |
||||
//可滚动 |
||||
indicatorColor: Color(0xff39B54A), |
||||
labelColor: Color(0xff32A060), |
||||
labelStyle: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: FontWeight.bold, |
||||
), |
||||
unselectedLabelStyle: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
), |
||||
// controller: tabController, |
||||
//未选中文字颜色 |
||||
unselectedLabelColor: Color(0xff4D4D4D), |
||||
indicatorSize: TabBarIndicatorSize.label, |
||||
//指示器与文字等宽 |
||||
tabs: widget.gooodsCategorys == null |
||||
? [] |
||||
: widget.gooodsCategorys |
||||
.map((e) => Tab(text: e.name)) |
||||
.toList(), |
||||
onTap: widget.onTap, |
||||
), |
||||
), |
||||
), |
||||
], |
||||
); |
||||
} |
||||
|
||||
_sortChange(item) { |
||||
var index = sortString.indexOf(item); |
||||
switch (index) { |
||||
case 0: |
||||
widget.sortChange(1, true); |
||||
break; |
||||
case 1: |
||||
widget.sortChange(3, true); |
||||
break; |
||||
case 2: |
||||
widget.sortChange(3, false); |
||||
break; |
||||
} |
||||
setState(() { |
||||
_itemText = item; |
||||
}); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,181 @@
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/retrofit/data/goods.dart'; |
||||
import 'package:huixiang/utils/flutter_utils.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:huixiang/view_widget/custom_image.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
||||
class PointGoods extends StatefulWidget { |
||||
final List<Goods> goods; |
||||
final ValueChanged onTap; |
||||
|
||||
PointGoods(this.goods, this.onTap); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _PointGoods(); |
||||
} |
||||
} |
||||
|
||||
class _PointGoods extends State<PointGoods> { |
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return GridView.builder( |
||||
itemCount: widget.goods == null ? 0 : widget.goods.length, |
||||
padding: EdgeInsets.only( |
||||
left: 16.w, |
||||
right: 16.w, |
||||
top: 13.h, |
||||
bottom: 16.h, |
||||
), |
||||
shrinkWrap: true, |
||||
physics: NeverScrollableScrollPhysics(), |
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( |
||||
//一行的Widget数量 |
||||
crossAxisCount: 2, |
||||
//水平子Widget之间间距 |
||||
crossAxisSpacing: 11.w, |
||||
//垂直子Widget之间间距 |
||||
mainAxisSpacing: 16.w, |
||||
//子Widget宽高比例 0.59 |
||||
childAspectRatio: |
||||
166 / (281 / 2 + (281 / 2) * AppUtils.textScale(context)), |
||||
), |
||||
itemBuilder: (context, index) { |
||||
return GestureDetector( |
||||
onTap: () { |
||||
widget.onTap(index); |
||||
}, |
||||
child: buildItem(widget.goods[index]), |
||||
); |
||||
}, |
||||
); |
||||
} |
||||
|
||||
Widget buildItem(Goods goods) { |
||||
return Container( |
||||
alignment: Alignment.center, |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(4), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
color: Colors.white, |
||||
), |
||||
child: Stack( |
||||
alignment: AlignmentDirectional.topEnd, |
||||
fit: StackFit.loose, |
||||
children: [ |
||||
Column( |
||||
mainAxisSize: MainAxisSize.max, |
||||
children: [ |
||||
MImage( |
||||
goods.mainImgPath, |
||||
aspectRatio: 1, |
||||
radius: BorderRadius.only( |
||||
topLeft: Radius.circular(4), |
||||
topRight: Radius.circular(4), |
||||
), |
||||
fit: BoxFit.cover, |
||||
errorSrc: "assets/image/default_1.png", |
||||
fadeSrc: "assets/image/default_1.png", |
||||
), |
||||
Expanded( |
||||
child: Container( |
||||
margin: EdgeInsets.only( |
||||
left: 12.w, |
||||
right: 12.w, |
||||
top: 10.h, |
||||
), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Text( |
||||
goods.name, |
||||
overflow: TextOverflow.ellipsis, |
||||
style: TextStyle( |
||||
color: Color(0xff353535), |
||||
fontWeight: MyFontWeight.medium, |
||||
fontSize: 16.sp, |
||||
), |
||||
), |
||||
SizedBox( |
||||
height: 5.h, |
||||
), |
||||
Container( |
||||
height: 35.h * AppUtils.textScale(context), |
||||
child: Text( |
||||
goods.description, |
||||
maxLines: 2, |
||||
overflow: TextOverflow.ellipsis, |
||||
style: TextStyle( |
||||
color: Color(0xFF727272), |
||||
fontWeight: MyFontWeight.regular, |
||||
fontSize: 12.sp, |
||||
), |
||||
), |
||||
), |
||||
SizedBox( |
||||
height: 4.h, |
||||
), |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.end, |
||||
children: [ |
||||
Expanded( |
||||
child: Text( |
||||
S.of(context).yuan_(goods.worth), |
||||
style: TextStyle( |
||||
color: Color(0xFF585858), |
||||
decoration: TextDecoration.lineThrough, |
||||
decorationColor: Color(0xFF585858), |
||||
fontWeight: MyFontWeight.regular, |
||||
fontSize: 12.sp, |
||||
), |
||||
), |
||||
flex: 1, |
||||
), |
||||
Text( |
||||
S.of(context).jifen_(goods.price), |
||||
style: TextStyle( |
||||
color: Color(0xFF32A060), |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
], |
||||
), |
||||
), |
||||
flex: 1, |
||||
), |
||||
SizedBox( |
||||
height: 10.h, |
||||
), |
||||
], |
||||
), |
||||
Visibility( |
||||
visible: goods.isHot, |
||||
child: ClipRRect( |
||||
borderRadius: BorderRadius.only(topRight: Radius.circular(4)), |
||||
child: Image.asset( |
||||
"assets/image/icon_hot_right_top.png", |
||||
width: 36, |
||||
height: 36, |
||||
fit: BoxFit.cover, |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,99 @@
|
||||
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter_swiper/flutter_swiper.dart'; |
||||
import 'package:huixiang/retrofit/data/banner.dart'; |
||||
import 'package:huixiang/view_widget/custom_image.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
||||
class PointMallBanner extends StatefulWidget { |
||||
|
||||
final List<BannerData> bannerData; |
||||
|
||||
PointMallBanner(this.bannerData); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _PointMallBanner(); |
||||
} |
||||
|
||||
} |
||||
|
||||
class _PointMallBanner extends State<PointMallBanner> { |
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Container( |
||||
margin: EdgeInsets.only(top: 16.h), |
||||
child: AspectRatio( |
||||
aspectRatio: 2.0, |
||||
child: Swiper( |
||||
pagination: SwiperPagination( |
||||
alignment: Alignment.bottomCenter, |
||||
builder: DotSwiperPaginationBuilder( |
||||
size: 8, |
||||
activeSize: 8, |
||||
space: 5, |
||||
activeColor: Colors.black, |
||||
color: Colors.black.withAlpha(76), |
||||
), |
||||
), |
||||
viewportFraction: 0.7, |
||||
scale: 0.7, |
||||
physics: BouncingScrollPhysics(), |
||||
itemBuilder: (context, position) { |
||||
return InkWell( |
||||
onTap: () { |
||||
bannerClick(widget.bannerData[position]); |
||||
}, |
||||
child: Container( |
||||
margin: EdgeInsets.only(bottom: 40.h), |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(8), |
||||
), |
||||
child: MImage( |
||||
widget.bannerData != null && position < widget.bannerData.length |
||||
? widget.bannerData[position].imgUrl |
||||
: "", |
||||
radius: BorderRadius.circular(8), |
||||
fit: BoxFit.cover, |
||||
errorSrc: "assets/image/default_2_1.png", |
||||
fadeSrc: "assets/image/default_2_1.png", |
||||
), |
||||
), |
||||
); |
||||
}, |
||||
itemCount: (widget.bannerData != null && widget.bannerData.length > 0) ? widget.bannerData.length : 1, |
||||
), |
||||
), |
||||
); |
||||
} |
||||
|
||||
/// contentType 跳转类型(0:不跳转,1:积分商品,2:活动,3:文章) |
||||
bannerClick(BannerData bannerData) async { |
||||
switch (bannerData.contentType) { |
||||
case 1: |
||||
Navigator.of(context).pushNamed('/router/integral_store_page', |
||||
arguments: {"goodsId": bannerData.content}); |
||||
break; |
||||
case 2: |
||||
Navigator.of(context) |
||||
.pushNamed('/router/store_detail_page', arguments: { |
||||
"activityId": bannerData.content, |
||||
}); |
||||
break; |
||||
case 3: |
||||
Navigator.of(context) |
||||
.pushNamed('/router/store_detail_page', arguments: { |
||||
"articleId": bannerData.content, |
||||
}); |
||||
break; |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,158 @@
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/utils/flutter_utils.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:shared_preferences/shared_preferences.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
||||
class MineItem extends StatefulWidget { |
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _MineItem(); |
||||
} |
||||
|
||||
} |
||||
|
||||
class _MineItem extends State<MineItem> { |
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Container( |
||||
margin: EdgeInsets.fromLTRB(16.w, 10.h, 16.w, 28.h), |
||||
padding: EdgeInsets.fromLTRB(20.w, 12.h, 20.w, 12.h), |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
borderRadius: BorderRadius.circular(8), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
), |
||||
child: Column( |
||||
children: [ |
||||
InkWell( |
||||
onTap: () { |
||||
SharedPreferences.getInstance().then((value) { |
||||
if (value.getString("token") == null || |
||||
value.getString("token") == "") { |
||||
AppUtils.loginTips(context); |
||||
return; |
||||
} |
||||
Navigator.of(context).pushNamed('/router/mine_wallet'); |
||||
}); |
||||
}, |
||||
child: mineItem( |
||||
S.of(context).wodeqianbao, |
||||
"assets/image/icon_mine_wallet.png", |
||||
), |
||||
), |
||||
InkWell( |
||||
onTap: () { |
||||
SharedPreferences.getInstance().then((value) { |
||||
if (value.getString("token") == null || |
||||
value.getString("token") == "") { |
||||
AppUtils.loginTips(context); |
||||
return; |
||||
} |
||||
Navigator.of(context) |
||||
.pushNamed('/router/exchange_history_page'); |
||||
}); |
||||
}, |
||||
child: mineItem( |
||||
S.of(context).duihuanlishi, |
||||
"assets/image/icon_mine_records_of_consumption.png", |
||||
), |
||||
), |
||||
InkWell( |
||||
onTap: () { |
||||
SharedPreferences.getInstance().then((value) { |
||||
if (value.getString("token") == null || |
||||
value.getString("token") == "") { |
||||
AppUtils.loginTips(context); |
||||
return; |
||||
} |
||||
Navigator.of(context).pushNamed('/router/roll_center_page'); |
||||
}); |
||||
}, |
||||
child: mineItem( |
||||
S.of(context).lingquanzhongxin, |
||||
"assets/image/icon_mine_invoice_assistant.png", |
||||
), |
||||
), |
||||
InkWell( |
||||
onTap: () { |
||||
SharedPreferences.getInstance().then((value) { |
||||
if (value.getString("token") == null || |
||||
value.getString("token") == "") { |
||||
AppUtils.loginTips(context); |
||||
return; |
||||
} |
||||
Navigator.of(context).pushNamed('/router/manage_address_page'); |
||||
}); |
||||
}, |
||||
child: mineItem( |
||||
S.of(context).guanlidizhi, |
||||
"assets/image/icon_location_address.png", |
||||
), |
||||
), |
||||
InkWell( |
||||
onTap: () { |
||||
Navigator.of(context).pushNamed('/router/setting_page'); |
||||
}, |
||||
child: mineItem( |
||||
S.of(context).shezhi, |
||||
"assets/image/icon_mine_setting.png", |
||||
), |
||||
), |
||||
// mineItem( |
||||
// S.of(context).bangzhuyufankui, |
||||
// "assets/image/icon_mine_feedback.png", |
||||
// ), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
|
||||
///我的页面下面条目 |
||||
Widget mineItem(text, icon) { |
||||
return Container( |
||||
margin: EdgeInsets.only(top: 8.h, bottom: 8.h), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Image.asset( |
||||
icon, |
||||
width: 28.w, |
||||
height: 28.h, |
||||
), |
||||
SizedBox( |
||||
width: 12.w, |
||||
), |
||||
Expanded( |
||||
flex: 1, |
||||
child: Text( |
||||
text, |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.medium, |
||||
fontSize: 16.sp, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
), |
||||
Icon( |
||||
Icons.keyboard_arrow_right, |
||||
size: 20, |
||||
color: Colors.black, |
||||
) |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,184 @@
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/retrofit/data/user_info.dart'; |
||||
import 'package:huixiang/utils/flutter_utils.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:huixiang/view_widget/custom_image.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
||||
class MineView extends StatefulWidget { |
||||
final UserInfo userInfo; |
||||
final Function toUserInfo; |
||||
final Function toIntegralPage; |
||||
|
||||
MineView(this.userInfo, this.toUserInfo, this.toIntegralPage); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _MineView(); |
||||
} |
||||
} |
||||
|
||||
class _MineView extends State<MineView> { |
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Column( |
||||
children: [ |
||||
Container( |
||||
margin: EdgeInsets.only(right: 16.w), |
||||
alignment: Alignment.centerRight, |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.end, |
||||
children: [ |
||||
InkWell( |
||||
onTap: () {}, |
||||
child: Container( |
||||
margin: EdgeInsets.all(8.h), |
||||
child: Image.asset( |
||||
"assets/image/icon_scan_qr_code.png", |
||||
width: 24.w, |
||||
height: 24.h, |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
InkWell( |
||||
onTap: widget.toUserInfo, |
||||
child: mineView(), |
||||
), |
||||
SizedBox( |
||||
height: 22.h, |
||||
), |
||||
], |
||||
); |
||||
} |
||||
|
||||
///我的信息部分 |
||||
Widget mineView() { |
||||
return Container( |
||||
alignment: Alignment.center, |
||||
margin: EdgeInsets.symmetric(horizontal: 16.w), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
MImage( |
||||
widget.userInfo == null ? "" : widget.userInfo.headimg, |
||||
isCircle: true, |
||||
width: 50, |
||||
height: 50, |
||||
fit: BoxFit.cover, |
||||
errorSrc: "assets/image/default_user.png", |
||||
fadeSrc: "assets/image/default_user.png", |
||||
), |
||||
SizedBox( |
||||
width: 10.w, |
||||
), |
||||
Expanded( |
||||
flex: 1, |
||||
child: Container( |
||||
height: 50.h, |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
crossAxisAlignment: CrossAxisAlignment.stretch, |
||||
children: [ |
||||
widget.userInfo == null |
||||
? Text( |
||||
S.of(context).denglu, |
||||
style: TextStyle( |
||||
fontSize: 16.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Color(0xFF353535), |
||||
), |
||||
) |
||||
: Row( |
||||
children: [ |
||||
InkWell( |
||||
onTap: () { |
||||
if (widget.userInfo == null) { |
||||
AppUtils.loginTips(context); |
||||
} |
||||
}, |
||||
child: Text( |
||||
widget.userInfo == null |
||||
? S.of(context).denglu |
||||
: "${widget.userInfo.nickname}", |
||||
style: TextStyle( |
||||
fontSize: 16.sp, |
||||
fontWeight: FontWeight.bold, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
), |
||||
Image.asset( |
||||
"assets/image/icon_user.png", |
||||
width: 18.w, |
||||
height: 18.h, |
||||
), |
||||
], |
||||
), |
||||
widget.userInfo == null |
||||
? Text( |
||||
S.of(context).weidengluxinxi, |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF2F2F2F), |
||||
), |
||||
) |
||||
: Text( |
||||
widget.userInfo == null |
||||
? "" |
||||
: "NO.${widget.userInfo.vipNo}", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF2F2F2F), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
), |
||||
widget.userInfo == null |
||||
? Container( |
||||
alignment: Alignment.center, |
||||
height: 50.h, |
||||
child: Icon( |
||||
Icons.keyboard_arrow_right, |
||||
size: 20, |
||||
color: Colors.black, |
||||
), |
||||
) |
||||
: Container( |
||||
alignment: Alignment.bottomRight, |
||||
height: 50.h, |
||||
child: GestureDetector( |
||||
onTap: widget.toIntegralPage(), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.end, |
||||
children: [ |
||||
Text( |
||||
S.of(context).jifenxiangqing, |
||||
style: TextStyle( |
||||
color: Colors.black, |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
), |
||||
), |
||||
Icon( |
||||
Icons.keyboard_arrow_right, |
||||
size: 16, |
||||
color: Colors.black, |
||||
) |
||||
], |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,121 @@
|
||||
|
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/utils/flutter_utils.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:shared_preferences/shared_preferences.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
||||
class OrderCard extends StatefulWidget { |
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _OrderCard(); |
||||
} |
||||
} |
||||
|
||||
class _OrderCard extends State<OrderCard> { |
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Container( |
||||
margin: EdgeInsets.fromLTRB(16.w, 12.h, 16.w, 10.h), |
||||
padding: EdgeInsets.fromLTRB(20.w, 12.h, 20.w, 12.h), |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
borderRadius: BorderRadius.circular(8), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 3), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
), |
||||
child: Row( |
||||
children: [ |
||||
Expanded( |
||||
flex: 1, |
||||
child: GestureDetector( |
||||
onTap: () { |
||||
SharedPreferences.getInstance().then((value) { |
||||
if (value.getString("token") == null || |
||||
value.getString("token") == "") { |
||||
AppUtils.loginTips(context); |
||||
return; |
||||
} |
||||
Navigator.of(context).pushNamed('/router/mine_card'); |
||||
}); |
||||
}, |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/icon_mine_card.png", |
||||
width: 32.w, |
||||
height: 32.h, |
||||
), |
||||
SizedBox( |
||||
width: 12.w, |
||||
), |
||||
Text( |
||||
S.of(context).kaquan, |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.medium, |
||||
fontSize: 16.sp, |
||||
color: Color(0xFF353535), |
||||
), |
||||
) |
||||
], |
||||
), |
||||
), |
||||
), |
||||
Container( |
||||
width: 2.w, |
||||
height: 32.h, |
||||
margin: EdgeInsets.only(left: 20.w, right: 20.w), |
||||
color: Color(0xFFF7F7F7), |
||||
), |
||||
Expanded( |
||||
flex: 1, |
||||
child: GestureDetector( |
||||
onTap: () { |
||||
SharedPreferences.getInstance().then((value) { |
||||
if (value.getString("token") == null || |
||||
value.getString("token") == "") { |
||||
AppUtils.loginTips(context); |
||||
return; |
||||
} |
||||
Navigator.of(context).pushNamed('/router/order_history_page'); |
||||
}); |
||||
}, |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/icon_mine_order.png", |
||||
width: 32.w, |
||||
height: 32.h, |
||||
), |
||||
SizedBox( |
||||
width: 12.w, |
||||
), |
||||
Text( |
||||
S.of(context).dingdan, |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.medium, |
||||
fontSize: 16.sp, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue