|
|
@@ -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; |
|
|
|