From 29c61ac7aa5e55af38d64372f3a7c0da06e84177 Mon Sep 17 00:00:00 2001 From: sonle Date: Wed, 15 Feb 2023 15:02:54 +0700 Subject: [PATCH] feat: update contact screen --- .../add_contact_screen.dart | 10 +- .../contact_detail_screen.dart | 76 ++- .../contact_new_version/contact_screen.dart | 7 +- .../welcome_screen/welcome_screen.dart | 189 +++---- .../widgets/bottom_navigation_widget.dart | 86 +++ .../widgets/welcome_sceen_home.dart | 521 +++++++++--------- lib/view_models/add_contact_provider.dart | 1 + .../welcome_screen_view_model.dart | 6 + 8 files changed, 483 insertions(+), 413 deletions(-) create mode 100644 lib/screens/welcome_screen/widgets/bottom_navigation_widget.dart 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..62159da4 100644 --- a/lib/screens/contact_new_version/contact_screen.dart +++ b/lib/screens/contact_new_version/contact_screen.dart @@ -126,7 +126,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 +137,9 @@ class _ContactScreenState extends State { ); }, ); - - reloadPage(); + if (result != false) { + reloadPage(); + } }, ), ), 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) ==