line.dart 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import 'package:fis_lib_report/converts/pt_to_px_converter.dart';
  2. import 'package:fis_lib_report/pages/helpler.dart';
  3. import 'package:fis_lib_report/report/line.dart';
  4. import 'package:fis_lib_report/report/rt_thickness.dart';
  5. import 'package:flutter/cupertino.dart';
  6. import 'package:flutter/material.dart';
  7. class RLine extends StatefulWidget {
  8. final Line line;
  9. RLine(this.line);
  10. @override
  11. State<StatefulWidget> createState() {
  12. return _LineState();
  13. }
  14. }
  15. class _LineState extends State<RLine> {
  16. late final Line line;
  17. _LineState();
  18. @override
  19. initState() {
  20. line = widget.line;
  21. ///TODO(Loki):设置虚线or实线
  22. final borderStyle = line.borderStyle;
  23. super.initState();
  24. }
  25. @override
  26. Widget build(BuildContext context) {
  27. final stroke = line.stroke!;
  28. final a = stroke.a!;
  29. final r = stroke.r!;
  30. final g = stroke.g!;
  31. final b = stroke.b!;
  32. final margin = line.margin ?? RTThickness.uniform(0);
  33. return Container(
  34. height: 10, //TODO(Loki):这里的Height在Json中没有
  35. alignment: Alignment.center,
  36. margin: EdgeInsets.only(
  37. top: margin.top!,
  38. bottom: margin.bottom!,
  39. right: margin.left!,
  40. left: margin.left!),
  41. width: PtToPxConverter.ptToPx(line.width),
  42. child: Divider(
  43. height: line.thickness,
  44. thickness: line.thickness,
  45. color: Color.fromARGB(a, r, g, b),
  46. ),
  47. );
  48. }
  49. }