diff --git a/lib/screens/contact_new_version/add_contact_screen.dart b/lib/screens/contact_new_version/add_contact_screen.dart index c088df95..bd85fd9a 100644 --- a/lib/screens/contact_new_version/add_contact_screen.dart +++ b/lib/screens/contact_new_version/add_contact_screen.dart @@ -129,11 +129,10 @@ class _AddContactScreenState extends State { mainAxisSize: MainAxisSize.min, children: [ const Text( - "atSign verified", + "atSign valid", style: TextStyle( fontSize: 14, fontWeight: FontWeight.w500, - color: Color(0xffCACACA), ), ), const SizedBox(width: 10), @@ -181,7 +180,9 @@ class _AddContactScreenState extends State { height: 60, width: double.infinity, decoration: BoxDecoration( - color: Colors.black, + color: !state.isVerify + ? ColorConstants.buttonGrey + : Colors.black, borderRadius: BorderRadius.circular(8), ), child: const Center( @@ -208,8 +209,7 @@ class _AddContactScreenState extends State { } void _checkValid() { - if (atSignController.text.isNotEmpty && - nicknameController.text.isNotEmpty) { + if (atSignController.text.isNotEmpty) { addContactProvider.changeVerifyStatus(true); } else { addContactProvider.changeVerifyStatus(false); diff --git a/lib/screens/contact_new_version/contact_detail_screen.dart b/lib/screens/contact_new_version/contact_detail_screen.dart index 53239ec0..d37f3c73 100644 --- a/lib/screens/contact_new_version/contact_detail_screen.dart +++ b/lib/screens/contact_new_version/contact_detail_screen.dart @@ -1,10 +1,12 @@ import 'package:at_contact/at_contact.dart'; import 'package:at_contacts_flutter/services/contact_service.dart'; +import 'package:at_contacts_group_flutter/models/group_contacts_model.dart'; import 'package:atsign_atmosphere_pro/screens/common_widgets/avatar_widget.dart'; import 'package:atsign_atmosphere_pro/screens/common_widgets/card_widget.dart'; import 'package:atsign_atmosphere_pro/utils/colors.dart'; import 'package:atsign_atmosphere_pro/utils/vectors.dart'; import 'package:atsign_atmosphere_pro/view_models/trusted_sender_view_model.dart'; +import 'package:atsign_atmosphere_pro/view_models/welcome_screen_view_model.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -23,12 +25,14 @@ class ContactDetailScreen extends StatefulWidget { class _ContactDetailScreenState extends State { late TrustedContactProvider _trustedContactProvider; late ContactService _contactService; + late WelcomeScreenProvider _welcomeScreenProvider; bool isTrusted = false; @override void initState() { _trustedContactProvider = TrustedContactProvider(); + _welcomeScreenProvider = WelcomeScreenProvider(); _contactService = ContactService(); checkTrustedContact(); super.initState(); @@ -158,36 +162,48 @@ class _ContactDetailScreenState extends State { child: Column( mainAxisSize: MainAxisSize.min, children: [ - Container( - height: 63, - decoration: BoxDecoration( - gradient: const LinearGradient( - begin: Alignment.topLeft, - end: Alignment.bottomRight, - colors: [ - Color(0xfff05e3f), - Color(0xffeaa743), - ], + InkWell( + onTap: () { + Navigator.of(context).pop(false); + _welcomeScreenProvider.selectedContacts = [ + GroupContactsModel( + contactType: ContactsType.CONTACT, + contact: widget.contact, + ), + ]; + _welcomeScreenProvider.changeBottomNavigationIndex(0); + }, + child: Container( + height: 63, + decoration: BoxDecoration( + gradient: const LinearGradient( + begin: Alignment.topLeft, + end: Alignment.bottomRight, + colors: [ + ColorConstants.orangeColor, + ColorConstants.yellow, + ], + ), + borderRadius: BorderRadius.circular(10), ), - borderRadius: BorderRadius.circular(10), - ), - child: Center( - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - const Text( - "Transfer Now", - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w700, - color: Colors.white, + child: Center( + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + const Text( + "Transfer Now", + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.w700, + color: Colors.white, + ), ), - ), - const SizedBox(width: 24), - SvgPicture.asset( - AppVectors.icArrow, - ), - ], + const SizedBox(width: 24), + SvgPicture.asset( + AppVectors.icArrow, + ), + ], + ), ), ), ), @@ -231,7 +247,7 @@ class _ContactDetailScreenState extends State { await _contactService.deleteAtSign( atSign: widget.contact.atSign!, ); - Navigator.of(context).pop(true); + Navigator.of(context).pop(); }, ), const SizedBox(height: 25), @@ -243,7 +259,7 @@ class _ContactDetailScreenState extends State { contact: widget.contact, blockAction: true, ); - Navigator.of(context).pop(true); + Navigator.of(context).pop(); }, ), const SizedBox(height: 25), diff --git a/lib/screens/contact_new_version/contact_screen.dart b/lib/screens/contact_new_version/contact_screen.dart index 9e2bf444..fce04d04 100644 --- a/lib/screens/contact_new_version/contact_screen.dart +++ b/lib/screens/contact_new_version/contact_screen.dart @@ -7,6 +7,7 @@ import 'package:atsign_atmosphere_pro/screens/contact_new_version/contact_detail import 'package:atsign_atmosphere_pro/screens/contact_new_version/group_contact_screen.dart'; import 'package:atsign_atmosphere_pro/screens/contact_new_version/trusted_contact_screen.dart'; import 'package:atsign_atmosphere_pro/utils/colors.dart'; +import 'package:atsign_atmosphere_pro/utils/images.dart'; import 'package:atsign_atmosphere_pro/utils/vectors.dart'; import 'package:atsign_atmosphere_pro/view_models/trusted_sender_view_model.dart'; import 'package:flutter/material.dart'; @@ -61,7 +62,21 @@ class _ContactScreenState extends State { ), ), ), - body: buildBody(), + body: Stack( + children: [ + Container( + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage( + ImageConstants.welcomeBackground, + ), + fit: BoxFit.fill, + ), + ), + ), + buildBody(), + ], + ), ); } @@ -126,7 +141,7 @@ class _ContactScreenState extends State { child: ListContactScreen( contactsTrusted: trustedProvider.trustedContacts, onTapContact: (contact) async { - await showModalBottomSheet( + final result = await showModalBottomSheet( context: context, isScrollControlled: true, useRootNavigator: true, @@ -137,8 +152,9 @@ class _ContactScreenState extends State { ); }, ); - - reloadPage(); + if (result != false) { + reloadPage(); + } }, ), ), diff --git a/lib/screens/history/transfer_history_screen.dart b/lib/screens/history/transfer_history_screen.dart index cd4fca1e..c4b22528 100644 --- a/lib/screens/history/transfer_history_screen.dart +++ b/lib/screens/history/transfer_history_screen.dart @@ -11,6 +11,7 @@ import 'package:atsign_atmosphere_pro/screens/history/widgets/filter_item_widget import 'package:atsign_atmosphere_pro/utils/app_utils.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/vectors.dart'; import 'package:atsign_atmosphere_pro/view_models/history_provider.dart'; import 'package:flutter/material.dart'; @@ -53,7 +54,21 @@ class _TransferHistoryScreenState extends State { height: 130, title: "Transfer History", ), - body: buildBody(), + body: Stack( + children: [ + Container( + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage( + ImageConstants.welcomeBackground, + ), + fit: BoxFit.fill, + ), + ), + ), + buildBody(), + ], + ), ); } diff --git a/lib/screens/my_files/my_files_screen.dart b/lib/screens/my_files/my_files_screen.dart index 1e224dbe..990b420a 100644 --- a/lib/screens/my_files/my_files_screen.dart +++ b/lib/screens/my_files/my_files_screen.dart @@ -1,12 +1,14 @@ -import 'dart:math'; +import 'dart:io'; import 'package:atsign_atmosphere_pro/data_models/enums/file_types.dart'; import 'package:atsign_atmosphere_pro/screens/common_widgets/app_bar_custom.dart'; import 'package:atsign_atmosphere_pro/screens/common_widgets/option_header_widget.dart'; import 'package:atsign_atmosphere_pro/screens/common_widgets/provider_handler.dart'; +import 'package:atsign_atmosphere_pro/screens/history/widgets/edit_bottomsheet.dart'; import 'package:atsign_atmosphere_pro/screens/my_files/widgets/downloads_folders.dart'; import 'package:atsign_atmosphere_pro/screens/my_files/widgets/videos.dart'; import 'package:at_common_flutter/services/size_config.dart'; +import 'package:atsign_atmosphere_pro/services/navigation_service.dart'; import 'package:atsign_atmosphere_pro/utils/app_utils.dart'; import 'package:atsign_atmosphere_pro/utils/colors.dart'; import 'package:atsign_atmosphere_pro/utils/images.dart'; @@ -47,7 +49,21 @@ class _MyFilesScreenState extends State { title: "My Files", description: '${provider.allFiles.length}', ), - body: buildBody(), + body: Stack( + children: [ + Container( + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage( + ImageConstants.welcomeBackground, + ), + fit: BoxFit.fill, + ), + ), + ), + buildBody(), + ], + ), ); } @@ -56,13 +72,17 @@ class _MyFilesScreenState extends State { children: [ OptionHeaderWidget( controller: searchController, - onSearch: (content){ - + onSearch: (content) { + provider.setFileSearchText(content); }, onReloadCallback: () async { await provider.getMyFilesRecords(); await provider.getAllFiles(); }, + searchOffCallBack: () { + searchController.clear(); + provider.setFileSearchText(''); + }, filterWidget: Consumer( builder: (context, provider, _) { return DropdownButtonHideUnderline( @@ -179,7 +199,15 @@ class _MyFilesScreenState extends State { functionName: 'all_files', showError: false, successBuilder: (provider) { - return (provider.displayFiles.isEmpty) + final listFile = provider.displayFiles + .where( + (element) => (element.fileName ?? '').contains( + provider.fileSearchText, + ), + ) + .toList(); + + return (listFile.isEmpty) ? Center( child: Text( TextStrings().noFilesRecieved, @@ -191,15 +219,24 @@ class _MyFilesScreenState extends State { ) : Scrollbar( child: ListView.builder( - itemCount: provider.displayFiles.length, - physics: ClampingScrollPhysics(), + itemCount: listFile.length, + physics: AlwaysScrollableScrollPhysics(), padding: EdgeInsets.only( - top: 24.toHeight, left: 28, right: 28), + top: 24.toHeight, + left: 28, + right: 28, + ), itemBuilder: (context, index) { return InkWell( onTap: () async { await openFilePath( - provider.displayFiles[index].filePath!, + listFile[index].filePath!, + ); + }, + onLongPress: () { + deleteFile( + listFile[index].filePath!, + fileTransferId: listFile[index].fileTransferId, ); }, child: Container( @@ -224,7 +261,7 @@ class _MyFilesScreenState extends State { children: [ Flexible( child: Text( - "${provider.displayFiles[index].fileName}", + "${listFile[index].fileName}", maxLines: 2, style: TextStyle( color: ColorConstants.grayText, @@ -236,9 +273,7 @@ class _MyFilesScreenState extends State { SizedBox(height: 2), Text( AppUtils.getFileSizeString( - bytes: provider - .displayFiles[index].size ?? - 0, + bytes: listFile[index].size ?? 0, decimals: 2, ), style: TextStyle( @@ -266,51 +301,26 @@ class _MyFilesScreenState extends State { ); } - Widget fileCard(String? title, String? filePath, {String? fileTransferId}) { - return InkWell( - onLongPress: () { - // deleteFile(filePath!, fileTransferId: fileTransferId); - }, - child: Column( - children: [ - filePath != null - ? Container( - width: 80.toHeight, - height: 80.toHeight, - color: Colors.purple, - // child: thumbnail(filePath.split('.').last, filePath), - ) - : Container( - width: 80.toHeight, - height: 80.toHeight, - child: ClipRect( - child: Image.asset( - ImageConstants.emptyTrustedSenders, - fit: BoxFit.fill, - ), - ), - ), - title != null - ? Container( - width: 100.toHeight, - height: 30.toHeight, - child: Padding( - padding: const EdgeInsets.only(top: 5.0), - child: Text( - title, - style: TextStyle( - color: Color(0xFF8A8E95), - fontSize: 12.toFont, - fontWeight: FontWeight.normal, - ), - textAlign: TextAlign.center, - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - ), - ) - : SizedBox() - ], + deleteFile(String filePath, {String? fileTransferId}) async { + await showModalBottomSheet( + context: NavService.navKey.currentContext!, + backgroundColor: Colors.white, + builder: (context) => EditBottomSheet( + onConfirmation: () async { + var file = File(filePath); + if (await file.exists()) { + file.deleteSync(); + } + if (fileTransferId != null) { + await Provider.of( + NavService.navKey.currentContext!, + listen: false) + .removeParticularFile(fileTransferId, + filePath.split(Platform.pathSeparator).last); + } + await provider.getAllFiles(); + }, + deleteMessage: TextStrings.deleteFileConfirmationMsgMyFiles, ), ); } diff --git a/lib/screens/settings/settings_screen.dart b/lib/screens/settings/settings_screen.dart index 4490e546..634ef008 100644 --- a/lib/screens/settings/settings_screen.dart +++ b/lib/screens/settings/settings_screen.dart @@ -3,6 +3,7 @@ import 'package:at_client_mobile/at_client_mobile.dart'; import 'package:at_common_flutter/services/size_config.dart'; import 'package:atsign_atmosphere_pro/routes/route_names.dart'; import 'package:atsign_atmosphere_pro/screens/common_widgets/app_bar.dart'; +import 'package:atsign_atmosphere_pro/screens/common_widgets/app_bar_custom.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/settings/widgets/settings_buttons.dart'; @@ -17,7 +18,6 @@ import 'package:flutter/material.dart'; import 'package:package_info_plus/package_info_plus.dart'; import 'package:url_launcher/url_launcher.dart'; - class SettingsScreen extends StatefulWidget { const SettingsScreen({Key? key}) : super(key: key); @@ -83,16 +83,21 @@ class _SettingsScreenState extends State { SizeConfig().init(context); return Scaffold( extendBodyBehindAppBar: true, - appBar: (SizeConfig().isTablet(context) + appBar: SizeConfig().isTablet(context) ? null - : CustomAppBar( + : AppBarCustom( + height: 130, + title: "Settings", + ), + /*CustomAppBar( showMenu: false, showBackButton: true, showLeadingicon: true, showTrailingButton: false, showTitle: true, showClosedBtnText: false, - title: 'Settings')), + title: 'Settings', + ),*/ extendBody: true, drawerScrimColor: Colors.transparent, endDrawer: SideBarWidget( @@ -111,93 +116,83 @@ class _SettingsScreenState extends State { ), ), SafeArea( - child: Padding( - padding: const EdgeInsets.all(28.0), - child: ListView( - children: [ - Text( - 'App Version ${_packageInfo.version} (${_packageInfo.buildNumber})', - style: CustomTextStyles.black12, - ), - SizedBox( - height: 28, - ), - SettingsButton( - buttonText: optionTitle[0], - onPressed: switchAtsign, - image: optionIcons[0], - ), - SizedBox( - height: 12, - ), - SettingsButton( - buttonText: optionTitle[1], - onPressed: () async { - BackupKeyWidget( - atsign: AtClientManager.getInstance() - .atClient - .getCurrentAtSign()!, - ).showBackupDialog(context); - }, - image: optionIcons[1], - ), - Divider( - height: 58, - color: ColorConstants.dividerGrey, - ), - SettingsButton( - buttonText: optionTitle[2], - onPressed: () { - Navigator.pushNamed( - context, - Routes.FAQ_SCREEN, - ); - }, - image: optionIcons[2], - ), - SizedBox( - height: 12, - ), - SettingsButton( - buttonText: optionTitle[3], - onPressed: () async { - await launchUrl(Uri( - scheme: 'mailto', path: 'atmospherepro@atsign.com')); - }, - image: optionIcons[3], - ), - SizedBox( - height: 12, - ), - SettingsButton( - buttonText: optionTitle[4], - onPressed: () { - Navigator.pushNamed( - context, - Routes.WEBSITE_SCREEN, - arguments: { - 'title': optionTitle[4], - 'url': MixedConstants.PRIVACY_POLICY - }, - ); - }, - image: optionIcons[4], - ), - SizedBox( - height: 12, - ), - SettingsButton( - buttonText: optionTitle[5], - onPressed: () async { - CommonUtilityFunctions().showResetAtsignDialog(); - }, - image: optionIcons[5], - ), - SizedBox( - height: 12, - ), - ], - ), + child: ListView( + padding: const EdgeInsets.fromLTRB(31, 0, 31, 24), + children: [ + Text( + 'App Version ${_packageInfo.version} (${_packageInfo.buildNumber})', + style: CustomTextStyles.black12, + ), + SizedBox( + height: 28, + ), + SettingsButton( + buttonText: optionTitle[0], + onPressed: switchAtsign, + image: optionIcons[0], + ), + SizedBox(height: 20), + SettingsButton( + buttonText: optionTitle[1], + onPressed: () async { + BackupKeyWidget( + atsign: AtClientManager.getInstance() + .atClient + .getCurrentAtSign()!, + ).showBackupDialog(context); + }, + image: optionIcons[1], + ), + Divider( + height: 58, + color: ColorConstants.dividerGrey, + ), + SettingsButton( + buttonText: optionTitle[2], + onPressed: () { + Navigator.pushNamed( + context, + Routes.FAQ_SCREEN, + ); + }, + image: optionIcons[2], + ), + SizedBox(height: 20), + SettingsButton( + buttonText: optionTitle[3], + onPressed: () async { + await launchUrl(Uri( + scheme: 'mailto', path: 'atmospherepro@atsign.com')); + }, + image: optionIcons[3], + ), + SizedBox(height: 20), + SettingsButton( + buttonText: optionTitle[4], + onPressed: () { + Navigator.pushNamed( + context, + Routes.WEBSITE_SCREEN, + arguments: { + 'title': optionTitle[4], + 'url': MixedConstants.PRIVACY_POLICY + }, + ); + }, + image: optionIcons[4], + ), + SizedBox(height: 20), + SettingsButton( + buttonText: optionTitle[5], + onPressed: () async { + CommonUtilityFunctions().showResetAtsignDialog(); + }, + image: optionIcons[5], + ), + SizedBox( + height: 12, + ), + ], ), ) ], diff --git a/lib/screens/settings/widgets/settings_buttons.dart b/lib/screens/settings/widgets/settings_buttons.dart index 4c5ca37f..8b5c2aca 100644 --- a/lib/screens/settings/widgets/settings_buttons.dart +++ b/lib/screens/settings/widgets/settings_buttons.dart @@ -37,9 +37,7 @@ class SettingsButton extends StatelessWidget { height: 27, width: 27, ), - SizedBox( - width: 12, - ), + SizedBox(width: 12), Text( buttonText.toString(), style: CustomTextStyles.greySemiBold18, diff --git a/lib/screens/welcome_screen/welcome_screen.dart b/lib/screens/welcome_screen/welcome_screen.dart index c90afe83..3daff737 100644 --- a/lib/screens/welcome_screen/welcome_screen.dart +++ b/lib/screens/welcome_screen/welcome_screen.dart @@ -6,6 +6,7 @@ import 'package:atsign_atmosphere_pro/screens/history/history_screen.dart'; import 'package:atsign_atmosphere_pro/screens/history/transfer_history_screen.dart'; import 'package:atsign_atmosphere_pro/screens/my_files/my_files_screen.dart'; import 'package:atsign_atmosphere_pro/screens/settings/settings_screen.dart'; +import 'package:atsign_atmosphere_pro/screens/welcome_screen/widgets/bottom_navigation_widget.dart'; import 'package:atsign_atmosphere_pro/screens/welcome_screen/widgets/welcome_sceen_home.dart'; import 'package:atsign_atmosphere_pro/services/overlay_service.dart'; import 'package:atsign_atmosphere_pro/utils/constants.dart'; @@ -32,8 +33,10 @@ class _WelcomeScreenState extends State { BackendService backendService = BackendService.getInstance(); HistoryProvider? historyProvider; bool isExpanded = true; - int _selectedBottomNavigationIndex = 0; + + // int _selectedBottomNavigationIndex = 0; late FileTransferProvider _fileTransferProvider; + late WelcomeScreenProvider welcomeScreenProvider; // 0-Sending, 1-Success, 2-Error List transferStatus = [ @@ -55,6 +58,7 @@ class _WelcomeScreenState extends State { void initState() { _fileTransferProvider = Provider.of(context, listen: false); + welcomeScreenProvider = context.read(); setAtSign(); listenForFlushBarStatus(); @@ -93,12 +97,6 @@ class _WelcomeScreenState extends State { await GroupService().fetchGroupsAndContacts(); } - void _onBottomNavigationSelect(int index) { - setState(() { - _selectedBottomNavigationIndex = index; - }); - } - static List _bottomSheetWidgetOptions = [ WelcomeScreenHome(), ContactScreen(), @@ -131,11 +129,12 @@ class _WelcomeScreenState extends State { elevation: 0, backgroundColor: Colors.transparent, onPressed: () { - setState(() { - _selectedBottomNavigationIndex = 0; - }); + welcomeScreenProvider.changeBottomNavigationIndex(0); }, - child: _selectedBottomNavigationIndex == 0 + child: context + .watch() + .selectedBottomNavigationIndex == + 0 ? SvgPicture.asset( "assets/svg/plus.svg", ) @@ -166,7 +165,9 @@ class _WelcomeScreenState extends State { body: Consumer( builder: (_c, provider, widget) { if (provider.isInternetAvailable) { - return _bottomSheetWidgetOptions[_selectedBottomNavigationIndex]; + return _bottomSheetWidgetOptions[context + .watch() + .selectedBottomNavigationIndex]; } else { return ErrorScreen( TextStrings.noInternet, @@ -179,105 +180,83 @@ class _WelcomeScreenState extends State { } Widget customBottomNavigationBar() { - return Container( - height: 70, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topRight: Radius.circular(20), topLeft: Radius.circular(20)), - boxShadow: [ - BoxShadow(color: Colors.black26, spreadRadius: 0, blurRadius: 10), - ], - ), - child: ClipRRect( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(30.0), - topRight: Radius.circular(30.0), - ), - child: Padding( - padding: const EdgeInsets.only(left: 15, right: 15.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - bottomNavigationItem("assets/svg/contacts.svg", "Contacts", 1), - bottomNavigationItem("assets/svg/my_files.svg", "My Files", 2), - SizedBox( - width: 1, - ), - bottomNavigationItem("assets/svg/history.svg", "History", 3), - bottomNavigationItem("assets/svg/settings.svg", "Settings", 4), - ], - ), - ), - ), - ); - } - - Widget bottomNavigationItem(String assetLocation, String label, int index) { - return GestureDetector( - onTap: () { - _onBottomNavigationSelect(index); - }, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Spacer(), - SvgPicture.asset( - assetLocation, - color: _selectedBottomNavigationIndex == index - ? Color(0xffEAA743) - : Colors.black, - height: 25, - ), - SizedBox( - height: 3, - ), - Text(label, - style: TextStyle( - fontSize: 11, - color: _selectedBottomNavigationIndex == index - ? Color(0xffEAA743) - : Colors.black)), - // Spacer(), - SizedBox( - height: 10, - ), - if (_selectedBottomNavigationIndex == index) - Container( - height: 2, - width: 40, + return Consumer(builder: (context, provider, _) { + return Selector( + selector: (context, provider) => + provider.selectedBottomNavigationIndex, + builder: (context, selectedBottomNavigationIndex, _) { + return Container( + height: 70, decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topRight: Radius.circular(20), + topLeft: Radius.circular(20)), boxShadow: [ BoxShadow( - color: Color(0xffEAA743).withOpacity(0.5), - spreadRadius: 3, - blurRadius: 5, - offset: Offset(0, -1), // changes position of shadow - ), + color: Colors.black26, spreadRadius: 0, blurRadius: 10), ], ), - ) - else - SizedBox( - height: 2, - width: 40, - ), - if (_selectedBottomNavigationIndex == index) - SizedBox( - height: 4, - width: 50, - child: CustomPaint( - painter: PainterOne(), + child: ClipRRect( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(30.0), + topRight: Radius.circular(30.0), + ), + child: Padding( + padding: const EdgeInsets.only(left: 15, right: 15.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + BottomNavigationWidget( + icon: "assets/svg/contacts.svg", + title: "Contacts", + index: 1, + indexSelected: selectedBottomNavigationIndex, + onTap: (index) { + welcomeScreenProvider + .changeBottomNavigationIndex(index); + }, + ), + BottomNavigationWidget( + icon: "assets/svg/my_files.svg", + title: "My Files", + index: 2, + indexSelected: selectedBottomNavigationIndex, + onTap: (index) { + welcomeScreenProvider + .changeBottomNavigationIndex(index); + }, + ), + SizedBox( + width: 1, + ), + BottomNavigationWidget( + icon: "assets/svg/history.svg", + title: "History", + index: 3, + indexSelected: selectedBottomNavigationIndex, + onTap: (index) { + welcomeScreenProvider + .changeBottomNavigationIndex(index); + }, + ), + BottomNavigationWidget( + icon: "assets/svg/settings.svg", + title: "Settings", + index: 4, + indexSelected: selectedBottomNavigationIndex, + onTap: (index) { + welcomeScreenProvider + .changeBottomNavigationIndex(index); + }, + ), + ], + ), + ), ), - ) - else - SizedBox( - height: 4, - width: 50, - ) - ], - ), - ); + ); + }); + }); } } diff --git a/lib/screens/welcome_screen/widgets/bottom_navigation_widget.dart b/lib/screens/welcome_screen/widgets/bottom_navigation_widget.dart new file mode 100644 index 00000000..fe7cc99e --- /dev/null +++ b/lib/screens/welcome_screen/widgets/bottom_navigation_widget.dart @@ -0,0 +1,86 @@ +import 'package:atsign_atmosphere_pro/screens/welcome_screen/welcome_screen.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; + +class BottomNavigationWidget extends StatelessWidget { + final Function(int index)? onTap; + final int index; + final String icon; + final String title; + final int indexSelected; + + const BottomNavigationWidget({ + Key? key, + this.onTap, + required this.index, + this.icon = '', + this.title = '', + required this.indexSelected, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: () { + onTap?.call(index); + }, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Spacer(), + SvgPicture.asset( + icon, + color: indexSelected == index ? Color(0xffEAA743) : Colors.black, + height: 25, + ), + SizedBox( + height: 3, + ), + Text(title, + style: TextStyle( + fontSize: 11, + color: indexSelected == index + ? Color(0xffEAA743) + : Colors.black)), + // Spacer(), + SizedBox( + height: 10, + ), + if (indexSelected == index) + Container( + height: 2, + width: 40, + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Color(0xffEAA743).withOpacity(0.5), + spreadRadius: 3, + blurRadius: 5, + offset: Offset(0, -1), // changes position of shadow + ), + ], + ), + ) + else + SizedBox( + height: 2, + width: 40, + ), + if (indexSelected == index) + SizedBox( + height: 4, + width: 50, + child: CustomPaint( + painter: PainterOne(), + ), + ) + else + SizedBox( + height: 4, + width: 50, + ) + ], + ), + ); + } +} diff --git a/lib/screens/welcome_screen/widgets/welcome_sceen_home.dart b/lib/screens/welcome_screen/widgets/welcome_sceen_home.dart index 77c57b5a..dfdc545d 100644 --- a/lib/screens/welcome_screen/widgets/welcome_sceen_home.dart +++ b/lib/screens/welcome_screen/widgets/welcome_sceen_home.dart @@ -1,18 +1,13 @@ import 'dart:async'; import 'package:at_client_mobile/at_client_mobile.dart'; -import 'package:at_common_flutter/widgets/custom_app_bar.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/error_dialog.dart'; import 'package:atsign_atmosphere_pro/screens/common_widgets/file_card.dart'; import 'package:atsign_atmosphere_pro/screens/common_widgets/provider_callback.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/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'; import 'package:atsign_atmosphere_pro/services/backend_service.dart'; import 'package:at_common_flutter/services/size_config.dart'; import 'package:atsign_atmosphere_pro/services/navigation_service.dart'; @@ -23,13 +18,13 @@ import 'package:atsign_atmosphere_pro/view_models/file_transfer_provider.dart'; import 'package:atsign_atmosphere_pro/view_models/history_provider.dart'; import 'package:atsign_atmosphere_pro/view_models/welcome_screen_view_model.dart'; import 'package:flutter/material.dart'; -import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; import '../../../utils/images.dart'; import '../../common_widgets/app_bar_custom.dart'; class WelcomeScreenHome extends StatefulWidget { + @override _WelcomeScreenHomeState createState() => _WelcomeScreenHomeState(); } @@ -46,8 +41,6 @@ class _WelcomeScreenHomeState extends State { ScrollController scrollController = ScrollController(); late FileTransferProvider filePickerModel; String? notes; - FocusNode _notesFocusNode = FocusNode(); - TextEditingController _notesController = TextEditingController(); @override void initState() { @@ -85,289 +78,277 @@ class _WelcomeScreenHomeState extends State { ), width: double.infinity, height: SizeConfig().screenHeight, - child: Stack( - children: [ - Row( + child: SingleChildScrollView( + controller: scrollController, + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: 20.toWidth, vertical: 20.toHeight), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, children: [ - Expanded( - flex: 3, - child: SingleChildScrollView( - controller: scrollController, - child: Container( - width: double.infinity, + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( padding: EdgeInsets.symmetric( - horizontal: 20.toWidth, vertical: 20.toHeight), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - padding: EdgeInsets.symmetric( - horizontal: SizeConfig().isTablet(context) - ? 30.toWidth - : 0), - child: Text( - TextStrings().selectFiles, - style: TextStyle( - fontSize: 20.toFont, - fontWeight: FontWeight.bold, - ), - ), - ), - Consumer( - builder: (context, provider, _) { - if (provider.selectedFiles.isNotEmpty) { - return InkWell( - onTap: SelectFiles, - child: Container( - color: Colors.black, - padding: EdgeInsets.all(10), - margin: - EdgeInsets.only(right: 30.toWidth), - child: Icon( - Icons.add_circle_outline, - color: Colors.white, - size: 15.toFont, - ), - ), - ); - } else { - return SizedBox(); - } - }), - ], + horizontal: SizeConfig().isTablet(context) + ? 30.toWidth + : 0), + child: Text( + TextStrings().selectFiles, + style: TextStyle( + fontSize: 20.toFont, + fontWeight: FontWeight.bold, + ), + ), + ), + Consumer( + builder: (context, provider, _) { + if (provider.selectedFiles.isNotEmpty) { + return InkWell( + onTap: SelectFiles, + child: Container( + color: Colors.black, + padding: EdgeInsets.all(10), + margin: + EdgeInsets.only(right: 30.toWidth), + child: Icon( + Icons.add_circle_outline, + color: Colors.white, + size: 15.toFont, + ), ), - SizedBox(height: 16), - Consumer( - builder: (context, provider, _) { - if (provider.selectedFiles.isEmpty) { - return InkWell( - onTap: SelectFiles, - child: Container( - height: 142.toHeight, - width: 350.toWidth, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - border: Border.all( - color: ColorConstants.orangeColor), - ), - child: Center( - child: Text( - 'Select file(s) to transfer', - style: TextStyle( - color: ColorConstants.orangeColor, - fontSize: 16.toFont), - ), - ), - ), - ); - } else { - return SizedBox(); - } - }), - SizedBox(height: 16), - Consumer( - builder: (context, provider, _) { - if (provider.selectedFiles.isNotEmpty) { - return Wrap( - alignment: WrapAlignment.start, - runAlignment: WrapAlignment.start, - runSpacing: 5.0.toWidth, - spacing: 10.0.toHeight, - children: List.generate( - provider.selectedFiles.length, (index) { - return SizedBox( - width: (320.toWidth) / 2, - child: Stack( - children: [ - FileCard( - fileDetail: - provider.selectedFiles[index], - ), - Positioned( - top: -10, - right: -10, - child: InkWell( - onTap: () { - provider.selectedFiles - .removeAt(index); - provider.calculateSize(); - provider.notifyListeners(); - }, - child: Container( - width: 40.toHeight, - height: 40.toHeight, - child: FittedBox( - fit: BoxFit.fill, - child: Image.asset( - ImageConstants.closeIcon), - ), - ), - ), - ), - ], - ), - ); - }), - ); - } else { - return SizedBox(); - } - }), - SizedBox(height: 16.toHeight), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + ); + } else { + return SizedBox(); + } + }), + ], + ), + SizedBox(height: 16), + Consumer( + builder: (context, provider, _) { + if (provider.selectedFiles.isEmpty) { + return InkWell( + onTap: SelectFiles, + child: Container( + height: 142.toHeight, + width: 350.toWidth, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + border: Border.all( + color: ColorConstants.orangeColor), + ), + child: Center( + child: Text( + 'Select file(s) to transfer', + style: TextStyle( + color: ColorConstants.orangeColor, + fontSize: 16.toFont), + ), + ), + ), + ); + } else { + return SizedBox(); + } + }), + SizedBox(height: 16), + Consumer( + builder: (context, provider, _) { + if (provider.selectedFiles.isNotEmpty) { + return Wrap( + alignment: WrapAlignment.start, + runAlignment: WrapAlignment.start, + runSpacing: 5.0.toWidth, + spacing: 10.0.toHeight, + children: List.generate( + provider.selectedFiles.length, (index) { + return SizedBox( + width: (320.toWidth) / 2, + child: Stack( children: [ - Padding( - padding: EdgeInsets.only( - left: SizeConfig().isTablet(context) - ? 30.toWidth - : 0), - child: Text( - TextStrings().selectContacts, - style: TextStyle( - fontSize: 20.toFont, - fontWeight: FontWeight.bold, - ), - ), - ), - Consumer( - builder: (context, provider, _) { - if (provider.selectedContacts.isNotEmpty) { - return InkWell( - onTap: () {}, - child: Container( - color: Colors.black, - padding: EdgeInsets.all(10), - margin: - EdgeInsets.only(right: 30.toWidth), - child: Icon( - Icons.add_circle_outline, - color: Colors.white, - size: 15.toFont, - ), - ), - ); - } else { - return SizedBox(); - } - }, + FileCard( + fileDetail: + provider.selectedFiles[index], ), - ], - ), - SizedBox(height: 16.toHeight), - Consumer( - builder: (context, provider, _) { - if (filePickerModel.scrollToBottom) { - scrollToBottom(); - } - return SizedBox(); - }), - Consumer( - builder: (context, provider, _) { - if (provider.scrollToBottom) { - scrollToBottom(); - } - if ((provider.selectedContacts.isEmpty)) { - return SelectContactWidget( - (b) { - print(b); - setState(() { - isContactSelected = b; - }); + Positioned( + top: -10, + right: -10, + child: InkWell( + onTap: () { + provider.selectedFiles + .removeAt(index); + provider.calculateSize(); + provider.notifyListeners(); }, - ); - } else { - if ((provider.selectedContacts.isEmpty)) { - return Container(); - } else { - return OverlappingContacts( - selectedList: provider.selectedContacts, - onChnage: (isUpdate) { - setState(() {}); - }, - ); - } - } - }, - ), - SizedBox(height: 16.toHeight), - Container( - width: 350.toWidth, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(10), - border: Border.all(color: ColorConstants.grey), - ), - child: TextField( - onChanged: (String txt) { - setState(() { - notes = txt; - }); - }, - decoration: InputDecoration( - labelText: 'Send Message (Optional)', - labelStyle: TextStyle(fontSize: 15.toFont), - fillColor: Colors.white, - border: OutlineInputBorder( - borderSide: BorderSide( - // color: ColorConstants.grey, - ), - borderRadius: BorderRadius.all( - Radius.circular(10.0), + child: Container( + width: 40.toHeight, + height: 40.toHeight, + child: FittedBox( + fit: BoxFit.fill, + child: Image.asset( + ImageConstants.closeIcon), + ), ), ), ), - keyboardType: TextInputType.multiline, - ), + ], ), - SizedBox(height: 40.toHeight), - InkWell( - onTap: sendFileWithFileBin, + ); + }), + ); + } else { + return SizedBox(); + } + }), + SizedBox(height: 16.toHeight), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: EdgeInsets.only( + left: SizeConfig().isTablet(context) + ? 30.toWidth + : 0), + child: Text( + TextStrings().selectContacts, + style: TextStyle( + fontSize: 20.toFont, + fontWeight: FontWeight.bold, + ), + ), + ), + Consumer( + builder: (context, provider, _) { + if (provider.selectedContacts.isNotEmpty) { + return InkWell( + onTap: () {}, child: Container( - height: 67.toHeight, - width: 350.toWidth, - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(10)), - gradient: LinearGradient( - colors: [ - Color(0xffF05E3F), - Color(0xffe9a642) - ], - stops: [0.1, 0.8], - ), - ), - child: Center( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - 'Transfer Now', - style: TextStyle( - fontSize: 20.toFont, - color: Colors.white), - ), - SizedBox(width: 10), - Icon(Icons.arrow_forward, - color: Colors.white, size: 20.toFont) - ], - ), + color: Colors.black, + padding: EdgeInsets.all(10), + margin: + EdgeInsets.only(right: 30.toWidth), + child: Icon( + Icons.add_circle_outline, + color: Colors.white, + size: 15.toFont, ), ), + ); + } else { + return SizedBox(); + } + }, + ), + ], + ), + SizedBox(height: 16.toHeight), + Consumer( + builder: (context, provider, _) { + if (filePickerModel.scrollToBottom) { + scrollToBottom(); + } + return SizedBox(); + }), + Consumer( + builder: (context, provider, _) { + if (provider.scrollToBottom) { + scrollToBottom(); + } + if ((provider.selectedContacts.isEmpty)) { + return SelectContactWidget( + (b) { + print(b); + setState(() { + isContactSelected = b; + }); + }, + ); + } else { + if ((provider.selectedContacts.isEmpty)) { + return Container(); + } else { + return OverlappingContacts( + selectedList: provider.selectedContacts, + onChnage: (isUpdate) { + setState(() {}); + }, + ); + } + } + }, + ), + SizedBox(height: 16.toHeight), + Container( + width: 350.toWidth, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(10), + border: Border.all(color: ColorConstants.grey), + ), + child: TextField( + onChanged: (String txt) { + setState(() { + notes = txt; + }); + }, + decoration: InputDecoration( + labelText: 'Send Message (Optional)', + labelStyle: TextStyle(fontSize: 15.toFont), + fillColor: Colors.white, + border: OutlineInputBorder( + borderSide: BorderSide( + // color: ColorConstants.grey, + ), + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + ), + ), + keyboardType: TextInputType.multiline, + ), + ), + SizedBox(height: 40.toHeight), + InkWell( + onTap: sendFileWithFileBin, + child: Container( + height: 67.toHeight, + width: 350.toWidth, + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(10)), + gradient: LinearGradient( + colors: [ + Color(0xffF05E3F), + Color(0xffe9a642) + ], + stops: [0.1, 0.8], + ), + ), + child: Center( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'Transfer Now', + style: TextStyle( + fontSize: 20.toFont, + color: Colors.white), ), - SizedBox(height: 100) + SizedBox(width: 10), + Icon(Icons.arrow_forward, + color: Colors.white, size: 20.toFont) ], ), ), ), ), + SizedBox(height: 100) ], ), - ], + ), ), ), ); diff --git a/lib/view_models/add_contact_provider.dart b/lib/view_models/add_contact_provider.dart index 04df454e..fd10b8e2 100644 --- a/lib/view_models/add_contact_provider.dart +++ b/lib/view_models/add_contact_provider.dart @@ -10,6 +10,7 @@ class AddContactProvider extends BaseModel { void initData() { contactService.resetData(); isVerify = false; + atSignError = ''; } void changeVerifyStatus(bool verify) { diff --git a/lib/view_models/welcome_screen_view_model.dart b/lib/view_models/welcome_screen_view_model.dart index e9536e9d..0ec11a84 100644 --- a/lib/view_models/welcome_screen_view_model.dart +++ b/lib/view_models/welcome_screen_view_model.dart @@ -15,12 +15,18 @@ class WelcomeScreenProvider extends BaseModel { bool hasSelectedContactsChanged = false, authenticating = false; bool isSelectionItemChanged = false; String? groupName; + int selectedBottomNavigationIndex = 0; void resetData() { selectedContacts = []; setStatus(updateContacts, Status.Done); } + void changeBottomNavigationIndex(int index){ + selectedBottomNavigationIndex = index; + notifyListeners(); + } + void _addtoContactsList(GroupContactsModel _obj) { if (selectedContacts.indexWhere( (element) => element.contact!.atSign == _obj.contact!.atSign) ==