diff --git a/.gitignore b/.gitignore index a58e73d0..3049db11 100644 --- a/.gitignore +++ b/.gitignore @@ -18,7 +18,7 @@ # The .vscode folder contains launch configuration and tasks you configure in # VS Code which you may wish to be included in version control, so this line # is commented out by default. -#.vscode/ +.vscode/ # Flutter/Dart/Pub related **/doc/api/ diff --git a/assets/fonts/Inter-Bold.ttf b/assets/fonts/Inter-Bold.ttf new file mode 100644 index 00000000..8e82c70d Binary files /dev/null and b/assets/fonts/Inter-Bold.ttf differ diff --git a/assets/fonts/Inter-Regular.ttf b/assets/fonts/Inter-Regular.ttf new file mode 100644 index 00000000..8d4eebf2 Binary files /dev/null and b/assets/fonts/Inter-Regular.ttf differ diff --git a/assets/fonts/Inter-SemiBold.ttf b/assets/fonts/Inter-SemiBold.ttf new file mode 100644 index 00000000..c6aeeb16 Binary files /dev/null and b/assets/fonts/Inter-SemiBold.ttf differ diff --git a/assets/images/plus.png b/assets/images/plus.png new file mode 100644 index 00000000..a58efe47 Binary files /dev/null and b/assets/images/plus.png differ diff --git a/assets/images/search.png b/assets/images/search.png new file mode 100644 index 00000000..a409ec4d Binary files /dev/null and b/assets/images/search.png differ diff --git a/assets/images/verified.png b/assets/images/verified.png new file mode 100644 index 00000000..8361a377 Binary files /dev/null and b/assets/images/verified.png differ diff --git a/ios/Podfile b/ios/Podfile index b74ea69c..1ae6abf4 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -platform :ios, '13.0' +platform :ios, '14.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 18b6777e..ae3fb656 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -11,14 +11,14 @@ PODS: - Flutter - biometric_storage (0.0.1): - Flutter - - DKImagePickerController/Core (4.3.3): + - DKImagePickerController/Core (4.3.4): - DKImagePickerController/ImageDataManager - DKImagePickerController/Resource - - DKImagePickerController/ImageDataManager (4.3.3) - - DKImagePickerController/PhotoGallery (4.3.3): + - DKImagePickerController/ImageDataManager (4.3.4) + - DKImagePickerController/PhotoGallery (4.3.4): - DKImagePickerController/Core - DKPhotoGallery - - DKImagePickerController/Resource (4.3.3) + - DKImagePickerController/Resource (4.3.4) - DKPhotoGallery (0.0.17): - DKPhotoGallery/Core (= 0.0.17) - DKPhotoGallery/Model (= 0.0.17) @@ -57,20 +57,18 @@ PODS: - Flutter - flutter_local_notifications (0.0.1): - Flutter - - flutter_qr_reader (0.0.1): - - Flutter - fluttertoast (0.0.2): - Flutter - Toast - - libwebp (1.2.1): - - libwebp/demux (= 1.2.1) - - libwebp/mux (= 1.2.1) - - libwebp/webp (= 1.2.1) - - libwebp/demux (1.2.1): + - libwebp (1.2.3): + - libwebp/demux (= 1.2.3) + - libwebp/mux (= 1.2.3) + - libwebp/webp (= 1.2.3) + - libwebp/demux (1.2.3): - libwebp/webp - - libwebp/mux (1.2.1): + - libwebp/mux (1.2.3): - libwebp/demux - - libwebp/webp (1.2.1) + - libwebp/webp (1.2.3) - Mantle (2.2.0): - Mantle/extobjc (= 2.2.0) - Mantle/extobjc (2.2.0) @@ -88,12 +86,12 @@ PODS: - MTBBarcodeScanner - receive_sharing_intent (0.0.1): - Flutter - - SDWebImage (5.12.5): - - SDWebImage/Core (= 5.12.5) - - SDWebImage/Core (5.12.5) - - SDWebImageWebPCoder (0.8.4): + - SDWebImage (5.13.5): + - SDWebImage/Core (= 5.13.5) + - SDWebImage/Core (5.13.5) + - SDWebImageWebPCoder (0.9.1): - libwebp (~> 1.0) - - SDWebImage/Core (~> 5.10) + - SDWebImage/Core (~> 5.13) - share_plus (0.0.1): - Flutter - shared_preferences_ios (0.0.1): @@ -123,7 +121,6 @@ DEPENDENCIES: - flutter_image_compress (from `.symlinks/plugins/flutter_image_compress/ios`) - flutter_keychain (from `.symlinks/plugins/flutter_keychain/ios`) - flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`) - - flutter_qr_reader (from `.symlinks/plugins/flutter_qr_reader/ios`) - fluttertoast (from `.symlinks/plugins/fluttertoast/ios`) - open_file (from `.symlinks/plugins/open_file/ios`) - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) @@ -175,8 +172,6 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/flutter_keychain/ios" flutter_local_notifications: :path: ".symlinks/plugins/flutter_local_notifications/ios" - flutter_qr_reader: - :path: ".symlinks/plugins/flutter_qr_reader/ios" fluttertoast: :path: ".symlinks/plugins/fluttertoast/ios" open_file: @@ -211,17 +206,16 @@ SPEC CHECKSUMS: at_file_saver: c0e052c72d8c0296318bd70f2ae7f510887014ce at_onboarding_flutter: e8219b6d0bfb236d3837ec3528871aebdcc56e8d biometric_storage: 1400f1382af3a4cc2bf05340e13c3d8de873ceb9 - DKImagePickerController: 72fd378f244cef3d27288e0aebf217a4467e4012 + DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179 emoji_picker_flutter: df19dac03a2b39ac667dc8d1da939ef3a9e21347 file_picker: 817ab1d8cd2da9d2da412a417162deee3500fc95 - Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a + Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 flutter_image_compress: 5a5e9aee05b6553048b8df1c3bc456d0afaac433 flutter_keychain: 01aabf894ffe8b01adfda1d9df21c210c1b4b452 flutter_local_notifications: 0c0b1ae97e741e1521e4c1629a459d04b9aec743 - flutter_qr_reader: d930dde3b2cfe2b3d0bb7d66e5ff3e514300a5e5 fluttertoast: 16fbe6039d06a763f3533670197d01fc73459037 - libwebp: 98a37e597e40bfdb4c911fc98f2c53d0b12d05fc + libwebp: 60305b2e989864154bd9be3d772730f08fc6a59c Mantle: c5aa8794a29a022dfbbfc9799af95f477a69b62d MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb open_file: 02eb5cb6b21264bd3a696876f5afbfb7ca4f4b7d @@ -230,8 +224,8 @@ SPEC CHECKSUMS: permission_handler_apple: 44366e37eaf29454a1e7b1b7d736c2cceaeb17ce qr_code_scanner: bb67d64904c3b9658ada8c402e8b4d406d5d796e receive_sharing_intent: c0d87310754e74c0f9542947e7cbdf3a0335a3b1 - SDWebImage: 0905f1b7760fc8ac4198cae0036600d67478751e - SDWebImageWebPCoder: f93010f3f6c031e2f8fb3081ca4ee6966c539815 + SDWebImage: 23d714cd599354ee7906dbae26dff89b421c4370 + SDWebImageWebPCoder: 18503de6621dd2c420d680e33d46bf8e1d5169b0 share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68 shared_preferences_ios: 548a61f8053b9b8a49ac19c1ffbc8b92c50d68ad SwiftyGif: 6c3eafd0ce693cad58bb63d2b2fb9bacb8552780 @@ -241,6 +235,6 @@ SPEC CHECKSUMS: video_thumbnail: c4e2a3c539e247d4de13cd545344fd2d26ffafd1 webview_flutter_wkwebview: b7e70ef1ddded7e69c796c7390ee74180182971f -PODFILE CHECKSUM: db8a7794fb1b0bee1e3803fed876c7cf9577099b +PODFILE CHECKSUM: fd947d50a75828cb5577cdcd37849392f3c5b1b0 COCOAPODS: 1.11.3 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index fc1e35ee..372ca6da 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 51; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -282,6 +282,7 @@ /* Begin PBXShellScriptBuildPhase section */ 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -296,6 +297,7 @@ }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 22f1584c..16bb0141 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -79,5 +79,7 @@ UIViewControllerBasedStatusBarAppearance + UIApplicationSupportsIndirectInputEvents + diff --git a/lib/screens/common_widgets/custom_outlined_button.dart b/lib/screens/common_widgets/custom_outlined_button.dart new file mode 100644 index 00000000..93482fa2 --- /dev/null +++ b/lib/screens/common_widgets/custom_outlined_button.dart @@ -0,0 +1,61 @@ +import 'package:at_common_flutter/services/size_config.dart'; +import 'package:atsign_atmosphere_pro/utils/text_styles.dart'; +import 'package:atsign_atmosphere_pro/utils/colors.dart'; +import 'package:flutter/material.dart'; + +class CustomOutlinedButton extends StatelessWidget { + final Function()? onPressed; + final String? buttonText; + final double? height; + final double? width; + final double? thickness; + final Widget? child; + final Color? borderColor; + final double? radius; + + const CustomOutlinedButton({ + Key? key, + this.onPressed, + this.buttonText, + this.height, + this.width, + this.thickness, + this.borderColor, + this.radius, + this.child, + }) : super(key: key); + @override + Widget build(BuildContext context) { + return TextButton( + onPressed: onPressed, + style: TextButton.styleFrom( + padding: EdgeInsets.zero, + ), + child: Container( + width: width ?? 158.toWidth, + height: height ?? (50.toHeight), + padding: EdgeInsets.symmetric(horizontal: 10.toWidth), + decoration: BoxDecoration( + border: Border.all( + color: borderColor ?? ColorConstants.outlineGrey, + width: thickness ?? 1.toWidth, + ), + borderRadius: BorderRadius.circular(radius ?? 30.toWidth), + ), + child: Center( + child: child ?? + Text( + buttonText ?? 'Add text', + textAlign: TextAlign.center, + style: TextStyle( + color: ColorConstants.outlineGrey, + fontSize: 17.toFont, + fontFamily: 'Inter', + fontWeight: FontWeight.w600, + ), + ), + ), + ), + ); + } +} diff --git a/lib/screens/common_widgets/side_bar.dart b/lib/screens/common_widgets/side_bar.dart index 79f29bee..cb15f33a 100644 --- a/lib/screens/common_widgets/side_bar.dart +++ b/lib/screens/common_widgets/side_bar.dart @@ -1,24 +1,26 @@ import 'dart:typed_data'; +import 'dart:ui'; import 'package:at_client_mobile/at_client_mobile.dart'; import 'package:at_common_flutter/services/size_config.dart'; import 'package:at_contact/at_contact.dart'; import 'package:at_contacts_flutter/utils/init_contacts_service.dart'; -import 'package:at_onboarding_flutter/at_onboarding_flutter.dart'; import 'package:atsign_atmosphere_pro/routes/route_names.dart'; import 'package:atsign_atmosphere_pro/screens/common_widgets/contact_initial.dart'; +import 'package:atsign_atmosphere_pro/screens/trusted_contacts/trusted_senders.dart'; +import 'package:atsign_atmosphere_pro/services/common_utility_functions.dart'; +import 'package:atsign_atmosphere_pro/view_models/file_download_checker.dart'; +import 'package:at_onboarding_flutter/at_onboarding_flutter.dart'; import 'package:atsign_atmosphere_pro/screens/common_widgets/side_bar_backup_item.dart'; import 'package:atsign_atmosphere_pro/screens/common_widgets/side_bar_list_item.dart'; import 'package:atsign_atmosphere_pro/screens/common_widgets/switch_at_sign.dart'; import 'package:atsign_atmosphere_pro/services/backend_service.dart'; -import 'package:atsign_atmosphere_pro/services/common_utility_functions.dart'; import 'package:atsign_atmosphere_pro/services/navigation_service.dart'; import 'package:atsign_atmosphere_pro/utils/colors.dart'; import 'package:atsign_atmosphere_pro/utils/constants.dart'; import 'package:atsign_atmosphere_pro/utils/images.dart'; import 'package:atsign_atmosphere_pro/utils/text_strings.dart'; import 'package:atsign_atmosphere_pro/utils/text_styles.dart'; -import 'package:atsign_atmosphere_pro/view_models/file_download_checker.dart'; import 'package:atsign_atmosphere_pro/view_models/welcome_screen_view_model.dart'; import 'package:flutter/material.dart'; import 'package:package_info_plus/package_info_plus.dart'; @@ -354,6 +356,24 @@ class _SideBarWidgetState extends State { title: menuItemsTitle[8], routeName: targetScreens[8], showIconOnly: !isExpanded, + onTap: () { + showModalBottomSheet( + context: context, + elevation: 10, + isScrollControlled: true, + //color with gradient + barrierColor: + Colors.white.withOpacity(0.25).withOpacity(0.6), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(20.toWidth), + topRight: Radius.circular(20.toWidth))), + builder: (context) => BackdropFilter( + filter: ImageFilter.blur( + sigmaY: -2, + ), + child: TrustedSenders())); + }, ), SizedBox(height: isTablet ? 20.toHeight : 0), SideBarItem( diff --git a/lib/screens/common_widgets/side_bar_list_item.dart b/lib/screens/common_widgets/side_bar_list_item.dart index 6846334f..d7828c95 100644 --- a/lib/screens/common_widgets/side_bar_list_item.dart +++ b/lib/screens/common_widgets/side_bar_list_item.dart @@ -12,6 +12,7 @@ class SideBarItem extends StatelessWidget { final bool showIconOnly, isDesktop; final WelcomeScreenProvider _welcomeScreenProvider = WelcomeScreenProvider(); final Color displayColor; + final Function()? onTap; bool isScale; final bool showNotificationDot; SideBarItem( @@ -20,6 +21,7 @@ class SideBarItem extends StatelessWidget { this.title, this.routeName, this.arguments, + this.onTap, this.showIconOnly = false, this.isScale = false, this.displayColor = ColorConstants.fadedText, @@ -33,13 +35,15 @@ class SideBarItem extends StatelessWidget { } return InkWell( - onTap: () { - if (SizeConfig().isMobile(context) || - _welcomeScreenProvider.isExpanded) { - Navigator.pop(context); - } - Navigator.pushNamed(context, routeName!, arguments: arguments ?? {}); - }, + onTap: onTap ?? + () { + if (SizeConfig().isMobile(context) || + _welcomeScreenProvider.isExpanded) { + Navigator.pop(context); + } + Navigator.pushNamed(context, routeName!, + arguments: arguments ?? {}); + }, child: Container( height: 50, child: Row( diff --git a/lib/screens/trusted_contacts/trusted_contacts.dart b/lib/screens/trusted_contacts/trusted_contacts.dart index 983bfca5..8ce3935d 100644 --- a/lib/screens/trusted_contacts/trusted_contacts.dart +++ b/lib/screens/trusted_contacts/trusted_contacts.dart @@ -1,7 +1,9 @@ import 'dart:typed_data'; +import 'dart:ui'; import 'package:at_contacts_flutter/screens/contacts_screen.dart'; import 'package:at_contacts_flutter/services/contact_service.dart'; +import 'package:atsign_atmosphere_pro/screens/trusted_contacts/trusted_senders.dart'; import 'package:atsign_atmosphere_pro/services/common_utility_functions.dart'; import 'package:atsign_atmosphere_pro/utils/text_strings.dart' as pro_text_strings; @@ -36,197 +38,202 @@ class _TrustedContactsState extends State { @override Widget build(BuildContext context) { - return Container( - child: ProviderHandler( - functionName: 'get_trusted_contacts', - load: (provider) async { - await provider.getTrustedContact(); - await provider.migrateTrustedContact(); - }, - showError: false, - errorBuilder: (provider) => Scaffold( - body: Center( - child: Text(TextStrings().errorOccured), + return Scaffold( + body: Container( + child: ProviderHandler( + functionName: 'get_trusted_contacts', + load: (provider) async { + await provider.getTrustedContact(); + await provider.migrateTrustedContact(); + }, + showError: false, + errorBuilder: (provider) => Scaffold( + body: Center( + child: Text(TextStrings().errorOccured), + ), ), - ), - successBuilder: (provider) { - return ShowCaseWidget(builder: Builder(builder: (context) { - myContext = context; - return Scaffold( - appBar: CustomAppBar( - showBackButton: true, - showTitle: true, - title: pro_text_strings.TextStrings().trustedSenders, - showTrailingButton: - provider.trustedContacts.isEmpty ? false : true, - trailingIcon: Icons.add, - isTrustedContactScreen: true, - ), - body: SafeArea( - child: Column(children: [ - Expanded( - child: provider.trustedContacts.isEmpty - ? Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Center( - child: Container( - padding: EdgeInsets.all(20.0), - decoration: BoxDecoration( - color: Color(0xffFCF9F9), - borderRadius: BorderRadius.circular( - 80.toHeight)), - height: 160.toHeight, - width: 160.toHeight, - child: Image.asset( - ImageConstants.emptyTrustedSenders), + successBuilder: (provider) { + return ShowCaseWidget(builder: Builder(builder: (context) { + myContext = context; + return Scaffold( + appBar: CustomAppBar( + showBackButton: true, + showTitle: true, + title: pro_text_strings.TextStrings().trustedSenders, + showTrailingButton: + provider.trustedContacts.isEmpty ? false : true, + trailingIcon: Icons.add, + isTrustedContactScreen: true, + ), + body: SafeArea( + child: Column(children: [ + Expanded( + child: provider.trustedContacts.isEmpty + ? Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + Center( + child: Container( + padding: EdgeInsets.all(20.0), + decoration: BoxDecoration( + color: Color(0xffFCF9F9), + borderRadius: + BorderRadius.circular( + 80.toHeight)), + height: 160.toHeight, + width: 160.toHeight, + child: Image.asset(ImageConstants + .emptyTrustedSenders), + ), ), - ), - SizedBox(height: 20.toHeight), - Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Showcase( - key: _one, - description: - 'When someone on your Trusted Senders list sends you a file while you’re in the app, it will be automatically downloaded. If they send it when you’re not in the app, it will download the next time you open it.', - shapeBorder: CircleBorder(), - disableAnimation: true, - radius: BorderRadius.all( - Radius.circular(40)), - showArrow: false, - overlayPadding: EdgeInsets.all(5), - blurValue: 2, - child: Padding( - padding: EdgeInsets.symmetric( - horizontal: 10, vertical: 5), - child: Text( - pro_text_strings.TextStrings() - .noTrustedSenders, - style: CustomTextStyles - .primaryBold18, + SizedBox(height: 20.toHeight), + Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Showcase( + key: _one, + description: + 'When someone on your Trusted Senders list sends you a file while you’re in the app, it will be automatically downloaded. If they send it when you’re not in the app, it will download the next time you open it.', + shapeBorder: CircleBorder(), + disableAnimation: true, + radius: BorderRadius.all( + Radius.circular(40)), + showArrow: false, + overlayPadding: EdgeInsets.all(5), + blurValue: 2, + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: 10, vertical: 5), + child: Text( + pro_text_strings.TextStrings() + .noTrustedSenders, + style: CustomTextStyles + .primaryBold18, + ), ), ), - ), - GestureDetector( - onTap: () { - ShowCaseWidget.of(myContext!) - .startShowCase([_one]); - }, - child: Container( - decoration: BoxDecoration( - color: Colors.grey.shade400, - borderRadius: - BorderRadius.circular(50)), - margin: EdgeInsets.all(0), - height: 20, - width: 20, - child: Icon( - Icons.question_mark, - size: 15, + GestureDetector( + onTap: () { + ShowCaseWidget.of(myContext!) + .startShowCase([_one]); + }, + child: Container( + decoration: BoxDecoration( + color: Colors.grey.shade400, + borderRadius: + BorderRadius.circular( + 50)), + margin: EdgeInsets.all(0), + height: 20, + width: 20, + child: Icon( + Icons.question_mark, + size: 15, + ), ), ), - ), - ], - ), - SizedBox(height: 10.toHeight), - Text( - pro_text_strings.TextStrings() - .addTrustedSender, - style: - CustomTextStyles.secondaryRegular16, - textAlign: TextAlign.center, - ), - SizedBox( - height: 25.toHeight, - ), - CustomButton( - isOrange: true, - buttonText: - pro_text_strings.TextStrings().add, - height: 40.toHeight, - width: 115.toWidth, - onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - ContactsScreen( - asSelectionScreen: true, - selectedContactsHistory: [], - selectedList: (s) async { - for (var element in s) { - await provider - .addTrustedContacts( - element!); - } - })), - ); - }, - ) - ], - ) - : ListView.builder( - itemCount: provider.trustedContacts.length, - itemBuilder: (context, index) { - Uint8List? byteImage = - CommonUtilityFunctions() - .getCachedContactImage( - provider.trustedContacts[index].atSign!, - ); + ], + ), + SizedBox(height: 10.toHeight), + Text( + pro_text_strings.TextStrings() + .addTrustedSender, + style: + CustomTextStyles.secondaryRegular16, + textAlign: TextAlign.center, + ), + SizedBox( + height: 25.toHeight, + ), + CustomButton( + isOrange: true, + buttonText: + pro_text_strings.TextStrings().add, + height: 40.toHeight, + width: 115.toWidth, + onPressed: () { + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => + // ContactsScreen( + // asSelectionScreen: true, + // selectedContactsHistory: [], + // selectedList: (s) async { + // for (var element in s) { + // await provider + // .addTrustedContacts( + // element!); + // } + // })), + // ); + }, + ) + ], + ) + : ListView.builder( + itemCount: provider.trustedContacts.length, + itemBuilder: (context, index) { + Uint8List? byteImage = + CommonUtilityFunctions() + .getCachedContactImage( + provider.trustedContacts[index].atSign!, + ); - return ContactListTile( - plainView: true, - isSelected: false, - onlyRemoveMethod: true, - onTileTap: () { - showDialog( - context: context, - barrierDismissible: false, - builder: (context) => - RemoveTrustedContact( - pro_text_strings.TextStrings() - .removeTrustedSender, - contact: - provider.trustedContacts[index], - image: byteImage, - ), - ); - }, - onAdd: () {}, - onRemove: () {}, - name: provider.trustedContacts[index] - .tags != - null && - provider.trustedContacts[index] - .tags!['name'] != - null - ? provider.trustedContacts[index] - .tags!['name'] - : provider - .trustedContacts[index].atSign! - .substring(1), - atSign: provider - .trustedContacts[index].atSign, - image: byteImage != null - ? CustomCircleAvatar( - byteImage: byteImage, - nonAsset: true, - ) - : ContactInitial( - initials: provider - .trustedContacts[index] - .atSign, + return ContactListTile( + plainView: true, + isSelected: false, + onlyRemoveMethod: true, + onTileTap: () { + showDialog( + context: context, + barrierDismissible: false, + builder: (context) => + RemoveTrustedContact( + pro_text_strings.TextStrings() + .removeTrustedSender, + contact: provider + .trustedContacts[index], + image: byteImage, ), - ); - }, - )), - ]), - ), - ); - })); - })); + ); + }, + onAdd: () {}, + onRemove: () {}, + name: provider.trustedContacts[index] + .tags != + null && + provider.trustedContacts[index] + .tags!['name'] != + null + ? provider.trustedContacts[index] + .tags!['name'] + : provider + .trustedContacts[index].atSign! + .substring(1), + atSign: provider + .trustedContacts[index].atSign, + image: byteImage != null + ? CustomCircleAvatar( + byteImage: byteImage, + nonAsset: true, + ) + : ContactInitial( + initials: provider + .trustedContacts[index] + .atSign, + ), + ); + }, + )), + ]), + ), + ); + })); + })), + ); } } diff --git a/lib/screens/trusted_contacts/trusted_senders.dart b/lib/screens/trusted_contacts/trusted_senders.dart new file mode 100644 index 00000000..79088950 --- /dev/null +++ b/lib/screens/trusted_contacts/trusted_senders.dart @@ -0,0 +1,353 @@ +import 'package:at_common_flutter/at_common_flutter.dart'; +import 'package:at_contact/at_contact.dart'; +import 'package:at_contacts_flutter/screens/contacts_screen.dart'; +import 'package:atsign_atmosphere_pro/screens/common_widgets/custom_outlined_button.dart'; +import 'package:atsign_atmosphere_pro/utils/images.dart'; +import 'package:atsign_atmosphere_pro/utils/text_strings.dart'; +import 'package:atsign_atmosphere_pro/utils/text_styles.dart'; +import 'package:atsign_atmosphere_pro/view_models/trusted_sender_view_model.dart'; +import 'package:collection/collection.dart'; +import 'package:flutter/material.dart'; +import 'package:atsign_atmosphere_pro/utils/text_strings.dart' + as pro_text_strings; +import 'package:atsign_atmosphere_pro/screens/common_widgets/provider_handler.dart'; +import 'package:showcaseview/showcaseview.dart'; +import 'widgets/gradient_button.dart'; +import 'widgets/remove_trusted_contact.dart'; +import 'widgets/search_sender.dart'; +import 'widgets/sender_grid_item.dart'; + +class TrustedSenders extends StatefulWidget { + TrustedSenders({Key? key}) : super(key: key); + + @override + State createState() => _TrustedSendersState(); +} + +class _TrustedSendersState extends State { + Map> groupSendersAlphabetically( + List contacts) { + return groupBy(contacts, (AtContact e) => e.atSign!.substring(1, 2)); + } + + GlobalKey _one = GlobalKey(); + + BuildContext? myContext; + + @override + Widget build(BuildContext context) { + return ProviderHandler( + functionName: 'get_trusted_contacts', + load: (provider) async { + await provider.getTrustedContact(); + await provider.migrateTrustedContact(); + }, + showError: false, + errorBuilder: (provider) => Scaffold( + body: Center( + child: Text(TextStrings().errorOccured), + ), + ), + successBuilder: (provider) { + return ShowCaseWidget( + builder: Builder(builder: (context) { + myContext = context; + return Container( + height: MediaQuery.of(context).size.height - 118.toHeight, + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Colors.white.withOpacity(0.25), + blurRadius: 61, + offset: Offset(0, -2), + ), + ], + borderRadius: BorderRadius.circular(20.toWidth), + ), + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: 27.toWidth, vertical: 30.toHeight), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + height: 1, + width: 45.toWidth, + color: Colors.black, + ), + CustomOutlinedButton( + buttonText: TextStrings().buttonClose, + height: 36.toHeight, + width: 106.toWidth, + radius: 28.toWidth, + onPressed: () { + Navigator.pop(context); + }, + ), + ], + ), + Text( + TextStrings().trustedSenders, + style: CustomTextStyles.interBold.copyWith( + fontSize: 27.toFont, + ), + ), + SizedBox( + height: 20.toHeight, + ), + Expanded( + child: provider.trustedContacts.isEmpty + ? Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Center( + child: Container( + padding: EdgeInsets.all(20.0), + decoration: BoxDecoration( + color: Color(0xffFCF9F9), + borderRadius: BorderRadius.circular( + 80.toHeight)), + height: 160.toHeight, + width: 160.toHeight, + child: Image.asset( + ImageConstants.emptyTrustedSenders), + ), + ), + SizedBox(height: 20.toHeight), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Showcase( + key: _one, + description: + 'When someone on your Trusted Senders list sends you a file while you’re in the app, it will be automatically downloaded. If they send it when you’re not in the app, it will download the next time you open it.', + shapeBorder: CircleBorder(), + disableAnimation: true, + radius: BorderRadius.all( + Radius.circular(40)), + showArrow: false, + overlayPadding: EdgeInsets.all(5), + blurValue: 2, + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: 10, vertical: 5), + child: Text( + pro_text_strings.TextStrings() + .noTrustedSenders, + style: + CustomTextStyles.primaryBold18, + ), + ), + ), + GestureDetector( + onTap: () { + // ShowCaseWidget.of(myContext!) + // .startShowCase([_one]); + }, + child: Container( + decoration: BoxDecoration( + color: Colors.grey.shade400, + borderRadius: + BorderRadius.circular(50)), + margin: EdgeInsets.all(0), + height: 20, + width: 20, + child: Icon( + Icons.question_mark, + size: 15, + ), + ), + ), + ], + ), + SizedBox(height: 10.toHeight), + Text( + pro_text_strings.TextStrings() + .addTrustedSender, + style: CustomTextStyles.secondaryRegular16, + textAlign: TextAlign.center, + ), + SizedBox( + height: 25.toHeight, + ), + ], + ) + : Column( + children: [ + SearchSender( + onSearch: provider.searchTrustedContacts, + ), + SizedBox( + height: 22.toHeight, + ), + Expanded( + child: RawScrollbar( + thumbColor: Color(0xFFE3E3E3), + radius: Radius.circular(11.toWidth), + thickness: 5.toWidth, + thumbVisibility: true, + interactive: true, + child: provider.searchedTrustedContacts + .isNotEmpty + ? TrustedContactListGrid( + trustedContact: provider + .searchedTrustedContacts, + ) + : ListView.builder( + itemCount: + groupSendersAlphabetically( + provider + .trustedContacts) + .keys + .length, + itemBuilder: + (context, int index) { + final item = + groupSendersAlphabetically( + provider + .trustedContacts) + .keys + .toList()[index]; + final trustedContact = + groupSendersAlphabetically( + provider + .trustedContacts)[ + item]; + return Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + SizedBox( + height: 22.toHeight, + ), + Row( + children: [ + Text( + item.toUpperCase(), + style: + CustomTextStyles + .interBold, + ), + SizedBox( + width: 19.toWidth, + ), + Expanded( + child: Divider( + color: Color( + 0xffD9D9D9), + thickness: + 1.toWidth, + height: 1.toHeight, + ), + ), + ], + ), + SizedBox( + height: 22.toHeight, + ), + TrustedContactListGrid( + trustedContact: + trustedContact!), + ], + ); + }), + ), + ), + SizedBox( + height: 10.toHeight, + ), + ], + ), + ), + GradientButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ContactsScreen( + asSelectionScreen: true, + selectedContactsHistory: [], + selectedList: (s) async { + for (var element in s) { + await provider + .addTrustedContacts(element!); + } + }))); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + ImageConstants.plus, + cacheHeight: 16, + cacheWidth: 20, + ), + SizedBox( + width: 10.toWidth, + ), + Text( + 'Add atSign', + style: CustomTextStyles.interBold.copyWith( + color: Colors.white, + fontSize: 15.toFont, + ), + ), + ], + ), + ) + ], + ), + ), + ); + }), + ); + }); + } +} + +class TrustedContactListGrid extends StatelessWidget { + const TrustedContactListGrid({ + Key? key, + required this.trustedContact, + }) : super(key: key); + + final List trustedContact; + + @override + Widget build(BuildContext context) { + return GridView.builder( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: trustedContact.length, + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + // childAspectRatio: 0.8, + crossAxisSpacing: 13.toWidth, + mainAxisSpacing: 10.toHeight, + mainAxisExtent: 65.toHeight, + ), + itemBuilder: (context, int index) { + final atContact = trustedContact[index]; + return InkWell( + onTap: () { + showDialog( + context: context, + builder: (context) => AlertDialog( + contentPadding: EdgeInsets.zero, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.toWidth), + ), + content: RemoveConfirmation(atContact: atContact), + )); + }, + child: SenderGridItem(atContact: atContact), + ); + }, + ); + } +} diff --git a/lib/screens/trusted_contacts/widgets/gradient_button.dart b/lib/screens/trusted_contacts/widgets/gradient_button.dart new file mode 100644 index 00000000..a58669aa --- /dev/null +++ b/lib/screens/trusted_contacts/widgets/gradient_button.dart @@ -0,0 +1,39 @@ +import 'package:at_common_flutter/services/size_config.dart'; +import 'package:atsign_atmosphere_pro/utils/colors.dart'; +import 'package:flutter/material.dart'; + +class GradientButton extends StatelessWidget { + final Widget child; + final Function()? onPressed; + const GradientButton({ + Key? key, + required this.child, + required this.onPressed, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return Container( + height: 59.toHeight, + width: double.infinity, + decoration: BoxDecoration( + gradient: LinearGradient(colors: [ + ColorConstants.orangeColor, + ColorConstants.yellow, + ]), + borderRadius: BorderRadius.circular(10.toWidth), + ), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: Colors.transparent, + shadowColor: Colors.transparent, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.toWidth), + ), + ), + onPressed: onPressed, + child: child, + ), + ); + } +} diff --git a/lib/screens/trusted_contacts/widgets/remove_trusted_contact.dart b/lib/screens/trusted_contacts/widgets/remove_trusted_contact.dart new file mode 100644 index 00000000..4462e20d --- /dev/null +++ b/lib/screens/trusted_contacts/widgets/remove_trusted_contact.dart @@ -0,0 +1,138 @@ +import 'package:at_common_flutter/services/size_config.dart'; +import 'package:at_contact/at_contact.dart'; +import 'package:atsign_atmosphere_pro/screens/common_widgets/custom_outlined_button.dart'; +import 'package:atsign_atmosphere_pro/utils/colors.dart'; +import 'package:atsign_atmosphere_pro/utils/text_styles.dart'; +import 'package:atsign_atmosphere_pro/view_models/trusted_sender_view_model.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class RemoveConfirmation extends StatelessWidget { + const RemoveConfirmation({ + Key? key, + required this.atContact, + }) : super(key: key); + + // final Map user; + final AtContact atContact; + + @override + Widget build(BuildContext context) { + return Container( + height: 230.toHeight, + decoration: BoxDecoration( + color: Colors.white.withOpacity(0.025), + + boxShadow: [ + BoxShadow( + color: Color.fromRGBO(0, 0, 0, 0.25), + blurRadius: 24, + spreadRadius: 10, + offset: Offset(0, 4), + ), + ], + // color: Colors.green, + borderRadius: BorderRadius.circular(10.toWidth), + ), + child: Padding( + padding: EdgeInsets.symmetric(vertical: 32.toHeight), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + 'Are you sure that you want to', + style: CustomTextStyles.interSemiBold, + ), + SizedBox( + height: 10.toHeight, + ), + Text( + 'Remove', + style: CustomTextStyles.interBold.copyWith( + fontSize: 16.toFont, + ), + ), + SizedBox( + height: 11.toHeight, + ), + Text( + '${atContact.atSign}', + style: CustomTextStyles.interRegular, + ), + SizedBox( + height: 16.toHeight, + ), + CustomOutlinedButton( + height: 28.toHeight, + width: 115.toWidth, + radius: 10.toWidth, + onPressed: () async { + var res = await Provider.of(context, + listen: false) + .removeTrustedContacts(atContact); + if (res) { + Navigator.pop(context); + } else { + Navigator.pop(context); + ScaffoldMessenger.of(context).showSnackBar(SnackBar( + backgroundColor: ColorConstants.red, + content: Text( + 'Error occured to delete the atKey', + style: CustomTextStyles.secondaryRegular14, + ), + )); + } + // Navigator.pop(context); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'Confirm', + style: CustomTextStyles.interBold.copyWith( + fontSize: 10.toFont, + color: ColorConstants.outlineGrey, + ), + ), + SizedBox( + width: 10.toWidth, + ), + Container( + height: 18.33.toHeight, + width: 18.33.toWidth, + decoration: BoxDecoration( + color: Colors.green, + border: Border.all(color: Colors.black, width: 2), + borderRadius: BorderRadius.circular(60)), + child: Center( + child: Icon( + Icons.check_rounded, + color: Colors.black, + size: 12.toWidth, + ), + ), + ), + ], + )), + SizedBox( + height: 18.toHeight, + ), + GestureDetector( + onTap: () { + Navigator.pop(context); + }, + child: Text( + 'Cancel', + style: CustomTextStyles.interRegular.copyWith( + fontSize: 10.toFont, + decoration: TextDecoration.underline, + color: Color(0xFFA4A4A5), + ), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/screens/trusted_contacts/widgets/search_sender.dart b/lib/screens/trusted_contacts/widgets/search_sender.dart new file mode 100644 index 00000000..4a46d95b --- /dev/null +++ b/lib/screens/trusted_contacts/widgets/search_sender.dart @@ -0,0 +1,57 @@ +import 'package:at_common_flutter/services/size_config.dart'; +import 'package:atsign_atmosphere_pro/utils/images.dart'; +import 'package:atsign_atmosphere_pro/utils/text_styles.dart'; +import 'package:flutter/material.dart'; + +class SearchSender extends StatelessWidget { + final Function(String)? onSearch; + const SearchSender({ + Key? key, + required this.onSearch, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return SizedBox( + height: 44.toHeight, + child: TextField( + textAlignVertical: TextAlignVertical.center, + onChanged: onSearch, + decoration: InputDecoration( + contentPadding: EdgeInsets.symmetric( + horizontal: 13.toWidth, + vertical: 16.toHeight, + ), + hintText: 'Search by atSign or nickname', + hintStyle: CustomTextStyles.interRegular.copyWith( + color: Color(0xff9B9B9B), + fontStyle: FontStyle.italic, + ), + suffixIcon: Image.asset( + ImageConstants.search, + cacheHeight: 20, + cacheWidth: 20, + ), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(10.toWidth), + borderSide: BorderSide( + color: Color(0xff9B9B9B), + ), + ), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(10.toWidth), + borderSide: BorderSide( + color: Color(0xff9B9B9B), + ), + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(10.toWidth), + borderSide: BorderSide( + color: Color(0xff9B9B9B), + ), + ), + ), + ), + ); + } +} diff --git a/lib/screens/trusted_contacts/widgets/sender_grid_item.dart b/lib/screens/trusted_contacts/widgets/sender_grid_item.dart new file mode 100644 index 00000000..b13c2adf --- /dev/null +++ b/lib/screens/trusted_contacts/widgets/sender_grid_item.dart @@ -0,0 +1,105 @@ +import 'package:at_common_flutter/services/size_config.dart'; +import 'package:at_contact/at_contact.dart'; +import 'package:atsign_atmosphere_pro/services/common_utility_functions.dart'; +import 'package:atsign_atmosphere_pro/utils/colors.dart'; +import 'package:atsign_atmosphere_pro/utils/images.dart'; +import 'package:atsign_atmosphere_pro/utils/text_styles.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +class SenderGridItem extends StatelessWidget { + const SenderGridItem({ + Key? key, + required this.atContact, + }) : super(key: key); + final AtContact atContact; + // final Map user; + Uint8List? get byteImage => + CommonUtilityFunctions().getCachedContactImage(atContact.atSign!); + @override + Widget build(BuildContext context) { + return Container( + decoration: BoxDecoration( + border: Border.all( + color: ColorConstants.textBoxBg, + width: 1, + ), + borderRadius: BorderRadius.circular(10.toWidth), + ), + child: Padding( + padding: EdgeInsets.symmetric( + vertical: 10.toHeight, + // horizontal: 5.toWidth, + ), + child: Row( + children: [ + SizedBox( + width: 5.toWidth, + ), + Stack( + clipBehavior: Clip.none, + children: [ + Container( + height: 39.toHeight, + width: 39.toWidth, + child: byteImage == null + ? CircleAvatar( + backgroundColor: ColorConstants.textBoxBg, + child: Text( + atContact.atSign!.substring(1, 3).toUpperCase(), + style: CustomTextStyles.redSmall12, + ), + ) + : SizedBox(), + decoration: byteImage != null + ? BoxDecoration( + shape: BoxShape.circle, + image: DecorationImage( + image: MemoryImage(byteImage!), + fit: BoxFit.cover, + ), + ) + : null, + ), + Positioned( + top: -9, + left: -5, + child: Image.asset( + ImageConstants.verified, + height: 24.toHeight, + width: 24.toWidth, + ), + ), + ], + ), + SizedBox( + width: 7.toWidth, + ), + Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + atContact.atSign!, + overflow: TextOverflow.ellipsis, + style: CustomTextStyles.interSemiBold.copyWith( + color: Colors.black, + ), + ), + atContact.tags != null && atContact.tags!['nickname'] != null + ? Text( + '${atContact.tags!['nickname']}', + style: CustomTextStyles.interRegular.copyWith( + fontSize: 8.toFont, + ), + ) + : SizedBox(), + ], + ), + Spacer(), + ], + ), + ), + ); + } +} diff --git a/lib/screens/welcome_screen/widgets/welcome_sceen_home.dart b/lib/screens/welcome_screen/widgets/welcome_sceen_home.dart index 1f3dcb84..555cf1ee 100644 --- a/lib/screens/welcome_screen/widgets/welcome_sceen_home.dart +++ b/lib/screens/welcome_screen/widgets/welcome_sceen_home.dart @@ -1,11 +1,14 @@ import 'dart:async'; +import 'dart:ui'; import 'package:at_client_mobile/at_client_mobile.dart'; import 'package:at_contact/at_contact.dart'; import 'package:atsign_atmosphere_pro/screens/common_widgets/common_button.dart'; import 'package:atsign_atmosphere_pro/screens/common_widgets/custom_heading.dart'; +import 'package:atsign_atmosphere_pro/screens/common_widgets/custom_outlined_button.dart'; import 'package:atsign_atmosphere_pro/screens/common_widgets/side_bar.dart'; import 'package:atsign_atmosphere_pro/screens/common_widgets/switch_at_sign.dart'; +import 'package:atsign_atmosphere_pro/screens/trusted_contacts/trusted_senders.dart'; import 'package:atsign_atmosphere_pro/screens/welcome_screen/widgets/overlapping_contacts.dart'; import 'package:atsign_atmosphere_pro/screens/welcome_screen/widgets/select_contact_widget.dart'; import 'package:atsign_atmosphere_pro/screens/welcome_screen/widgets/select_file_widget.dart'; diff --git a/lib/utils/colors.dart b/lib/utils/colors.dart index fb8dd7a0..03c09dfe 100644 --- a/lib/utils/colors.dart +++ b/lib/utils/colors.dart @@ -33,6 +33,7 @@ class ColorConstants { static const Color light_border_color = Color(0xFFEEF1F4); static const Color textBoxBg = Color(0xFFF2F2F2); static const Color lightBlueBg = Color(0xFFF8FBFF); + static const Color outlineGrey = Color(0xFF939393); //NEW UI COLORS static const Color fadedGreyN = Color(0xFFF1F1F1); diff --git a/lib/utils/images.dart b/lib/utils/images.dart index 0b2df96a..8ed530f4 100644 --- a/lib/utils/images.dart +++ b/lib/utils/images.dart @@ -40,6 +40,9 @@ class ImageConstants { static String myFiles = '$_basePath/my_files.png'; static String groups = '$_basePath/groups.png'; static String contactUs = '$_basePath/contactUs.png'; + static String search = '$_basePath/search.png'; + static String plus = '$_basePath/plus.png'; + static String verified = '$_basePath/verified.png'; static String settings = '$_basePath/settings.png'; // TEST FILE DELETE WHEN IN PRODUCTION static String test = '$_basePath/test.jpg'; diff --git a/lib/utils/text_styles.dart b/lib/utils/text_styles.dart index e9b1368d..ca2d7b53 100644 --- a/lib/utils/text_styles.dart +++ b/lib/utils/text_styles.dart @@ -318,6 +318,27 @@ class CustomTextStyles { fontWeight: FontWeight.w600, ); + //INTER FONTS + static TextStyle interBold = TextStyle( + color: Colors.black, + fontSize: 20.toFont, + fontFamily: 'Inter', + fontWeight: FontWeight.w700, + ); + + static TextStyle interSemiBold = TextStyle( + fontSize: 10.toFont, + fontFamily: 'Inter', + color: Color(0xFF7B7B7B), + fontWeight: FontWeight.w600, + ); + + static TextStyle interRegular = TextStyle( + fontSize: 14.toFont, + fontFamily: 'Inter', + color: Colors.black, + fontWeight: FontWeight.w400, + ); static TextStyle desktopButton15 = TextStyle( color: Colors.white, fontSize: 15, diff --git a/lib/view_models/trusted_sender_view_model.dart b/lib/view_models/trusted_sender_view_model.dart index 97e14bb8..9bf746f0 100644 --- a/lib/view_models/trusted_sender_view_model.dart +++ b/lib/view_models/trusted_sender_view_model.dart @@ -3,17 +3,17 @@ import 'dart:convert'; import 'package:at_client_mobile/at_client_mobile.dart'; import 'package:at_contact/at_contact.dart'; import 'package:atsign_atmosphere_pro/services/backend_service.dart'; -import 'package:atsign_atmosphere_pro/services/exception_service.dart'; import 'package:atsign_atmosphere_pro/view_models/base_model.dart'; -import 'package:flutter/material.dart'; class TrustedContactProvider extends BaseModel { TrustedContactProvider._(); static TrustedContactProvider _instance = TrustedContactProvider._(); factory TrustedContactProvider() => _instance; String AddTrustedContacts = 'add_trusted_contacts'; + String SearchTrustedContacts = 'add_trusted_contacts'; List _trustedContacts = []; List get trustedContacts => _trustedContacts; + List searchedTrustedContacts = []; var jsonValue; List new_trustedContactsKeys = []; @@ -171,4 +171,22 @@ class TrustedContactProvider extends BaseModel { setError(GetTrustedContacts, e.toString()); } } + + searchTrustedContacts(String query) async { + setStatus(SearchTrustedContacts, Status.Loading); + searchedTrustedContacts.clear(); + if (query.isEmpty) { + setStatus(SearchTrustedContacts, Status.Done); + return; + } + + query = query.replaceAll("@", ""); + for (AtContact? contact in _trustedContacts) { + if (contact!.atSign!.contains(query)) { + searchedTrustedContacts.add(contact); + } + } + setStatus(SearchTrustedContacts, Status.Done); + // return searchedTrustedContacts; + } } diff --git a/pubspec.lock b/pubspec.lock index 3d613a8c..43b58f56 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -232,7 +232,7 @@ packages: source: hosted version: "1.1.1" collection: - dependency: transitive + dependency: "direct main" description: name: collection url: "https://pub.dartlang.org" @@ -467,6 +467,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.6.0" + flutter_svg: + dependency: "direct main" + description: + name: flutter_svg + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.6" flutter_test: dependency: "direct dev" description: flutter @@ -623,7 +630,7 @@ packages: name: material_color_utilities url: "https://pub.dartlang.org" source: hosted - version: "0.1.5" + version: "0.2.0" meta: dependency: transitive description: @@ -743,6 +750,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.8.2" + path_drawing: + dependency: transitive + description: + name: path_drawing + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" + path_parsing: + dependency: transitive + description: + name: path_parsing + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" path_provider: dependency: transitive description: @@ -1090,7 +1111,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.9.0" + version: "1.9.1" stack_trace: dependency: transitive description: @@ -1125,21 +1146,21 @@ packages: name: test url: "https://pub.dartlang.org" source: hosted - version: "1.21.4" + version: "1.21.5" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.12" + version: "0.4.13" test_core: dependency: transitive description: name: test_core url: "https://pub.dartlang.org" source: hosted - version: "0.4.16" + version: "0.4.17" timezone: dependency: transitive description: @@ -1223,7 +1244,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "2.1.3" video_compress: dependency: "direct main" description: @@ -1330,5 +1351,5 @@ packages: source: hosted version: "0.1.0" sdks: - dart: ">=2.17.0 <3.0.0" + dart: ">=2.18.0-146.0.dev <3.0.0" flutter: ">=3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index ae1a3982..cfbb0d7b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,33 +15,51 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html - # Mobile version version: 1.0.8+48 # Desktop version macos # version: 1.0.1+19 - # Desktop version windows # version: 1.0.1+1 - environment: sdk: ">=2.12.0 <3.0.0" dependencies: - flutter: - sdk: flutter archive: ^3.2.2 + at_backupkey_flutter: ^4.0.5 + at_client_mobile: ^3.2.5 + at_common_flutter: ^2.0.10 + at_commons: ^3.0.25 + at_contact: ^3.0.7 + at_contacts_flutter: ^4.0.7 + at_contacts_group_flutter: ^4.0.9 + at_onboarding_flutter: ^5.0.2 + at_sync_ui_flutter: ^1.0.6 + biometric_storage: ^4.1.3 + carousel_slider: ^4.0.0 + collection: ^1.16.0 cupertino_icons: ^0.1.3 + desktop_window: ^0.4.0 file_picker: ^4.5.1 + file_selector: ^0.8.3 + file_selector_macos: ^0.8.2 filesystem_picker: ^2.0.0-nullsafety.0 - desktop_window: ^0.4.0 + flutter: + sdk: flutter flutter_keychain: ^2.1.0 flutter_local_notifications: ^9.4.0 flutter_slidable: ^0.6.0 + flutter_svg: ^1.1.6 + flutter_toastr: ^1.0.3 + fluttertoast: ^8.0.9 google_fonts: ^2.3.1 + http: ^0.13.4 intl: ^0.17.0 + local_notifier: ^0.1.1 + new_version: ^0.3.0 open_file: ^3.2.1 + package_info_plus: ^1.4.2 pedantic: ^1.11.1 permission_handler: ^9.2.0 provider: ^6.0.2 @@ -49,33 +67,11 @@ dependencies: receive_sharing_intent: ^1.4.5 rxdart: ^0.27.3 share_plus: ^4.0.1 + showcaseview: ^1.1.5 url_launcher: ^6.0.20 + video_compress: ^3.1.0 video_thumbnail: ^0.4.6 webview_flutter: ^3.0.4 - http: ^0.13.4 - package_info_plus: ^1.4.2 - fluttertoast: ^8.0.9 - file_selector: ^0.8.3 - file_selector_macos: ^0.8.2 - carousel_slider: ^4.0.0 - flutter_toastr: ^1.0.3 - video_compress: ^3.1.0 - new_version: ^0.3.0 - - at_commons: ^3.0.25 - at_contact: ^3.0.7 - at_common_flutter: ^2.0.10 - - at_client_mobile: ^3.2.5 - at_onboarding_flutter: ^5.0.2 - at_backupkey_flutter: ^4.0.5 - at_contacts_flutter: ^4.0.7 - at_contacts_group_flutter: ^4.0.9 - local_notifier: ^0.1.1 - at_sync_ui_flutter: ^1.0.6 - showcaseview: ^1.1.5 - biometric_storage: ^4.1.3 - flutter_svg: ^1.1.5 dev_dependencies: flutter_test: @@ -136,6 +132,14 @@ flutter: - asset: assets/fonts/HelveticaExtraBold.ttf weight: 800 # style: italic + - family: Inter + fonts: + - asset: assets/fonts/Inter-Regular.ttf + weight: 400 + - asset: assets/fonts/Inter-SemiBold.ttf + weight: 600 + - asset: assets/fonts/Inter-Bold.ttf + weight: 700 - family: PlayfairDisplay fonts: - asset: assets/fonts/Playfair_Display/PlayfairDisplay-Bold.ttf @@ -158,7 +162,6 @@ flutter: # # For details regarding fonts from package dependencies, # see https://flutter.dev/custom-fonts/#from-packages - msix_config: display_name: "atmospherePro" publisher_display_name: "The @ Company"