temp commit

This commit is contained in:
Neeraj Gupta 2022-03-26 07:19:14 +05:30
parent 2c03a09808
commit 374dddca44
10 changed files with 340 additions and 116 deletions

View file

@ -30,6 +30,7 @@ final lightThemeData = ThemeData(
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),
padding: EdgeInsets.fromLTRB(50, 16, 50, 16), padding: EdgeInsets.fromLTRB(50, 16, 50, 16),
alignment: Alignment.center,
textStyle: TextStyle( textStyle: TextStyle(
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontFamily: 'Inter-SemiBold', fontFamily: 'Inter-SemiBold',
@ -64,11 +65,23 @@ final lightThemeData = ThemeData(
iconTheme: IconThemeData(color: Colors.black)), iconTheme: IconThemeData(color: Colors.black)),
//https://api.flutter.dev/flutter/material/TextTheme-class.html //https://api.flutter.dev/flutter/material/TextTheme-class.html
textTheme: TextTheme().copyWith( textTheme: TextTheme().copyWith(
headline4: TextStyle(
fontFamily: 'Inter-SemiBold',
color: Colors.black,
fontSize: 32,
fontWeight: FontWeight.w600),
headline6: TextStyle( headline6: TextStyle(
color: Colors.black, fontSize: 18, fontWeight: FontWeight.w600), color: Colors.black, fontSize: 18, fontWeight: FontWeight.w600),
subtitle1: TextStyle( subtitle1: TextStyle(
fontFamily: 'Inter-Medium', fontFamily: 'Inter-Medium',
color: Colors.black, fontSize: 16, fontWeight: FontWeight.w500), color: Colors.black,
fontSize: 16,
fontWeight: FontWeight.w500),
bodyText1: TextStyle(
fontFamily: 'Inter-Medium',
color: Colors.black,
fontSize: 16,
fontWeight: FontWeight.w400),
caption: TextStyle(color: Colors.black.withOpacity(0.7), fontSize: 14), caption: TextStyle(color: Colors.black.withOpacity(0.7), fontSize: 14),
overline: TextStyle(color: Colors.black.withOpacity(0.8), fontSize: 12)), overline: TextStyle(color: Colors.black.withOpacity(0.8), fontSize: 12)),
@ -107,10 +120,23 @@ final darkThemeData = ThemeData(
), ),
// primaryColor: Colors.red, // primaryColor: Colors.red,
textTheme: TextTheme().copyWith( textTheme: TextTheme().copyWith(
headline4: TextStyle(
fontFamily: 'Inter-SemiBold',
color: Colors.white,
fontSize: 32,
fontWeight: FontWeight.w600),
headline6: TextStyle( headline6: TextStyle(
color: Colors.white, fontSize: 18, fontWeight: FontWeight.w600), color: Colors.white, fontSize: 18, fontWeight: FontWeight.w600),
subtitle1: TextStyle( subtitle1: TextStyle(
color: Colors.white, fontFamily: 'Inter-Medium', fontSize: 16, fontWeight: FontWeight.w500), color: Colors.white,
fontFamily: 'Inter-Medium',
fontSize: 16,
fontWeight: FontWeight.w500),
bodyText1: TextStyle(
fontFamily: 'Inter-Medium',
color: Colors.white,
fontSize: 16,
fontWeight: FontWeight.w400),
caption: TextStyle( caption: TextStyle(
color: Colors.white.withOpacity(0.6), color: Colors.white.withOpacity(0.6),
fontSize: 14, fontSize: 14,
@ -125,6 +151,7 @@ final darkThemeData = ThemeData(
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),
alignment: Alignment.center,
padding: EdgeInsets.fromLTRB(50, 16, 50, 16), padding: EdgeInsets.fromLTRB(50, 16, 50, 16),
textStyle: TextStyle( textStyle: TextStyle(
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,

View file

@ -135,7 +135,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: 24, right: 24, bottom: Platform.isIOS ? 60 : 32),
child: OutlinedButton( child: OutlinedButton(
child: Text(widget.buttonText), child: Text(widget.buttonText),
onPressed: _selectedFolders.isEmpty onPressed: _selectedFolders.isEmpty
@ -278,11 +278,7 @@ class _BackupFolderSelectionPageState extends State<BackupFolderSelectionPage> {
fontSize: 12, fontSize: 12,
color: isSelected color: isSelected
? Colors.white ? Colors.white
: Theme.of(context).colorScheme.onSurface,
: Theme.of(context)
.colorScheme
.onSurface
,
), ),
), ),
], ],

View file

@ -0,0 +1,79 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:photos/core/configuration.dart';
import 'package:photos/ui/settings/account_section_widget.dart';
import 'package:photos/ui/settings/app_version_widget.dart';
import 'package:photos/ui/settings/backup_section_widget.dart';
import 'package:photos/ui/settings/danger_section_widget.dart';
import 'package:photos/ui/settings/debug_section_widget.dart';
import 'package:photos/ui/settings/details_section_widget.dart';
import 'package:photos/ui/settings/info_section_widget.dart';
import 'package:photos/ui/settings/security_section_widget.dart';
import 'package:photos/ui/settings/social_section_widget.dart';
import 'package:photos/ui/settings/support_section_widget.dart';
import 'package:photos/ui/settings/theme_switch_widget.dart';
import 'package:photos/utils/dialog_util.dart';
class RecoveryKeyPage extends StatelessWidget {
const RecoveryKeyPage({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: _getBody(context),
);
}
Widget _getBody(BuildContext context) {
final hasLoggedIn = Configuration.instance.getToken() != null;
final List<Widget> contents = [];
contents.add(Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: const [ThemeSwitchWidget()]));
final sectionDivider = Divider(
height: 10,
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.4),
);
if (hasLoggedIn) {
contents.addAll([
DetailsSectionWidget(),
sectionDivider,
BackupSectionWidget(),
sectionDivider,
AccountSectionWidget(),
sectionDivider,
]);
}
contents.addAll([
SecuritySectionWidget(),
sectionDivider,
test(),
sectionDivider,
SupportSectionWidget(),
sectionDivider,
SocialSectionWidget(),
sectionDivider,
InfoSectionWidget(),
]);
if (hasLoggedIn) {
contents.addAll([
sectionDivider,
DangerSectionWidget(),
]);
}
contents.add(AppVersionWidget());
if (kDebugMode && hasLoggedIn) {
contents.add(DebugSectionWidget());
}
return SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Column(
children: contents,
),
),
);
}
}

