Skip to content

armgit / ente

Public Imported from GitHub
0

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

Align auth primary palette and toggle styling

Prateek Sunalebeaea8a6bd5
diff --git a/mobile/apps/auth/lib/theme/colors.dart b/mobile/apps/auth/lib/theme/colors.dart
index c92d57dba0..e35a4b189e 100644
--- a/mobile/apps/auth/lib/theme/colors.dart
+++ b/mobile/apps/auth/lib/theme/colors.dart
@@ -247,10 +247,10 @@ const Color blurStrokePressedDark = Color.fromRGBO(255, 255, 255, 0.50);
const Color _primaryGreen = Color.fromRGBO(29, 185, 84, 1);
-const Color _primary700 = accentColor;
+const Color _primary700 = Color(0xFF722ED1);
const Color _primary500 = accentColor;
-const Color _primary400 = accentColor;
-const Color _primary300 = accentColor;
+const Color _primary400 = Color(0xFF7A29C1);
+const Color _primary300 = Color(0xFF984DF4);
const Color _iconButtonBrightColor = Color.fromRGBO(130, 50, 225, 1);
const Color _iconButtonDarkColor = Color.fromRGBO(255, 150, 16, 1);
diff --git a/mobile/apps/auth/lib/ui/settings/data/local_backup/local_backup_experience.dart b/mobile/apps/auth/lib/ui/settings/data/local_backup/local_backup_experience.dart
index 016d6954c4..af35d1649b 100644
--- a/mobile/apps/auth/lib/ui/settings/data/local_backup/local_backup_experience.dart
+++ b/mobile/apps/auth/lib/ui/settings/data/local_backup/local_backup_experience.dart
@@ -182,7 +182,7 @@ class _LocalBackupExperienceState extends State<LocalBackupExperience> {
}
Future<bool> _ensurePasswordConfigured(
- {required bool disableOnCancel}) async {
+ {required bool disableOnCancel,}) async {
if (await _hasStoredPassword()) {
return true;
}
diff --git a/mobile/packages/ui/lib/components/toggle_switch_widget.dart b/mobile/packages/ui/lib/components/toggle_switch_widget.dart
index 438bcf177f..ab56cf6ff4 100644
--- a/mobile/packages/ui/lib/components/toggle_switch_widget.dart
+++ b/mobile/packages/ui/lib/components/toggle_switch_widget.dart
@@ -1,9 +1,12 @@
+import "dart:io";
+
import 'package:ente_base/typedefs.dart';
import 'package:ente_ui/components/loading_widget.dart';
import 'package:ente_ui/models/execution_states.dart';
import 'package:ente_ui/theme/ente_theme.dart';
import 'package:ente_utils/debouncer.dart';
import 'package:flutter/material.dart';
+import 'package:flutter/cupertino.dart';
typedef OnChangedCallBack = void Function(bool);
@@ -51,59 +54,70 @@ class _ToggleSwitchWidgetState extends State<ToggleSwitchWidget> {
height: 31,
child: FittedBox(
fit: BoxFit.contain,
- child: Switch.adaptive(
- activeColor: enteColorScheme.primary400,
- activeTrackColor: enteColorScheme.primary300,
- inactiveTrackColor: enteColorScheme.fillMuted,
- materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
- value: toggleValue ?? false,
- onChanged: (negationOfToggleValue) async {
- setState(() {
- toggleValue = negationOfToggleValue;
- //start showing inProgress statu icons if toggle takes more than debounce time
- _debouncer.run(
- () => Future(
- () {
- setState(() {
- executionState = ExecutionState.inProgress;
- });
- },
+ child: Platform.isAndroid
+ ? Switch(
+ inactiveTrackColor: enteColorScheme.fillMuted,
+ activeTrackColor: enteColorScheme.primary500,
+ activeColor: Colors.white,
+ inactiveThumbColor: enteColorScheme.primary500,
+ trackOutlineColor: WidgetStateColor.resolveWith(
+ (states) => enteColorScheme.primary500,
),
- );
- });
- final Stopwatch stopwatch = Stopwatch()..start();
- await widget.onChanged.call().onError(
- (error, stackTrace) => _debouncer.cancelDebounce(),
- );
- //for toggle feedback on short unsuccessful onChanged
- await _feedbackOnUnsuccessfulToggle(stopwatch);
- //debouncer gets canceled if onChanged takes less than debounce time
- _debouncer.cancelDebounce();
-
- final newValue = widget.value.call();
- setState(() {
- if (toggleValue == newValue) {
- if (executionState == ExecutionState.inProgress) {
- executionState = ExecutionState.successful;
- Future.delayed(const Duration(seconds: 2), () {
- setState(() {
- executionState = ExecutionState.idle;
- });
- });
- }
- } else {
- toggleValue = !toggleValue!;
- executionState = ExecutionState.idle;
- }
- });
- },
- ),
+ materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
+ value: toggleValue ?? false,
+ onChanged: _handleToggleChange,
+ )
+ : CupertinoSwitch(
+ value: toggleValue ?? false,
+ onChanged: _handleToggleChange,
+ ),
),
),
],
);
}
+ Future<void> _handleToggleChange(bool negationOfToggleValue) async {
+ setState(() {
+ toggleValue = negationOfToggleValue;
+ //start showing inProgress statu icons if toggle takes more than debounce time
+ _debouncer.run(
+ () => Future(
+ () {
+ setState(() {
+ executionState = ExecutionState.inProgress;
+ });
+ },
+ ),
+ );
+ });
+ final Stopwatch stopwatch = Stopwatch()..start();
+ await widget.onChanged.call().onError(
+ (error, stackTrace) => _debouncer.cancelDebounce(),
+ );
+ //for toggle feedback on short unsuccessful onChanged
+ await _feedbackOnUnsuccessfulToggle(stopwatch);
+ //debouncer gets canceled if onChanged takes less than debounce time
+ _debouncer.cancelDebounce();
+
+ final newValue = widget.value.call();
+ setState(() {
+ if (toggleValue == newValue) {
+ if (executionState == ExecutionState.inProgress) {
+ executionState = ExecutionState.successful;
+ Future.delayed(const Duration(seconds: 2), () {
+ setState(() {
+ executionState = ExecutionState.idle;
+ });
+ });
+ }
+ } else {
+ toggleValue = !toggleValue!;
+ executionState = ExecutionState.idle;
+ }
+ });
+ }
+
Widget _stateIcon(enteColorScheme) {
if (executionState == ExecutionState.idle) {
return const SizedBox(width: 24);
diff --git a/mobile/packages/ui/lib/theme/colors.dart b/mobile/packages/ui/lib/theme/colors.dart
index 0f280e7782..75dda57821 100644
--- a/mobile/packages/ui/lib/theme/colors.dart
+++ b/mobile/packages/ui/lib/theme/colors.dart
@@ -31,14 +31,14 @@ class EnteColorScheme extends ThemeExtension<EnteColorScheme> {
}) {
final appColors = switch (app) {
EnteApp.auth => (
- primary700: const Color.fromARGB(255, 164, 0, 182),
- primary500: const Color.fromARGB(255, 204, 10, 101),
- primary400: const Color.fromARGB(255, 122, 41, 193),
- primary300: const Color.fromARGB(255, 152, 77, 244),
- gradientButtonBgColor: const Color(0xFF531DAB),
+ primary700: const Color(0xFF722ED1),
+ primary500: const Color(0xFFA75CFF),
+ primary400: const Color(0xFF7A29C1),
+ primary300: const Color(0xFF984DF4),
+ gradientButtonBgColor: const Color(0xFF722ED1),
gradientButtonBgColors: const [
- Color.fromARGB(255, 122, 41, 193),
- Color.fromARGB(255, 122, 41, 193),
+ Color(0xFF722ED1),
+ Color(0xFFA75CFF),
],
),
EnteApp.locker => (