基础组件库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

bottom_pic.dart 1.5 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import 'dart:convert';
  2. import 'package:flutter/material.dart';
  3. import 'package:zhiying_comm/util/log/let_log.dart';
  4. import 'package:zhiying_comm/zhiying_comm.dart';
  5. import 'bottom_pic_style.dart';
  6. class BottomPic extends StatelessWidget {
  7. final Map<String, dynamic> model;
  8. BottomPic({Key key, this.model}) : super(key: key);
  9. @override
  10. BottomPicStyle style;
  11. Widget build(BuildContext context) {
  12. style = BottomPicStyle.fromJson(json.decode(model['data']));
  13. Logger.log(model['data']);
  14. if (style == null) {
  15. return Container();
  16. }
  17. return GestureDetector(
  18. onTap: () {
  19. RouterUtil.route(SkipModel.fromJson(style.toJson()), style.toJson(), context);
  20. },
  21. child: Container(
  22. margin: EdgeInsets.only(
  23. left: double.tryParse(style?.leftRightMargin ?? "0"), right: double.tryParse(style?.leftRightMargin ?? "0"), top: double.tryParse(style?.topMargin ?? "0"), bottom: 0),
  24. decoration: BoxDecoration(
  25. color: HexColor.fromHex(style?.bgColor ?? ''),
  26. borderRadius: BorderRadius.only(
  27. topLeft: Radius.circular(double.tryParse(style?.topLeftRadius ?? "0")),
  28. topRight: Radius.circular(double.tryParse(style?.topRightRadius ?? "0")),
  29. bottomLeft: Radius.circular(double.tryParse(style?.bottomLeftRadius ?? "0")),
  30. bottomRight: Radius.circular(double.tryParse(style?.bottomRightRadius ?? "0")))),
  31. child: CachedNetworkImage(
  32. imageUrl: style?.bgImage ?? "",
  33. ),
  34. ),
  35. );
  36. }
  37. }