View file

@ -6,9 +6,11 @@ import 'package:photos/ui/common_elements.dart';
import 'package:photos/ui/password_entry_page.dart'; import 'package:photos/ui/password_entry_page.dart';
import 'package:photos/utils/dialog_util.dart'; import 'package:photos/utils/dialog_util.dart';
import 'package:photos/utils/toast_util.dart'; import 'package:photos/utils/toast_util.dart';
import 'package:dotted_border/dotted_border.dart';
class RecoveryPage extends StatefulWidget { class RecoveryPage extends StatefulWidget {
const RecoveryPage({Key key}) : super(key: key); final bool showAppBar;
const RecoveryPage({Key key, @required this.showAppBar}) : super(key: key);
@override @override
_RecoveryPageState createState() => _RecoveryPageState(); _RecoveryPageState createState() => _RecoveryPageState();
@ -20,108 +22,71 @@ class _RecoveryPageState extends State<RecoveryPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: widget.showAppBar
title: Text( ? AppBar(
"recover account", title: Text(""),
style: TextStyle( )
fontSize: 18, : null,
), body: Padding(
), padding: const EdgeInsets.fromLTRB(20, 40, 20, 20),
), child: Column(
body: Column( crossAxisAlignment: CrossAxisAlignment.stretch,
crossAxisAlignment: CrossAxisAlignment.stretch, // mainAxisAlignment: MainAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
Padding( Text("Recovery Key", style: Theme.of(context).textTheme.headline4),
padding: const EdgeInsets.fromLTRB(60, 0, 60, 0), Padding(padding: EdgeInsets.all(12)),
child: TextFormField( Text(
decoration: InputDecoration( "If you forget your password, the only way you can recover your data is with this key.",
hintText: "enter your recovery key", style: Theme.of(context).textTheme.subtitle1,
contentPadding: EdgeInsets.all(20),
),
style: TextStyle(
fontSize: 14,
fontFeatures: [FontFeature.tabularFigures()],
),
controller: _recoveryKey,
autofocus: false,
autocorrect: false,
keyboardType: TextInputType.multiline,
maxLines: null,
onChanged: (_) {
setState(() {});
},
), ),
), Padding(padding: EdgeInsets.only(top: 24)),
Padding(padding: EdgeInsets.all(12)), DottedBorder(
Container( color: Color.fromRGBO(17, 127, 56, 1), //color of dotted/dash line
padding: const EdgeInsets.fromLTRB(80, 0, 80, 0), strokeWidth: 1, //thickness of dash/dots
width: double.infinity, dashPattern: const [6, 6],
height: 64, radius: Radius.circular(8),
child: button( //dash patterns, 10 is dash width, 6 is space width
"recover", child: SizedBox(
fontSize: 18, //inner container
onPressed: _recoveryKey.text.isNotEmpty height: 200, //height of inner container
? () async { width:
final dialog = double.infinity, //width to 100% match to parent container.
createProgressDialog(context, "decrypting..."); // ignore: prefer_const_literals_to_create_immutables
await dialog.show(); child: Column(
try { children: [
await Configuration.instance Container(
.recover(_recoveryKey.text.trim()); decoration: BoxDecoration(
await dialog.hide(); border: Border.all(
showToast("recovery successful!"); color: Color.fromRGBO(49, 155, 86, .2),
Navigator.of(context).pushReplacement( ),
MaterialPageRoute( borderRadius: BorderRadius.all(
builder: (BuildContext context) { Radius.circular(12),
return WillPopScope( ),
onWillPop: () async => false, color: Color.fromRGBO(49, 155, 86, .2),
child: PasswordEntryPage( ),
mode: PasswordEntryMode.reset, // color: Color.fromRGBO(49, 155, 86, .2),
), height: 120,
); width: double.infinity,
}, child: const Text('1'),
),
SizedBox(
height: 80,
width: double.infinity,
child: Padding(
child: Text(
"we dont store this key, please save this in a safe place",
style: Theme.of(context).textTheme.bodyText1,
), ),
); padding: EdgeInsets.all(20)),
} catch (e) { ),
await dialog.hide(); ],
String errMessage =
'the recovery key you entered is incorrect';
if (e is AssertionError) {
errMessage = '$errMessage : ${e.message}';
}
showErrorDialog(
context, "incorrect recovery key", errMessage);
}
}
: null,
),
),
GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
showErrorDialog(
context,
"sorry",
"due to the nature of our end-to-end encryption protocol, your data cannot be decrypted without your password or recovery key",
);
},
child: Container(
padding: EdgeInsets.all(40),
child: Center(
child: Text(
"no recovery key?",
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 12,
color: Colors.white.withOpacity(0.9),
),
), ),
), ),
), )
), ],
], ),
), ),
); );
} }

