Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: removed dead code and commented out unused function #144

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/dekstop_services/desktop_image_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ Future<List<PlatformFile>?> desktopImagePicker() async {
final XTypeGroup typeGroup = XTypeGroup();
final List<XFile> files = await openFiles(acceptedTypeGroups: [typeGroup]);

if (files == null) {
return null;
}
// files can't be null
// if (files!=null) {
// return null;
// }

await Future.forEach(files, (XFile f) async {
selectedFiles.add(
Expand Down
4 changes: 2 additions & 2 deletions lib/desktop_routes/desktop_routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ class DesktopSetupRoutes {
DesktopRoutes.DESKTOP_EMPTY_TRUSTED_SENDER: (context) =>
DesktopEmptySender(),
DesktopRoutes.DESKTOP_GROUP: (context) {
Map<String, dynamic>? args =
ModalRoute.of(context)!.settings.arguments as Map<String, dynamic>?;
// Map<String, dynamic>? args =
// ModalRoute.of(context)!.settings.arguments as Map<String, dynamic>?;
DesktopGroupSetupRoutes.setExitFunction(() {
DesktopSetupRoutes.nested_pop();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ class DesktopContactsCustomListTile extends StatelessWidget {
)),
trailing: IconButton(
onPressed: () {},
icon: (false) ? Icon(Icons.close) : Icon(Icons.add),
icon: Icon(Icons.add),
// condition is always false
// (false) ? Icon(Icons.close) : Icon(Icons.add),
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ class DesktopCustomInputField extends StatelessWidget {
@override
Widget build(BuildContext context) {
textController = TextEditingController.fromValue(TextEditingValue(
text: initialValue != null ? initialValue : '',
// initalValue can't be null
text: initialValue,
selection: TextSelection.collapsed(
offset: initialValue != null ? initialValue.length : -1)));
// initialValue can't be null
offset: initialValue.length)));
return Container(
width: width.toWidth,
height: height,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ Widget customPersonVerticalTile(
right: 0,
child: InkWell(
onTap: () {
if (onCancel != null) {
onCancel();
}
onCancel();
},
child: isCancelIcon ? Icon(Icons.cancel) : SizedBox(),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import 'package:flutter/material.dart';
class DesktopHeader extends StatelessWidget {
final String? title;
final ValueChanged<bool>? onFilter;
List<Widget>? actions;
List<String> options = [
final List<Widget>? actions;
final List<String> options = [
'By type',
'By name',
'By size',
'By date',
'add-btn'
];
bool showBackIcon, isTitleCentered;
final bool showBackIcon, isTitleCentered;
DesktopHeader(
{this.title,
this.showBackIcon = true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

class DesktopSelectedContacts extends StatefulWidget {
ValueChanged<bool> onChange;
bool showCancelIcon;
final ValueChanged<bool> onChange;
final bool showCancelIcon;
DesktopSelectedContacts(this.onChange, {this.showCancelIcon = false});

@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,24 @@ import 'package:provider/provider.dart';
import 'package:atsign_atmosphere_pro/utils/text_strings.dart';

class DesktopSelectedFiles extends StatefulWidget {
ValueChanged<bool> onChange;
final ValueChanged<bool> onChange;
final bool showCancelIcon;
DesktopSelectedFiles(this.onChange, {this.showCancelIcon = true});
@override
_DesktopSelectedFilesState createState() => _DesktopSelectedFilesState();
}

class _DesktopSelectedFilesState extends State<DesktopSelectedFiles> {
FileTransferProvider? _filePickerProvider;
// late FileTransferProvider? _filePickerProvider;
late WelcomeScreenProvider welcomeScreenProvider;
@override
void initState() {
welcomeScreenProvider = Provider.of<WelcomeScreenProvider>(
NavService.navKey.currentContext!,
listen: false);
_filePickerProvider =
Provider.of<FileTransferProvider>(context, listen: false);
// _filePickerProvider isn't used
// _filePickerProvider =
// Provider.of<FileTransferProvider>(context, listen: false);
super.initState();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import 'package:atsign_atmosphere_pro/utils/text_styles.dart';
import 'package:flutter/material.dart';

class DesktopSwitchAtsign extends StatefulWidget {
String atsign;
final String atsign;
DesktopSwitchAtsign({Key? key, required this.atsign}) : super(key: key);

@override
Expand Down Expand Up @@ -91,7 +91,7 @@ class _DesktopSwitchAtsignState extends State<DesktopSwitchAtsign> {
),
),
SizedBox(height: 5),
(_name != null && _name != '')
(_name != '')
? SizedBox(
width: 180,
child: Text(
Expand Down
10 changes: 5 additions & 5 deletions lib/desktop_screens/desktop_history/desktop_history.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:at_common_flutter/widgets/custom_input_field.dart';
import 'package:atsign_atmosphere_pro/data_models/file_transfer.dart';
import 'package:atsign_atmosphere_pro/desktop_screens/desktop_history/widgets/desktop_received_file_details.dart';
import 'package:atsign_atmosphere_pro/desktop_screens/desktop_history/widgets/desktop_received_file_list_tile.dart';
Expand All @@ -17,7 +16,7 @@ import 'package:provider/provider.dart';

class DesktopHistoryScreen extends StatefulWidget {
final int tabIndex;
Key? key;
final Key? key;
DesktopHistoryScreen({this.tabIndex = 0, this.key});
@override
_DesktopHistoryScreenState createState() => _DesktopHistoryScreenState();
Expand Down Expand Up @@ -82,9 +81,10 @@ class _DesktopHistoryScreenState extends State<DesktopHistoryScreen>

@override
Widget build(BuildContext context) {
if (historyProvider == null) {
historyProvider = Provider.of<HistoryProvider>(context);
}
// historyProvider can't be null
// if (historyProvider == null) {
// historyProvider = Provider.of<HistoryProvider>(context);
// }
SizeConfig().init(context);
return Scaffold(
backgroundColor: ColorConstants.scaffoldColor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import 'package:atsign_atmosphere_pro/utils/text_strings.dart';

class DesktopSentFileDetails extends StatefulWidget {
final FileHistory? selectedFileData;
Key? key;
final Key? key;
DesktopSentFileDetails({this.key, this.selectedFileData});

@override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'dart:io';

import 'package:atsign_atmosphere_pro/desktop_screens/desktop_my_files/widgets/desktop_file_card.dart';
import 'package:atsign_atmosphere_pro/screens/common_widgets/provider_handler.dart';
import 'package:atsign_atmosphere_pro/utils/text_strings.dart';
import 'package:atsign_atmosphere_pro/view_models/history_provider.dart';
import 'package:flutter/material.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,9 @@ import 'package:atsign_atmosphere_pro/view_models/switch_atsign_provider.dart';
import 'package:flutter/material.dart';
import 'package:at_common_flutter/services/size_config.dart';
import 'package:atsign_atmosphere_pro/services/navigation_service.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
import 'package:atsign_atmosphere_pro/screens/common_widgets/provider_handler.dart';
import 'package:provider/provider.dart';
import 'package:atsign_atmosphere_pro/utils/constants.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:url_launcher/url_launcher.dart';

class DesktopWelcomeScreenStart extends StatefulWidget {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ 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';
import 'package:atsign_atmosphere_pro/services/common_utility_functions.dart';
import 'package:atsign_atmosphere_pro/services/navigation_service.dart';
import 'package:atsign_atmosphere_pro/services/snackbar_service.dart';
import 'package:atsign_atmosphere_pro/view_models/base_model.dart';
import 'package:atsign_atmosphere_pro/view_models/file_transfer_provider.dart';
import 'package:atsign_atmosphere_pro/view_models/welcome_screen_view_model.dart';
import 'package:atsign_atmosphere_pro/services/backend_service.dart';
Expand Down Expand Up @@ -85,10 +83,11 @@ class _WelcomeScreenHomeState extends State<WelcomeScreenHome> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'Welcome ' +
(AtClientManager.getInstance().atClient != null
? '${AtClientManager.getInstance().atClient.getCurrentAtSign()}'
: ''),
'Welcome ${AtClientManager.getInstance().atClient.getCurrentAtSign()}',
// AtClientManager.getInstance().atClient can't be null
// + (AtClientManager.getInstance().atClient != null
// ? '${AtClientManager.getInstance().atClient.getCurrentAtSign()}'
// : ''),
style: CustomTextStyles.desktopBlackPlayfairDisplay26,
),
SizedBox(
Expand Down Expand Up @@ -121,8 +120,7 @@ class _WelcomeScreenHomeState extends State<WelcomeScreenHome> {
SizedBox(
height: 20.toHeight,
),
(_welcomeScreenProvider.selectedContacts != null &&
_welcomeScreenProvider.selectedContacts.isNotEmpty &&
(_welcomeScreenProvider.selectedContacts.isNotEmpty &&
_filePickerProvider.selectedFiles.isNotEmpty)
? Container(
color: Colors.white,
Expand Down Expand Up @@ -178,8 +176,7 @@ class _WelcomeScreenHomeState extends State<WelcomeScreenHome> {
)
: SizedBox(),
SizedBox(
height: (_welcomeScreenProvider.selectedContacts != null &&
_welcomeScreenProvider.selectedContacts.isNotEmpty &&
height: (_welcomeScreenProvider.selectedContacts.isNotEmpty &&
_filePickerProvider.selectedFiles.isNotEmpty)
? 10.toHeight
: 0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import 'package:at_contacts_group_flutter/screens/group_contact_view/group_contact_view.dart';
import 'package:atsign_atmosphere_pro/desktop_routes/desktop_route_names.dart';
import 'package:atsign_atmosphere_pro/desktop_routes/desktop_routes.dart';
import 'package:atsign_atmosphere_pro/desktop_screens/desktop_common_widgets/dektop_custom_person_tile.dart';
import 'package:atsign_atmosphere_pro/desktop_screens/desktop_common_widgets/desktop_custom_input_field.dart';
import 'package:atsign_atmosphere_pro/desktop_screens/desktop_common_widgets/desktop_header.dart';
Expand Down
1 change: 0 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:at_utils/at_logger.dart';
import 'package:desktop_window/desktop_window.dart';
import 'app.dart';
import 'dart:io';
Expand Down
5 changes: 3 additions & 2 deletions lib/routes/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ class SetupRoutes {
);
},
Routes.GROUPS: (context) {
Map<String, dynamic>? args =
ModalRoute.of(context)!.settings.arguments as Map<String, dynamic>?;
// args isn't used
// Map<String, dynamic>? args =
// ModalRoute.of(context)!.settings.arguments as Map<String, dynamic>?;
return GroupList();
},
Routes.TRUSTED_CONTACTS: (context) => TrustedContacts(),
Expand Down
6 changes: 2 additions & 4 deletions lib/screens/common_widgets/app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import 'dart:io';
import 'package:at_contacts_flutter/screens/contacts_screen.dart';
import 'package:at_contacts_flutter/widgets/add_contacts_dialog.dart';
import 'package:atsign_atmosphere_pro/data_models/file_transfer.dart';
import 'package:atsign_atmosphere_pro/services/backend_service.dart';
import 'package:atsign_atmosphere_pro/services/navigation_service.dart';
import 'package:at_common_flutter/services/size_config.dart';
Expand All @@ -18,7 +17,6 @@ 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/history_provider.dart';
import 'package:atsign_atmosphere_pro/view_models/trusted_sender_view_model.dart';
import 'package:filesystem_picker/filesystem_picker.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -157,8 +155,8 @@ class _CustomAppBarState extends State<CustomAppBar> {
BackendService.getInstance()
.atClientPreference
.downloadPath!;
if (await canLaunch(url)) {
await launch(url);
if (await canLaunchUrl(Uri.parse(url))) {
await launchUrl(Uri.parse(url));
} else {
throw 'Could not launch $url';
}
Expand Down
11 changes: 6 additions & 5 deletions lib/screens/common_widgets/contact_initial.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import 'package:at_common_flutter/services/size_config.dart';
class ContactInitial extends StatelessWidget {
final double? size, maxSize, minSize;
final String? initials;
int? index;
Color? background;
final int? index;
final Color? background;

ContactInitial(
{Key? key,
Expand All @@ -20,10 +20,11 @@ class ContactInitial extends StatelessWidget {
: super(key: key);
@override
Widget build(BuildContext context) {
int? _index = index;
if (initials!.length < 3) {
index = initials!.length;
_index = initials!.length;
} else {
index = 3;
_index = 3;
}

return Container(
Expand All @@ -37,7 +38,7 @@ class ContactInitial extends StatelessWidget {
),
child: Center(
child: Text(
initials!.substring((index == 1) ? 0 : 1, index).toUpperCase(),
initials!.substring((_index == 1) ? 0 : 1, _index).toUpperCase(),
style: CustomTextStyles.whiteBold(size: (size! ~/ 3)),
),
),
Expand Down
3 changes: 1 addition & 2 deletions lib/screens/common_widgets/custom_popup_route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ class CustomPopupRoutes<T> extends PopupRoute<T> {
Duration transitionDuration = const Duration(milliseconds: 200),
RouteTransitionsBuilder? transitionBuilder,
RouteSettings? settings,
}) : assert(barrierDismissible != null),
_pageBuilder = pageBuilder,
}) : _pageBuilder = pageBuilder,
_barrierDismissible = barrierDismissible,
_barrierLabel = barrierLabel,
_barrierColor = barrierColor,
Expand Down
1 change: 0 additions & 1 deletion lib/screens/common_widgets/error_screen.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:at_common_flutter/at_common_flutter.dart';
import 'package:atsign_atmosphere_pro/utils/images.dart';
import 'package:atsign_atmosphere_pro/utils/text_styles.dart';
import 'package:flutter/material.dart';
Expand Down
4 changes: 2 additions & 2 deletions lib/screens/common_widgets/history_app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ class _HistoryAppBarState extends State<HistoryAppBar> {
} else {
String url = 'shareddocuments://' +
BackendService.getInstance().atClientPreference.downloadPath!;
if (await canLaunch(url)) {
await launch(url);
if (await canLaunchUrl(Uri.parse(url))) {
await launchUrl(Uri.parse(url));
} else {
throw 'Could not launch $url';
}
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/common_widgets/labelled_circular_progress.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
import '../../utils/colors.dart';

class LabelledCircularProgressIndicator extends StatelessWidget {
double? value;
final double? value;
LabelledCircularProgressIndicator({this.value});
@override
Widget build(BuildContext context) {
Expand Down
1 change: 0 additions & 1 deletion lib/screens/common_widgets/person_vertical_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:at_contacts_flutter/at_contacts_flutter.dart';
import 'package:atsign_atmosphere_pro/data_models/file_transfer.dart';
import 'package:atsign_atmosphere_pro/screens/common_widgets/contact_initial.dart';
import 'package:atsign_atmosphere_pro/screens/common_widgets/triple_dot_loading.dart';
import 'package:at_common_flutter/services/size_config.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/services/snackbar_service.dart';
Expand Down
5 changes: 0 additions & 5 deletions lib/screens/common_widgets/side_bar.dart
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
import 'dart:io';
import 'dart:typed_data';

import 'package:at_client_mobile/at_client_mobile.dart';
import 'package:at_contact/at_contact.dart';
import 'package:at_contacts_flutter/utils/init_contacts_service.dart';
import 'package:atsign_atmosphere_pro/data_models/file_transfer.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/services/common_utility_functions.dart';
import 'package:atsign_atmosphere_pro/view_models/file_download_checker.dart';
import 'package:atsign_atmosphere_pro/view_models/history_provider.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/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';
Expand All @@ -24,7 +20,6 @@ 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/welcome_screen_view_model.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:package_info_plus/package_info_plus.dart';
Expand Down
Loading