Skip to content

armgit / ente

Public Imported from GitHub
0

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

[auth] Show advance option only when code setup

Aman Raj Singh Mouryab35cd47c8ac7
diff --git a/auth/lib/onboarding/view/setup_enter_secret_key_page.dart b/auth/lib/onboarding/view/setup_enter_secret_key_page.dart
index 4fa1644d08..38aa777a27 100644
--- a/auth/lib/onboarding/view/setup_enter_secret_key_page.dart
+++ b/auth/lib/onboarding/view/setup_enter_secret_key_page.dart
@@ -281,51 +281,78 @@ class _SetupEnterSecretKeyPageState extends State<SetupEnterSecretKeyPage> {
],
),
const SizedBox(height: 12),
- Row(
- children: [
- const FieldLabel("Digits"),
- Expanded(
- child: TextFormField(
- keyboardType: TextInputType.number,
- // The validator receives the text that the user has entered.
- validator: (value) {
- if (value == null || value.isEmpty) {
- return "Please enter a number";
- }
- final intValue = int.tryParse(value);
- if (intValue == null) {
- return "Only integers are allowed";
- }
- if (intValue < 1 || intValue > 10) {
- return "OTP digits must be between 1 and 10";
- }
- return null;
- },
- maxLines: 1,
- decoration: const InputDecoration(
- contentPadding:
- EdgeInsets.symmetric(vertical: 12.0),
+ widget.code == null
+ ? Theme(
+ data: Theme.of(context).copyWith(
+ splashColor: Colors.transparent,
+ highlightColor: Colors.transparent,
+ hoverColor: Colors.transparent,
),
- style: getEnteTextTheme(context).small,
- controller: _digitsController,
- ),
- ),
- ],
- ),
- const SizedBox(height: 22),
- Row(
- children: [
- const FieldLabel("Algorithm"),
- AlgorithmSelectorWidget(
- currentAlgorithm: _algorithm,
- onSelected: (newAlgorithm) async {
- setState(() {
- _algorithm = newAlgorithm;
- });
- },
- ),
- ],
- ),
+ child: ExpansionTile(
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(8.0),
+ ),
+ collapsedShape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(8.0),
+ ),
+ collapsedBackgroundColor: Colors.transparent,
+ tilePadding: EdgeInsets.zero,
+ title: Text(
+ "Advanced",
+ style: getEnteTextTheme(context).small,
+ ),
+ children: <Widget>[
+ Row(
+ children: [
+ const FieldLabel("Digits"),
+ Expanded(
+ child: TextFormField(
+ keyboardType: TextInputType.number,
+ // The validator receives the text that the user has entered.
+ validator: (value) {
+ if (value == null || value.isEmpty) {
+ return "Please enter a number";
+ }
+ final intValue = int.tryParse(value);
+ if (intValue == null) {
+ return "Only integers are allowed";
+ }
+ if (intValue < 1 || intValue > 10) {
+ return "OTP digits must be between 1 and 10";
+ }
+ return null;
+ },
+ maxLines: 1,
+ decoration: const InputDecoration(
+ contentPadding: EdgeInsets.symmetric(
+ vertical: 12.0,
+ ),
+ ),
+ style: getEnteTextTheme(context).small,
+ controller: _digitsController,
+ ),
+ ),
+ ],
+ ),
+ const SizedBox(height: 22),
+ Row(
+ children: [
+ const FieldLabel("Algorithm"),
+ AlgorithmSelectorWidget(
+ currentAlgorithm: _algorithm,
+ onSelected: (newAlgorithm) async {
+ setState(() {
+ _algorithm = newAlgorithm;
+ });
+ },
+ ),
+ ],
+ ),
+ const SizedBox(height: 12),
+ ],
+ ),
+ )
+ : const SizedBox.shrink(),
const SizedBox(height: 12),
Wrap(
spacing: 12,
diff --git a/auth/lib/ui/algorithm_selector_widget.dart b/auth/lib/ui/algorithm_selector_widget.dart
index d4ef28037d..f84aba156d 100644
--- a/auth/lib/ui/algorithm_selector_widget.dart
+++ b/auth/lib/ui/algorithm_selector_widget.dart
@@ -1,4 +1,5 @@
import 'package:ente_auth/models/code.dart';
+import 'package:ente_auth/theme/ente_theme.dart';
import 'package:flutter/material.dart';
class AlgorithmSelectorWidget extends StatelessWidget {
@@ -15,10 +16,7 @@ class AlgorithmSelectorWidget extends StatelessWidget {
Text algorithmOptionText(Algorithm algorithm) {
return Text(
algorithm.name.toUpperCase(),
- style: Theme.of(context).textTheme.titleMedium!.copyWith(
- fontSize: 14,
- color: Theme.of(context).iconTheme.color!.withOpacity(0.7),
- ),
+ style: getEnteTextTheme(context).small,
);
}