From 7d4e6a970bcb751beea329431ed58f8f194c16c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyanghuaxuan=E2=80=9D?= <“646903573@qq.com”> Date: Wed, 30 Dec 2020 09:16:45 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E9=A6=96=E9=A1=B5=E5=85=AC?= =?UTF-8?q?=E5=91=8A=E6=A0=8F=E3=80=81=E8=BD=AE=E6=92=AD=E5=9B=BE=E3=80=81?= =?UTF-8?q?=E5=A4=9A=E7=9C=BC=E5=AF=BC=E8=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../custom/multi_nav/custom_quick_entry.dart | 61 ++++++++++--------- .../custom/notice/custom_notice_widget.dart | 7 ++- .../slide_banner/custom_slide_banner.dart | 4 +- .../model/custom_slide_banner_model.dart | 6 ++ 4 files changed, 46 insertions(+), 32 deletions(-) diff --git a/lib/widgets/custom/multi_nav/custom_quick_entry.dart b/lib/widgets/custom/multi_nav/custom_quick_entry.dart index 86df86b..29e2a2b 100644 --- a/lib/widgets/custom/multi_nav/custom_quick_entry.dart +++ b/lib/widgets/custom/multi_nav/custom_quick_entry.dart @@ -19,7 +19,9 @@ class CustomQuickEntry extends StatelessWidget { @override Widget build(BuildContext context) { return BlocProvider( - create: (_) => CustomQuickEntryBloc(repository: CustomQuickEntryRepository())..add(CustomQuickEntryInitEvent(model: model)), + create: (_) => + CustomQuickEntryBloc(repository: CustomQuickEntryRepository()) + ..add(CustomQuickEntryInitEvent(model: model)), child: _CustomQuickEntryContainer(model), ); } @@ -27,7 +29,9 @@ class CustomQuickEntry extends StatelessWidget { class _CustomQuickEntryContainer extends StatefulWidget { final Map model; + _CustomQuickEntryContainer(this.model); + @override __CustomQuickEntryContainerState createState() => __CustomQuickEntryContainerState(); } @@ -57,8 +61,7 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer> @override Widget build(BuildContext context) { return BlocConsumer( - listener: (context, state) { - }, + listener: (context, state) {}, buildWhen: (prev, current) { return true; }, @@ -69,14 +72,14 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer> if (state is CustomQuickEntryLoadedState) { return _getMainWidget(state.model); } - if(state is CustomQuickEntryErrorState){ + if (state is CustomQuickEntryErrorState) { return Container(); } return CustomQuickEntrySkeleton(); }, ); } - + Widget _getMainWidget(CustomQuickEntryModel model) { // 数据总数 int totalDataSize = model?.listStyle?.length ?? 0; @@ -128,16 +131,18 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer> // } return Container( - margin: EdgeInsets.only(top: ParseUtil.stringParseDouble(model?.topMargin)), + margin: EdgeInsets.only(top: double.tryParse(model?.topMargin), + left: ParseUtil.stringParseDouble(model?.leftRightMargin), + right: ParseUtil.stringParseDouble(model?.leftRightMargin)), decoration: BoxDecoration( - color: HexColor.fromHex(model?.bgColor ?? ''), - // color: Colors.green, - borderRadius: BorderRadius.only( - topRight: Radius.circular(ParseUtil.stringParseDouble(model?.topRightRadius)), - topLeft: Radius.circular(ParseUtil.stringParseDouble(model?.topLeftRadius)), - bottomLeft: Radius.circular(ParseUtil.stringParseDouble(model?.bottomLeftRadius)), - bottomRight: Radius.circular(ParseUtil.stringParseDouble(model?.bottomRightRadius)), - ) + color: HexColor.fromHex(model?.bgColor ?? ''), + //color: Colors.green, + borderRadius: BorderRadius.only( + topRight: Radius.circular(ParseUtil.stringParseDouble(model?.topRightRadius)), + topLeft: Radius.circular(ParseUtil.stringParseDouble(model?.topLeftRadius)), + bottomLeft: Radius.circular(ParseUtil.stringParseDouble(model?.bottomLeftRadius)), + bottomRight: Radius.circular(ParseUtil.stringParseDouble(model?.bottomRightRadius)), + ) ), child: Container( margin: EdgeInsets.only(top: !hasCategory ? 15 : 0, bottom: totalPage > 1 ? 15 : 0), @@ -150,7 +155,7 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer> Container( width: double.infinity, - height: hasCategory ? totalHeight - categoryHeight - categoryBottomMargin : totalHeight , + height: hasCategory ? totalHeight - categoryHeight - categoryBottomMargin : totalHeight, child: Swiper( controller: _controller, itemCount: totalPage, @@ -274,17 +279,16 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer> } /// 行的数据 - Widget _getRowWidget( - {double titleHeight, - double iconHeight, - int totalPage, - int currentPage, - int columSize, - int totalRowSize, - int totalDataSize, - CustomQuickEntryModel model, - int currentRow, - double itemHeight}) { + Widget _getRowWidget({double titleHeight, + double iconHeight, + int totalPage, + int currentPage, + int columSize, + int totalRowSize, + int totalDataSize, + CustomQuickEntryModel model, + int currentRow, + double itemHeight}) { List itemList = []; for (int i = 0; i < columSize; i++) { itemList.add(i); @@ -353,6 +357,7 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer> // color: Colors.red, child: Column( children: [ + /// 图标 MyNetWorkImage(item.img), @@ -404,7 +409,8 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer> SwiperPagination _swiperPaginationDot(CustomQuickEntryModel model) { return SwiperPagination( margin: const EdgeInsets.only(), - builder: DotSwiperPaginationBuilder(color: HexColor.fromHex(model?.paginationUnselectColor), activeColor: HexColor.fromHex(model?.paginationSelectColor), size: 8, activeSize: 8)); + builder: DotSwiperPaginationBuilder( + color: HexColor.fromHex(model?.paginationUnselectColor), activeColor: HexColor.fromHex(model?.paginationSelectColor), size: 8, activeSize: 8)); } // 自定义进度条 条形 @@ -465,7 +471,6 @@ class MyNetWorkImage extends StatelessWidget { } - // Widget _getMainWidget(CustomQuickEntryModel model) { // // 数据总数 // int totalDataSize = model?.listStyle?.length ?? 0; diff --git a/lib/widgets/custom/notice/custom_notice_widget.dart b/lib/widgets/custom/notice/custom_notice_widget.dart index 8bd2e13..7f8c8c8 100644 --- a/lib/widgets/custom/notice/custom_notice_widget.dart +++ b/lib/widgets/custom/notice/custom_notice_widget.dart @@ -68,14 +68,17 @@ class _CustomNoticeWidgetContainerState extends State<_CustomNoticeWidgetContain width: double.infinity, decoration: BoxDecoration( color: HexColor.fromHex(model?.bgColor), - // color: Colors.orangeAccent, + //color: Colors.orangeAccent, borderRadius: BorderRadius.only( topRight: Radius.circular(ParseUtil.stringParseDouble(model?.topRightRadius, defVal: 7.5)), topLeft: Radius.circular(ParseUtil.stringParseDouble(model?.topLeftRadius, defVal: 7.5)), bottomLeft: Radius.circular(ParseUtil.stringParseDouble(model?.bottomLeftRadius, defVal: 7.5)), bottomRight: Radius.circular(ParseUtil.stringParseDouble(model?.bottomRightRadius, defVal: 7.5)), )), - margin: EdgeInsets.only(top: ParseUtil.stringParseDouble(model?.topMargin)), + margin: EdgeInsets.only( + top: ParseUtil.stringParseDouble(model?.topMargin), + left: ParseUtil.stringParseDouble(model?.leftRightMargin), + right: ParseUtil.stringParseDouble(model?.leftRightMargin)), padding: EdgeInsets.symmetric(horizontal: ParseUtil.stringParseDouble(model?.leftRightMargin, defVal: 12.5), vertical: 7.5), child: Container( decoration: BoxDecoration(borderRadius: BorderRadius.circular(7.5), color: HexColor.fromHex('#F6F6F6')), diff --git a/lib/widgets/custom/slide_banner/custom_slide_banner.dart b/lib/widgets/custom/slide_banner/custom_slide_banner.dart index 974926d..bdc040c 100644 --- a/lib/widgets/custom/slide_banner/custom_slide_banner.dart +++ b/lib/widgets/custom/slide_banner/custom_slide_banner.dart @@ -123,7 +123,7 @@ class _CustomSlideBannerContainerState extends State child: Container( width: double.infinity, height: double.infinity, - color: size > 1 ? HexColor.fromHex('#FFFF4242') : Colors.transparent, + color: size > 1 ? HexColor.fromHex(datas?.bgColor2??"#FFFF4242") : Colors.transparent, // color: Colors.yellow, ), ), @@ -132,7 +132,7 @@ class _CustomSlideBannerContainerState extends State child: Container( height: double.infinity, width: double.infinity, - color: size > 1 ? Colors.white : Colors.transparent, + color: size > 1 ? HexColor.fromHex(datas?.bgColor??"#FFFFFF") : Colors.transparent, // color: Colors.yellow, ), ) diff --git a/lib/widgets/custom/slide_banner/model/custom_slide_banner_model.dart b/lib/widgets/custom/slide_banner/model/custom_slide_banner_model.dart index c45b192..d356152 100644 --- a/lib/widgets/custom/slide_banner/model/custom_slide_banner_model.dart +++ b/lib/widgets/custom/slide_banner/model/custom_slide_banner_model.dart @@ -17,6 +17,8 @@ class CustomSlideBannerModel { String carouselTime; String topMargin; String leftRightMargin; + String bgColor; + String bgColor2; List indexCarouselList; int moduleKeyId; @@ -39,6 +41,8 @@ class CustomSlideBannerModel { this.leftRightMargin, this.indexCarouselList, this.moduleKeyId, + this.bgColor, + this.bgColor2 }); CustomSlideBannerModel.fromJson(Map json) { @@ -58,6 +62,8 @@ class CustomSlideBannerModel { carouselTime = json['carousel_time']; topMargin = json['top_margin']; leftRightMargin = json['left_right_margin']; + bgColor=json['bg_color']; + bgColor2=json['bg_color2']; if (json['index_carousel_list'] != null) { indexCarouselList = new List(); json['index_carousel_list'].forEach((v) {