2020-10-13 07:50:25 +06:30
|
|
|
import 'package:fcs/domain/vo/delivery_address.dart';
|
|
|
|
|
import 'package:fcs/helpers/theme.dart';
|
|
|
|
|
import 'package:fcs/pages/delivery_address/delivery_address_row.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_icons/flutter_icons.dart';
|
|
|
|
|
|
|
|
|
|
import 'callbacks.dart';
|
|
|
|
|
import 'display_text.dart';
|
|
|
|
|
import 'local_text.dart';
|
|
|
|
|
|
|
|
|
|
class DefaultDeliveryAddress extends StatelessWidget {
|
|
|
|
|
final DeliveryAddress deliveryAddress;
|
|
|
|
|
final String labelKey;
|
|
|
|
|
final OnTap onTap;
|
2020-10-14 01:51:53 +06:30
|
|
|
final IconData iconData;
|
2020-10-13 07:50:25 +06:30
|
|
|
|
|
|
|
|
const DefaultDeliveryAddress(
|
2020-10-14 01:51:53 +06:30
|
|
|
{Key key, this.deliveryAddress, this.onTap, this.labelKey, this.iconData})
|
2020-10-13 07:50:25 +06:30
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: DisplayText(
|
|
|
|
|
labelTextKey: this.labelKey ?? "delivery_address",
|
2020-10-14 01:51:53 +06:30
|
|
|
iconData: iconData ?? MaterialCommunityIcons.truck_fast,
|
2020-10-13 07:50:25 +06:30
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
onTap == null
|
|
|
|
|
? Container()
|
|
|
|
|
: GestureDetector(
|
|
|
|
|
onTap: () => onTap(),
|
|
|
|
|
child: Chip(
|
|
|
|
|
label: LocalText(
|
|
|
|
|
context, "delivery_address.change_address",
|
|
|
|
|
color: primaryColor)),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 28.0),
|
|
|
|
|
child: deliveryAddress == null
|
|
|
|
|
? Container()
|
|
|
|
|
: DeliveryAddressRow(
|
|
|
|
|
key: ValueKey(deliveryAddress.id),
|
|
|
|
|
deliveryAddress: deliveryAddress),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|