Files
fcs/lib/pages/delivery_address/delivery_address_row.dart

86 lines
2.8 KiB
Dart
Raw Normal View History

2020-10-08 15:54:43 +06:30
import 'package:fcs/domain/vo/delivery_address.dart';
2020-10-11 02:17:23 +06:30
import 'package:fcs/pages/widgets/local_text.dart';
2020-10-08 15:54:43 +06:30
import 'package:flutter/material.dart';
2021-09-10 14:29:55 +06:30
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
2020-10-08 15:54:43 +06:30
2020-10-11 02:17:23 +06:30
typedef SelectionCallback(DeliveryAddress deliveryAddress);
2020-10-08 15:54:43 +06:30
class DeliveryAddressRow extends StatelessWidget {
2020-10-11 02:17:23 +06:30
final DeliveryAddress deliveryAddress;
2021-09-10 12:02:08 +06:30
final SelectionCallback? selectionCallback;
2020-10-11 02:17:23 +06:30
const DeliveryAddressRow(
2021-09-10 12:02:08 +06:30
{Key? key, required this.deliveryAddress, this.selectionCallback})
2020-10-08 15:54:43 +06:30
: super(key: key);
@override
Widget build(BuildContext context) {
2020-10-11 02:17:23 +06:30
return InkWell(
onTap: selectionCallback == null
? null
2021-09-10 12:02:08 +06:30
: () => this.selectionCallback!(deliveryAddress),
2020-10-11 02:17:23 +06:30
child: Row(
2020-10-08 15:54:43 +06:30
children: <Widget>[
2020-10-11 02:17:23 +06:30
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
2024-02-14 16:54:38 +06:30
deliveryAddress.fullName!=""
?
2020-10-11 02:17:23 +06:30
line(context, deliveryAddress.fullName,
2020-10-14 01:51:53 +06:30
iconData: MaterialCommunityIcons.account,
2024-02-14 16:54:38 +06:30
color: Colors.black,
fontSize: 16):SizedBox(),
deliveryAddress.phoneNumber!=""
?
2020-10-11 02:17:23 +06:30
line(context, deliveryAddress.phoneNumber,
2024-02-14 16:54:38 +06:30
iconData: Icons.phone, color: Colors.black, fontSize: 16):SizedBox(),
deliveryAddress.addressLine1!=""
?
2020-10-11 02:17:23 +06:30
line(context, deliveryAddress.addressLine1,
2024-02-14 16:54:38 +06:30
iconData: Icons.location_on,color: Colors.black, fontSize: 16):SizedBox(),
deliveryAddress.addressLine2!=""
?
2020-10-11 02:17:23 +06:30
line(
context,
2024-02-14 16:54:38 +06:30
deliveryAddress.addressLine2,color: Colors.black, fontSize: 16
):SizedBox(),
deliveryAddress.city!=""
?
2020-10-11 02:17:23 +06:30
line(
context,
2024-02-14 16:54:38 +06:30
deliveryAddress.city,color: Colors.black, fontSize: 16
):SizedBox(),
deliveryAddress.state!=""
?
line(context, deliveryAddress.state,color: Colors.black, fontSize: 16):SizedBox(),
2020-10-11 02:17:23 +06:30
],
),
2020-10-08 15:54:43 +06:30
),
],
),
);
}
2020-10-11 02:17:23 +06:30
2021-09-10 12:02:08 +06:30
Widget line(BuildContext context, String? text,
{IconData? iconData, Color? color, double? fontSize}) {
2020-10-11 02:17:23 +06:30
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,
2021-09-10 12:02:08 +06:30
color: color ?? Colors.grey,
2020-10-11 02:17:23 +06:30
),
),
],
);
}
2020-10-08 15:54:43 +06:30
}