View file

@ -10,6 +10,7 @@ import 'package:photos/services/sync_service.dart';
import 'package:photos/ui/backup_folder_selection_page.dart'; import 'package:photos/ui/backup_folder_selection_page.dart';
import 'package:photos/ui/deduplicate_page.dart'; import 'package:photos/ui/deduplicate_page.dart';
import 'package:photos/ui/free_space_page.dart'; import 'package:photos/ui/free_space_page.dart';
import 'package:photos/ui/recovery_page.dart';
import 'package:photos/ui/settings/common_settings.dart'; import 'package:photos/ui/settings/common_settings.dart';
import 'package:photos/ui/settings/settings_section_title.dart'; import 'package:photos/ui/settings/settings_section_title.dart';
import 'package:photos/ui/settings/settings_text_item.dart'; import 'package:photos/ui/settings/settings_text_item.dart';
@ -44,11 +45,14 @@ class BackupSectionWidgetState extends State<BackupSectionWidget> {
behavior: HitTestBehavior.translucent, behavior: HitTestBehavior.translucent,
onTap: () async { onTap: () async {
routeToPage( routeToPage(
context, context,
BackupFolderSelectionPage( RecoveryPage(
buttonText: "Backup", showAppBar: true,
), )
); // BackupFolderSelectionPage(
// buttonText: "Backup",
// ),
);
}, },
child: SettingsTextItem( child: SettingsTextItem(
text: "Backed up folders", icon: Icons.navigate_next), text: "Backed up folders", icon: Icons.navigate_next),
@ -59,7 +63,10 @@ class BackupSectionWidgetState extends State<BackupSectionWidget> {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text("Backup over mobile data", style: Theme.of(context).textTheme.subtitle1,), Text(
"Backup over mobile data",
style: Theme.of(context).textTheme.subtitle1,
),
Switch.adaptive( Switch.adaptive(
value: Configuration.instance.shouldBackupOverMobileData(), value: Configuration.instance.shouldBackupOverMobileData(),
onChanged: (value) async { onChanged: (value) async {
@ -76,7 +83,10 @@ class BackupSectionWidgetState extends State<BackupSectionWidget> {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text("Backup videos", style: Theme.of(context).textTheme.subtitle1,), Text(
"Backup videos",
style: Theme.of(context).textTheme.subtitle1,
),
Switch.adaptive( Switch.adaptive(
value: Configuration.instance.shouldBackupVideos(), value: Configuration.instance.shouldBackupVideos(),
onChanged: (value) async { onChanged: (value) async {

View file

@ -1,6 +1,5 @@
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:photos/core/configuration.dart'; import 'package:photos/core/configuration.dart';
import 'package:photos/ui/settings/account_section_widget.dart'; import 'package:photos/ui/settings/account_section_widget.dart';
import 'package:photos/ui/settings/app_version_widget.dart'; import 'package:photos/ui/settings/app_version_widget.dart';

View file

@ -101,3 +101,128 @@ Future<T> showConfettiDialog<T>({
routeSettings: routeSettings, routeSettings: routeSettings,
); );
} }
Widget test() {
return Container(
width: 355,
height: 236,
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: 355,
height: 236,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Color(0x4c000000),
),
padding: const EdgeInsets.only(
top: 20,
bottom: 16,
),
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
width: 234,
child: Text(
"Are you sure you want to logout?",
style: TextStyle(
color: Colors.white,
fontSize: 24,
fontFamily: "SF Pro Display",
fontWeight: FontWeight.w600,
),
),
),
SizedBox(height: 16),
Container(
width: 323,
height: 48,
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: 323,
height: 48,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Color(0x4c000000),
),
padding: const EdgeInsets.only(
left: 135,
right: 136,
),
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"Cancel",
style: TextStyle(
color: Colors.white,
fontSize: 16,
fontFamily: "SF Pro Text",
fontWeight: FontWeight.w500,
),
),
],
),
),
],
),
),
SizedBox(height: 16),
Container(
width: 323,
height: 48,
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: 323,
height: 48,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Colors.white,
),
padding: const EdgeInsets.symmetric(
horizontal: 120,
vertical: 12,
),
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"Yes Logout",
style: TextStyle(
color: Colors.black,
fontSize: 16,
fontFamily: "SF Pro Text",
fontWeight: FontWeight.w500,
),
),
],
),
),
],
),
),
],
),
),
],
),
);
}

View file

@ -232,6 +232,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.0" version: "2.0.0"
dotted_border:
dependency: "direct main"
description:
name: dotted_border
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0+2"
email_validator: email_validator:
dependency: "direct main" dependency: "direct main"
description: description:
@ -786,6 +793,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0" version: "1.8.0"
path_drawing:
dependency: transitive
description:
name: path_drawing
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
path_parsing:
dependency: transitive
description:
name: path_parsing
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
path_provider: path_provider:
dependency: "direct main" dependency: "direct main"
description: description:

View file

@ -33,6 +33,7 @@ dependencies:
device_info: ^2.0.2 device_info: ^2.0.2
dio: ^4.0.0 dio: ^4.0.0
dots_indicator: ^2.0.0 dots_indicator: ^2.0.0
dotted_border: ^2.0.0+2
email_validator: ^2.0.1 email_validator: ^2.0.1
event_bus: ^2.0.0 event_bus: ^2.0.0
exif: ^3.0.0 exif: ^3.0.0

1
thirdparty/extended_image vendored Submodule

@ -0,0 +1 @@
Subproject commit 112cc8be0c2f07129edd7575003a3f9ddb62ae3f