import 'dart:io'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:aslan/app_localizations.dart'; import 'package:aslan/chatvibe_ui/components/at_debounce_widget.dart'; import 'package:aslan/chatvibe_ui/components/text/at_text.dart'; import 'package:aslan/chatvibe_ui/components/at_tts.dart'; import 'package:aslan/chatvibe_core/constants/at_global_config.dart'; import 'package:aslan/chatvibe_core/utilities/at_share_utils.dart'; class SharePage extends StatefulWidget { String shareText; SharePage(this.shareText); @override _SharePageState createState() => _SharePageState(); } class _SharePageState extends State { @override Widget build(BuildContext context) { return SafeArea( child: Container( padding: EdgeInsets.all(16.w), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only( topLeft: Radius.circular(12.w), topRight: Radius.circular(12.w), ), ), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ text( ATAppLocalizations.of(context)!.shareTo, fontSize: 16.sp, fontWeight: FontWeight.w600, textColor: Colors.black, ), SizedBox(height: 15.w), Row( children: [ Expanded( child: ATDebounceWidget( child: Column( children: [ Image.asset( "atu_images/general/at_icon_share_link.png", width: 40.w, height: 40.w, ), text( ATAppLocalizations.of(context)!.copyLink, maxLines: 2, fontWeight: FontWeight.w600, textColor: Colors.black38, fontSize: 14.sp, ), ], ), onTap: () { Clipboard.setData( ClipboardData( text: "${widget.shareText}${Platform.isAndroid ? ATGlobalConfig.appDownloadUrlGoogle : ATGlobalConfig.appDownloadUrlGoogle}", ), ); ATTts.show(ATAppLocalizations.of(context)!.copiedToClipboard); }, ), ), Expanded( child: ATDebounceWidget( child: Column( children: [ Image.asset( "atu_images/general/at_icon_share_facebook.png", width: 40.w, height: 40.w, ), text( ATAppLocalizations.of(context)!.faceBook, maxLines: 2, fontWeight: FontWeight.w600, textColor: Colors.black38, fontSize: 14.sp, ), ], ), onTap: () { ATSharingHelper.shareTextToFacebook( "${widget.shareText}${Platform.isAndroid ? ATGlobalConfig.appDownloadUrlGoogle : ATGlobalConfig.appDownloadUrlGoogle}", ); }, ), ), Expanded( child: ATDebounceWidget( child: Column( children: [ Image.asset( "atu_images/general/at_icon_share_whatsapp.png", width: 40.w, height: 40.w, ), text( ATAppLocalizations.of(context)!.whatsApp, maxLines: 2, fontWeight: FontWeight.w600, textColor: Colors.black38, fontSize: 14.sp, ), ], ), onTap: () { ATSharingHelper.shareTextToWhatsApp( "${widget.shareText}${Platform.isAndroid ? ATGlobalConfig.appDownloadUrlGoogle : ATGlobalConfig.appDownloadUrlGoogle}", ); }, ), ), Expanded( child: ATDebounceWidget( child: Column( children: [ Image.asset( "atu_images/general/at_icon_share_snapchat.png", width: 40.w, height: 40.w, ), text( ATAppLocalizations.of(context)!.snapChat, maxLines: 2, fontWeight: FontWeight.w600, textColor: Colors.black38, fontSize: 14.sp, ), ], ), onTap: () { ATSharingHelper.shareToSnapchatDirectlyMethod( "${widget.shareText}${Platform.isAndroid ? ATGlobalConfig.appDownloadUrlGoogle : ATGlobalConfig.appDownloadUrlGoogle}", ); }, ), ), ], ), ], ), ), ); } }