Merge pull request #216 from ente-io/new-user-redesign

New user redesign
This commit is contained in:
Neeraj Gupta 2022-04-22 18:11:40 +05:30 committed by GitHub
commit 9a4db83c3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 190 additions and 230 deletions

File diff suppressed because one or more lines are too long

View file

@ -14,11 +14,10 @@ extension CustomColorScheme on ColorScheme {
? Color.fromRGBO(240, 240, 240, 1) ? Color.fromRGBO(240, 240, 240, 1)
: Color.fromRGBO(8, 18, 18, 0.4); : Color.fromRGBO(8, 18, 18, 0.4);
Color get fabBackgroundColor => Color get dynamicFABBackgroundColor =>
brightness == Brightness.light ? Colors.black : Colors.grey[850]; brightness == Brightness.light ? Colors.black : Colors.grey[850];
Color get fabTextOrIconColor => Color get dynamicFABTextColor => Colors.white; //same for both themes
brightness == Brightness.light ? Colors.white : Colors.white;
// todo: use brightness == Brightness.light for changing color for dark/light theme // todo: use brightness == Brightness.light for changing color for dark/light theme
ButtonStyle get optionalActionButtonStyle => buildElevatedButtonThemeData( ButtonStyle get optionalActionButtonStyle => buildElevatedButtonThemeData(

View file

@ -104,10 +104,10 @@ class _BackupFolderSelectionPageState extends State<BackupFolderSelectionPage> {
? "Unselect all" ? "Unselect all"
: "Select all", : "Select all",
textAlign: TextAlign.right, textAlign: TextAlign.right,
style: Theme.of(context) style: Theme.of(context).textTheme.overline.copyWith(
.textTheme decoration: TextDecoration.underline,
.overline fontSize: 16,
.copyWith(decoration: TextDecoration.underline), letterSpacing: 1),
), ),
), ),
), ),
@ -133,7 +133,7 @@ class _BackupFolderSelectionPageState extends State<BackupFolderSelectionPage> {
child: Container( child: Container(
width: double.infinity, width: double.infinity,
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: 24, right: 24, bottom: Platform.isIOS ? 60 : 32), left: 20, right: 20, bottom: Platform.isIOS ? 60 : 32),
child: OutlinedButton( child: OutlinedButton(
child: Text(widget.buttonText), child: Text(widget.buttonText),
onPressed: _selectedFolders.isEmpty onPressed: _selectedFolders.isEmpty
@ -219,10 +219,18 @@ class _BackupFolderSelectionPageState extends State<BackupFolderSelectionPage> {
borderRadius: BorderRadius.all( borderRadius: BorderRadius.all(
Radius.circular(12), Radius.circular(12),
), ),
color: isSelected // color: isSelected
? Theme.of(context).colorScheme.boxSelectColor // ? Theme.of(context).colorScheme.boxSelectColor
: Theme.of(context).colorScheme.boxUnSelectColor, // : Theme.of(context).colorScheme.boxUnSelectColor,
), gradient: isSelected
? LinearGradient(colors: const [
Color(0xFF00DD4D),
Color(0xFF43BA6C)
]) //same for both themes
: LinearGradient(colors: [
Theme.of(context).colorScheme.boxUnSelectColor,
Theme.of(context).colorScheme.boxUnSelectColor
])),
padding: EdgeInsets.fromLTRB(8, 4, 4, 4), padding: EdgeInsets.fromLTRB(8, 4, 4, 4),
child: InkWell( child: InkWell(
child: Row( child: Row(

View file

@ -37,9 +37,9 @@ class DynamicFAB extends StatelessWidget {
FloatingActionButton( FloatingActionButton(
//mini: true, //mini: true,
backgroundColor: backgroundColor:
Theme.of(context).colorScheme.fabBackgroundColor, Theme.of(context).colorScheme.dynamicFABBackgroundColor,
foregroundColor: foregroundColor:
Theme.of(context).colorScheme.fabTextOrIconColor, Theme.of(context).colorScheme.dynamicFABTextColor,
child: Transform.rotate( child: Transform.rotate(
angle: isFormValid ? 0 : math.pi / 2, //var here angle: isFormValid ? 0 : math.pi / 2, //var here
child: Icon( child: Icon(

View file

@ -335,9 +335,13 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
horizontal: 20), horizontal: 20),
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( boxShadow: [
BoxShadow(
spreadRadius: 0.5,
color: Theme.of(context).hintColor, color: Theme.of(context).hintColor,
width: 0.5), offset: Offset(0, -0.325),
),
],
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: Radius.zero, topLeft: Radius.zero,
topRight: Radius.zero, topRight: Radius.zero,

View file

@ -3,16 +3,18 @@ import 'dart:ui';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:photo_manager/photo_manager.dart'; import 'package:photo_manager/photo_manager.dart';
import 'package:photos/ente_theme_data.dart'; // import 'package:photos/ente_theme_data.dart';
import 'package:photos/services/sync_service.dart'; import 'package:photos/services/sync_service.dart';
class GrantPermissionsWidget extends StatelessWidget { class GrantPermissionsWidget extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
body: SingleChildScrollView( body: Column(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
children: [ children: [
Center( Center(
child: Padding( child: Padding(
@ -27,72 +29,20 @@ class GrantPermissionsWidget extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 20), padding: const EdgeInsets.symmetric(horizontal: 20),
child: Text( child: Text(
'ente needs your permission to access gallery', 'ente needs your permission to access gallery',
style: style: Theme.of(context)
Theme.of(context).textTheme.headline4.copyWith(height: 1.4), .textTheme
), .headline4
), .copyWith(height: 1.4),
Padding(
padding: const EdgeInsets.symmetric(vertical: 40),
child: Divider(
thickness: 1.5,
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Text(
'Why we need permissions',
style: Theme.of(context).textTheme.headline5,
),
),
Padding(
padding: const EdgeInsets.fromLTRB(0, 20, 0, 5),
child: ListTile(
leading: ClipRRect(
borderRadius: BorderRadius.circular(10),
child: Container(
height: 40,
width: 40,
color: Colors.greenAccent,
),
),
title: Text("hey there random stuff"),
subtitle: Text(
"Even more random stuff here. blah blabh blahhasdn asidf as"),
),
),
Padding(
padding: const EdgeInsets.fromLTRB(0, 5, 0, 180),
child: ListTile(
leading: ClipRRect(
borderRadius: BorderRadius.circular(10),
child: Container(
height: 40,
width: 40,
color: Colors.greenAccent,
),
),
title: Text("hey there random stuff"),
subtitle: Text(
"Even more random stuff here. blah blabh blahhasdn asidf as"),
), ),
), ),
], ],
), ),
), Container(
floatingActionButton: Container(
decoration: BoxDecoration(boxShadow: [
BoxShadow(
color: Theme.of(context).backgroundColor,
spreadRadius: 200,
blurRadius: 100,
offset: Offset(0, 150),
)
]),
width: double.infinity, width: double.infinity,
height: 56, padding: EdgeInsets.only(
padding: EdgeInsets.symmetric(horizontal: 20), left: 20, right: 20, bottom: Platform.isIOS ? 60 : 32),
child: FloatingActionButton.extended( child: OutlinedButton(
backgroundColor: Theme.of(context).colorScheme.fabBackgroundColor, child: Text("Grant Permission"),
onPressed: () async { onPressed: () async {
final state = await PhotoManager.requestPermissionExtend(); final state = await PhotoManager.requestPermissionExtend();
if (state == PermissionState.authorized || if (state == PermissionState.authorized ||
@ -133,13 +83,11 @@ class GrantPermissionsWidget extends StatelessWidget {
); );
} }
}, },
label: Text('Grant permission', // padding: EdgeInsets.fromLTRB(12, 20, 12, 20),
style: Theme.of(context).textTheme.headline6.copyWith( ),
color: Theme.of(context).colorScheme.fabTextOrIconColor)), ),
shape: ],
RoundedRectangleBorder(borderRadius: BorderRadius.circular(8))),
), ),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
); );
} }
} }

View file

@ -12,6 +12,7 @@ import 'package:photo_manager/photo_manager.dart';
import 'package:photos/core/configuration.dart'; import 'package:photos/core/configuration.dart';
import 'package:photos/core/event_bus.dart'; import 'package:photos/core/event_bus.dart';
import 'package:photos/db/files_db.dart'; import 'package:photos/db/files_db.dart';
import 'package:photos/ente_theme_data.dart';
import 'package:photos/events/account_configured_event.dart'; import 'package:photos/events/account_configured_event.dart';
import 'package:photos/events/backup_folders_updated_event.dart'; import 'package:photos/events/backup_folders_updated_event.dart';
import 'package:photos/events/files_updated_event.dart'; import 'package:photos/events/files_updated_event.dart';
@ -33,7 +34,7 @@ import 'package:photos/services/user_service.dart';
import 'package:photos/ui/app_update_dialog.dart'; import 'package:photos/ui/app_update_dialog.dart';
import 'package:photos/ui/backup_folder_selection_page.dart'; import 'package:photos/ui/backup_folder_selection_page.dart';
import 'package:photos/ui/collections_gallery_widget.dart'; import 'package:photos/ui/collections_gallery_widget.dart';
import 'package:photos/ui/common_elements.dart'; import 'package:photos/ui/common/gradientButton.dart';
import 'package:photos/ui/create_collection_page.dart'; import 'package:photos/ui/create_collection_page.dart';
import 'package:photos/ui/extents_page_view.dart'; import 'package:photos/ui/extents_page_view.dart';
import 'package:photos/ui/gallery.dart'; import 'package:photos/ui/gallery.dart';
@ -421,10 +422,18 @@ class _HomeWidgetState extends State<HomeWidget> {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
_headerWidgetWithSettingsButton, _headerWidgetWithSettingsButton,
Image.asset( Padding(
padding: const EdgeInsets.only(top: 64),
child: Image.asset(
"assets/preserved.png", "assets/preserved.png",
height: 160, height: 206,
), ),
),
Text('No photos are being backed up right now',
style: Theme.of(context)
.textTheme
.caption
.copyWith(fontFamily: 'Inter-Medium', fontSize: 16)),
Center( Center(
child: Hero( child: Hero(
tag: "select_folders", tag: "select_folders",
@ -433,13 +442,17 @@ class _HomeWidgetState extends State<HomeWidget> {
child: Container( child: Container(
width: double.infinity, width: double.infinity,
height: 64, height: 64,
padding: const EdgeInsets.fromLTRB(60, 0, 60, 0), padding: const EdgeInsets.fromLTRB(20, 0, 20, 0),
child: button( child: GradientButton(
"start backup", child: Text(
fontSize: 16, 'Start Backup',
lineHeight: 1.5, style: gradientButtonTextTheme(),
padding: EdgeInsets.only(bottom: 4), ),
onPressed: () async { linearGradientColors: const [
Color(0xFF2CD267),
Color(0xFF1DB954),
],
onTap: () async {
if (LocalSyncService.instance if (LocalSyncService.instance
.hasGrantedLimitedPermissions()) { .hasGrantedLimitedPermissions()) {
PhotoManager.presentLimited(); PhotoManager.presentLimited();
@ -448,12 +461,32 @@ class _HomeWidgetState extends State<HomeWidget> {
context, context,
BackupFolderSelectionPage( BackupFolderSelectionPage(
shouldSelectAll: true, shouldSelectAll: true,
buttonText: "Start backup", buttonText: "Start Backup",
), ),
); );
} }
}, },
), ),
// child: button(
// "start backup",
// fontSize: 16,
// lineHeight: 1.5,
// padding: EdgeInsets.only(bottom: 4),
// onPressed: () async {
// if (LocalSyncService.instance
// .hasGrantedLimitedPermissions()) {
// PhotoManager.presentLimited();
// } else {
// routeToPage(
// context,
// BackupFolderSelectionPage(
// shouldSelectAll: true,
// buttonText: "Start backup",
// ),
// );
// }
// },
// ),
), ),
), ),
), ),
@ -474,7 +507,7 @@ class _HomeWidgetState extends State<HomeWidget> {
width: 180, width: 180,
child: ClipRect( child: ClipRect(
child: BackdropFilter( child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), filter: ImageFilter.blur(sigmaX: 4, sigmaY: 4),
child: GNav( child: GNav(
curve: Curves.easeOutExpo, curve: Curves.easeOutExpo,
backgroundColor: Theme.of(context).bottomAppBarColor, backgroundColor: Theme.of(context).bottomAppBarColor,

View file

@ -1,8 +1,9 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:loading_animations/loading_animations.dart'; import 'package:lottie/lottie.dart';
import 'package:photos/core/event_bus.dart'; import 'package:photos/core/event_bus.dart';
import 'package:photos/ente_theme_data.dart';
import 'package:photos/events/sync_status_update_event.dart'; import 'package:photos/events/sync_status_update_event.dart';
import 'package:photos/services/local_sync_service.dart'; import 'package:photos/services/local_sync_service.dart';
import 'package:photos/ui/backup_folder_selection_page.dart'; import 'package:photos/ui/backup_folder_selection_page.dart';
@ -17,20 +18,10 @@ class LoadingPhotosWidget extends StatefulWidget {
class _LoadingPhotosWidgetState extends State<LoadingPhotosWidget> { class _LoadingPhotosWidgetState extends State<LoadingPhotosWidget> {
StreamSubscription<SyncStatusUpdate> _firstImportEvent; StreamSubscription<SyncStatusUpdate> _firstImportEvent;
int _currentPage = 0; // final int _currentPage = 0;
final PageController _pageController = PageController( // final PageController _pageController = PageController(
initialPage: 0, // initialPage: 0,
); // );
final List<String> _messages = [
"web.ente.io has a slick uploader",
"we have preserved over a 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",
"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",
];
@override @override
void initState() { void initState() {
@ -46,28 +37,11 @@ class _LoadingPhotosWidgetState extends State<LoadingPhotosWidget> {
context, context,
BackupFolderSelectionPage( BackupFolderSelectionPage(
shouldSelectAll: true, shouldSelectAll: true,
buttonText: "Start backup", buttonText: "Start Backup",
)); ));
} }
} }
}); });
Timer.periodic(Duration(seconds: 5), (Timer timer) {
if (!mounted) {
return;
}
if (_currentPage < _messages.length - 1) {
_currentPage++;
} else {
_currentPage = 0;
}
_pageController.animateToPage(
_currentPage,
duration: Duration(milliseconds: 300),
curve: Curves.easeIn,
);
});
} }
@override @override
@ -81,47 +55,28 @@ class _LoadingPhotosWidgetState extends State<LoadingPhotosWidget> {
return Scaffold( return Scaffold(
body: Center( body: Center(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
LoadingBouncingGrid.square(
inverted: true,
backgroundColor: Theme.of(context).buttonColor,
size: 64,
),
Padding(padding: const EdgeInsets.all(20.0)),
Text(
"loading your gallery...",
style: TextStyle(
fontSize: 16,
),
),
Padding(padding: EdgeInsets.all(10)),
Text(
"this might take upto 30 seconds 🐣",
style: TextStyle(color: Colors.white.withOpacity(0.3)),
),
Padding(padding: const EdgeInsets.all(70)),
Text(
"did you know?",
style: TextStyle(
fontSize: 16,
color: Theme.of(context).buttonColor,
),
),
Padding(padding: EdgeInsets.all(8)),
SizedBox( SizedBox(
height: 80, height: 56,
child: PageView.builder(
scrollDirection: Axis.vertical,
controller: _pageController,
itemBuilder: (context, index) {
return _getMessage(_messages[index]);
},
itemCount: _messages.length,
physics: NeverScrollableScrollPhysics(),
), ),
Lottie.asset('assets/loadingGalleryLottie.json'),
Text("Did you know?",
style: Theme.of(context).textTheme.headline6.copyWith(
fontFamily: "Inter",
color: Theme.of(context)
.colorScheme
.defaultTextColor
.withOpacity(0.4))),
SizedBox(
height: 16,
), ),
Text(
"ente is amazing",
style: Theme.of(context).textTheme.headline6.copyWith(
fontFamily: "Inter",
color: Theme.of(context).colorScheme.defaultTextColor),
)
], ],
), ),
), ),

View file

@ -358,9 +358,13 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
horizontal: 20), horizontal: 20),
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( boxShadow: [
BoxShadow(
spreadRadius: 0.5,
color: Theme.of(context).hintColor, color: Theme.of(context).hintColor,
width: 0.5), offset: Offset(0, -0.325),
),
],
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: Radius.zero, topLeft: Radius.zero,
topRight: Radius.zero, topRight: Radius.zero,

View file

@ -679,6 +679,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.1" version: "1.0.1"
lottie:
dependency: "direct main"
description:
name: lottie
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.2"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:

View file

@ -72,6 +72,7 @@ dependencies:
loading_animations: ^2.1.0 loading_animations: ^2.1.0
local_auth: ^1.1.5 local_auth: ^1.1.5
logging: ^1.0.1 logging: ^1.0.1
lottie: ^1.2.2
motionphoto: motionphoto:
git: "https://github.com/ente-io/motionphoto.git" git: "https://github.com/ente-io/motionphoto.git"
move_to_background: ^1.0.2 move_to_background: ^1.0.2