Skip to content

Commit

Permalink
Merge pull request #108 from atsign-foundation/feat/598
Browse files Browse the repository at this point in the history
Feat/598
  • Loading branch information
sarika01 authored May 9, 2022
2 parents 4eeb983 + ca75514 commit 65cb2d4
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -201,6 +202,13 @@ class _WelcomeScreenHomeState extends State<WelcomeScreenHome> {
showContacts: true,
isDesktop: true,
contactSelectedHistory: _welcomeScreenProvider.selectedContacts,
onContactsTap: (_list) {
Provider.of<WelcomeScreenProvider>(
NavService.navKey.currentContext!,
listen: false)
.updateSelectedContacts(_list, notifyListeners: false);
_welcomeScreenProvider.isSelectionItemChanged = true;
},
selectedList: (_list) {
Provider.of<WelcomeScreenProvider>(
NavService.navKey.currentContext!,
Expand Down Expand Up @@ -303,6 +311,8 @@ class _WelcomeScreenHomeState extends State<WelcomeScreenHome> {
} else {
var file = await desktopImagePicker();
if (file != null) {
GroupService().selectedGroupContacts = [];
GroupService().selectedContactsSink.add([]);
_filePickerProvider.selectedFiles = file;
_welcomeScreenProvider.isSelectionItemChanged = true;
_currentScreen = CurrentScreen.SelectedItems;
Expand Down
10 changes: 7 additions & 3 deletions lib/screens/common_widgets/error_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ class _ErrorScreenState extends State<ErrorScreen> {
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,
),
),
],
),
Expand Down
3 changes: 2 additions & 1 deletion lib/screens/welcome_screen/welcome_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -168,7 +169,7 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
return _bottomSheetWidgetOptions[_selectedBottomNavigationIndex];
} else {
return ErrorScreen(
'You are not connected to internet.',
TextStrings.noInternet,
);
}
}),
Expand Down
3 changes: 2 additions & 1 deletion lib/utils/text_strings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.';
Expand Down
15 changes: 11 additions & 4 deletions lib/view_models/welcome_screen_view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@ class WelcomeScreenProvider extends BaseModel {
}
}

updateSelectedContacts(List<GroupContactsModel?> updatedList) {
updateSelectedContacts(List<GroupContactsModel?> 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) {
Expand All @@ -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());
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ dependency_overrides:
at_contacts_flutter:
git:
url: [email protected]:atsign-foundation/at_widgets.git
ref: fix/missing-fontweight
ref: feat/598
path: at_contacts_flutter
at_common_flutter:
git:
Expand All @@ -99,7 +99,7 @@ dependency_overrides:
at_contacts_group_flutter:
git:
url: [email protected]:atsign-foundation/at_widgets.git
ref: fix/missing-fontweight
ref: feat/598
path: at_contacts_group_flutter

dev_dependencies:
Expand Down

0 comments on commit 65cb2d4

Please sign in to comment.