import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:location/utils/common_expand.dart';

import '../../resource/string.gen.dart';

Widget getMainTrackDot(Color color) {
  return Container(
    width: 12.w,
    height: 12.w,
    decoration: BoxDecoration(
      color: Colors.white,
      shape: BoxShape.circle,
      border: Border.all(color: color, width: 2.w),
    ),
  );
}

Widget buildTrackPoint(MainTrackType type, String address) {
  return Text.rich(
    TextSpan(
      children: [
        WidgetSpan(
          alignment: PlaceholderAlignment.middle,
          child: Visibility(
            visible: type != MainTrackType.normalPoint,
            child: Container(
              margin: EdgeInsets.only(right: 4.w),
              padding: EdgeInsets.symmetric(horizontal: 4.w, vertical: 2.5.w),
              decoration: BoxDecoration(
                color: type == MainTrackType.startPoint
                    ? '#15CBA1'.color
                    : '#E94949'.color,
                borderRadius: BorderRadius.circular(3.r),
              ),
              child: Text(
                type == MainTrackType.startPoint
                    ? StringName.todaySimpleTrackStart
                    : StringName.todaySimpleTrackError,
                style:
                    TextStyle(color: Colors.white, fontSize: 11.sp, height: 1),
              ),
            ),
          ),
        ),
        TextSpan(
          text: type == MainTrackType.normalPoint
              ? StringName.mainTodayTrackNormalPoint
              : address,
          style: TextStyle(fontSize: 12.sp, color: '#666666'.color),
        ),
      ],
    ),
  );
}

enum MainTrackType { startPoint, errorPoint, normalPoint }
