Apply lint suggestions

This commit is contained in:
Neeraj Gupta 2022-12-30 21:12:03 +05:30
parent 3234081e85
commit f3d8a13337
No known key found for this signature in database
GPG key ID: 3C5A1684DC1729E1
38 changed files with 259 additions and 358 deletions

View file

@ -16,7 +16,7 @@
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
DA6BE5E826B3BC8600656280 /* BuildFile in Resources */ = {isa = PBXBuildFile; };
DA6BE5E826B3BC8600656280 /* (null) in Resources */ = {isa = PBXBuildFile; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@ -213,7 +213,7 @@
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
DA6BE5E826B3BC8600656280 /* BuildFile in Resources */,
DA6BE5E826B3BC8600656280 /* (null) in Resources */,
277218A0270F596900FFE3CC /* GoogleService-Info.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -501,10 +501,7 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
@ -661,10 +658,7 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
@ -698,10 +692,7 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",

View file

@ -239,7 +239,7 @@ class SuperLogging {
extraLines = null;
}
final str = (config.prefix ?? '') + " " + rec.toPrettyString(extraLines);
final str = (config.prefix) + " " + rec.toPrettyString(extraLines);
// write to stdout
printLog(str);

View file

@ -109,7 +109,7 @@ class TrashDB {
orderBy: '$columnTrashDeleteBy DESC',
limit: 1,
);
if (rows == null || rows.isEmpty) {
if (rows.isEmpty) {
return null;
}
return _getTrashFromRow(rows[0]);
@ -264,10 +264,10 @@ class TrashDB {
row[columnCreationTime] = trash.creationTime;
row[columnFileMetadata] = jsonEncode(trash.metadata);
row[columnMMdVersion] = trash.mMdVersion ?? 0;
row[columnMMdVersion] = trash.mMdVersion;
row[columnMMdEncodedJson] = trash.mMdEncodedJson ?? '{}';
row[columnPubMMdVersion] = trash.pubMmdVersion ?? 0;
row[columnPubMMdVersion] = trash.pubMmdVersion;
row[columnPubMMdEncodedJson] = trash.pubMmdEncodedJson ?? '{}';
return row;
}

View file

@ -53,9 +53,7 @@ class BillingService {
purchase.productID,
purchase.verificationData.serverVerificationData,
).then((response) {
if (response != null) {
InAppPurchase.instance.completePurchase(purchase);
}
});
} else if (Platform.isIOS && purchase.pendingCompletePurchase) {
InAppPurchase.instance.completePurchase(purchase);

View file

@ -454,9 +454,7 @@ class CollectionsService {
_config.getSecretKey()!,
);
}
if (collectionKey != null) {
_cachedKeys[collection.id] = collectionKey;
}
return collectionKey;
}
@ -642,7 +640,6 @@ class CollectionsService {
},
);
final List<Collection> collections = [];
if (response != null) {
final c = response.data["collections"];
for (final collectionData in c) {
final collection = Collection.fromMap(collectionData);
@ -662,7 +659,6 @@ class CollectionsService {
}
collections.add(collection);
}
}
return collections;
} catch (e) {
if (e is DioError && e.response?.statusCode == 401) {
@ -700,7 +696,7 @@ class CollectionsService {
final response = await _enteDio.get(
"/collections/$collectionID",
);
assert(response != null && response.data != null);
assert(response.data != null);
final collectionData = response.data["collection"];
final collection = Collection.fromMap(collectionData);
if (collectionData['magicMetadata'] != null) {

View file

@ -3,7 +3,6 @@ import 'dart:io';
import 'package:computer/computer.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
import 'package:logging/logging.dart';
import 'package:photo_manager/photo_manager.dart';
import 'package:photos/core/configuration.dart';

View file

@ -97,8 +97,7 @@ class RemoteSyncService {
// remote-sync is done. This is done to avoid adding existing files to
// the same or different collection when user had already uploaded them
// before.
final bool hasSyncedBefore =
_prefs.containsKey(_isFirstRemoteSyncDone) ?? false;
final bool hasSyncedBefore = _prefs.containsKey(_isFirstRemoteSyncDone);
if (hasSyncedBefore) {
await syncDeviceCollectionFilesForUpload();
}

View file

@ -1,5 +1,3 @@
import 'package:email_validator/email_validator.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
@ -33,8 +31,8 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
String _cnfPassword = '';
double _passwordStrength = 0.0;
bool _emailIsValid = false;
bool? _hasAgreedToTOS = true;
bool? _hasAgreedToE2E = false;
bool _hasAgreedToTOS = true;
bool _hasAgreedToE2E = false;
bool _password1Visible = false;
bool _password2Visible = false;
bool _passwordsMatch = false;
@ -352,7 +350,7 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
return GestureDetector(
onTap: () {
setState(() {
_hasAgreedToTOS = !_hasAgreedToTOS!;
_hasAgreedToTOS = !_hasAgreedToTOS;
});
},
behavior: HitTestBehavior.translucent,
@ -363,7 +361,7 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
side: CheckboxTheme.of(context).side,
onChanged: (value) {
setState(() {
_hasAgreedToTOS = value;
_hasAgreedToTOS = value!;
});
},
),
@ -431,7 +429,7 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
return GestureDetector(
onTap: () {
setState(() {
_hasAgreedToE2E = !_hasAgreedToE2E!;
_hasAgreedToE2E = !_hasAgreedToE2E;
});
},
behavior: HitTestBehavior.translucent,
@ -442,7 +440,7 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
side: CheckboxTheme.of(context).side,
onChanged: (value) {
setState(() {
_hasAgreedToE2E = value;
_hasAgreedToE2E = value!;
});
},
),
@ -491,8 +489,8 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
bool _isFormValid() {
return _emailIsValid &&
_passwordsMatch &&
_hasAgreedToTOS! &&
_hasAgreedToE2E! &&
_hasAgreedToTOS &&
_hasAgreedToE2E &&
_passwordIsValid;
}
}

View file

@ -1,5 +1,3 @@
import 'package:flutter/material.dart';
import 'package:photos/ente_theme_data.dart';
import 'package:photos/services/user_service.dart';
@ -65,8 +63,7 @@ class _OTTVerificationPageState extends State<OTTVerificationPage> {
body: _getBody(),
floatingActionButton: DynamicFAB(
isKeypadOpen: isKeypadOpen,
isFormValid: !(_verificationCodeController.text == null ||
_verificationCodeController.text.isEmpty),
isFormValid: _verificationCodeController.text.isNotEmpty,
buttonText: 'Verify',
onPressedFunction: () {
if (widget.isChangeEmail) {

View file

@ -1,5 +1,3 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:logging/logging.dart';
@ -187,7 +185,8 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
),
TextSpan(
text: "we cannot decrypt your data",
style: Theme.of(context).textTheme.subtitle1!.copyWith(
style:
Theme.of(context).textTheme.subtitle1!.copyWith(
fontSize: 14,
decoration: TextDecoration.underline,
),
@ -321,8 +320,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
onChanged: (cnfPassword) {
setState(() {
_passwordInInputConfirmationBox = cnfPassword;
if (_passwordInInputBox != null ||
_passwordInInputBox != '') {
if (_passwordInInputBox != '') {
_passwordsMatch = _passwordInInputBox ==
_passwordInInputConfirmationBox;
}

View file

@ -1,5 +1,3 @@
import 'dart:async';
import 'package:flutter/material.dart';
@ -8,7 +6,6 @@ import 'package:photos/core/configuration.dart';
import 'package:photos/core/errors.dart';
import 'package:photos/core/event_bus.dart';
import 'package:photos/events/subscription_purchased_event.dart';
import 'package:photos/models/key_attributes.dart';
import 'package:photos/ui/account/recovery_page.dart';
import 'package:photos/ui/common/dialogs.dart';
import 'package:photos/ui/common/dynamic_fab.dart';
@ -284,10 +281,4 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
],
);
}
void validatePreVerificationState(KeyAttributes keyAttributes) {
if (keyAttributes == null) {
throw Exception("Key Attributes can not be null");
}
}
}

View file

@ -1,5 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/widgets.dart';
import 'package:photos/db/files_db.dart';
import 'package:photos/models/collection.dart';
import 'package:photos/models/file.dart';

View file

@ -358,9 +358,9 @@ class _BackupFolderSelectionPageState extends State<BackupFolderSelectionPage> {
const Padding(padding: EdgeInsets.only(top: 2)),
Text(
(kDebugMode ? 'inApp: $importedCount : device ' : '') +
(deviceCollection.count ?? 0).toString() +
(deviceCollection.count).toString() +
" item" +
((deviceCollection.count ?? 0) == 1 ? "" : "s"),
((deviceCollection.count) == 1 ? "" : "s"),
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 12,

View file

@ -107,7 +107,6 @@ class BottomActionBarWidget extends StatelessWidget {
...?iconButtons,
ExpansionIconWidget(expandableController: _expandableController)
];
iconButtonsWithExpansionIcon.removeWhere((element) => element == null);
return iconButtonsWithExpansionIcon;
}

View file

@ -1,5 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:photos/theme/ente_theme.dart';
class KeyboardTopButton extends StatelessWidget {

View file

@ -292,7 +292,6 @@ class _CreateCollectionPageState extends State<CreateCollectionPage> {
case CollectionActionType.restoreFiles:
return _restoreFilesToCollection(collectionID);
}
throw AssertionError("unexpected actionType ${widget.actionType}");
}
Future<bool> _moveFilesToCollection(int toCollectionID) async {
@ -307,7 +306,7 @@ class _CreateCollectionPageState extends State<CreateCollectionPage> {
await CollectionsService.instance.move(
toCollectionID,
fromCollectionID,
widget.selectedFiles!.files?.toList() ?? <File>[],
widget.selectedFiles!.files.toList(),
);
await dialog.hide();
RemoteSyncService.instance.sync(silently: true);
@ -330,8 +329,8 @@ class _CreateCollectionPageState extends State<CreateCollectionPage> {
final dialog = createProgressDialog(context, "Restoring files...");
await dialog.show();
try {
await CollectionsService.instance.restore(
toCollectionID, widget.selectedFiles!.files?.toList() ?? <File>[]);
await CollectionsService.instance
.restore(toCollectionID, widget.selectedFiles!.files.toList());
RemoteSyncService.instance.sync(silently: true);
widget.selectedFiles?.clearAll();
await dialog.hide();

View file

@ -1,5 +1,3 @@
import 'package:flutter/gestures.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart' hide PageView;
@ -211,8 +209,7 @@ class ExtentsPageView extends StatefulWidget {
required this.childrenDelegate,
this.dragStartBehavior = DragStartBehavior.start,
this.openDrawer,
}) : assert(childrenDelegate != null),
extents = 0,
}) : extents = 0,
controller = controller ?? _defaultPageController,
super(key: key);
@ -317,7 +314,6 @@ class _PageViewState extends State<ExtentsPageView> {
case Axis.vertical:
return widget.reverse ? AxisDirection.up : AxisDirection.down;
}
return null;
}
@override

View file

@ -2,7 +2,6 @@ import 'dart:async';
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:photos/core/event_bus.dart';
import 'package:photos/ente_theme_data.dart';
import 'package:photos/events/tab_changed_event.dart';

View file

@ -1,5 +1,3 @@
import 'dart:async';
import 'package:flutter/material.dart';
@ -231,7 +229,7 @@ class RefreshIndicatorWidget extends StatelessWidget {
return event!.reason;
}
if (event!.status == SyncStatus.error) {
return event!.reason ?? "Upload failed";
return event!.reason;
}
if (event!.status == SyncStatus.completedBackup) {
if (event!.wasStopped) {

View file

@ -1,4 +1,3 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:photos/services/update_service.dart';
import 'package:photos/theme/ente_theme.dart';

View file

@ -224,14 +224,10 @@ class _PaymentWebPageState extends State<PaymentWebPage> {
paymentProvider: stripe,
);
await _dialog.hide();
if (response != null) {
final content = widget.actionType == 'buy'
? 'Your purchase was successful'
: 'Your subscription was updated successfully';
await _showExitPageDialog(title: 'Thank you', content: content);
} else {
throw Exception("verifySubscription api failed");
}
} catch (error) {
_logger.severe(error);
await _dialog.hide();

View file

@ -1,5 +1,3 @@
import 'dart:async';
import 'package:flutter/material.dart';
@ -79,7 +77,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
final billingPlans = await _billingService.getBillingPlans();
_freePlan = billingPlans.freePlan;
_plans = billingPlans.plans.where((plan) {
if (plan.stripeID == null || plan.stripeID.isEmpty) {
if (plan.stripeID.isEmpty) {
return false;
}
final isYearlyPlan = plan.period == 'year';
@ -393,11 +391,11 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
bool foundActivePlan = false;
for (final plan in _plans) {
final productID = plan.stripeID;
if (productID == null || productID.isEmpty) {
if (productID.isEmpty) {
continue;
}
final isActive =
_hasActiveSubscription && _currentSubscription!.productID == productID;
final isActive = _hasActiveSubscription &&
_currentSubscription!.productID == productID;
if (isActive) {
foundActivePlan = true;
}

View file

@ -1,5 +1,3 @@
import 'dart:async';
import 'dart:io';
@ -166,7 +164,7 @@ class _SubscriptionPageState extends State<SubscriptionPage> {
: Platform.isAndroid
? plan.androidID
: plan.iosID;
return productID != null && productID.isNotEmpty;
return productID.isNotEmpty;
}).toList();
_freePlan = billingPlans.freePlan;
_hasLoadedData = true;
@ -320,11 +318,11 @@ class _SubscriptionPageState extends State<SubscriptionPage> {
bool foundActivePlan = false;
for (final plan in _plans) {
final productID = plan.stripeID;
if (productID == null || productID.isEmpty) {
if (productID.isEmpty) {
continue;
}
final isActive =
_hasActiveSubscription && _currentSubscription!.productID == productID;
final isActive = _hasActiveSubscription &&
_currentSubscription!.productID == productID;
if (isActive) {
foundActivePlan = true;
}
@ -375,8 +373,8 @@ class _SubscriptionPageState extends State<SubscriptionPage> {
}
for (final plan in _plans) {
final productID = Platform.isAndroid ? plan.androidID : plan.iosID;
final isActive =
_hasActiveSubscription && _currentSubscription!.productID == productID;
final isActive = _hasActiveSubscription &&
_currentSubscription!.productID == productID;
if (isActive) {
foundActivePlan = true;
}

View file

@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:logging/logging.dart';
import 'package:photos/models/user_details.dart';
import 'package:photos/states/user_details_state.dart';
import 'package:photos/theme/ente_theme.dart';
@ -11,7 +10,6 @@ class SettingsTitleBarWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
final logger = Logger((SettingsTitleBarWidget).toString());
final inheritedDetails = InheritedUserDetails.of(context);
final userDetails = inheritedDetails?.userDetails;
bool isCached = false;

View file

@ -499,33 +499,6 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
}
}
Text _getLinkExpiryTimeWidget() {
final int validTill =
widget.collection!.publicURLs?.firstOrNull?.validTill ?? 0;
if (validTill == 0) {
return const Text(
'Never',
style: TextStyle(
color: Colors.grey,
),
);
}
if (validTill < DateTime.now().microsecondsSinceEpoch) {
return Text(
'Expired',
style: TextStyle(
color: Colors.orange[300],
),
);
}
return Text(
getFormattedTime(DateTime.fromMicrosecondsSinceEpoch(validTill)),
style: const TextStyle(
color: Colors.grey,
),
);
}
Future<void> _showDeviceLimitPicker() async {
final List<Text> options = [];
for (int i = 50; i > 0; i--) {

View file

@ -22,7 +22,6 @@ class UserAvatarWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
final enteTextTheme = getEnteTextTheme(context);
final colorScheme = getEnteColorScheme(context);
final displayChar = (user.name == null || user.name!.isEmpty)
? ((user.email.isEmpty) ? " " : user.email.substring(0, 1))

View file

@ -1,6 +1,5 @@
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:path_provider/path_provider.dart';
@ -78,13 +77,16 @@ class _AppStorageViewerState extends State<AppStorageViewer> {
allowCacheClear: true,
),
]);
if (internalUser) {
// if (internalUser) {
paths.addAll([
PathStorageItem.name(appDocumentsDirectory.path, "App Documents Dir"),
PathStorageItem.name(appSupportDirectory.path, "App Support Dir"),
PathStorageItem.name(appTemporaryDirectory.path, "App Temp Dir"),
]);
if (!Platform.isAndroid) {
paths.add(PathStorageItem.name(iOSOnlyTempDirectory, "/tmp directory"));
}
// }
if (mounted) {
setState(() => {});
}

View file

@ -1,5 +1,3 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:photos/core/constants.dart';
@ -138,7 +136,8 @@ class _DeduplicatePageState extends State<DeduplicatePage> {
} else if (sortKey == SortKey.count) {
return second.files.length - first.files.length;
} else {
return second.files.first.creationTime! - first.files.first.creationTime!;
return second.files.first.creationTime! -
first.files.first.creationTime!;
}
});
}
@ -273,7 +272,7 @@ class _DeduplicatePageState extends State<DeduplicatePage> {
children: [
Container(),
PopupMenuButton(
initialValue: sortKey?.index ?? 0,
initialValue: sortKey.index,
child: Padding(
padding: const EdgeInsets.fromLTRB(24, 6, 24, 6),
child: Row(
@ -473,7 +472,8 @@ class _DeduplicatePageState extends State<DeduplicatePage> {
CollectionsService.instance
.getCollectionByID(file.collectionID!)!
.name!,
style: Theme.of(context).textTheme.caption!.copyWith(fontSize: 12),
style:
Theme.of(context).textTheme.caption!.copyWith(fontSize: 12),
overflow: TextOverflow.ellipsis,
),
),

View file

@ -346,7 +346,9 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
final AssetEntity? newAsset =
await (PhotoManager.editor.saveImage(result, title: fileName));
final newFile = await ente.File.fromAsset(
widget.originalFile.deviceFolder!, newAsset!);
widget.originalFile.deviceFolder!,
newAsset!,
);
newFile.creationTime = widget.originalFile.creationTime;
newFile.collectionID = widget.originalFile.collectionID;
newFile.location = widget.originalFile.location;

View file

@ -1,5 +1,4 @@
import 'package:fast_base58/fast_base58.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:page_transition/page_transition.dart';

View file

@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:page_transition/page_transition.dart';
import 'package:photos/models/collection.dart';

View file

@ -1,5 +1,3 @@
import 'dart:ui';
import "package:exif/exif.dart";
import "package:flutter/cupertino.dart";
import "package:flutter/material.dart";
@ -76,8 +74,8 @@ class _FileInfoWidgetState extends State<FileInfoWidget> {
final bool isFileOwner =
file.ownerID == null || file.ownerID == _currentUserID;
late Future<Set<int>> allCollectionIDsOfFile;
; //Typing this as Future<Set<T>> as it would be easier to implement showing multiple device folders for a file in the future
Future<Set<String>> allDeviceFoldersOfFile =
//Typing this as Future<Set<T>> as it would be easier to implement showing multiple device folders for a file in the future
final Future<Set<String>> allDeviceFoldersOfFile =
Future.sync(() => {file.deviceFolder ?? ''});
if (fileIsBackedup) {
allCollectionIDsOfFile = FilesDB.instance.getAllCollectionIDsOfFile(
@ -326,10 +324,8 @@ class _FileInfoWidgetState extends State<FileInfoWidget> {
} else {
final fileOwner = CollectionsService.instance
.getFileOwner(file.ownerID!, file.collectionID);
if (fileOwner != null) {
addedBy = fileOwner.email;
}
}
if (addedBy == null || addedBy.isEmpty) {
return const SizedBox.shrink();
}

View file

@ -226,7 +226,7 @@ class _ThumbnailWidgetState extends State<ThumbnailWidget> {
return;
}
if (thumbData != null && mounted) {
if (mounted) {
final imageProvider = Image.memory(thumbData).image;
_cacheAndRender(imageProvider);
}

View file

@ -1,5 +1,3 @@
import 'dart:async';
import 'package:chewie/chewie.dart';
@ -64,7 +62,6 @@ class _VideoControlsState extends State<VideoControls> {
children: [
_latestValue != null &&
!_latestValue!.isPlaying &&
_latestValue!.duration == null ||
_latestValue!.isBuffering
? const Center(
child: CircularProgressIndicator(),
@ -181,9 +178,8 @@ class _VideoControlsState extends State<VideoControls> {
}
Widget _buildCurrentPosition(Color? iconColor) {
final position = _latestValue != null && _latestValue!.position != null
? _latestValue!.position
: Duration.zero;
final position =
_latestValue != null ? _latestValue!.position : Duration.zero;
return Container(
margin: const EdgeInsets.only(left: 20.0, right: 16.0),
@ -198,9 +194,8 @@ class _VideoControlsState extends State<VideoControls> {
}
Widget _buildTotalDuration(Color? iconColor) {
final duration = _latestValue != null && _latestValue!.duration != null
? _latestValue!.duration
: Duration.zero;
final duration =
_latestValue != null ? _latestValue!.duration : Duration.zero;
return Padding(
padding: const EdgeInsets.only(right: 20.0),
@ -229,8 +224,7 @@ class _VideoControlsState extends State<VideoControls> {
_updateState();
if ((controller.value != null && controller.value.isPlaying) ||
chewieController!.autoPlay) {
if ((controller.value.isPlaying) || chewieController!.autoPlay) {
_startHideTimer();
}

View file

@ -124,8 +124,10 @@ class _VideoWidgetState extends State<VideoWidget> {
super.dispose();
}
VideoPlayerController _setVideoPlayerController(
{String? url, io.File? file}) {
VideoPlayerController _setVideoPlayerController({
String? url,
io.File? file,
}) {
VideoPlayerController videoPlayerController;
if (url != null) {
videoPlayerController = VideoPlayerController.network(url);
@ -230,7 +232,7 @@ class _VideoWidgetState extends State<VideoWidget> {
if (widget.playbackCallback != null) {
widget.playbackCallback!(_isPlaying);
}
unawaited(_keepScreenAliveOnPlaying(_isPlaying!));
unawaited(_keepScreenAliveOnPlaying(_isPlaying));
}
});
_chewieController = ChewieController(

View file

@ -31,7 +31,6 @@ class DiffFetcher {
);
final files = <File>[];
int latestUpdatedAtTime = 0;
if (response != null) {
final diff = response.data["diff"] as List;
final bool hasMore = response.data["hasMore"] as bool;
final startTime = DateTime.now();
@ -61,8 +60,7 @@ class DiffFetcher {
file.encryptedKey = item["encryptedKey"];
file.keyDecryptionNonce = item["keyDecryptionNonce"];
file.fileDecryptionHeader = item["file"]["decryptionHeader"];
file.thumbnailDecryptionHeader =
item["thumbnail"]["decryptionHeader"];
file.thumbnailDecryptionHeader = item["thumbnail"]["decryptionHeader"];
file.metadataDecryptionHeader = item["metadata"]["decryptionHeader"];
if (item["info"] != null) {
file.fileSize = item["info"]["fileSize"];
@ -115,9 +113,6 @@ class DiffFetcher {
).inMilliseconds.toString(),
);
return Diff(files, deletedFiles, hasMore, latestUpdatedAtTime);
} else {
return Diff(<File>[], <File>[], false, 0);
}
} catch (e, s) {
_logger.severe(e, s);
rethrow;

View file

@ -191,7 +191,7 @@ Future<void> sendEmail(
}) async {
try {
final String clientDebugInfo = await _clientInfo();
final EmailContent email = EmailContent(
final EmailContent emailContent = EmailContent(
to: [
to,
],
@ -204,7 +204,7 @@ Future<void> sendEmail(
final Uri params = Uri(
scheme: 'mailto',
path: to,
query: 'subject=${email.subject}&body=${email.body}',
query: 'subject=${emailContent.subject}&body=${emailContent.body}',
);
if (await canLaunchUrl(params)) {
await launchUrl(params);
@ -215,8 +215,8 @@ Future<void> sendEmail(
} else {
final OpenMailAppResult result =
await OpenMailApp.composeNewEmailInMailApp(
nativePickerTitle: 'Select email app',
emailContent: email,
nativePickerTitle: 'Select emailContent app',
emailContent: emailContent,
);
if (!result.didOpen && !result.canOpen) {
_showNoMailAppsDialog(context, to);
@ -230,15 +230,13 @@ Future<void> sendEmail(
CupertinoActionSheetAction(
child: Text(app.name),
onPressed: () {
final content = email;
if (content != null) {
final content = emailContent;
OpenMailApp.composeNewEmailInSpecificMailApp(
mailApp: app,
emailContent: content,
);
} else {
OpenMailApp.openSpecificMailApp(app);
}
Navigator.of(context, rootNavigator: true).pop();
},
),
@ -254,7 +252,7 @@ Future<void> sendEmail(
}
}
} catch (e) {
_logger.severe("Failed to send email to $to", e);
_logger.severe("Failed to send emailContent to $to", e);
_showNoMailAppsDialog(context, to);
}
}

View file

@ -25,7 +25,7 @@ class TrashDiffFetcher {
final trashedFiles = <TrashFile>[];
final deletedUploadIDs = <int>[];
final restoredFiles = <TrashFile>[];
if (response != null) {
final diff = response.data["diff"] as List;
final bool hasMore = response.data["hasMore"] as bool;
final startTime = DateTime.now();
@ -104,9 +104,6 @@ class TrashDiffFetcher {
hasMore,
latestUpdatedAtTime,
);
} else {
return Diff(<TrashFile>[], <TrashFile>[], <int>[], false, 0);
}
} catch (e, s) {
_logger.severe(e, s);
rethrow;