Sfoglia il codice sorgente

1、多眼导航添加支持左上角标题

tags/0.0.3+6
PH2 4 anni fa
parent
commit
9ed6aab011
2 ha cambiato i file con 50 aggiunte e 26 eliminazioni
  1. +44
    -26
      lib/widgets/custom/multi_nav/custom_quick_entry.dart
  2. +6
    -0
      lib/widgets/custom/multi_nav/model/custom_quick_entry_model.dart

+ 44
- 26
lib/widgets/custom/multi_nav/custom_quick_entry.dart Vedi File

@@ -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: <Widget>[

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),
),
),
)



+ 6
- 0
lib/widgets/custom/multi_nav/model/custom_quick_entry_model.dart Vedi File

@@ -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<String, dynamic> 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<String, dynamic> toJson() {


Caricamento…
Annulla
Salva