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/material.dart';
|
2021-09-10 14:25:37 +06:30
|
|
|
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
2020-10-13 07:50:25 +06:30
|
|
|
|
|
|
|
|
import 'callbacks.dart';
|
|
|
|
|
import 'display_text.dart';
|
|
|
|
|
import 'local_text.dart';
|
|
|
|
|
|
|
|
|
|
class DefaultDeliveryAddress extends StatelessWidget {
|
2021-09-10 14:25:37 +06:30
|
|
|
final DeliveryAddress? deliveryAddress;
|
|
|
|
|
final String? labelKey;
|
|
|
|
|
final OnTap? onTap;
|
|
|
|
|
final IconData? iconData;
|
2020-10-13 07:50:25 +06:30
|
|
|
|
|
|
|
|
const DefaultDeliveryAddress(
|
2024-01-25 17:40:35 +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(
|
2020-10-19 05:13:49 +06:30
|
|
|
child: this.labelKey == null
|
|
|
|
|
? Container()
|
|
|
|
|
: DisplayText(
|
|
|
|
|
labelTextKey: this.labelKey,
|
|
|
|
|
iconData: iconData ?? MaterialCommunityIcons.truck_fast,
|
|
|
|
|
),
|
2020-10-13 07:50:25 +06:30
|
|
|
),
|
|
|
|
|
onTap == null
|
|
|
|
|
? Container()
|
|
|
|
|
: GestureDetector(
|
2021-09-10 14:25:37 +06:30
|
|
|
onTap: () => onTap!(),
|
2020-10-13 07:50:25 +06:30
|
|
|
child: Chip(
|
2024-01-25 17:40:35 +06:30
|
|
|
shape: const StadiumBorder(
|
|
|
|
|
side: BorderSide(color: Colors.transparent)),
|
|
|
|
|
backgroundColor: Colors.grey.withOpacity(0.3),
|
2020-10-13 07:50:25 +06:30
|
|
|
label: LocalText(
|
|
|
|
|
context, "delivery_address.change_address",
|
|
|
|
|
color: primaryColor)),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 28.0),
|
|
|
|
|
child: deliveryAddress == null
|
|
|
|
|
? Container()
|
|
|
|
|
: DeliveryAddressRow(
|
2021-09-10 14:25:37 +06:30
|
|
|
key: ValueKey(deliveryAddress!.id),
|
|
|
|
|
deliveryAddress: deliveryAddress!),
|
2020-10-13 07:50:25 +06:30
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|