Files
fcs/lib/pages/delivery_address/delivery_address_row.dart
2024-02-14 17:19:55 +06:30

86 lines
2.8 KiB
Dart

import 'package:fcs/domain/vo/delivery_address.dart';
import 'package:fcs/pages/widgets/local_text.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: <Widget>[
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
deliveryAddress.fullName!=""
?
line(context, deliveryAddress.fullName,
iconData: MaterialCommunityIcons.account,
color: Colors.black,
fontSize: 16):SizedBox(),
deliveryAddress.phoneNumber!=""
?
line(context, deliveryAddress.phoneNumber,
iconData: Icons.phone, color: Colors.black, fontSize: 16):SizedBox(),
deliveryAddress.addressLine1!=""
?
line(context, deliveryAddress.addressLine1,
iconData: Icons.location_on,color: Colors.black, fontSize: 16):SizedBox(),
deliveryAddress.addressLine2!=""
?
line(
context,
deliveryAddress.addressLine2,color: Colors.black, fontSize: 16
):SizedBox(),
deliveryAddress.city!=""
?
line(
context,
deliveryAddress.city,color: Colors.black, fontSize: 16
):SizedBox(),
deliveryAddress.state!=""
?
line(context, deliveryAddress.state,color: Colors.black, fontSize: 16):SizedBox(),
],
),
),
],
),
);
}
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,
),
),
],
);
}
}