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

79 lines
2.4 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/helpers/theme.dart';
import 'package:fcs/pages/widgets/local_text.dart';
2020-10-08 15:54:43 +06:30
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
2020-10-11 02:17:23 +06:30
import 'package:flutter_icons/flutter_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;
final SelectionCallback selectionCallback;
const DeliveryAddressRow(
{Key key, 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
: () => this.selectionCallback(deliveryAddress),
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>[
line(context, deliveryAddress.fullName,
2020-10-14 01:51:53 +06:30
iconData: MaterialCommunityIcons.account,
2020-10-11 02:17:23 +06:30
color: primaryColor,
fontSize: 16),
line(context, deliveryAddress.phoneNumber,
iconData: Icons.phone, color: primaryColor, fontSize: 16),
SizedBox(
height: 5,
2020-10-08 15:54:43 +06:30
),
2020-10-11 02:17:23 +06:30
line(context, deliveryAddress.addressLine1,
iconData: Icons.location_on),
line(
context,
deliveryAddress.addressLine2,
),
line(
context,
deliveryAddress.city,
),
line(context, deliveryAddress.state),
],
),
2020-10-08 15:54:43 +06:30
),
],
),
);
}
2020-10-11 02:17:23 +06:30
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,
),
),
],
);
}
2020-10-08 15:54:43 +06:30
}