diff --git a/assets/icons/shop_close.png b/assets/icons/shop_close.png new file mode 100644 index 00000000..e7dd1d20 Binary files /dev/null and b/assets/icons/shop_close.png differ diff --git a/assets/icons/shop_favorfill.png b/assets/icons/shop_favorfill.png new file mode 100644 index 00000000..5d59d70d Binary files /dev/null and b/assets/icons/shop_favorfill.png differ diff --git a/assets/icons/shop_torb.png b/assets/icons/shop_torb.png new file mode 100644 index 00000000..e6130e2d Binary files /dev/null and b/assets/icons/shop_torb.png differ diff --git a/assets/icons/test_kingcion.png b/assets/icons/test_kingcion.png new file mode 100644 index 00000000..b9848e19 Binary files /dev/null and b/assets/icons/test_kingcion.png differ diff --git a/lib/const/resource.dart b/lib/const/resource.dart index b6c27f91..c2a7f316 100644 --- a/lib/const/resource.dart +++ b/lib/const/resource.dart @@ -340,6 +340,14 @@ class R { /// ![preview](file:///Users/datang/aku_community/assets/icons/shop_car.png) static const String ASSETS_ICONS_SHOP_CAR_PNG = 'assets/icons/shop_car.png'; + /// ![preview](file:///Users/datang/aku_community/assets/icons/shop_close.png) + static const String ASSETS_ICONS_SHOP_CLOSE_PNG = + 'assets/icons/shop_close.png'; + + /// ![preview](file:///Users/datang/aku_community/assets/icons/shop_favorfill.png) + static const String ASSETS_ICONS_SHOP_FAVORFILL_PNG = + 'assets/icons/shop_favorfill.png'; + /// ![preview](file:///Users/datang/aku_community/assets/icons/shop_laba.png) static const String ASSETS_ICONS_SHOP_LABA_PNG = 'assets/icons/shop_laba.png'; @@ -359,6 +367,9 @@ class R { static const String ASSETS_ICONS_SHOP_SEARCH_PNG = 'assets/icons/shop_search.png'; + /// ![preview](file:///Users/datang/aku_community/assets/icons/shop_torb.png) + static const String ASSETS_ICONS_SHOP_TORB_PNG = 'assets/icons/shop_torb.png'; + /// ![preview](file:///Users/datang/aku_community/assets/icons/system_notice.png) static const String ASSETS_ICONS_SYSTEM_NOTICE_PNG = 'assets/icons/system_notice.png'; @@ -403,6 +414,10 @@ class R { static const String ASSETS_ICONS_TABBAR_USER_NO_PNG = 'assets/icons/tabbar_user_no.png'; + /// ![preview](file:///Users/datang/aku_community/assets/icons/test_kingcion.png) + static const String ASSETS_ICONS_TEST_KINGCION_PNG = + 'assets/icons/test_kingcion.png'; + /// ![preview](file:///Users/datang/aku_community/assets/icons/tool_bmdh.png) static const String ASSETS_ICONS_TOOL_BMDH_PNG = 'assets/icons/tool_bmdh.png'; diff --git a/lib/pages/splash/splash_page.dart b/lib/pages/splash/splash_page.dart index 75fae8ff..16ab75fd 100644 --- a/lib/pages/splash/splash_page.dart +++ b/lib/pages/splash/splash_page.dart @@ -148,53 +148,48 @@ class _SplashPageState extends State { children: [ Align( alignment: Alignment.topCenter, - child:Row( + child: + Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Container( + child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ - 380.hb, + Text('追\n求',style: TextStyle(color:Color(0xFF000000),fontSize: 40.sp,height: 1.15),), ], ), - height: 400, + margin: EdgeInsets.only(top: 450.w), + ), 25.wb, Container( child: - Row( - children: [ Column( - mainAxisAlignment: MainAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.start, children: [ + Text('更\n便\n捷\n的\n生\n活\n方\n程\n式',style: TextStyle(color:Color(0xFF000000),fontSize: 40.sp,height: 1.15),), - 40.hb, + ], ), - 20.wb, - Column( - children: [ - 580.hb, - Container( - height: 400.w, - width: 2.w, - decoration: BoxDecoration( - gradient: LinearGradient( - colors: [Color(0x99000000), Color(0x00000000)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter), - borderRadius: BorderRadius.circular(2.w), - ), - ), - ], - ) - ], - ), - height: 472, + margin: EdgeInsets.only(top: 530.w), ), + 25.wb, + Container( + height: 400.w, + width: 2.w, + decoration: BoxDecoration( + gradient: LinearGradient( + colors: [Color(0x99000000), Color(0x00000000)], + begin: Alignment.topCenter, + end: Alignment.bottomCenter), + borderRadius: BorderRadius.circular(2.w), + ), + ), ], diff --git a/lib/ui/market/goods/goods_card.dart b/lib/ui/market/goods/goods_card.dart index 11ff3679..8e8c1227 100644 --- a/lib/ui/market/goods/goods_card.dart +++ b/lib/ui/market/goods/goods_card.dart @@ -33,8 +33,11 @@ class GoodsCard extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - AspectRatio( - aspectRatio: 1, + Container( + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(12.w)), + ), child: Stack( children: [ FadeInImage.assetNetwork( @@ -70,17 +73,28 @@ class GoodsCard extends StatelessWidget { Padding( padding: EdgeInsets.symmetric( horizontal: 12.w, - vertical: 20.w, + vertical: 10.w, + ), + child: Container( + + ) + ), + Padding( + padding: EdgeInsets.symmetric( + horizontal: 12.w, + vertical: 10.w, ), child: Text( item.title, maxLines: 2, overflow: TextOverflow.ellipsis, style: TextStyle( - fontSize: 24.sp, + fontSize: 28.sp, + color: ktextPrimary ), ), ), + Padding( padding: EdgeInsets.symmetric( horizontal: 12.w, @@ -112,4 +126,7 @@ class GoodsCard extends StatelessWidget { ), ); } + + + } diff --git a/lib/ui/market/market_page.dart b/lib/ui/market/market_page.dart index 6df0829b..8382413f 100644 --- a/lib/ui/market/market_page.dart +++ b/lib/ui/market/market_page.dart @@ -1,16 +1,22 @@ // import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/base/base_style.dart'; +import 'package:aku_community/model/common/img_model.dart'; +import 'package:aku_community/model/community/swiper_model.dart'; import 'package:aku_community/provider/app_provider.dart'; +import 'package:aku_community/ui/community/community_func.dart'; +import 'package:aku_community/ui/home/public_infomation/public_information_detail_page.dart'; import 'package:aku_community/ui/market/widget/animated_home_background.dart'; import 'package:aku_community/ui/search/bee_search.dart'; import 'package:aku_community/widget/home/home_sliver_app_bar.dart'; +import 'package:aku_community/widget/others/rectIndicator.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:bot_toast/bot_toast.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter_swiper_null_safety/flutter_swiper_null_safety.dart'; import 'package:get/get.dart'; import 'package:waterfall_flow/waterfall_flow.dart'; @@ -53,13 +59,16 @@ class _MarketPageState extends State int _pageNum = 1; int _size = 4; int _pageCount = 0; - double MessageHeight = 0; - double bannerHeight = 0; - double buttonsHeight = 200.w; + double MessageHeight = 76.w; + double bannerHeight = 354.w; + double buttonsHeight = 334.w; + double searchHeight = 74.w.w; double tabBarHeight = 60.w; late TabController _tabController; + List _swiperModels = []; + Future updateMarketInfo() async { BaseListModel baseListModel = await NetUtil().getList(API.market.hotTop, params: { @@ -115,64 +124,7 @@ class _MarketPageState extends State super.build(context); final mediaWidth = MediaQuery.of(context).size.width; - MessageHeight = 76; - return Scaffold( - // leading: IconButton( - // icon: Icon(CupertinoIcons.search), - // onPressed: () { - // Get.to(() => SearchGoodsPage()); - // }, - // ), - // title: '商城', - // actions: [ - // MaterialButton( - // minWidth: 108.w, - // padding: EdgeInsets.zero, - // onPressed: () async { - // // Get.to(() => SecondHandPage()); - // Get.to(() => MyOrderPage()); - // }, - // child: Column( - // mainAxisAlignment: MainAxisAlignment.center, - // mainAxisSize: MainAxisSize.max, - // children: [ - // Image.asset( - // R.ASSETS_ICONS_SECOND_HAND_PNG, - // width: 48.w, - // height: 48.w, - // ), - // 4.hb, - // // '二手'.text.size(20.sp).black.make(), - // '订单'.text.size(20.sp).black.make(), - // ], - // ), - // ), - // MaterialButton( - // minWidth: 108.w, - // padding: EdgeInsets.zero, - // onPressed: () async { - // final cancel = BotToast.showLoading(); - // List models = - // await DisplayCategoryModel.fetchCategory(0); - // cancel(); - // Get.to(() => CategoryPage(models: models)); - // }, - // child: Column( - // mainAxisAlignment: MainAxisAlignment.center, - // mainAxisSize: MainAxisSize.max, - // children: [ - // Image.asset( - // R.ASSETS_ICONS_CATEGORY_PNG, - // width: 48.w, - // height: 48.w, - // ), - // 4.hb, - // '分类'.text.size(20.sp).black.make(), - // ], - // ), - // ), - // ], body:EasyRefresh( firstRefresh: true, enableControlFinishLoad: false, @@ -182,6 +134,7 @@ class _MarketPageState extends State onRefresh: () async { _pageNum = 1; await updateMarketInfo(); + _swiperModels = await CommunityFunc.swiper(); setState(() {}); }, onLoad: () async { @@ -209,83 +162,32 @@ class _MarketPageState extends State key: _sliverAppBarGlobalKey, actions: _actionsWidget(), title: _buildTitle(), - backgroundColor: Colors.white, - expandedHeight: - bannerHeight + - buttonsHeight+600.w, + backgroundColor: Colors.red, + expandedHeight: MessageHeight+ + bannerHeight + + buttonsHeight+ + searchHeight +tabBarHeight+ScreenUtil().statusBarHeight +kToolbarHeight+280.w, flexibleSpace: _flexibleSpaceBar(context), bottom: PreferredSize( preferredSize: Size.fromHeight(tabBarHeight), child: _goodsTitle() - - // Container( - // color: Colors.green, - // height: tabBarHeight, - // width: 200.w, - // // alignment: Alignment.center, - // // color: AppColor.frenchColor, - // // child: HomePageTabbar( - // // promotionList: _promotionList, - // // timerJump: (index) { - // // _tabIndex = index; - // // _homeCountdownController.indexChange(index); - // // // 定时任务回调 - // // _tabController.animateTo(index); - // // _getPromotionGoodsList(_promotionList[index].id); - // // }, - // // clickItem: (index) { - // // _homeCountdownController.indexChange(index); - // // _getPromotionGoodsList(_promotionList[index].id); - // // }, - // // tabController: _tabController, - // // ), - // ), )), SliverPadding( padding: EdgeInsets.all(10.w), ), - buildSliverGrid(), - - // EasyRefresh( - // firstRefresh: false, - // enableControlFinishLoad: false, - // header: MaterialHeader(), - // footer: MaterialFooter(), - // controller: _refreshController, - // onRefresh: () async { - // _pageNum = 1; - // await updateMarketInfo(); - // setState(() {}); - // }, - // onLoad: () async { - // _pageNum++; - // await loadMarketInfo(); - // if (_pageCount <= _pageNum) { - // _refreshController.finishLoad(noMore: false); - // } - // setState(() {}); - // }, - // child: WaterfallFlow.builder( - // gridDelegate: SliverWaterfallFlowDelegateWithFixedCrossAxisCount( - // crossAxisCount: 2, - // mainAxisSpacing: 20.w, - // crossAxisSpacing: 20.w, - // ), - // padding: EdgeInsets.all(32.w), - // itemBuilder: (context, index) { - // final item = _hotItems[index]; - // return GoodsCard(item: item); - // }, - // itemCount: _hotItems.length, - // ), - // ), + SliverPadding( + padding: EdgeInsets.only(left: 20.w,right: 20.w), + sliver: buildSliverGrid(), + ), + ], ); } SliverGrid buildSliverGrid() { return SliverGrid( + // child: WaterfallFlow.builder( // gridDelegate: SliverWaterfallFlowDelegateWithFixedCrossAxisCount( // crossAxisCount: 2, @@ -303,20 +205,23 @@ class _MarketPageState extends State crossAxisCount: 2, mainAxisSpacing: 20.w, crossAxisSpacing: 20.w, + childAspectRatio:0.57, ), + ///子Item构建器 delegate: new SliverChildBuilderDelegate( (BuildContext context, int index) { + ///每一个子Item的样式 - //return GoodsCard(item: _hotItems[index]); - return Container( - width: 200.w, - height: 200.w, - color: Colors.blue, - ); + return GoodsCard(item: _hotItems[index]); + // return Container( + // width: 200.w, + // height: 200.w, + // color: Colors.blue, + // ); }, ///子Item的个数 - childCount: 20,//_hotItems.length, + childCount: _hotItems.length, ), ); } @@ -345,29 +250,6 @@ class _MarketPageState extends State Widget _buildTitle() { final appProvider = Provider.of(context); - double iconSize = 18.w; - // MaterialButton ges = MaterialButton( - // materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - // height: 74.w, - // shape: StadiumBorder(), - // elevation: 0, - // minWidth: double.infinity, - // color: Colors.white, - // onPressed: () { - // Get.to(() => BeeSearch()); - // }, - // child: Row( - // children: [ - // Icon( - // Icons.search, - // size: 32.w, - // color: Color(0xFF666666), - // ), - // 10.wb, - // '请输入关键字'.text.size(28.sp).color(ktextSubColor).make().expand(), - // ], - // ), - // ); return Container( height: kToolbarHeight, @@ -442,31 +324,13 @@ class _MarketPageState extends State ), geSearch(), 20.hb, - getNum() - // Container( - // color: Colors.blue, - // width: 300, - // height: 300, - // ), - - - // HomeWeatherWidget( - // backgroundColor: Colors.white.withAlpha(0), - // homeWeatherModel: _homeWeatherModel, - // ), - // _bannerView(), - // _buildGoodsCards(), - // kingCoinListModelList != null - // ? _buttonTitle(context) - // : SizedBox(), - // _activityImageTitle(), - // _activityImageRow(), - // _activityT4Image(), - // HomeCountdownWidget( - // height: timeHeight, - // controller: _homeCountdownController, - // promotionList: _promotionList, - // ), + getNum(), + 20.hb, + HomeSwiper(), + 20.hb, + _buttonTitle(), + 20.hb, + _recommend(), ], ), @@ -480,7 +344,6 @@ class _MarketPageState extends State return Container( margin: EdgeInsets.symmetric(horizontal: 24.w), child: MaterialButton( - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, height: 74.w, shape: StadiumBorder(), @@ -538,18 +401,21 @@ class _MarketPageState extends State ), child: Container( - + height: 50.w, width: 682.w, decoration: BoxDecoration( //color: Color(0x99F5AF16), borderRadius: BorderRadius.horizontal(right: Radius.circular(12),left:Radius.circular(12)), - border: Border.all(width: 1.w,color: Color(0x99F5AF16)), + border: Border.all(width: 2.w,color: Color(0x99F5AF16)), ), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - + 80.wb, + Image.asset(R.ASSETS_ICONS_SHOP_LABA_PNG,width: 36.w,height: 34.w,), + 20.wb, + Text('今日上新1231件',style: TextStyle(color: Color(0xFFD0564B),fontSize: 24.sp,height: 1.05),), ], ), ), @@ -587,8 +453,294 @@ class _MarketPageState extends State ); } + Widget HomeSwiper() { + return Container( + padding: EdgeInsets.symmetric(horizontal: 20.w), + width: double.infinity, + height: bannerHeight, + child: AspectRatio( + aspectRatio: 355 / 177, + child: Swiper( + key: UniqueKey(), + itemBuilder: (BuildContext context, int index) { + return getSwiperImage(_swiperModels[index]); + }, + + pagination: SwiperPagination( + alignment: Alignment.bottomRight, + builder: SwiperCustomPagination( + builder: (BuildContext context, SwiperPluginConfig config) { + return RectIndicator( + position: config.activeIndex, + count: _swiperModels.length, + activeColor: Color(0x99FFFFFF), + color: Color(0xD9FFFFFF), + //未选中 指示器颜色,选中的颜色key为Color + width: 4, + //指示器宽度 + activeWidth: 14, + //选中的指示器宽度 + radius: 4, + //指示器圆角角度 + height: 4, + ); //指示器高度 + })), + scrollDirection: Axis.horizontal, + // control: new SwiperControl(), + autoplay: true, + onTap: (index) { + Get.to(() => + PublicInformationDetailPage(id: _swiperModels[index].newsId!)); + }, + itemCount: _swiperModels.length, + ), + ), + ); + } + + Widget getSwiperImage(SwiperModel swiperModel) { + return Container( + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(12.w)), + ), + child: + FadeInImage.assetNetwork( + placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, + image: API.image(ImgModel.first(swiperModel.voResourcesImgList)), + fit: BoxFit.fill, + + imageErrorBuilder: (context, error, stackTrace) { + return Image.asset( + R.ASSETS_IMAGES_PLACEHOLDER_WEBP, + fit: BoxFit.fill, + ); + }, + ), + ); + } + + + _buttonTitle() { + Container titles = Container( + alignment: Alignment.center, + + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12.w), + ), + child: + + Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + _buttonTitleRow( + + ), + _buttonTitleRow( + + ), + _buttonTitleRow( + + ), + _buttonTitleRow( + + ), + _buttonTitleRow( + + ), + + + + ], + ), + ), + ], + ), + 28.hb, + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + _buttonTitleRow( + ), + _buttonTitleRow( + ), + _buttonTitleRow( + + ), + _buttonTitleRow( + + ), + _buttonTitleRow( + + ), + + + + ], + ), + ), + ], + ), + ], + ), + ); + return Container( + alignment: Alignment.center, + padding: EdgeInsets.symmetric(horizontal: 20.w), + height: buttonsHeight, + width: MediaQuery.of(context).size.width, + child: titles, + ); + } + + Widget getkingCoin() { + return Container( + alignment: Alignment.center, + padding: EdgeInsets.symmetric(horizontal: 20.w,vertical: 20.w), + width: double.infinity, + height: buttonsHeight, + child:_buttonTitleRow(), + ); + } + + + _buttonTitleRow({onPressed}) { + return Expanded( + child: CupertinoButton( + padding: EdgeInsets.zero, + child: Column( + children: [ + Container( + width: 88.w, + height: 88.w, + child: Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP,width: 88.w,height: 88.w,), + // FadeInImage.assetNetwork( + // placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, + // image: Api.getImgUrl(kingCoin.url),) + ), + Container( + margin: EdgeInsets.only(top: 6.w), + child: Text( + '数码产品', + style: TextStyle( + + fontSize: 28.sp, + color: Color(0xFF333333)), + ), + ) + ], + ), + onPressed: () { + if (onPressed != null) { + onPressed(); + } + }, + ), + ); + } + + + _recommend(){ + return Container( + height: 184.w, + margin: EdgeInsets.only(left: 20.w,right: 20.w), + padding: EdgeInsets.only(top: 8.w,left: 16.w,right: 16.w), + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12.w), + ), + child: + Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + '爆款推荐', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 28.sp, + color: ktextPrimary), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + width: 96.w, + height: 96.w, + child: Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP,width: 96.w,height: 96.w,), + // FadeInImage.assetNetwork( + // placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, + // image: Api.getImgUrl(kingCoin.url),) + ), + 20.wb, + Container( + width: 96.w, + height: 96.w, + child: Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP,width: 96.w,height: 96.w,), + // FadeInImage.assetNetwork( + // placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, + // image: Api.getImgUrl(kingCoin.url),) + ), + 20.wb, + Container( + width: 96.w, + height: 96.w, + child: Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP,width: 96.w,height: 96.w,), + // FadeInImage.assetNetwork( + // placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, + // image: Api.getImgUrl(kingCoin.url),) + ), + 20.wb, + Container( + width: 96.w, + height: 96.w, + child: Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP,width: 96.w,height: 96.w,), + // FadeInImage.assetNetwork( + // placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, + // image: Api.getImgUrl(kingCoin.url),) + ), + 20.wb, + Container( + width: 96.w, + height: 96.w, + child: Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP,width: 96.w,height: 96.w,), + // FadeInImage.assetNetwork( + // placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, + // image: Api.getImgUrl(kingCoin.url),) + ), + 20.wb, + Container( + width: 96.w, + height: 96.w, + child: Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP,width: 96.w,height: 96.w,), + // FadeInImage.assetNetwork( + // placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, + // image: Api.getImgUrl(kingCoin.url),) + ), + ], + ).expand(), + ], + ) + ); + } diff --git a/lib/widget/home/home_sliver_app_bar.dart b/lib/widget/home/home_sliver_app_bar.dart index 747bbe8e..db89be7b 100644 --- a/lib/widget/home/home_sliver_app_bar.dart +++ b/lib/widget/home/home_sliver_app_bar.dart @@ -22,7 +22,7 @@ class HomeSliverAppBar extends StatefulWidget { } class HomeSliverAppBarState extends State { - Color _displayColor = Colors.blue; + Color _displayColor = Colors.red; updateColor(Color color) { setState(() {