import 'package:fcs/domain/vo/delivery_address.dart'; import 'package:fcs/helpers/theme.dart'; import 'package:fcs/pages/widgets/local_text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_vector_icons/flutter_vector_icons.dart'; typedef SelectionCallback(DeliveryAddress deliveryAddress); class DeliveryAddressRow extends StatelessWidget { final DeliveryAddress deliveryAddress; final SelectionCallback? selectionCallback; const DeliveryAddressRow( {Key? key, required this.deliveryAddress, this.selectionCallback}) : super(key: key); @override Widget build(BuildContext context) { return InkWell( onTap: selectionCallback == null ? null : () => this.selectionCallback!(deliveryAddress), child: Row( children: [ Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ line(context, deliveryAddress.fullName, iconData: MaterialCommunityIcons.account, color: primaryColor, fontSize: 16), line(context, deliveryAddress.phoneNumber, iconData: Icons.phone, color: primaryColor, fontSize: 16), SizedBox( height: 5, ), line(context, deliveryAddress.addressLine1, iconData: Icons.location_on), line( context, deliveryAddress.addressLine2, ), line( context, deliveryAddress.city, ), line(context, deliveryAddress.state), ], ), ), ], ), ); } Widget line(BuildContext context, String? text, {IconData? iconData, Color? color, double? fontSize}) { return Row( children: [ iconData == null ? SizedBox(width: 40) : Padding( padding: const EdgeInsets.only(left: 8.0, right: 8), child: Icon(iconData, color: Colors.black38), ), Flexible( child: TextLocalStyle( context, text ?? "", fontSize: fontSize ?? 14, color: color ?? Colors.grey, ), ), ], ); } }