Merge branch 'redesign' into shared-collection-screen-fixes

This commit is contained in:
ashilkn 2022-06-10 14:58:15 +05:30
commit 6cc6ac32ff
15 changed files with 99 additions and 111 deletions

View file

@ -39,7 +39,7 @@ extension CustomColorScheme on ColorScheme {
: Color(0xFF1DB954);
Color get frostyBlurBackdropFilterColor => brightness == Brightness.light
? Colors.white.withOpacity(0.5)
? Color.fromRGBO(238, 238, 238, 0.5)
: Color.fromRGBO(48, 48, 48, 0.5);
Color get iconColor =>
@ -82,12 +82,12 @@ extension CustomColorScheme on ColorScheme {
: Color.fromRGBO(255, 255, 255, 0.9);
Color get gNavIconColor => brightness == Brightness.light
? Color.fromRGBO(0, 0, 0, 0.9)
: Color.fromRGBO(255, 255, 255, 1);
? Color.fromRGBO(0, 0, 0, 0.8)
: Color.fromRGBO(255, 255, 255, 0.8);
Color get gNavActiveIconColor => brightness == Brightness.light
? Color.fromRGBO(0, 0, 0, 0.9)
: Color.fromRGBO(0, 0, 0, 1);
? Color.fromRGBO(0, 0, 0, 0.8)
: Color.fromRGBO(0, 0, 0, 0.8);
Color get galleryThumbBackgroundColor => brightness == Brightness.light
? Color.fromRGBO(240, 240, 240, 1)

View file

@ -80,17 +80,18 @@ class _BackupFolderSelectionPageState extends State<BackupFolderSelectionPage> {
'Select folders for backup',
textAlign: TextAlign.left,
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface,
fontFamily: 'Inter-Bold',
fontSize: 32,
fontWeight: FontWeight.bold),
color: Theme.of(context).colorScheme.onSurface,
fontFamily: 'Inter-Bold',
fontSize: 32,
fontWeight: FontWeight.bold,
),
),
),
),
Padding(
padding: const EdgeInsets.only(left: 24, right: 48),
child: Text(
"Selected folders will be end-to-end encrypted and backed up",
"Selected folders will be encrypted and backed up",
style: Theme.of(context).textTheme.caption.copyWith(height: 1.3),
),
),
@ -110,10 +111,10 @@ class _BackupFolderSelectionPageState extends State<BackupFolderSelectionPage> {
? "Unselect all"
: "Select all",
textAlign: TextAlign.right,
style: Theme.of(context).textTheme.overline.copyWith(
decoration: TextDecoration.underline,
fontSize: 16,
letterSpacing: 1),
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 16,
),
),
),
),

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("Long-press on an item to view in full-screen");
}
void _selectAllFilesButFirst() {

View file

@ -105,7 +105,7 @@ class _HomeWidgetState extends State<HomeWidget> {
_selectedTabIndex = event.selectedIndex;
_pageController.animateToPage(
event.selectedIndex,
duration: Duration(milliseconds: 150),
duration: Duration(milliseconds: 100),
curve: Curves.easeIn,
);
}
@ -150,7 +150,11 @@ class _HomeWidgetState extends State<HomeWidget> {
);
});
_loggedOutEvent = Bus.instance.on<UserLoggedOutEvent>().listen((event) {
setState(() {});
_logger.info('logged out, selectTab index to 0');
_selectedTabIndex = 0;
if (mounted) {
setState(() {});
}
});
_permissionGrantedEvent =
Bus.instance.on<PermissionGrantedEvent>().listen((event) async {
@ -223,7 +227,7 @@ class _HomeWidgetState extends State<HomeWidget> {
@override
Widget build(BuildContext context) {
_logger.info("Building home_Widget");
_logger.info("Building home_Widget with tab $_selectedTabIndex");
return WillPopScope(
child: Scaffold(

View file

@ -94,7 +94,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
try {
await _fetchSub();
} catch (e) {
showToast("failed to refresh subscription");
showToast("Failed to refresh subscription");
}
await _dialog.hide();

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("Recovery key copied to clipboard");
setState(() {
_hasTriedToSave = true;
});

View file

@ -35,12 +35,12 @@ class _RecoveryPageState extends State<RecoveryPage> {
isFormValid: _recoveryKey.text.isNotEmpty,
buttonText: 'Recover',
onPressedFunction: () async {
final dialog = createProgressDialog(context, "decrypting...");
final dialog = createProgressDialog(context, "Decrypting...");
await dialog.show();
try {
await Configuration.instance.recover(_recoveryKey.text.trim());
await dialog.hide();
showToast("recovery successful!");
showToast("Recovery successful!");
Navigator.of(context).pushReplacement(
MaterialPageRoute(
builder: (BuildContext context) {

View file

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

View file

@ -10,7 +10,6 @@ import 'package:photos/services/user_service.dart';
import 'package:photos/ui/loading_widget.dart';
import 'package:photos/ui/payment/subscription.dart';
import 'package:photos/utils/data_util.dart';
import 'package:photos/utils/toast_util.dart';
class DetailsSectionWidget extends StatefulWidget {
DetailsSectionWidget({Key key}) : super(key: key);
@ -71,7 +70,7 @@ class _DetailsSectionWidgetState extends State<DetailsSectionWidget> {
);
},
child: SizedBox(
height: 148,
height: 172,
child: _userDetails == null ? loadWidget : getContainer(),
),
);
@ -79,19 +78,21 @@ class _DetailsSectionWidgetState extends State<DetailsSectionWidget> {
Container getContainer() {
return Container(
width: double.infinity,
height: 148,
decoration: BoxDecoration(
color: Colors.transparent,
borderRadius: BorderRadius.only(
topRight: Radius.circular(16), bottomLeft: Radius.circular(16)),
topRight: Radius.circular(16),
bottomLeft: Radius.circular(16),
topLeft: Radius.circular(2),
bottomRight: Radius.circular(2),
),
image: DecorationImage(
fit: BoxFit.fill,
image: AssetImage("assets/card_background.png"),
),
),
child: Padding(
padding: EdgeInsets.only(top: 12, bottom: 12, left: 20, right: 0),
padding: EdgeInsets.only(top: 24, bottom: 24, left: 20, right: 0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
@ -103,7 +104,7 @@ class _DetailsSectionWidgetState extends State<DetailsSectionWidget> {
.subtitle1
.copyWith(color: Colors.white.withOpacity(0.7)),
),
Padding(padding: EdgeInsets.symmetric(vertical: 2)),
Padding(padding: EdgeInsets.symmetric(vertical: 3)),
Text(
"${convertBytesToReadableFormat(_userDetails.getFreeStorage())} of ${convertBytesToReadableFormat(_userDetails.getTotalStorage())} free",
style: Theme.of(context)
@ -147,82 +148,64 @@ class _DetailsSectionWidgetState extends State<DetailsSectionWidget> {
),
),
Padding(padding: EdgeInsets.symmetric(vertical: 6)),
GestureDetector(
onTap: () {
int totalStorage = _userDetails.isPartOfFamily()
? _userDetails.familyData.storage
: _userDetails.subscription.storage;
String usageText = formatBytes(_userDetails.getFreeStorage()) +
" / " +
convertBytesToReadableFormat(totalStorage) +
" free";
if (_userDetails.isPartOfFamily()) {
usageText +=
"\npersonal usage: ${convertBytesToReadableFormat(_userDetails.getPersonalUsage())}\n"
"family usage: ${convertBytesToReadableFormat(_userDetails.getFamilyOrPersonalUsage() - _userDetails.getPersonalUsage())}";
}
showToast(usageText);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_userDetails.isPartOfFamily()
? Row(
children: [
Container(
width: 10,
height: 10,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.white,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_userDetails.isPartOfFamily()
? Row(
children: [
Container(
width: 10,
height: 10,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.white,
),
Padding(padding: EdgeInsets.only(right: 4)),
Text(
"You",
style: Theme.of(context)
.textTheme
.bodyText1
.copyWith(color: Colors.white),
),
Padding(padding: EdgeInsets.only(right: 4)),
Text(
"You",
style: Theme.of(context)
.textTheme
.bodyText1
.copyWith(color: Colors.white),
),
Padding(padding: EdgeInsets.only(right: 12)),
Container(
width: 10,
height: 10,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.white.withOpacity(0.75),
),
Padding(padding: EdgeInsets.only(right: 12)),
Container(
width: 10,
height: 10,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.white.withOpacity(0.75),
),
),
Padding(padding: EdgeInsets.only(right: 4)),
Text(
"Family",
style: Theme.of(context)
.textTheme
.bodyText1
.copyWith(color: Colors.white),
),
],
)
: Text(
"${convertBytesToReadableFormat(_userDetails.getFamilyOrPersonalUsage())} used",
style: Theme.of(context).textTheme.headline5.copyWith(
color: Colors.white.withOpacity(0.7),
fontSize: 14),
),
Padding(
padding: const EdgeInsets.only(right: 24.0),
child: Text(
"${NumberFormat().format(_userDetails.fileCount)} Memories",
style: Theme.of(context)
.textTheme
.headline5
.copyWith(color: Colors.white, fontSize: 14),
),
)
],
),
)
),
Padding(padding: EdgeInsets.only(right: 4)),
Text(
"Family",
style: Theme.of(context)
.textTheme
.bodyText1
.copyWith(color: Colors.white),
),
],
)
: Text(
"${convertBytesToReadableFormat(_userDetails.getFamilyOrPersonalUsage())} used",
style: Theme.of(context).textTheme.headline5.copyWith(
color: Colors.white.withOpacity(0.7), fontSize: 14),
),
Padding(
padding: const EdgeInsets.only(right: 24.0),
child: Text(
"${NumberFormat().format(_userDetails.fileCount)} Memories",
style: Theme.of(context)
.textTheme
.headline5
.copyWith(color: Colors.white, fontSize: 14),
),
)
],
),
],
),
),

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("You are on the latest version");
}
},
child: SettingsTextItem(

View file

@ -58,7 +58,7 @@ class SettingsPage extends StatelessWidget {
if (hasLoggedIn) {
contents.addAll([
DetailsSectionWidget(),
Padding(padding: EdgeInsets.only(bottom: 16)),
Padding(padding: EdgeInsets.only(bottom: 24)),
BackupSectionWidget(),
sectionDivider,
AccountSectionWidget(),

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("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("Code copied to clipboard");
},
child: Column(
mainAxisAlignment: MainAxisAlignment.center,

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("Downloading...", toastLength: Toast.LENGTH_LONG);
}
var videoFile = await getFile(widget.file, liveVideo: true)
@ -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("Press and hold to play video");
_preferences.setInt(kLivePhotoToastCounterKey, promptTillNow + 1);
}
}

View file

@ -307,7 +307,7 @@ Future<bool> deleteLocalFiles(
Bus.instance.fire(LocalPhotosUpdatedEvent(deletedFiles));
return true;
} else {
showToast("could not free up space");
showToast("Could not free up space");
return false;
}
}