Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Add lock screen configuration and assets for improved UI

AmanRajSinghMourya3d46548e8a0e
diff --git a/mobile/packages/lock_screen/assets/2.0x/locker_pin.png b/mobile/packages/lock_screen/assets/2.0x/locker_pin.png
new file mode 100644
index 0000000000..01d8019b67
Binary files /dev/null and b/mobile/packages/lock_screen/assets/2.0x/locker_pin.png differ
diff --git a/mobile/packages/lock_screen/assets/3.0x/locker_pin.png b/mobile/packages/lock_screen/assets/3.0x/locker_pin.png
new file mode 100644
index 0000000000..9aa7596c7c
Binary files /dev/null and b/mobile/packages/lock_screen/assets/3.0x/locker_pin.png differ
diff --git a/mobile/packages/lock_screen/assets/locker_pin.png b/mobile/packages/lock_screen/assets/locker_pin.png
new file mode 100644
index 0000000000..42fc6e8c58
Binary files /dev/null and b/mobile/packages/lock_screen/assets/locker_pin.png differ
diff --git a/mobile/packages/lock_screen/lib/lock_screen_config.dart b/mobile/packages/lock_screen/lib/lock_screen_config.dart
new file mode 100644
index 0000000000..e40afb24e5
--- /dev/null
+++ b/mobile/packages/lock_screen/lib/lock_screen_config.dart
@@ -0,0 +1,185 @@
+import "package:ente_ui/theme/colors.dart";
+import "package:ente_ui/theme/ente_theme.dart";
+import "package:ente_ui/theme/theme_config.dart";
+import "package:flutter/material.dart";
+
+/// Configuration for lock screen UI
+class LockScreenConfig {
+ final Widget titleWidget;
+ final Widget Function(BuildContext, TextEditingController?) iconBuilder;
+ final double pinBoxHeight;
+ final double pinBoxWidth;
+ final EdgeInsets? pinBoxPadding;
+ final double pinBoxBorderRadius;
+ final Color? pinBoxBorderColor;
+ final Color? pinBoxBackgroundColor;
+ final bool useDynamicColors;
+
+ const LockScreenConfig({
+ required this.titleWidget,
+ required this.iconBuilder,
+ required this.pinBoxHeight,
+ required this.pinBoxWidth,
+ this.pinBoxPadding,
+ required this.pinBoxBorderRadius,
+ this.pinBoxBorderColor,
+ this.pinBoxBackgroundColor,
+ this.useDynamicColors = false,
+ });
+
+ /// Default configuration for Auth app
+ static const LockScreenConfig auth = LockScreenConfig(
+ titleWidget: SizedBox.shrink(),
+ iconBuilder: _buildAuthIcon,
+ pinBoxHeight: 48,
+ pinBoxWidth: 48,
+ pinBoxPadding: EdgeInsets.only(top: 6.0),
+ pinBoxBorderRadius: 15.0,
+ pinBoxBorderColor: Color.fromRGBO(45, 194, 98, 1.0),
+ pinBoxBackgroundColor: null,
+ useDynamicColors: false,
+ );
+
+ /// Configuration for Locker app
+ static LockScreenConfig locker = LockScreenConfig(
+ titleWidget: _buildLockerTitle(),
+ iconBuilder: _buildLockerIcon,
+ pinBoxHeight: 48,
+ pinBoxWidth: 48,
+ pinBoxPadding: const EdgeInsets.only(top: 6.0),
+ pinBoxBorderRadius: 15.0,
+ pinBoxBorderColor: null,
+ pinBoxBackgroundColor: null,
+ useDynamicColors: true,
+ );
+
+ /// Get current configuration based on AppThemeConfig
+ static LockScreenConfig get current {
+ switch (AppThemeConfig.currentApp) {
+ case EnteApp.locker:
+ return locker;
+ case EnteApp.auth:
+ return auth;
+ }
+ }
+
+ /// Check if title should be shown (not a SizedBox.shrink)
+ bool get showTitle => titleWidget is! SizedBox;
+
+ /// Get border color based on config and theme
+ Color getBorderColor(EnteColorScheme colorTheme) {
+ if (useDynamicColors) {
+ return colorTheme.fillMuted;
+ }
+ return pinBoxBorderColor ?? colorTheme.fillMuted;
+ }
+
+ /// Get background color based on config and theme
+ Color? getBackgroundColor(EnteColorScheme colorTheme) {
+ if (useDynamicColors) {
+ return colorTheme.backgroundBase;
+ }
+ return pinBoxBackgroundColor;
+ }
+
+ // Helper methods for building title
+ static Widget _buildLockerTitle() {
+ return Builder(
+ builder: (context) {
+ final colorTheme = getEnteColorScheme(context);
+ return Text(
+ 'Locker',
+ style: TextStyle(
+ color: colorTheme.primary700,
+ fontSize: 24,
+ fontFamily: 'Inter',
+ fontWeight: FontWeight.w600,
+ ),
+ );
+ },
+ );
+ }
+
+ // Helper methods for building icons
+ static Widget _buildAuthIcon(
+ BuildContext context,
+ TextEditingController? controller,
+ ) {
+ final colorTheme = getEnteColorScheme(context);
+ return SizedBox(
+ height: 120,
+ width: 120,
+ child: Stack(
+ alignment: Alignment.center,
+ children: [
+ Container(
+ width: 82,
+ height: 82,
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ gradient: LinearGradient(
+ colors: [
+ Colors.grey.shade500.withValues(alpha: 0.2),
+ Colors.grey.shade50.withValues(alpha: 0.1),
+ Colors.grey.shade400.withValues(alpha: 0.2),
+ Colors.grey.shade300.withValues(alpha: 0.4),
+ ],
+ begin: Alignment.topCenter,
+ end: Alignment.bottomCenter,
+ ),
+ ),
+ child: Padding(
+ padding: const EdgeInsets.all(1.0),
+ child: Container(
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ color: colorTheme.backgroundBase,
+ ),
+ ),
+ ),
+ ),
+ if (controller != null)
+ SizedBox(
+ height: 75,
+ width: 75,
+ child: ValueListenableBuilder(
+ valueListenable: controller,
+ builder: (context, value, child) {
+ return TweenAnimationBuilder<double>(
+ tween: Tween<double>(
+ begin: 0,
+ end: controller.text.length / 4,
+ ),
+ curve: Curves.ease,
+ duration: const Duration(milliseconds: 250),
+ builder: (context, value, _) => CircularProgressIndicator(
+ backgroundColor: colorTheme.fillFaintPressed,
+ value: value,
+ color: colorTheme.primary400,
+ strokeWidth: 1.5,
+ ),
+ );
+ },
+ ),
+ ),
+ Icon(
+ Icons.lock,
+ color: colorTheme.textBase,
+ size: 30,
+ ),
+ ],
+ ),
+ );
+ }
+
+ static Widget _buildLockerIcon(
+ BuildContext context,
+ TextEditingController? controller,
+ ) {
+ return Image.asset(
+ 'packages/ente_lock_screen/assets/locker_pin.png',
+ width: 129,
+ height: 95,
+ );
+ }
+}
diff --git a/mobile/packages/lock_screen/lib/lock_screen_settings.dart b/mobile/packages/lock_screen/lib/lock_screen_settings.dart
index dda7f90dbb..35499225f5 100644
--- a/mobile/packages/lock_screen/lib/lock_screen_settings.dart
+++ b/mobile/packages/lock_screen/lib/lock_screen_settings.dart
@@ -248,7 +248,7 @@ class LockScreenSettings {
}
}
- Future<bool> isDeviceSupported() async{
+ Future<bool> isDeviceSupported() async {
return await LocalAuthentication().isDeviceSupported();
}
}
diff --git a/mobile/packages/lock_screen/lib/ui/lock_screen_confirm_password.dart b/mobile/packages/lock_screen/lib/ui/lock_screen_confirm_password.dart
index 32d2d7e671..dc8e52b227 100644
--- a/mobile/packages/lock_screen/lib/ui/lock_screen_confirm_password.dart
+++ b/mobile/packages/lock_screen/lib/ui/lock_screen_confirm_password.dart
@@ -1,7 +1,7 @@
+import "package:ente_lock_screen/lock_screen_config.dart";
import "package:ente_lock_screen/lock_screen_settings.dart";
import "package:ente_strings/ente_strings.dart";
import "package:ente_ui/components/buttons/dynamic_fab.dart";
-import "package:ente_ui/components/buttons/icon_button_widget.dart";
import "package:ente_ui/components/text_input_widget.dart";
import "package:ente_ui/theme/ente_theme.dart";
import "package:flutter/material.dart";
@@ -58,6 +58,7 @@ class _LockScreenConfirmPasswordState extends State<LockScreenConfirmPassword> {
Widget build(BuildContext context) {
final colorTheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
+ final config = LockScreenConfig.current;
final isKeypadOpen = MediaQuery.viewInsetsOf(context).bottom > 100;
FloatingActionButtonLocation? fabLocation() {
@@ -69,8 +70,10 @@ class _LockScreenConfirmPasswordState extends State<LockScreenConfirmPassword> {
}
return Scaffold(
+ backgroundColor: config.getBackgroundColor(colorTheme),
resizeToAvoidBottomInset: isKeypadOpen,
appBar: AppBar(
+ backgroundColor: config.getBackgroundColor(colorTheme),
elevation: 0,
leading: IconButton(
onPressed: () {
@@ -82,6 +85,8 @@ class _LockScreenConfirmPasswordState extends State<LockScreenConfirmPassword> {
color: colorTheme.textBase,
),
),
+ centerTitle: config.showTitle,
+ title: config.titleWidget,
),
floatingActionButton: ValueListenableBuilder<bool>(
valueListenable: _isFormValid,
@@ -100,84 +105,44 @@ class _LockScreenConfirmPasswordState extends State<LockScreenConfirmPassword> {
floatingActionButtonAnimator: NoScalingAnimation(),
body: SingleChildScrollView(
child: Center(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- SizedBox(
- height: 120,
- width: 120,
- child: Stack(
- alignment: Alignment.center,
- children: [
- Container(
- width: 82,
- height: 82,
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- gradient: LinearGradient(
- colors: [
- Colors.grey.shade500.withValues(alpha: 0.2),
- Colors.grey.shade50.withValues(alpha: 0.1),
- Colors.grey.shade400.withValues(alpha: 0.2),
- Colors.grey.shade300.withValues(alpha: 0.4),
- ],
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- ),
- ),
- child: Padding(
- padding: const EdgeInsets.all(1.0),
- child: Container(
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- color: colorTheme.backgroundBase,
- ),
- ),
- ),
- ),
- SizedBox(
- height: 75,
- width: 75,
- child: CircularProgressIndicator(
- color: colorTheme.fillFaintPressed,
- value: 1,
- strokeWidth: 1.5,
- ),
- ),
- IconButtonWidget(
- icon: Icons.lock,
- iconButtonType: IconButtonType.primary,
- iconColor: colorTheme.textBase,
- ),
- ],
+ child: Padding(
+ padding: EdgeInsets.symmetric(
+ horizontal: config.showTitle ? 16.0 : 0,
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ SizedBox(height: config.showTitle ? 40 : 0),
+ config.iconBuilder(context, null),
+ SizedBox(height: config.showTitle ? 24 : 0),
+ Text(
+ context.strings.reEnterPassword,
+ textAlign: TextAlign.center,
+ style: textTheme.bodyBold,
),
- ),
- Text(
- context.strings.reEnterPassword,
- style: textTheme.bodyBold,
- ),
- const Padding(padding: EdgeInsets.all(12)),
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16),
- child: TextInputWidget(
- hintText: context.strings.confirmPassword,
- autoFocus: true,
- textCapitalization: TextCapitalization.none,
- isPasswordInput: true,
- shouldSurfaceExecutionStates: false,
- onChange: (p0) {
- _confirmPasswordController.text = p0;
- _isFormValid.value =
- _confirmPasswordController.text.isNotEmpty;
- },
- onSubmit: (p0) {
- return _confirmPasswordMatch();
- },
- submitNotifier: _submitNotifier,
+ const Padding(padding: EdgeInsets.all(12)),
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16),
+ child: TextInputWidget(
+ hintText: context.strings.password,
+ autoFocus: true,
+ textCapitalization: TextCapitalization.none,
+ isPasswordInput: true,
+ shouldSurfaceExecutionStates: false,
+ onChange: (p0) {
+ _confirmPasswordController.text = p0;
+ _isFormValid.value =
+ _confirmPasswordController.text.isNotEmpty;
+ },
+ onSubmit: (p0) {
+ return _confirmPasswordMatch();
+ },
+ submitNotifier: _submitNotifier,
+ ),
),
- ),
- const Padding(padding: EdgeInsets.all(12)),
- ],
+ const Padding(padding: EdgeInsets.all(12)),
+ ],
+ ),
),
),
),
diff --git a/mobile/packages/lock_screen/lib/ui/lock_screen_confirm_pin.dart b/mobile/packages/lock_screen/lib/ui/lock_screen_confirm_pin.dart
index 1553a194f9..3353d45cb2 100644
--- a/mobile/packages/lock_screen/lib/ui/lock_screen_confirm_pin.dart
+++ b/mobile/packages/lock_screen/lib/ui/lock_screen_confirm_pin.dart
@@ -1,5 +1,6 @@
import "dart:io";
+import "package:ente_lock_screen/lock_screen_config.dart";
import "package:ente_lock_screen/lock_screen_settings.dart";
import "package:ente_lock_screen/ui/custom_pin_keypad.dart";
import "package:ente_strings/ente_strings.dart";
@@ -57,8 +58,12 @@ class _LockScreenConfirmPinState extends State<LockScreenConfirmPin> {
Widget build(BuildContext context) {
final colorTheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
+ final config = LockScreenConfig.current;
+
return Scaffold(
+ backgroundColor: config.getBackgroundColor(colorTheme),
appBar: AppBar(
+ backgroundColor: config.getBackgroundColor(colorTheme),
elevation: 0,
leading: IconButton(
onPressed: () {
@@ -69,143 +74,117 @@ class _LockScreenConfirmPinState extends State<LockScreenConfirmPin> {
color: colorTheme.textBase,
),
),
+ centerTitle: config.showTitle,
+ title: config.titleWidget,
),
floatingActionButton: isPlatformDesktop
? null
: CustomPinKeypad(controller: _confirmPinController),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
body: SingleChildScrollView(
- child: _getBody(colorTheme, textTheme),
+ child: _getBody(colorTheme, textTheme, config),
),
);
}
- Widget _getBody(colorTheme, textTheme) {
+ Widget _getBody(colorTheme, textTheme, LockScreenConfig config) {
final pinPutDecoration = PinTheme(
- height: 48,
- width: 48,
- padding: const EdgeInsets.only(top: 6.0),
+ height: config.pinBoxHeight,
+ width: config.pinBoxWidth,
+ padding: config.pinBoxPadding,
decoration: BoxDecoration(
- border: Border.all(color: const Color.fromRGBO(45, 194, 98, 1.0)),
- borderRadius: BorderRadius.circular(15.0),
+ color: config.getBackgroundColor(colorTheme),
+ border: Border.all(
+ color: config.getBorderColor(colorTheme),
+ width: 1,
+ ),
+ borderRadius: BorderRadius.circular(config.pinBoxBorderRadius),
),
);
return Center(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- SizedBox(
- height: 120,
- width: 120,
- child: Stack(
- alignment: Alignment.center,
- children: [
- Container(
- width: 82,
- height: 82,
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- gradient: LinearGradient(
- colors: [
- Colors.grey.shade500.withValues(alpha: 0.2),
- Colors.grey.shade50.withValues(alpha: 0.1),
- Colors.grey.shade400.withValues(alpha: 0.2),
- Colors.grey.shade300.withValues(alpha: 0.4),
- ],
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- ),
- ),
- child: Padding(
- padding: const EdgeInsets.all(1.0),
- child: Container(
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- color: colorTheme.backgroundBase,
- ),
- ),
+ child: Padding(
+ padding: EdgeInsets.symmetric(horizontal: config.showTitle ? 24.0 : 0),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ SizedBox(height: config.showTitle ? 40 : 0),
+ config.iconBuilder(context, _confirmPinController),
+ SizedBox(height: config.showTitle ? 24 : 0),
+ Text(
+ context.strings.reEnterPin,
+ style: textTheme.bodyBold,
+ ),
+ const Padding(padding: EdgeInsets.all(12)),
+ Pinput(
+ length: 4,
+ showCursor: false,
+ useNativeKeyboard: isPlatformDesktop,
+ autofocus: true,
+ controller: _confirmPinController,
+ defaultPinTheme: pinPutDecoration.copyWith(
+ textStyle: textTheme.h3Bold,
+ decoration: BoxDecoration(
+ borderRadius:
+ BorderRadius.circular(config.pinBoxBorderRadius),
+ border: Border.all(
+ color: config.getBorderColor(colorTheme),
),
),
- SizedBox(
- height: 75,
- width: 75,
- child: ValueListenableBuilder(
- valueListenable: _confirmPinController,
- builder: (context, value, child) {
- return TweenAnimationBuilder<double>(
- tween: Tween<double>(
- begin: 0,
- end: _confirmPinController.text.length / 4,
- ),
- curve: Curves.ease,
- duration: const Duration(milliseconds: 250),
- builder: (context, value, _) =>
- CircularProgressIndicator(
- backgroundColor: colorTheme.fillFaintPressed,
- value: value,
- color: colorTheme.primary400,
- strokeWidth: 1.5,
- ),
- );
- },
- ),
+ ),
+ submittedPinTheme: pinPutDecoration.copyWith(
+ textStyle: textTheme.h3Bold.copyWith(
+ color: config.showTitle ? colorTheme.primary700 : null,
),
- Icon(
- Icons.lock,
- color: colorTheme.textBase,
- size: 30,
+ decoration: BoxDecoration(
+ borderRadius:
+ BorderRadius.circular(config.pinBoxBorderRadius),
+ border: Border.all(
+ color: config.showTitle
+ ? colorTheme.primary700
+ : colorTheme.fillBase,
+ ),
),
- ],
- ),
- ),
- Text(
- context.strings.reEnterPin,
- style: textTheme.bodyBold,
- ),
- const Padding(padding: EdgeInsets.all(12)),
- Pinput(
- length: 4,
- showCursor: false,
- useNativeKeyboard: isPlatformDesktop,
- autofocus: true,
- controller: _confirmPinController,
- defaultPinTheme: pinPutDecoration,
- submittedPinTheme: pinPutDecoration.copyWith(
- textStyle: textTheme.h3Bold,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(10.0),
- border: Border.all(
- color: colorTheme.fillBase,
+ ),
+ followingPinTheme: pinPutDecoration.copyWith(
+ decoration: BoxDecoration(
+ borderRadius:
+ BorderRadius.circular(config.pinBoxBorderRadius),
+ border: Border.all(
+ color: config.getBorderColor(colorTheme),
+ ),
),
),
- ),
- followingPinTheme: pinPutDecoration.copyWith(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(10.0),
- border: Border.all(
- color: colorTheme.fillMuted,
+ focusedPinTheme: pinPutDecoration.copyWith(
+ decoration: BoxDecoration(
+ borderRadius:
+ BorderRadius.circular(config.pinBoxBorderRadius),
+ border: Border.all(
+ color: config.showTitle
+ ? colorTheme.fillBase
+ : config.getBorderColor(colorTheme),
+ ),
),
),
- ),
- focusedPinTheme: pinPutDecoration,
- errorPinTheme: pinPutDecoration.copyWith(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(10.0),
- border: Border.all(
- color: colorTheme.warning400,
+ errorPinTheme: pinPutDecoration.copyWith(
+ decoration: BoxDecoration(
+ borderRadius:
+ BorderRadius.circular(config.pinBoxBorderRadius),
+ border: Border.all(
+ color: colorTheme.warning400,
+ ),
),
),
+ errorText: '',
+ obscureText: true,
+ obscuringCharacter: '*',
+ forceErrorState: isConfirmPinValid,
+ onCompleted: (value) async {
+ await _confirmPinMatch();
+ },
),
- errorText: '',
- obscureText: true,
- obscuringCharacter: '*',
- forceErrorState: isConfirmPinValid,
- onCompleted: (value) async {
- await _confirmPinMatch();
- },
- ),
- ],
+ ],
+ ),
),
);
}
diff --git a/mobile/packages/lock_screen/lib/ui/lock_screen_password.dart b/mobile/packages/lock_screen/lib/ui/lock_screen_password.dart
index 85a1cb4d0b..768adcc9f3 100644
--- a/mobile/packages/lock_screen/lib/ui/lock_screen_password.dart
+++ b/mobile/packages/lock_screen/lib/ui/lock_screen_password.dart
@@ -1,12 +1,12 @@
import "dart:convert";
import "package:ente_crypto_dart/ente_crypto_dart.dart";
+import "package:ente_lock_screen/lock_screen_config.dart";
import "package:ente_lock_screen/lock_screen_settings.dart";
import "package:ente_lock_screen/ui/lock_screen_confirm_password.dart";
import "package:ente_lock_screen/ui/lock_screen_options.dart";
import "package:ente_strings/ente_strings.dart";
import "package:ente_ui/components/buttons/dynamic_fab.dart";
-import "package:ente_ui/components/buttons/icon_button_widget.dart";
import "package:ente_ui/components/text_input_widget.dart";
import "package:ente_ui/theme/ente_theme.dart";
import "package:flutter/material.dart";
@@ -69,6 +69,7 @@ class _LockScreenPasswordState extends State<LockScreenPassword> {
Widget build(BuildContext context) {
final colorTheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
+ final config = LockScreenConfig.current;
final isKeypadOpen = MediaQuery.viewInsetsOf(context).bottom > 100;
FloatingActionButtonLocation? fabLocation() {
@@ -80,8 +81,10 @@ class _LockScreenPasswordState extends State<LockScreenPassword> {
}
return Scaffold(
+ backgroundColor: config.getBackgroundColor(colorTheme),
resizeToAvoidBottomInset: isKeypadOpen,
appBar: AppBar(
+ backgroundColor: config.getBackgroundColor(colorTheme),
elevation: 0,
leading: IconButton(
onPressed: () {
@@ -93,6 +96,8 @@ class _LockScreenPasswordState extends State<LockScreenPassword> {
color: colorTheme.textBase,
),
),
+ centerTitle: config.showTitle,
+ title: config.titleWidget,
),
floatingActionButton: ValueListenableBuilder<bool>(
valueListenable: _isFormValid,
@@ -111,86 +116,45 @@ class _LockScreenPasswordState extends State<LockScreenPassword> {
floatingActionButtonAnimator: NoScalingAnimation(),
body: SingleChildScrollView(
child: Center(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- SizedBox(
- height: 120,
- width: 120,
- child: Stack(
- alignment: Alignment.center,
- children: [
- Container(
- width: 82,
- height: 82,
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- gradient: LinearGradient(
- colors: [
- Colors.grey.shade500.withValues(alpha: 0.2),
- Colors.grey.shade50.withValues(alpha: 0.1),
- Colors.grey.shade400.withValues(alpha: 0.2),
- Colors.grey.shade300.withValues(alpha: 0.4),
- ],
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- ),
- ),
- child: Padding(
- padding: const EdgeInsets.all(1.0),
- child: Container(
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- color: colorTheme.backgroundBase,
- ),
- ),
- ),
- ),
- SizedBox(
- height: 75,
- width: 75,
- child: CircularProgressIndicator(
- color: colorTheme.fillFaintPressed,
- value: 1,
- strokeWidth: 1.5,
- ),
- ),
- IconButtonWidget(
- icon: Icons.lock,
- iconButtonType: IconButtonType.primary,
- iconColor: colorTheme.textBase,
- ),
- ],
+ child: Padding(
+ padding: EdgeInsets.symmetric(
+ horizontal: config.showTitle ? 16.0 : 0,
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ SizedBox(height: config.showTitle ? 40 : 0),
+ config.iconBuilder(context, null),
+ SizedBox(height: config.showTitle ? 24 : 0),
+ Text(
+ widget.isChangingLockScreenSettings
+ ? context.strings.enterPassword
+ : context.strings.setNewPassword,
+ textAlign: TextAlign.center,
+ style: textTheme.bodyBold,
),
- ),
- Text(
- widget.isChangingLockScreenSettings
- ? context.strings.enterPassword
- : context.strings.setNewPassword,
- textAlign: TextAlign.center,
- style: textTheme.bodyBold,
- ),
- const Padding(padding: EdgeInsets.all(12)),
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16),
- child: TextInputWidget(
- hintText: context.strings.password,
- autoFocus: true,
- textCapitalization: TextCapitalization.none,
- isPasswordInput: true,
- shouldSurfaceExecutionStates: false,
- onChange: (p0) {
- _passwordController.text = p0;
- _isFormValid.value = _passwordController.text.isNotEmpty;
- },
- onSubmit: (p0) {
- return _confirmPassword();
- },
- submitNotifier: _submitNotifier,
+ const Padding(padding: EdgeInsets.all(12)),
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16),
+ child: TextInputWidget(
+ hintText: context.strings.password,
+ autoFocus: true,
+ textCapitalization: TextCapitalization.none,
+ isPasswordInput: true,
+ shouldSurfaceExecutionStates: false,
+ onChange: (p0) {
+ _passwordController.text = p0;
+ _isFormValid.value = _passwordController.text.isNotEmpty;
+ },
+ onSubmit: (p0) {
+ return _confirmPassword();
+ },
+ submitNotifier: _submitNotifier,
+ ),
),
- ),
- const Padding(padding: EdgeInsets.all(12)),
- ],
+ const Padding(padding: EdgeInsets.all(12)),
+ ],
+ ),
),
),
),
diff --git a/mobile/packages/lock_screen/lib/ui/lock_screen_pin.dart b/mobile/packages/lock_screen/lib/ui/lock_screen_pin.dart
index a5f1950bb8..d7bd61e4de 100644
--- a/mobile/packages/lock_screen/lib/ui/lock_screen_pin.dart
+++ b/mobile/packages/lock_screen/lib/ui/lock_screen_pin.dart
@@ -2,6 +2,7 @@ import "dart:convert";
import "dart:io";
import "package:ente_crypto_dart/ente_crypto_dart.dart";
+import "package:ente_lock_screen/lock_screen_config.dart";
import "package:ente_lock_screen/lock_screen_settings.dart";
import "package:ente_lock_screen/ui/custom_pin_keypad.dart";
import "package:ente_lock_screen/ui/lock_screen_confirm_pin.dart";
@@ -124,18 +125,25 @@ class _LockScreenPinState extends State<LockScreenPin> {
Widget build(BuildContext context) {
final colorTheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
+ final config = LockScreenConfig.current;
final pinPutDecoration = PinTheme(
- height: 48,
- width: 48,
- padding: const EdgeInsets.only(top: 6.0),
+ height: config.pinBoxHeight,
+ width: config.pinBoxWidth,
+ padding: config.pinBoxPadding,
decoration: BoxDecoration(
- border: Border.all(color: const Color.fromRGBO(45, 194, 98, 1.0)),
- borderRadius: BorderRadius.circular(15.0),
+ color: config.getBackgroundColor(colorTheme),
+ border: Border.all(
+ color: config.getBorderColor(colorTheme),
+ width: 1,
+ ),
+ borderRadius: BorderRadius.circular(config.pinBoxBorderRadius),
),
);
return Scaffold(
+ backgroundColor: config.getBackgroundColor(colorTheme),
appBar: AppBar(
+ backgroundColor: config.getBackgroundColor(colorTheme),
elevation: 0,
leading: IconButton(
onPressed: () {
@@ -146,13 +154,15 @@ class _LockScreenPinState extends State<LockScreenPin> {
color: colorTheme.textBase,
),
),
+ centerTitle: config.showTitle,
+ title: config.titleWidget,
),
floatingActionButton: isPlatformDesktop
? null
: CustomPinKeypad(controller: _pinController),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
body: SingleChildScrollView(
- child: _getBody(colorTheme, textTheme, pinPutDecoration),
+ child: _getBody(colorTheme, textTheme, pinPutDecoration, config),
),
);
}
@@ -161,124 +171,93 @@ class _LockScreenPinState extends State<LockScreenPin> {
EnteColorScheme colorTheme,
EnteTextTheme textTheme,
PinTheme pinPutDecoration,
+ LockScreenConfig config,
) {
return Center(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- SizedBox(
- height: 120,
- width: 120,
- child: Stack(
- alignment: Alignment.center,
- children: [
- Container(
- width: 82,
- height: 82,
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- gradient: LinearGradient(
- colors: [
- Colors.grey.shade500.withValues(alpha: 0.2),
- Colors.grey.shade50.withValues(alpha: 0.1),
- Colors.grey.shade400.withValues(alpha: 0.2),
- Colors.grey.shade300.withValues(alpha: 0.4),
- ],
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- ),
- ),
- child: Padding(
- padding: const EdgeInsets.all(1.0),
- child: Container(
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- color: colorTheme.backgroundBase,
- ),
- ),
+ child: Padding(
+ padding: EdgeInsets.symmetric(horizontal: config.showTitle ? 24.0 : 0),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ SizedBox(height: config.showTitle ? 40 : 0),
+ config.iconBuilder(context, _pinController),
+ SizedBox(height: config.showTitle ? 24 : 0),
+ Text(
+ widget.isChangingLockScreenSettings
+ ? context.strings.enterPin
+ : context.strings.setNewPin,
+ style: textTheme.bodyBold,
+ ),
+ const Padding(padding: EdgeInsets.all(12)),
+ Pinput(
+ length: 4,
+ showCursor: false,
+ useNativeKeyboard: isPlatformDesktop,
+ controller: _pinController,
+ autofocus: true,
+ defaultPinTheme: pinPutDecoration.copyWith(
+ textStyle: textTheme.h3Bold,
+ decoration: BoxDecoration(
+ borderRadius:
+ BorderRadius.circular(config.pinBoxBorderRadius),
+ border: Border.all(
+ color: config.getBorderColor(colorTheme),
),
),
- SizedBox(
- height: 75,
- width: 75,
- child: ValueListenableBuilder(
- valueListenable: _pinController,
- builder: (context, value, child) {
- return TweenAnimationBuilder<double>(
- tween: Tween<double>(
- begin: 0,
- end: _pinController.text.length / 4,
- ),
- curve: Curves.ease,
- duration: const Duration(milliseconds: 250),
- builder: (context, value, _) =>
- CircularProgressIndicator(
- backgroundColor: colorTheme.fillFaintPressed,
- value: value,
- color: colorTheme.primary400,
- strokeWidth: 1.5,
- ),
- );
- },
- ),
+ ),
+ submittedPinTheme: pinPutDecoration.copyWith(
+ textStyle: textTheme.h3Bold.copyWith(
+ color: config.showTitle ? colorTheme.primary700 : null,
),
- Icon(
- Icons.lock,
- color: colorTheme.textBase,
- size: 30,
+ decoration: BoxDecoration(
+ borderRadius:
+ BorderRadius.circular(config.pinBoxBorderRadius),
+ border: Border.all(
+ color: config.showTitle
+ ? colorTheme.primary700
+ : colorTheme.fillBase,
+ ),
),
- ],
- ),
- ),
- Text(
- widget.isChangingLockScreenSettings
- ? context.strings.enterPin
- : context.strings.setNewPin,
- style: textTheme.bodyBold,
- ),
- const Padding(padding: EdgeInsets.all(12)),
- Pinput(
- length: 4,
- showCursor: false,
- useNativeKeyboard: isPlatformDesktop,
- controller: _pinController,
- autofocus: true,
- defaultPinTheme: pinPutDecoration,
- submittedPinTheme: pinPutDecoration.copyWith(
- textStyle: textTheme.h3Bold,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(10.0),
- border: Border.all(
- color: colorTheme.fillBase,
+ ),
+ followingPinTheme: pinPutDecoration.copyWith(
+ decoration: BoxDecoration(
+ borderRadius:
+ BorderRadius.circular(config.pinBoxBorderRadius),
+ border: Border.all(
+ color: config.getBorderColor(colorTheme),
+ ),
),
),
- ),
- followingPinTheme: pinPutDecoration.copyWith(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(10.0),
- border: Border.all(
- color: colorTheme.fillMuted,
+ focusedPinTheme: pinPutDecoration.copyWith(
+ decoration: BoxDecoration(
+ borderRadius:
+ BorderRadius.circular(config.pinBoxBorderRadius),
+ border: Border.all(
+ color: config.showTitle
+ ? colorTheme.fillBase
+ : config.getBorderColor(colorTheme),
+ ),
),
),
- ),
- focusedPinTheme: pinPutDecoration,
- errorPinTheme: pinPutDecoration.copyWith(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(10.0),
- border: Border.all(
- color: colorTheme.warning400,
+ errorPinTheme: pinPutDecoration.copyWith(
+ decoration: BoxDecoration(
+ borderRadius:
+ BorderRadius.circular(config.pinBoxBorderRadius),
+ border: Border.all(
+ color: colorTheme.warning400,
+ ),
),
),
+ forceErrorState: isPinValid,
+ obscureText: true,
+ obscuringCharacter: '*',
+ errorText: '',
+ onCompleted: (value) async {
+ await _confirmPin(_pinController.text);
+ },
),
- forceErrorState: isPinValid,
- obscureText: true,
- obscuringCharacter: '*',
- errorText: '',
- onCompleted: (value) async {
- await _confirmPin(_pinController.text);
- },
- ),
- ],
+ ],
+ ),
),
);
}