view.dart 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter_screenutil/flutter_screenutil.dart';
  4. import 'package:location/utils/common_expand.dart';
  5. import '../../resource/string.gen.dart';
  6. Widget getMainTrackDot(Color color) {
  7. return Container(
  8. width: 12.w,
  9. height: 12.w,
  10. decoration: BoxDecoration(
  11. color: Colors.white,
  12. shape: BoxShape.circle,
  13. border: Border.all(color: color, width: 2.w),
  14. ),
  15. );
  16. }
  17. Widget buildTrackPoint(MainTrackType type, String address) {
  18. return Text.rich(
  19. TextSpan(
  20. children: [
  21. WidgetSpan(
  22. alignment: PlaceholderAlignment.middle,
  23. child: Container(
  24. margin: EdgeInsets.only(right: 4.w),
  25. padding: EdgeInsets.symmetric(horizontal: 4.w, vertical: 2.5.w),
  26. decoration: BoxDecoration(
  27. color: type == MainTrackType.startPoint
  28. ? '#15CBA1'.color
  29. : '#E94949'.color,
  30. borderRadius: BorderRadius.circular(3.r),
  31. ),
  32. child: Text(
  33. type == MainTrackType.startPoint
  34. ? StringName.todaySimpleTrackStart
  35. : StringName.todaySimpleTrackError,
  36. style: TextStyle(color: Colors.white, fontSize: 11.sp, height: 1),
  37. ),
  38. ),
  39. ),
  40. TextSpan(
  41. text: address,
  42. style: TextStyle(fontSize: 12.sp, color: '#666666'.color),
  43. ),
  44. ],
  45. ),
  46. );
  47. }
  48. enum MainTrackType { startPoint, errorPoint }