diff --git a/lib/desktop_screens/desktop_welcome_screen/widgets/welcome_screen_home.dart b/lib/desktop_screens/desktop_welcome_screen/widgets/welcome_screen_home.dart index 37814d15..f4b86b10 100644 --- a/lib/desktop_screens/desktop_welcome_screen/widgets/welcome_screen_home.dart +++ b/lib/desktop_screens/desktop_welcome_screen/widgets/welcome_screen_home.dart @@ -1,5 +1,6 @@ import 'package:at_client_mobile/at_client_mobile.dart'; import 'package:at_contacts_group_flutter/screens/group_contact_view/group_contact_view.dart'; +import 'package:at_contacts_group_flutter/services/group_service.dart'; import 'package:atsign_atmosphere_pro/dekstop_services/desktop_image_picker.dart'; import 'package:atsign_atmosphere_pro/screens/common_widgets/custom_toast.dart'; import 'package:atsign_atmosphere_pro/screens/common_widgets/triple_dot_loading.dart'; @@ -201,6 +202,13 @@ class _WelcomeScreenHomeState extends State { showContacts: true, isDesktop: true, contactSelectedHistory: _welcomeScreenProvider.selectedContacts, + onContactsTap: (_list) { + Provider.of( + NavService.navKey.currentContext!, + listen: false) + .updateSelectedContacts(_list, notifyListeners: false); + _welcomeScreenProvider.isSelectionItemChanged = true; + }, selectedList: (_list) { Provider.of( NavService.navKey.currentContext!, @@ -303,6 +311,8 @@ class _WelcomeScreenHomeState extends State { } else { var file = await desktopImagePicker(); if (file != null) { + GroupService().selectedGroupContacts = []; + GroupService().selectedContactsSink.add([]); _filePickerProvider.selectedFiles = file; _welcomeScreenProvider.isSelectionItemChanged = true; _currentScreen = CurrentScreen.SelectedItems; diff --git a/lib/screens/common_widgets/error_screen.dart b/lib/screens/common_widgets/error_screen.dart index 68a9899e..0d129038 100644 --- a/lib/screens/common_widgets/error_screen.dart +++ b/lib/screens/common_widgets/error_screen.dart @@ -21,9 +21,13 @@ class _ErrorScreenState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ Image.asset(ImageConstants.emptyGroup), - Text( - widget.title, - style: CustomTextStyles.greyText16, + Padding( + padding: const EdgeInsets.all(10.0), + child: Text( + widget.title, + style: CustomTextStyles.greyText16, + textAlign: TextAlign.center, + ), ), ], ), diff --git a/lib/screens/welcome_screen/welcome_screen.dart b/lib/screens/welcome_screen/welcome_screen.dart index 3ec1521c..53303c9a 100644 --- a/lib/screens/welcome_screen/welcome_screen.dart +++ b/lib/screens/welcome_screen/welcome_screen.dart @@ -19,6 +19,7 @@ import 'package:atsign_atmosphere_pro/view_models/welcome_screen_view_model.dart import 'package:flutter/material.dart'; import 'package:new_version/new_version.dart'; import 'package:provider/provider.dart'; +import '../../utils/text_strings.dart'; import '../common_widgets/side_bar.dart'; import '../../view_models/file_transfer_provider.dart'; import 'package:http/http.dart' as http; @@ -168,7 +169,7 @@ class _WelcomeScreenState extends State { return _bottomSheetWidgetOptions[_selectedBottomNavigationIndex]; } else { return ErrorScreen( - 'You are not connected to internet.', + TextStrings.noInternet, ); } }), diff --git a/lib/utils/text_strings.dart b/lib/utils/text_strings.dart index e96ff423..57f32d16 100644 --- a/lib/utils/text_strings.dart +++ b/lib/utils/text_strings.dart @@ -329,7 +329,8 @@ class TextStrings { 'Please select at least one @sign to reset'; static const String resetWarningText = 'Warning: This action cannot be undone!'; - + static const String noInternet = + 'Offline. Please check your internet connection and try again.'; static const uploaded = 'Uploaded'; static const reUploadFileMsg = 'Do you want to re-upload file ?'; static const uploadFile = 'Please upload file first.'; diff --git a/lib/view_models/welcome_screen_view_model.dart b/lib/view_models/welcome_screen_view_model.dart index 5ff4613f..e9536e9d 100644 --- a/lib/view_models/welcome_screen_view_model.dart +++ b/lib/view_models/welcome_screen_view_model.dart @@ -29,11 +29,14 @@ class WelcomeScreenProvider extends BaseModel { } } - updateSelectedContacts(List updatedList) { + updateSelectedContacts(List updatedList, + {bool notifyListeners = true}) { try { groupName = null; selectedContacts = []; - setStatus(updateContacts, Status.Loading); + if (notifyListeners) { + setStatus(updateContacts, Status.Loading); + } for (var _obj in updatedList) { if (_obj?.contact != null) { @@ -51,9 +54,13 @@ class WelcomeScreenProvider extends BaseModel { hasSelectedContactsChanged = true; scrollToBottom = true; // to scroll welcome screen to the bottom - setStatus(updateContacts, Status.Done); + if (notifyListeners) { + setStatus(updateContacts, Status.Done); + } } catch (error) { - setError(updateContacts, error.toString()); + if (notifyListeners) { + setError(updateContacts, error.toString()); + } } } diff --git a/pubspec.yaml b/pubspec.yaml index 64330b7d..519b9ea9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -84,7 +84,7 @@ dependency_overrides: at_contacts_flutter: git: url: git@github.com:atsign-foundation/at_widgets.git - ref: fix/missing-fontweight + ref: feat/598 path: at_contacts_flutter at_common_flutter: git: @@ -99,7 +99,7 @@ dependency_overrides: at_contacts_group_flutter: git: url: git@github.com:atsign-foundation/at_widgets.git - ref: fix/missing-fontweight + ref: feat/598 path: at_contacts_group_flutter dev_dependencies: