Browse Source

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

tags/0.0.3+6
PH2 4 years ago
parent
commit
9ed6aab011
2 changed files with 50 additions and 26 deletions
  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 View File

@@ -140,6 +140,12 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer>
// hasCategory = true; // hasCategory = true;
// } // }


// 如果有左上角标题
double moduleTitleHeight = 22 + 10.0;
if (!EmptyUtil.isEmpty(model?.moduleTitleName)) {
totalHeight = totalHeight + moduleTitleHeight;
}

return Container( return Container(
margin: EdgeInsets.only(top: double.tryParse(model?.topMargin), margin: EdgeInsets.only(top: double.tryParse(model?.topMargin),
left: ParseUtil.stringParseDouble(model?.leftRightMargin), left: ParseUtil.stringParseDouble(model?.leftRightMargin),
@@ -161,34 +167,46 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer>
width: double.infinity, width: double.infinity,
// color: HexColor.fromHex(widget?.model['bg_color']), // color: HexColor.fromHex(widget?.model['bg_color']),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ 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 View File

@@ -29,6 +29,8 @@ class CustomQuickEntryModel {
String titleColor; String titleColor;
String subTitleColor; String subTitleColor;
String columSize; String columSize;
String moduleTitleName;
String moduleTitleColor;


CustomQuickEntryModel( CustomQuickEntryModel(
{this.name, {this.name,
@@ -58,6 +60,8 @@ class CustomQuickEntryModel {
this.subTitleColor, this.subTitleColor,
this.columSize, this.columSize,
this.isShowTitle, this.isShowTitle,
this.moduleTitleName,
this.moduleTitleColor,
}); });


CustomQuickEntryModel.fromJson(Map<String, dynamic> json) { CustomQuickEntryModel.fromJson(Map<String, dynamic> json) {
@@ -98,6 +102,8 @@ class CustomQuickEntryModel {
titleColor = json['title_color']; titleColor = json['title_color'];
subTitleColor = json['sub_title_color']; subTitleColor = json['sub_title_color'];
columSize = json['colum_size']?.toString(); columSize = json['colum_size']?.toString();
moduleTitleName = json['module_title_name']?.toString();
moduleTitleColor = json['module_title_color']?.toString();
} }


Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {


Loading…
Cancel
Save