import 'package:driverapp/config/size_config.dart';
import 'package:driverapp/widgets/delivery/distance_in_kilometers.dart';
import 'package:flutter/material.dart';

import '../../uitl/date_uitl.dart';
import '../../uitl/translations_delegate_base.dart';

class CustomerBriefCard extends StatelessWidget {
  final int itemId;
  final String time;
  final String customerFirstName;
  final String customerLastName;
  final String mobileNo;
  final String direction;
  final String totalPayment;
  final String deliveryTime;
  final double longitude;
  final double latitude;
  final bool showDistance;

  CustomerBriefCard({
    this.itemId,
    this.time,
    this.customerFirstName,
    this.customerLastName,
    this.mobileNo,
    this.direction,
    this.totalPayment,
    this.deliveryTime,
    this.longitude,
    this.latitude,
    this.showDistance = true,
  });

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Container(
        width: MediaQuery.of(context).orientation == Orientation.landscape
            ? SizeConfig.widthMultiplier * 125.0
            : SizeConfig.widthMultiplier * 90.0,
        height: 290,
        decoration: BoxDecoration(
          color: Colors.white,
          borderRadius: BorderRadius.only(
              topLeft: Radius.circular(30),
              topRight: Radius.circular(30),
              bottomRight: Radius.circular(30),
              bottomLeft: Radius.circular(30)),
          boxShadow: [
            BoxShadow(
              color: Colors.grey.withOpacity(0.3),
              spreadRadius: 5,
              blurRadius: 7,
              offset: Offset(0, 3),
            ),
          ],
        ),
        child: Container(
          padding: EdgeInsets.only(left: 30, top: 20, right: 30),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: <Widget>[
              Row(
                children: <Widget>[
                  Expanded(
                    flex: 3,
                    child: Text(
                      'ID: ${itemId}',
                      style: TextStyle(
                          color: Color(0xFFADACAD),
                          fontWeight: FontWeight.w800,
                          fontSize: 17.5),
                    ),
                  ),
                  Expanded(
                    child: Padding(
                      padding: EdgeInsets.all(8.0),
                      child: DistanceInKilometers(
                        distanceInKilometers: 0.0,
                      ),
                    ),
                  ),
                ],
              ),
              SizedBox(
                height: MediaQuery.of(context).size.width * 0.02,
              ),
              Text(
                '${customerFirstName} ${customerLastName}',
                style: TextStyle(fontSize: 20, fontWeight: FontWeight.w500),
              ),
              SizedBox(
                height: MediaQuery.of(context).size.width * 0.019,
              ),
              Text(
                mobileNo,
                style: TextStyle(color: Color(0xFF50BDC5)),
              ),
              SizedBox(
                height: MediaQuery.of(context).size.width * 0.005,
              ),
//              Text(
//                'Olaya street, behind KFC resturant, next to kingdom towers 2nd floor ofice 277',
//                style: TextStyle(
//                    color: Color(0xFF464748), fontWeight: FontWeight.w600),
//              ),
              SizedBox(
                height: 10,
              ),
              SizedBox(
                height: 10.0,
                child: Center(
                  child: Container(
                    margin: EdgeInsetsDirectional.only(start: 1.0, end: 1.0),
                    height: 1.0,
                    color: Colors.grey,
                  ),
                ),
              ),
              SizedBox(
                height: 20,
              ),
              Column(
                children: <Widget>[
                  Row(
                    children: <Widget>[
                      Expanded(
                        flex: 2,
                        child: Text(
                          TranslationBase.of(context).payment,
                          textAlign: TextAlign.start,
                        ),
                      ),
                      SizedBox(
                        width: 170,
                      ),
                      Expanded(
                        child: Text(
                          totalPayment.toString(),
                          textAlign: TextAlign.end,
                          style: TextStyle(fontWeight: FontWeight.w400),
                        ),
                      ),
                    ],
                  ),
                  SizedBox(
                    height: MediaQuery.of(context).size.width * 0.03,
                  ),
                  Row(
                    children: <Widget>[
                      Expanded(
                        flex: 1,
                        child: Text(
                          TranslationBase.of(context).delivryTime,
                          textAlign: TextAlign.start,
                        ),
                      ),
                      Expanded(
                        child: Text(
                            '${DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDate(deliveryTime))} ${(DateUtil.convertStringToHours(deliveryTime))}',
                            textAlign: TextAlign.end,
                            style: TextStyle(fontWeight: FontWeight.w400)),
                      ),
                    ],
                  )
                ],
              ),
            ],
          ),
        ),
      ),
    );
  }
}
