From 9ed6aab011167d03869e48c1fc8bae763efe09ff Mon Sep 17 00:00:00 2001 From: PH2 <1293456824@qq.com> Date: Tue, 12 Jan 2021 14:57:39 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=A4=9A=E7=9C=BC=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=94=AF=E6=8C=81=E5=B7=A6=E4=B8=8A=E8=A7=92?= =?UTF-8?q?=E6=A0=87=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../custom/multi_nav/custom_quick_entry.dart | 70 ++++++++++++------- .../model/custom_quick_entry_model.dart | 6 ++ 2 files changed, 50 insertions(+), 26 deletions(-) diff --git a/lib/widgets/custom/multi_nav/custom_quick_entry.dart b/lib/widgets/custom/multi_nav/custom_quick_entry.dart index 88e3c7f..c5190a5 100644 --- a/lib/widgets/custom/multi_nav/custom_quick_entry.dart +++ b/lib/widgets/custom/multi_nav/custom_quick_entry.dart @@ -140,6 +140,12 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer> // hasCategory = true; // } + // 如果有左上角标题 + double moduleTitleHeight = 22 + 10.0; + if (!EmptyUtil.isEmpty(model?.moduleTitleName)) { + totalHeight = totalHeight + moduleTitleHeight; + } + return Container( margin: EdgeInsets.only(top: double.tryParse(model?.topMargin), left: ParseUtil.stringParseDouble(model?.leftRightMargin), @@ -161,34 +167,46 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer> width: double.infinity, // color: HexColor.fromHex(widget?.model['bg_color']), child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - width: double.infinity, - height: hasCategory ? totalHeight - categoryHeight - categoryBottomMargin : totalHeight, - child: Swiper( - controller: _controller, - itemCount: totalPage, - loop: false, - itemBuilder: (context, index) { - return Container( - height: double.infinity, - width: double.infinity, - padding: const EdgeInsets.symmetric(horizontal: 4), - child: _getPageWidget( - iconHeight: iconHeight, - titleHeight: titleHeight, - totalDataSize: totalDataSize, - totalPage: totalPage, - currentPage: index, - totalRowSize: totalRowSize, - columSize: columSize, - model: model, - itemHeight: itemHeight, - ), - ); - }, - pagination: totalPage <= 1 ? null : _getSwiperPaginationContorl(model, totalPage), + // 左上角标题 + Visibility( + visible: !EmptyUtil.isEmpty(model?.moduleTitleName), + child: Padding( + padding: const EdgeInsets.only(left: 12.5, bottom: 10), + child: Text(model?.moduleTitleName ?? '', style: TextStyle(color: HexColor.fromHex(model?.moduleTitleColor), fontWeight: FontWeight.bold, fontSize: 15))), + ), + + // icon + Expanded( + child: Container( + width: double.infinity, + height: hasCategory ? totalHeight - categoryHeight - categoryBottomMargin : totalHeight, + child: Swiper( + controller: _controller, + itemCount: totalPage, + loop: false, + itemBuilder: (context, index) { + return Container( + height: double.infinity, + width: double.infinity, + padding: const EdgeInsets.symmetric(horizontal: 4), + child: _getPageWidget( + iconHeight: iconHeight, + titleHeight: titleHeight, + totalDataSize: totalDataSize, + totalPage: totalPage, + currentPage: index, + totalRowSize: totalRowSize, + columSize: columSize, + model: model, + itemHeight: itemHeight, + ), + ); + }, + pagination: totalPage <= 1 ? null : _getSwiperPaginationContorl(model, totalPage), + ), ), ) diff --git a/lib/widgets/custom/multi_nav/model/custom_quick_entry_model.dart b/lib/widgets/custom/multi_nav/model/custom_quick_entry_model.dart index 802f8bc..0045882 100644 --- a/lib/widgets/custom/multi_nav/model/custom_quick_entry_model.dart +++ b/lib/widgets/custom/multi_nav/model/custom_quick_entry_model.dart @@ -29,6 +29,8 @@ class CustomQuickEntryModel { String titleColor; String subTitleColor; String columSize; + String moduleTitleName; + String moduleTitleColor; CustomQuickEntryModel( {this.name, @@ -58,6 +60,8 @@ class CustomQuickEntryModel { this.subTitleColor, this.columSize, this.isShowTitle, + this.moduleTitleName, + this.moduleTitleColor, }); CustomQuickEntryModel.fromJson(Map json) { @@ -98,6 +102,8 @@ class CustomQuickEntryModel { titleColor = json['title_color']; subTitleColor = json['sub_title_color']; columSize = json['colum_size']?.toString(); + moduleTitleName = json['module_title_name']?.toString(); + moduleTitleColor = json['module_title_color']?.toString(); } Map toJson() {