import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:zhiying_comm/util/log/let_log.dart'; import 'package:zhiying_comm/zhiying_comm.dart'; import 'bottom_pic_style.dart'; class BottomPic extends StatelessWidget { final Map model; BottomPic({Key key, this.model}) : super(key: key); @override BottomPicStyle style; Widget build(BuildContext context) { style = BottomPicStyle.fromJson(json.decode(model['data'])); Logger.log(model['data']); if (style == null) { return Container(); } return GestureDetector( onTap: () { RouterUtil.route(SkipModel.fromJson(style.toJson()), style.toJson(), context); }, child: Container( margin: EdgeInsets.only( left: double.tryParse(style?.leftRightMargin ?? "0"), right: double.tryParse(style?.leftRightMargin ?? "0"), top: double.tryParse(style?.topMargin ?? "0"), bottom: 0), decoration: BoxDecoration( color: HexColor.fromHex(style?.bgColor ?? ''), borderRadius: BorderRadius.only( topLeft: Radius.circular(double.tryParse(style?.topLeftRadius ?? "0")), topRight: Radius.circular(double.tryParse(style?.topRightRadius ?? "0")), bottomLeft: Radius.circular(double.tryParse(style?.bottomLeftRadius ?? "0")), bottomRight: Radius.circular(double.tryParse(style?.bottomRightRadius ?? "0")))), child: CachedNetworkImage( imageUrl: style?.bgImage ?? "", ), ), ); } }