Merge remote-tracking branch 'origin/redesign' into shared-collection-screen-fixes

This commit is contained in:
vishnukvmd 2022-06-11 13:14:46 +05:30
commit b1a17e0cec
44 changed files with 296 additions and 248 deletions

BIN
fonts/Montserrat-Bold.ttf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -115,15 +115,20 @@ final darkThemeData = ThemeData(
),
cardColor: Color.fromRGBO(10, 15, 15, 1.0),
dialogTheme: DialogTheme().copyWith(
backgroundColor: Color.fromRGBO(10, 15, 15, 1.0),
titleTextStyle: TextStyle(
color: Colors.white, fontSize: 24, fontWeight: FontWeight.w600),
contentTextStyle: TextStyle(
fontFamily: 'Inter-Medium',
color: Colors.white,
fontSize: 16,
fontWeight: FontWeight.w500),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8))),
backgroundColor: Color.fromRGBO(15, 15, 15, 1.0),
titleTextStyle: TextStyle(
color: Colors.white,
fontSize: 24,
fontWeight: FontWeight.w600,
),
contentTextStyle: TextStyle(
fontFamily: 'Inter-Medium',
color: Colors.white,
fontSize: 16,
fontWeight: FontWeight.w500,
),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
),
inputDecorationTheme: InputDecorationTheme().copyWith(
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
@ -155,46 +160,51 @@ final darkThemeData = ThemeData(
TextTheme _buildTextTheme(Color textColor) {
return TextTheme().copyWith(
headline4: TextStyle(
color: textColor,
fontSize: 32,
fontWeight: FontWeight.w600,
fontFamily: 'Inter',
),
headline5: TextStyle(
color: textColor,
fontSize: 24,
fontWeight: FontWeight.w600,
fontFamily: 'Inter',
),
headline6: TextStyle(
color: textColor,
fontSize: 18,
fontFamily: 'Inter',
fontWeight: FontWeight.w600),
subtitle1: TextStyle(
color: textColor,
fontFamily: 'Inter',
fontSize: 16,
fontWeight: FontWeight.w500),
subtitle2: TextStyle(
color: textColor,
fontFamily: 'Inter',
fontSize: 14,
fontWeight: FontWeight.w500),
bodyText1: TextStyle(
fontFamily: 'Inter',
color: textColor,
fontSize: 16,
fontWeight: FontWeight.w400),
caption: TextStyle(
color: textColor.withOpacity(0.6),
fontSize: 14,
),
overline: TextStyle(
color: textColor.withOpacity(0.8),
fontSize: 12,
));
headline4: TextStyle(
color: textColor,
fontSize: 32,
fontWeight: FontWeight.w600,
fontFamily: 'Inter',
),
headline5: TextStyle(
color: textColor,
fontSize: 24,
fontWeight: FontWeight.w600,
fontFamily: 'Inter',
),
headline6: TextStyle(
color: textColor,
fontSize: 18,
fontFamily: 'Inter',
fontWeight: FontWeight.w600,
),
subtitle1: TextStyle(
color: textColor,
fontFamily: 'Inter',
fontSize: 16,
fontWeight: FontWeight.w500,
),
subtitle2: TextStyle(
color: textColor,
fontFamily: 'Inter',
fontSize: 14,
fontWeight: FontWeight.w500,
),
bodyText1: TextStyle(
fontFamily: 'Inter',
color: textColor,
fontSize: 16,
fontWeight: FontWeight.w400,
),
caption: TextStyle(
color: textColor.withOpacity(0.6),
fontSize: 14,
),
overline: TextStyle(
color: textColor.withOpacity(0.8),
fontSize: 12,
),
);
}
class EnteApp extends StatefulWidget {

View file

@ -53,7 +53,7 @@ extension CustomColorScheme on ColorScheme {
? Colors.white
: Color.fromRGBO(10, 15, 15, 1.0);
Color get greenText => Color.fromRGBO(40, 190, 92, 1);
Color get greenText => Color.fromARGB(255, 40, 190, 113);
Color get cupertinoPickerTopColor => brightness == Brightness.light
? Color.fromARGB(255, 238, 238, 238)
@ -100,6 +100,25 @@ extension CustomColorScheme on ColorScheme {
Color get backupEnabledBgColor => brightness == Brightness.light
? Color.fromRGBO(230, 230, 230, 0.95)
: Color.fromRGBO(10, 40, 40, 0.3);
Color get dotsIndicatorActiveColor => brightness == Brightness.light
? Colors.black.withOpacity(0.5)
: Colors.white.withOpacity(0.5);
Color get dotsIndicatorInactiveColor => brightness == Brightness.light
? Colors.black.withOpacity(0.12)
: Colors.white.withOpacity(0.12);
Color get toastTextColor =>
brightness == Brightness.light ? Colors.white : Colors.black;
Color get toastBackgroundColor => brightness == Brightness.light
? Color.fromRGBO(24, 24, 24, 0.95)
: Color.fromRGBO(255, 255, 255, 0.95);
Color get subTextColor => brightness == Brightness.light
? Color.fromRGBO(180, 180, 180, 1)
: Color.fromRGBO(100, 100, 100, 1);
}
OutlinedButtonThemeData buildOutlinedButtonThemeData(

View file

@ -210,7 +210,7 @@ class UserService {
);
await dialog.hide();
if (response != null && response.statusCode == 200) {
showShortToast("Email verification successful!");
showShortToast(context, "Email verification successful!");
Widget page;
final String twoFASessionID = response.data["twoFactorSessionID"];
if (twoFASessionID != null && twoFASessionID.isNotEmpty) {
@ -275,7 +275,7 @@ class UserService {
);
await dialog.hide();
if (response != null && response.statusCode == 200) {
showToast("Email changed to " + email);
showToast(context, "Email changed to " + email);
_config.setEmail(email);
Navigator.of(context).popUntil((route) => route.isFirst);
Bus.instance.fire(UserDetailsChangedEvent());
@ -384,7 +384,7 @@ class UserService {
);
await dialog.hide();
if (response != null && response.statusCode == 200) {
showToast("Authentication successful!");
showToast(context, "Authentication successful!");
await _saveConfiguration(response);
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
@ -399,7 +399,7 @@ class UserService {
await dialog.hide();
_logger.severe(e);
if (e.response != null && e.response.statusCode == 404) {
showToast("Session expired");
showToast(context, "Session expired");
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (BuildContext context) {
@ -446,7 +446,7 @@ class UserService {
} on DioError catch (e) {
_logger.severe(e);
if (e.response != null && e.response.statusCode == 404) {
showToast("Session expired");
showToast(context, "Session expired");
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (BuildContext context) {
@ -498,7 +498,7 @@ class UserService {
},
);
if (response != null && response.statusCode == 200) {
showShortToast("Two-factor authentication successfully reset");
showShortToast(context, "Two-factor authentication successfully reset");
await _saveConfiguration(response);
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
@ -512,7 +512,7 @@ class UserService {
} on DioError catch (e) {
_logger.severe(e);
if (e.response != null && e.response.statusCode == 404) {
showToast("Session expired");
showToast(context, "Session expired");
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (BuildContext context) {
@ -622,7 +622,7 @@ class UserService {
);
Bus.instance.fire(TwoFactorStatusChangeEvent(false));
await dialog.hide();
showToast("Two-factor authentication has been disabled");
showToast(context, "Two-factor authentication has been disabled");
} catch (e, s) {
await dialog.hide();
_logger.severe(e, s);

View file

@ -486,7 +486,7 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
),
),
onTap: () async {
await showToast(
await showToast(context,
"long press to select photos and click + to create an album",
toastLength: Toast.LENGTH_LONG);
Bus.instance

View file

@ -181,9 +181,11 @@ class _CreateCollectionPageState extends State<CreateCollectionPage> {
),
onTap: () async {
if (await _runCollectionAction(item.collection.id)) {
showShortToast(widget.actionType == CollectionActionType.addFiles
? "Added successfully to " + item.collection.name
: "Moved successfully to " + item.collection.name);
showShortToast(
context,
widget.actionType == CollectionActionType.addFiles
? "Added successfully to " + item.collection.name
: "Moved successfully to " + item.collection.name);
_navigateToCollection(item.collection);
}
},
@ -240,9 +242,11 @@ class _CreateCollectionPageState extends State<CreateCollectionPage> {
if (collection != null) {
if (await _runCollectionAction(collection.id)) {
if (widget.actionType == CollectionActionType.restoreFiles) {
showShortToast('Restored files to album ' + _albumName);
showShortToast(
context, 'Restored files to album ' + _albumName);
} else {
showShortToast("Album '" + _albumName + "' created.");
showShortToast(
context, "Album '" + _albumName + "' created.");
}
_navigateToCollection(collection);
}

View file

@ -64,7 +64,7 @@ class _DeduplicatePageState extends State<DeduplicatePage> {
_duplicates =
DeduplicationService.instance.clubDuplicatesByTime(widget.duplicates);
_selectAllFilesButFirst();
showToast("Long-press on an item to view in full-screen");
showToast(context, "Long-press on an item to view in full-screen");
}
void _selectAllFilesButFirst() {

View file

@ -73,7 +73,7 @@ class FadingAppBarState extends State<FadingAppBar> {
opacity: _shouldHide ? 0 : 1,
duration: Duration(milliseconds: 150),
),
height: Platform.isAndroid ? 64 : 80,
height: Platform.isAndroid ? 64 : 96,
);
}
@ -219,7 +219,7 @@ class FadingAppBarState extends State<FadingAppBar> {
} catch (e, s) {
_logger.severe(e, s);
hasError = true;
showToast("Sorry, could not add this to favorites!");
showToast(context, "Sorry, could not add this to favorites!");
} finally {
if (shouldBlockUser) {
await dialog.hide();
@ -231,7 +231,7 @@ class FadingAppBarState extends State<FadingAppBar> {
} catch (e, s) {
_logger.severe(e, s);
hasError = true;
showToast("Sorry, could not remove this from favorites!");
showToast(context, "Sorry, could not remove this from favorites!");
}
}
return hasError ? oldValue : isLiked;
@ -294,7 +294,7 @@ class FadingAppBarState extends State<FadingAppBar> {
isDestructiveAction: true,
onPressed: () async {
await deleteFilesOnDeviceOnly(context, [file]);
showToast("File deleted from device");
showToast(context, "File deleted from device");
Navigator.of(context, rootNavigator: true).pop();
// TODO: Fix behavior when inside a device folder
},
@ -305,7 +305,7 @@ class FadingAppBarState extends State<FadingAppBar> {
isDestructiveAction: true,
onPressed: () async {
await deleteFilesFromRemoteOnly(context, [file]);
showShortToast("Moved to trash");
showShortToast(context, "Moved to trash");
Navigator.of(context, rootNavigator: true).pop();
// TODO: Fix behavior when inside a collection
},
@ -364,9 +364,9 @@ class FadingAppBarState extends State<FadingAppBar> {
Bus.instance.fire(LocalPhotosUpdatedEvent([file]));
await dialog.hide();
if (file.fileType == FileType.livePhoto) {
showToast("Photo and video saved to gallery");
showToast(context, "Photo and video saved to gallery");
} else {
showToast("File saved to gallery");
showToast(context, "File saved to gallery");
}
}
}

View file

@ -275,7 +275,7 @@ class _FileInfoWidgetState extends State<FileInfoWidget> {
],
),
onPressed: () {
showShortToast("This image has no exif data");
showShortToast(context, "This image has no exif data");
},
),
);

View file

@ -448,7 +448,7 @@ class _OverlayWidgetState extends State<OverlayWidget> {
await deleteFilesOnDeviceOnly(
context, widget.selectedFiles.files.toList());
_clearSelectedFiles();
showToast("Files deleted from device");
showToast(context, "Files deleted from device");
},
));
actions.add(CupertinoActionSheetAction(
@ -459,7 +459,7 @@ class _OverlayWidgetState extends State<OverlayWidget> {
await deleteFilesFromRemoteOnly(
context, widget.selectedFiles.files.toList());
_clearSelectedFiles();
showShortToast("Moved to trash");
showShortToast(context, "Moved to trash");
},
));
actions.add(CupertinoActionSheetAction(

View file

@ -1,15 +1,15 @@
import 'dart:io';
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:photo_manager/photo_manager.dart';
// import 'package:photos/ente_theme_data.dart';
import 'package:photos/services/sync_service.dart';
class GrantPermissionsWidget extends StatelessWidget {
const GrantPermissionsWidget({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
final isLightMode =
MediaQuery.of(context).platformBrightness == Brightness.light;
return Scaffold(
body: SingleChildScrollView(
physics: NeverScrollableScrollPhysics(),
@ -23,10 +23,24 @@ class GrantPermissionsWidget extends StatelessWidget {
children: [
Center(
child: Padding(
padding: const EdgeInsets.fromLTRB(0, 140, 0, 50),
child: Image.asset(
"assets/gallery.png",
height: 220,
padding: const EdgeInsets.fromLTRB(0, 100, 0, 50),
child: Stack(
alignment: Alignment.center,
children: [
isLightMode
? Image.asset(
'assets/loading_photos_light.png',
color: Colors.white.withOpacity(0.4),
colorBlendMode: BlendMode.modulate,
)
: Image.asset('assets/loading_photos_dark.png'),
Center(
child: Image.asset(
"assets/gallery.png",
height: 160,
),
),
],
),
),
),
@ -92,10 +106,7 @@ class GrantPermissionsWidget extends StatelessWidget {
showDialog(
context: context,
builder: (BuildContext context) {
return BackdropFilter(
filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
child: alert,
);
return alert;
},
barrierColor: Colors.black12,
);

View file

@ -300,7 +300,7 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
if (img == null) {
_logger.severe("null rawImageData");
showToast("Something went wrong");
showToast(context, "Something went wrong");
return;
}
@ -329,7 +329,7 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
if (result == null) {
_logger.severe("null result");
showToast("Something went wrong");
showToast(context, "Something went wrong");
return;
}
try {
@ -358,7 +358,7 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
await LocalSyncService.instance.trackEditedFile(newFile);
Bus.instance.fire(LocalPhotosUpdatedEvent([newFile]));
SyncService.instance.sync();
showToast("Edits saved");
showToast(context, "Edits saved");
_logger.info("Original file " + widget.originalFile.toString());
_logger.info("Saved edits to file " + newFile.toString());
final existingFiles = widget.detailPageConfig.files;
@ -377,7 +377,7 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
),
);
} catch (e, s) {
showToast("Oops, could not save edits");
showToast(context, "Oops, could not save edits");
_logger.severe(e, s);
}
await dialog.hide();

View file

@ -1,6 +1,7 @@
import 'dart:io';
import 'package:dots_indicator/dots_indicator.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:photos/core/configuration.dart';
import 'package:photos/ente_theme_data.dart';
import 'package:photos/ui/common/gradientButton.dart';
@ -31,65 +32,35 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {
child: Column(
children: [
Padding(padding: const EdgeInsets.all(12)),
Text.rich(
TextSpan(
children: const <TextSpan>[
TextSpan(
text: "With ",
style: TextStyle(
fontSize: 16,
),
),
TextSpan(
text: "ente",
style: TextStyle(
fontWeight: FontWeight.bold,
fontFamily: 'Montserrat',
fontSize: 16,
),
),
],
Text(
"ente",
style: TextStyle(
fontWeight: FontWeight.bold,
fontFamily: 'Montserrat',
fontSize: 42,
),
textAlign: TextAlign.center,
),
Padding(
padding: EdgeInsets.all(2),
),
Text.rich(
TextSpan(
children: const <TextSpan>[
TextSpan(
text: "your ",
style: TextStyle(
fontSize: 16,
),
),
TextSpan(
text: "memories",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16,
),
),
TextSpan(
text: " are",
style: TextStyle(
fontSize: 16,
),
),
],
),
textAlign: TextAlign.center,
),
Padding(
padding: EdgeInsets.all(24),
padding: EdgeInsets.all(28),
),
_getFeatureSlider(),
Padding(
padding: EdgeInsets.all(12),
),
DotsIndicator(
dotsCount: 3,
position: _featureIndex,
decorator: DotsDecorator(
activeColor: Theme.of(context).buttonColor,
activeColor:
Theme.of(context).colorScheme.dotsIndicatorActiveColor,
color: Theme.of(context).colorScheme.dotsIndicatorInactiveColor,
activeShape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(3)),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(3)),
size: Size(100, 5),
activeSize: Size(100, 5),
spacing: EdgeInsets.all(3),
),
),
Padding(
@ -106,6 +77,9 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {
Theme.of(context).colorScheme.optionalActionButtonStyle,
child: Text(
"Existing user",
style: TextStyle(
color: Colors.black, // same for both themes
),
),
onPressed: _navigateToSignInPage,
),
@ -142,19 +116,27 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {
return ConstrainedBox(
constraints: BoxConstraints(maxHeight: 320),
child: PageView(
children: const [
children: [
FeatureItemWidget(
"assets/protected.png",
"Protected",
"End-to-end encrypted with your password,",
"visible only to you"),
FeatureItemWidget("assets/synced.png", "Synced",
"Available across all your devices,", "web, android and ios"),
"assets/protected.png",
"Private backups",
"for your memories",
"End-to-end encrypted by default",
),
FeatureItemWidget(
"assets/preserved.png",
"Preserved",
"Reliably replicated to a fallout shelter,",
"designed to outlive"),
"assets/preserved.png",
"Safely stored",
"at a fallout shelter",
"Designed to outlive",
),
FeatureItemWidget(
"assets/synced.png",
"Available",
"everywhere",
Platform.isAndroid
? "Android, iOS, Web, Desktop"
: "iOS, Android, Web, Desktop",
),
],
onPageChanged: (index) {
setState(() {
@ -219,12 +201,16 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {
}
class FeatureItemWidget extends StatelessWidget {
final String assetPath, featureTitle, firstLine, secondLine;
final String assetPath,
featureTitleFirstLine,
featureTitleSecondLine,
subText;
const FeatureItemWidget(
this.assetPath,
this.featureTitle,
this.firstLine,
this.secondLine, {
this.featureTitleFirstLine,
this.featureTitleSecondLine,
this.subText, {
Key key,
}) : super(key: key);
@ -243,23 +229,21 @@ class FeatureItemWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
featureTitle,
style: Theme.of(context).textTheme.headline6,
),
Padding(padding: EdgeInsets.all(12)),
Text(
firstLine,
textAlign: TextAlign.center,
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.9),
),
featureTitleFirstLine,
style: Theme.of(context).textTheme.headline5,
),
Padding(padding: EdgeInsets.all(2)),
Text(
secondLine,
featureTitleSecondLine,
style: Theme.of(context).textTheme.headline5,
),
Padding(padding: EdgeInsets.all(12)),
Text(
subText,
textAlign: TextAlign.center,
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.9),
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.5),
fontSize: 16,
),
),
],

View file

@ -28,10 +28,10 @@ class _LoadingPhotosWidgetState extends State<LoadingPhotosWidget> {
"We have preserved over 3 million memories so far",
"All our apps are open source",
"Our encryption protocols have been reviewed by engineers at Google, Apple, Amazon, and Facebook",
"You can share files and folders with your loved ones, end-to-end encrypted",
"You can share links to your albums with your loved ones",
"Our mobile apps run in the background to encrypt and backup new photos you take",
"We use Xchacha20Poly1305 to safely encrypt your data",
"One of our data centers is in a fall out shelter 25m underground",
"One of our data centers is in an underground fall out shelter in Paris",
];
@override
@ -79,6 +79,8 @@ class _LoadingPhotosWidgetState extends State<LoadingPhotosWidget> {
@override
Widget build(BuildContext context) {
final isLightMode =
MediaQuery.of(context).platformBrightness == Brightness.light;
return Scaffold(
body: Center(
child: Padding(
@ -87,21 +89,44 @@ class _LoadingPhotosWidgetState extends State<LoadingPhotosWidget> {
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Stack(alignment: Alignment.center, children: [
Image.asset(MediaQuery.of(context).platformBrightness ==
Brightness.light
? 'assets/loading_photos_light.png'
: 'assets/loading_photos_dark.png'),
Lottie.asset('assets/loadingGalleryLottie.json', height: 300)
]),
Stack(
alignment: Alignment.center,
children: [
isLightMode
? Image.asset(
'assets/loading_photos_light.png',
color: Colors.white.withOpacity(0.5),
colorBlendMode: BlendMode.modulate,
)
: Image.asset(
'assets/loading_photos_light.png',
color: Colors.white.withOpacity(0.25),
colorBlendMode: BlendMode.modulate,
),
Lottie.asset(
'assets/loadingGalleryLottie.json',
height: 400,
)
],
),
Text(
"Loading your photos...",
style: TextStyle(
color: Theme.of(context).colorScheme.subTextColor,
),
),
Padding(padding: EdgeInsets.all(36)),
Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text("Did you know?",
style: Theme.of(context).textTheme.headline6.copyWith(
color: Theme.of(context).colorScheme.greenText)),
Text(
"Did you know?",
style: Theme.of(context).textTheme.headline6.copyWith(
color: Theme.of(context).colorScheme.greenText,
),
),
],
),
const SizedBox(

View file

@ -414,7 +414,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
try {
await CollectionsService.instance.updateShareUrl(widget.collection, prop);
await dialog.hide();
showToast("Album updated");
showToast(context, "Album updated");
} catch (e) {
await dialog.hide();
await showGenericErrorDialog(context);

View file

@ -429,7 +429,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
.updatePassword(_passwordController1.text);
await UserService.instance.updateKeyAttributes(keyAttributes);
await dialog.hide();
showShortToast("Password changed successfully");
showShortToast(context, "Password changed successfully");
Navigator.of(context).pop();
if (widget.mode == PasswordEntryMode.reset) {
Bus.instance.fire(SubscriptionPurchasedEvent());

View file

@ -82,7 +82,6 @@ class ChildSubscriptionWidget extends StatelessWidget {
child: Text(
"leave family",
style: TextStyle(
fontFamily: 'Ubuntu-Regular',
fontWeight: FontWeight.bold,
fontSize: 18,
color: Color.fromRGBO(255, 52, 52, 1),

View file

@ -94,7 +94,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
try {
await _fetchSub();
} catch (e) {
showToast("Failed to refresh subscription");
showToast(context, "Failed to refresh subscription");
}
await _dialog.hide();
@ -274,7 +274,6 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
text: "Manage family",
style: TextStyle(
color: Colors.blue,
fontFamily: 'Ubuntu',
fontSize: 15,
),
),
@ -384,7 +383,8 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
: await _billingService.cancelStripeSubscription();
await _fetchSub();
} catch (e) {
showToast(isRenewCancelled ? 'failed to renew' : 'failed to cancel');
showToast(
context, isRenewCancelled ? 'failed to renew' : 'failed to cancel');
}
await _dialog.hide();
}

View file

@ -86,7 +86,7 @@ class _SubscriptionPageState extends State<SubscriptionPage> {
text = "your plan was successfully downgraded";
}
}
showToast(text);
showToast(context, text);
_currentSubscription = newSubscription;
_hasActiveSubscription = _currentSubscription.isValid();
setState(() {});

View file

@ -117,7 +117,7 @@ class _RecoveryKeyPageState extends State<RecoveryKeyPage> {
onTap: () async {
await Clipboard.setData(
ClipboardData(text: recoveryKey));
showToast("Recovery key copied to clipboard");
showToast(context, "Recovery key copied to clipboard");
setState(() {
_hasTriedToSave = true;
});

View file

@ -40,7 +40,7 @@ class _RecoveryPageState extends State<RecoveryPage> {
try {
await Configuration.instance.recover(_recoveryKey.text.trim());
await dialog.hide();
showToast("Recovery successful!");
showToast(context, "Recovery successful!");
Navigator.of(context).pushReplacement(
MaterialPageRoute(
builder: (BuildContext context) {

View file

@ -128,7 +128,7 @@ class _SessionsPageState extends State<SessionsPage> {
_sessions = await UserService.instance
.getActiveSessions()
.onError((error, stackTrace) {
showToast("Failed to fetch active sessions");
showToast(context, "Failed to fetch active sessions");
throw error;
});
_sessions.sessions.sort((first, second) {

View file

@ -75,11 +75,11 @@ class _SetWallpaperDialogState extends State<SetWallpaperDialog> {
await WallpaperManagerFlutter().setwallpaperfromFile(
await getFile(widget.file), _lockscreenValue);
await dialog.hide();
showToast("Wallpaper set successfully");
showToast(context, "Wallpaper set successfully");
} catch (e, s) {
await dialog.hide();
Logger("SetWallpaperDialog").severe(e, s);
showToast("Something went wrong");
showToast(context, "Something went wrong");
return;
}
},

View file

@ -62,7 +62,7 @@ class AccountSectionWidgetState extends State<AccountSectionWidget> {
AppLock.of(context)
.setEnabled(Configuration.instance.shouldShowLockScreen());
if (!result) {
showToast(reason);
showToast(context, reason);
return;
}
@ -91,7 +91,7 @@ class AccountSectionWidgetState extends State<AccountSectionWidget> {
AppLock.of(context)
.setEnabled(Configuration.instance.shouldShowLockScreen());
if (!result) {
showToast(reason);
showToast(context, reason);
return;
}
showDialog(
@ -116,7 +116,7 @@ class AccountSectionWidgetState extends State<AccountSectionWidget> {
AppLock.of(context)
.setEnabled(Configuration.instance.shouldShowLockScreen());
if (!result) {
showToast(reason);
showToast(context, reason);
return;
}
Navigator.of(context).push(

View file

@ -194,7 +194,7 @@ class BackupSectionWidgetState extends State<BackupSectionWidget> {
),
onPressed: () {
if (Platform.isIOS) {
showToast(
showToast(context,
"Also empty \"Recently Deleted\" from \"Settings\" -> \"Storage\" to claim the freed space");
}
Navigator.of(context, rootNavigator: true).pop('dialog');
@ -251,7 +251,8 @@ class BackupSectionWidgetState extends State<BackupSectionWidget> {
),
),
onPressed: () {
showToast("Also empty your \"Trash\" to claim the freed up space");
showToast(context,
"Also empty your \"Trash\" to claim the freed up space");
Navigator.of(context, rootNavigator: true).pop('dialog');
},
),

View file

@ -76,7 +76,6 @@ class _DangerSectionWidgetState extends State<DangerSectionWidget> {
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface,
height: 1.5,
fontFamily: 'Ubuntu',
fontSize: 16,
),
),

View file

@ -99,7 +99,7 @@ class InfoSectionWidget extends StatelessWidget {
barrierColor: Colors.black.withOpacity(0.85),
);
} else {
showToast("You are on the latest version");
showToast(context, "You are on the latest version");
}
},
child: SettingsTextItem(

View file

@ -89,7 +89,7 @@ class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {
AppLock.of(context).setEnabled(
Configuration.instance.shouldShowLockScreen());
if (!result) {
showToast(reason);
showToast(context, reason);
return;
}
if (value) {
@ -248,7 +248,7 @@ class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {
AppLock.of(context)
.setEnabled(Configuration.instance.shouldShowLockScreen());
if (!result) {
showToast(kAuthToViewSessions);
showToast(context, kAuthToViewSessions);
return;
}
Navigator.of(context).push(

View file

@ -52,7 +52,7 @@ class SettingsPage extends StatelessWidget {
);
final sectionDivider = Divider(
height: 20,
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.4),
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.12),
);
contents.add(Padding(padding: EdgeInsets.all(4)));
if (hasLoggedIn) {

View file

@ -254,7 +254,7 @@ class _SharingDialogState extends State<SharingDialog> {
GestureDetector(
onTap: () async {
await Clipboard.setData(ClipboardData(text: url));
showToast("Link copied to clipboard");
showToast(context, "Link copied to clipboard");
},
child: Container(
padding: EdgeInsets.all(16),
@ -406,7 +406,7 @@ class _SharingDialogState extends State<SharingDialog> {
await CollectionsService.instance
.share(widget.collection.id, email, publicKey);
await dialog.hide();
showShortToast("Shared successfully!");
showShortToast(context, "Shared successfully!");
setState(() {
_sharees.add(User(email: email));
_showEntryField = false;
@ -502,7 +502,7 @@ class EmailItemWidget extends StatelessWidget {
await CollectionsService.instance.unshare(collection.id, email);
collection.sharees.removeWhere((user) => user.email == email);
await dialog.hide();
showToast("Stopped sharing with " + email + ".");
showToast(context, "Stopped sharing with " + email + ".");
Navigator.of(context).pop();
} catch (e, s) {
Logger("EmailItemWidget").severe(e, s);

View file

@ -250,7 +250,7 @@ class _SharedCollectionGalleryState extends State<SharedCollectionGallery>
Color(0xFF1DB954),
],
onTap: () async {
await showToast("Select an album on ente to share",
await showToast(context, "Select an album on ente to share",
toastLength: Toast.LENGTH_LONG);
Bus.instance.fire(
TabChangedEvent(1, TabChangedEventSource.collections_page));

View file

@ -129,7 +129,7 @@ class _TwoFactorSetupPageState extends State<TwoFactorSetupPage>
return GestureDetector(
onTap: () async {
await Clipboard.setData(ClipboardData(text: widget.secretCode));
showToast("Code copied to clipboard");
showToast(context, "Code copied to clipboard");
},
child: Column(
mainAxisAlignment: MainAxisAlignment.center,

View file

@ -75,7 +75,7 @@ class _VideoWidgetState extends State<VideoWidget> {
setState(() {
_progress = count / total;
if (_progress == 1) {
showShortToast("decrypting video...");
showShortToast(context, "Decrypting video...");
}
});
}

View file

@ -115,7 +115,7 @@ class _ZoomableLiveImageState extends State<ZoomableLiveImage>
}
_isLoadingVideoPlayer = true;
if (_file.isRemoteFile() && !(await isFileCached(_file, liveVideo: true))) {
showToast("Downloading...", toastLength: Toast.LENGTH_LONG);
showToast(context, "Downloading...", toastLength: Toast.LENGTH_LONG);
}
var videoFile = await getFile(widget.file, liveVideo: true)
@ -138,7 +138,7 @@ class _ZoomableLiveImageState extends State<ZoomableLiveImage>
if (videoFile != null && videoFile.existsSync()) {
_setVideoPlayerController(file: videoFile);
} else {
showShortToast("download failed");
showShortToast(context, "download failed");
}
_isLoadingVideoPlayer = false;
}
@ -159,7 +159,7 @@ class _ZoomableLiveImageState extends State<ZoomableLiveImage>
var _preferences = await SharedPreferences.getInstance();
int promptTillNow = _preferences.getInt(kLivePhotoToastCounterKey) ?? 0;
if (promptTillNow < kMaxLivePhotoToastCount) {
showToast("Press and hold to play video");
showToast(context, "Press and hold to play video");
_preferences.setInt(kLivePhotoToastCounterKey, promptTillNow + 1);
}
}

View file

@ -119,9 +119,9 @@ Future<void> deleteFilesFromEverywhere(
Bus.instance.fire(LocalPhotosUpdatedEvent(deletedFiles,
type: EventType.deletedFromEverywhere));
if (hasLocalOnlyFiles && Platform.isAndroid) {
showShortToast("Files deleted");
showShortToast(context, "Files deleted");
} else {
showShortToast("Moved to trash");
showShortToast(context, "Moved to trash");
}
}
await dialog.hide();
@ -134,7 +134,7 @@ Future<void> deleteFilesFromRemoteOnly(
BuildContext context, List<File> files) async {
files.removeWhere((element) => element.uploadedFileID == null);
if (files.isEmpty) {
showToast("Selected files are not on ente");
showToast(context, "Selected files are not on ente");
return;
}
final dialog = createProgressDialog(context, "Deleting...");
@ -239,7 +239,7 @@ Future<bool> deleteFromTrash(BuildContext context, List<File> files) async {
await dialog.show();
try {
await TrashSyncService.instance.deleteFromTrash(files);
showShortToast("Successfully deleted");
showShortToast(context, "Successfully deleted");
await dialog.hide();
Bus.instance
.fire(FilesUpdatedEvent(files, type: EventType.deletedFromEverywhere));
@ -263,7 +263,7 @@ Future<bool> emptyTrash(BuildContext context) async {
await dialog.show();
try {
await TrashSyncService.instance.emptyTrash();
showShortToast("Trash emptied");
showShortToast(context, "Trash emptied");
await dialog.hide();
return true;
} catch (e, s) {
@ -307,7 +307,7 @@ Future<bool> deleteLocalFiles(
Bus.instance.fire(LocalPhotosUpdatedEvent(deletedFiles));
return true;
} else {
showToast("Could not free up space");
showToast(context, "Could not free up space");
return false;
}
}

View file

@ -1,5 +1,4 @@
import 'dart:math';
import 'dart:ui';
import 'package:confetti/confetti.dart';
import 'package:flutter/material.dart';
@ -50,10 +49,7 @@ Future<dynamic> showErrorDialog(
return showDialog(
context: context,
builder: (BuildContext context) {
return BackdropFilter(
filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
child: alert,
);
return alert;
},
barrierColor: Colors.black12,
);

View file

@ -22,9 +22,11 @@ Future<void> changeVisibility(
await dialog.show();
try {
await FileMagicService.instance.changeVisibility(files, newVisibility);
showShortToast(newVisibility == kVisibilityArchive
? "Successfully hidden"
: "Successfully unhidden");
showShortToast(
context,
newVisibility == kVisibilityArchive
? "Successfully hidden"
: "Successfully unhidden");
await dialog.hide();
} catch (e, s) {
@ -44,9 +46,11 @@ Future<void> changeCollectionVisibility(
await CollectionsService.instance.updateMagicMetadata(collection, update);
// Force reload home gallery to pull in the now unarchived files
Bus.instance.fire(ForceReloadHomeGalleryEvent());
showShortToast(newVisibility == kVisibilityArchive
? "Successfully hidden"
: "Successfully unhidden");
showShortToast(
context,
newVisibility == kVisibilityArchive
? "Successfully hidden"
: "Successfully unhidden");
await dialog.hide();
} catch (e, s) {
@ -63,7 +67,7 @@ Future<bool> editTime(
context, files, kPubMagicKeyEditedTime, editedTime);
return true;
} catch (e, s) {
showToast('something went wrong');
showToast(context, 'something went wrong');
return false;
}
}
@ -92,7 +96,7 @@ Future<bool> editFilename(
context, List.of([file]), kPubMagicKeyEditedName, result);
return true;
} catch (e, s) {
showToast('something went wrong');
showToast(context, 'something went wrong');
return false;
}
}
@ -107,7 +111,7 @@ Future<void> _updatePublicMetadata(
try {
Map<String, dynamic> update = {key: value};
await FileMagicService.instance.updatePublicMagicMetadata(files, update);
showShortToast('done');
showShortToast(context, 'done');
await dialog.hide();
if (_shouldReloadGallery(key)) {
Bus.instance.fire(ForceReloadHomeGalleryEvent());

View file

@ -3,9 +3,13 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:photos/ente_theme_data.dart';
Future<void> showToast(String message,
{toastLength = Toast.LENGTH_LONG}) async {
Future<void> showToast(
BuildContext context,
String message, {
toastLength = Toast.LENGTH_LONG,
}) async {
if (Platform.isAndroid) {
await Fluttertoast.cancel();
return Fluttertoast.showToast(
@ -13,14 +17,14 @@ Future<void> showToast(String message,
toastLength: toastLength,
gravity: ToastGravity.BOTTOM,
timeInSecForIosWeb: 1,
backgroundColor: Color.fromRGBO(127, 127, 127, 0.8),
textColor: Colors.white,
backgroundColor: Theme.of(context).colorScheme.toastBackgroundColor,
textColor: Theme.of(context).colorScheme.toastTextColor,
fontSize: 16.0);
} else {
EasyLoading.instance
..backgroundColor = Color.fromRGBO(127, 127, 127, 0.8)
..indicatorColor = Color.fromRGBO(127, 127, 127, 0.8)
..textColor = Colors.white
..backgroundColor = Theme.of(context).colorScheme.toastBackgroundColor
..indicatorColor = Theme.of(context).colorScheme.toastBackgroundColor
..textColor = Theme.of(context).colorScheme.toastTextColor
..userInteractions = true
..loadingStyle = EasyLoadingStyle.custom;
return EasyLoading.showToast(
@ -31,6 +35,6 @@ Future<void> showToast(String message,
}
}
Future<void> showShortToast(String message) {
return showToast(message, toastLength: Toast.LENGTH_SHORT);
Future<void> showShortToast(context, String message) {
return showToast(context, message, toastLength: Toast.LENGTH_SHORT);
}

View file

@ -143,14 +143,6 @@ flutter:
assets:
- assets/
fonts:
- family: NunitoSans
fonts:
- asset: fonts/NunitoSans-Regular.ttf
- asset: fonts/NunitoSans-Bold.ttf
- family: Ubuntu
fonts:
- asset: fonts/Ubuntu-Regular.ttf
- asset: fonts/Ubuntu-Light.ttf
- family: Inter
fonts:
- asset: fonts/Inter-Regular.ttf
@ -160,7 +152,7 @@ flutter:
- asset: fonts/Inter-Bold.ttf
- family: Montserrat
fonts:
- asset: fonts/Montserrat-Medium.ttf
- asset: fonts/Montserrat-Bold.ttf
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in