import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

import '../../../../../models/entities/Address.dart';

class UserAddress extends StatelessWidget {
  final Address item;

  const UserAddress({Key? key, required this.item}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
        alignment: Alignment.center,
        height: 123.w,
        width: 345.w,
        margin: EdgeInsets.fromLTRB(0, 15.w, 0, 15.w),
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(30),
          color: Colors.white,
          boxShadow: [
            BoxShadow(
              blurRadius: 10, //阴影范围
              spreadRadius: 0.1, //阴影浓度
              color: Colors.grey.withOpacity(0.2), //阴影颜色
            ),
          ],
        ),
        child: Column(
          children: [
            Container(
                margin: EdgeInsets.fromLTRB(0, 30.w, 0, 20.w),
                alignment: Alignment.topLeft,
                decoration: const BoxDecoration(
                    border: Border(
                        left: BorderSide(width: 5, color: Color(0xff000000)
                            // 0x17000000
                            ))),
                child: Padding(
                  padding: EdgeInsets.fromLTRB(12.w, 0, 0, 0),
                  child: Text(
                    '地址信息',
                    style: TextStyle(
                      color: Color(0xff333333),
                      fontWeight: FontWeight.bold,
                      fontSize: 17.sp,
                    ),
                  ),
                )),
            GestureDetector(
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Container(
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Padding(
                          padding: EdgeInsets.fromLTRB(17.w, 0, 10.w, 0),
                          child: Image(
                            image: AssetImage('images/gpsImgae.png'),
                            width: 12.w,
                          ),
                        ),
                        Container(
                          width: 260,
                          child:  Text(item!=null?item.address.toString():'请设置详细地址！',
                            softWrap: true,
                            maxLines: 1,
                            textAlign: TextAlign.left,
                            overflow: TextOverflow.ellipsis,
                            style: TextStyle(
                              fontWeight: FontWeight.bold,
                              fontSize: 17,
                            ),
                          ),
                        ),
                      ],
                    ),
                  ),
                  Container(
                    alignment: Alignment.center,
                    padding: EdgeInsets.fromLTRB(0, 0, 30.w, 0),
                    child: Text(
                      '>>',
                      style: TextStyle(
                        fontWeight: FontWeight.bold,
                        fontSize: 17,
                      ),
                    ),
                  ),
                ],
              ),
              onTap: () {
                Get.toNamed("/addressList");
              },
            ),
          ],
        ));
  }
}
