Pārlūkot izejas kodu

1.优化首页公告栏、轮播图、多眼导航

tags/0.0.3+2
“yanghuaxuan” pirms 3 gadiem
vecāks
revīzija
7d4e6a970b
4 mainītis faili ar 46 papildinājumiem un 32 dzēšanām
  1. +33
    -28
      lib/widgets/custom/multi_nav/custom_quick_entry.dart
  2. +5
    -2
      lib/widgets/custom/notice/custom_notice_widget.dart
  3. +2
    -2
      lib/widgets/custom/slide_banner/custom_slide_banner.dart
  4. +6
    -0
      lib/widgets/custom/slide_banner/model/custom_slide_banner_model.dart

+ 33
- 28
lib/widgets/custom/multi_nav/custom_quick_entry.dart Parādīt failu

@@ -19,7 +19,9 @@ class CustomQuickEntry extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BlocProvider<CustomQuickEntryBloc>(
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<String, dynamic> model;

_CustomQuickEntryContainer(this.model);

@override
__CustomQuickEntryContainerState createState() => __CustomQuickEntryContainerState();
}
@@ -57,8 +61,7 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer>
@override
Widget build(BuildContext context) {
return BlocConsumer<CustomQuickEntryBloc, CustomQuickEntryState>(
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: <Widget>[

/// 图标
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;


+ 5
- 2
lib/widgets/custom/notice/custom_notice_widget.dart Parādīt failu

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


+ 2
- 2
lib/widgets/custom/slide_banner/custom_slide_banner.dart Parādīt failu

@@ -123,7 +123,7 @@ class _CustomSlideBannerContainerState extends State<CustomSlideBannerContainer>
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<CustomSlideBannerContainer>
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,
),
)


+ 6
- 0
lib/widgets/custom/slide_banner/model/custom_slide_banner_model.dart Parādīt failu

@@ -17,6 +17,8 @@ class CustomSlideBannerModel {
String carouselTime;
String topMargin;
String leftRightMargin;
String bgColor;
String bgColor2;
List<IndexCarouselList> indexCarouselList;
int moduleKeyId;

@@ -39,6 +41,8 @@ class CustomSlideBannerModel {
this.leftRightMargin,
this.indexCarouselList,
this.moduleKeyId,
this.bgColor,
this.bgColor2
});

CustomSlideBannerModel.fromJson(Map<String, dynamic> 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<IndexCarouselList>();
json['index_carousel_list'].forEach((v) {


Notiek ielāde…
Atcelt
Saglabāt