11/17/1
This commit is contained in:
@@ -7,6 +7,7 @@ import '../../../constant/box_name.dart';
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../controller/home/profile/invit_controller.dart';
|
||||
import '../../../main.dart';
|
||||
import '../../../print.dart';
|
||||
|
||||
class ShareAppPage extends StatelessWidget {
|
||||
final InviteController controller = Get.put(InviteController());
|
||||
@@ -81,6 +82,40 @@ class ShareAppPage extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
// Widget _buildPhoneInput() {
|
||||
// return Container(
|
||||
// decoration: BoxDecoration(
|
||||
// color: CupertinoColors.systemGrey6,
|
||||
// borderRadius: BorderRadius.circular(8),
|
||||
// ),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Expanded(
|
||||
// child: CupertinoTextField.borderless(
|
||||
// controller: controller.invitePhoneController,
|
||||
// placeholder: 'Enter phone'.tr,
|
||||
// padding: const EdgeInsets.all(12),
|
||||
// keyboardType: TextInputType.phone,
|
||||
// ),
|
||||
// ),
|
||||
// CupertinoButton(
|
||||
// child: const Icon(CupertinoIcons.person_badge_plus,
|
||||
// color: AppColor.blueColor),
|
||||
// onPressed: () async {
|
||||
// await controller.pickContacts();
|
||||
// if (controller.contacts.isNotEmpty) {
|
||||
// if (box.read(BoxName.isSavedPhones) == null) {
|
||||
// controller.savePhoneToServer();
|
||||
// box.write(BoxName.isSavedPhones, true);
|
||||
// }
|
||||
// _showContactsDialog(Get.context!);
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
Widget _buildPhoneInput() {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
@@ -102,12 +137,15 @@ class ShareAppPage extends StatelessWidget {
|
||||
color: AppColor.blueColor),
|
||||
onPressed: () async {
|
||||
await controller.pickContacts();
|
||||
Log.print('contacts: ${controller.contacts}');
|
||||
if (controller.contacts.isNotEmpty) {
|
||||
if (box.read(BoxName.isSavedPhones) == null) {
|
||||
controller.savePhoneToServer();
|
||||
box.write(BoxName.isSavedPhones, true);
|
||||
}
|
||||
_showContactsDialog(Get.context!);
|
||||
_showContactsDialog(Get
|
||||
.context!); // Show contacts dialog after loading contacts
|
||||
} else {
|
||||
Get.snackbar(
|
||||
'No contacts available'.tr,
|
||||
'Please add contacts to your phone.'.tr,
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
@@ -326,48 +364,38 @@ class ShareAppPage extends StatelessWidget {
|
||||
}
|
||||
|
||||
void _showContactsDialog(BuildContext context) {
|
||||
showCupertinoModalPopup(
|
||||
context: context,
|
||||
builder: (BuildContext context) => Container(
|
||||
Get.defaultDialog(
|
||||
title: 'Choose from contact'.tr,
|
||||
content: SizedBox(
|
||||
height: 400,
|
||||
decoration: BoxDecoration(
|
||||
color: CupertinoColors.systemBackground,
|
||||
borderRadius: const BorderRadius.vertical(top: Radius.circular(20)),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: CupertinoColors.black.withOpacity(0.2),
|
||||
offset: const Offset(0, -4),
|
||||
blurRadius: 10,
|
||||
),
|
||||
],
|
||||
),
|
||||
width: 400,
|
||||
child: Column(
|
||||
children: [
|
||||
// Header with cancel and title
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
decoration: const BoxDecoration(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
|
||||
color: CupertinoColors.systemGrey6,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
CupertinoButton(
|
||||
padding: EdgeInsets.zero,
|
||||
child: Text(
|
||||
'Cancel'.tr,
|
||||
style: const TextStyle(color: CupertinoColors.systemBlue),
|
||||
),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
Container(
|
||||
child: Text('Choose from contact'.tr,
|
||||
style: AppStyle.title)),
|
||||
const SizedBox(width: 60), // Balance for Cancel button
|
||||
],
|
||||
),
|
||||
),
|
||||
// Container(
|
||||
// padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
// decoration: const BoxDecoration(
|
||||
// borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
|
||||
// color: CupertinoColors.systemGrey6,
|
||||
// ),
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// CupertinoButton(
|
||||
// padding: EdgeInsets.zero,
|
||||
// child: Text(
|
||||
// 'Cancel'.tr,
|
||||
// style: const TextStyle(color: CupertinoColors.systemBlue),
|
||||
// ),
|
||||
// onPressed: () => Navigator.pop(context),
|
||||
// ),
|
||||
// Container(
|
||||
// child: Text('Choose from contact'.tr,
|
||||
// style: AppStyle.title)),
|
||||
// const SizedBox(width: 60), // Balance for Cancel button
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
|
||||
// Contact list
|
||||
Expanded(
|
||||
@@ -433,5 +461,112 @@ class ShareAppPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
);
|
||||
// showCupertinoModalPopup(
|
||||
// context: context,
|
||||
// builder: (BuildContext context) => Container(
|
||||
// height: 400,
|
||||
// decoration: BoxDecoration(
|
||||
// color: CupertinoColors.systemBackground,
|
||||
// borderRadius: const BorderRadius.vertical(top: Radius.circular(20)),
|
||||
// boxShadow: [
|
||||
// BoxShadow(
|
||||
// color: CupertinoColors.black.withOpacity(0.2),
|
||||
// offset: const Offset(0, -4),
|
||||
// blurRadius: 10,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// child: Column(
|
||||
// children: [
|
||||
// // Header with cancel and title
|
||||
// Container(
|
||||
// padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
// decoration: const BoxDecoration(
|
||||
// borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
|
||||
// color: CupertinoColors.systemGrey6,
|
||||
// ),
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// CupertinoButton(
|
||||
// padding: EdgeInsets.zero,
|
||||
// child: Text(
|
||||
// 'Cancel'.tr,
|
||||
// style: const TextStyle(color: CupertinoColors.systemBlue),
|
||||
// ),
|
||||
// onPressed: () => Navigator.pop(context),
|
||||
// ),
|
||||
// Container(
|
||||
// child: Text('Choose from contact'.tr,
|
||||
// style: AppStyle.title)),
|
||||
// const SizedBox(width: 60), // Balance for Cancel button
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
|
||||
// // Contact list
|
||||
// Expanded(
|
||||
// child: ListView.builder(
|
||||
// itemCount: controller.contactMaps.length,
|
||||
// itemBuilder: (context, index) {
|
||||
// final contact = controller.contactMaps[index];
|
||||
// return CupertinoButton(
|
||||
// padding: EdgeInsets.zero,
|
||||
// onPressed: () {
|
||||
// controller.selectPhone(contact['phones'].toString());
|
||||
// },
|
||||
// child: Container(
|
||||
// padding: const EdgeInsets.symmetric(
|
||||
// horizontal: 16, vertical: 12),
|
||||
// decoration: BoxDecoration(
|
||||
// color: CupertinoColors.systemBackground,
|
||||
// border: Border(
|
||||
// bottom: BorderSide(
|
||||
// color: CupertinoColors.separator.withOpacity(0.5),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// // Display contact name and phone number
|
||||
// Expanded(
|
||||
// child: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// Text(
|
||||
// contact['name'],
|
||||
// style: const TextStyle(
|
||||
// color: CupertinoColors.label,
|
||||
// fontSize: 17,
|
||||
// fontWeight: FontWeight.w500,
|
||||
// ),
|
||||
// ),
|
||||
// Text(
|
||||
// controller.formatPhoneNumber(
|
||||
// contact['phones'][0].toString()),
|
||||
// style: const TextStyle(
|
||||
// color: CupertinoColors.secondaryLabel,
|
||||
// fontSize: 15,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// // Chevron icon for selection
|
||||
// const Icon(
|
||||
// CupertinoIcons.chevron_forward,
|
||||
// color: CupertinoColors.systemGrey2,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user