diff --git a/auth/lib/ui/two_factor_authentication_page.dart b/auth/lib/ui/two_factor_authentication_page.dart index 58a462286..068f4255d 100644 --- a/auth/lib/ui/two_factor_authentication_page.dart +++ b/auth/lib/ui/two_factor_authentication_page.dart @@ -4,8 +4,7 @@ import 'package:ente_auth/services/user_service.dart'; import 'package:ente_auth/ui/lifecycle_event_handler.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; - -import 'package:pinput/pinput.dart'; +import 'package:pinput/pin_put/pin_put.dart'; class TwoFactorAuthenticationPage extends StatefulWidget { final String sessionID; @@ -20,6 +19,10 @@ class TwoFactorAuthenticationPage extends StatefulWidget { class _TwoFactorAuthenticationPageState extends State { final _pinController = TextEditingController(); + final _pinPutDecoration = BoxDecoration( + border: Border.all(color: const Color.fromRGBO(45, 194, 98, 1.0)), + borderRadius: BorderRadius.circular(15.0), + ); String _code = ""; late LifecycleEventHandler _lifecycleEventHandler; @@ -60,16 +63,6 @@ class _TwoFactorAuthenticationPageState Widget _getBody() { final l10n = context.l10n; - final pinPutDecoration = BoxDecoration( - border: Border.all( - color: Theme.of(context) - .inputDecorationTheme - .focusedBorder! - .borderSide - .color, - ), - borderRadius: BorderRadius.circular(15.0), - ); return Column( crossAxisAlignment: CrossAxisAlignment.stretch, mainAxisAlignment: MainAxisAlignment.center, @@ -86,31 +79,32 @@ class _TwoFactorAuthenticationPageState const Padding(padding: EdgeInsets.all(32)), Padding( padding: const EdgeInsets.fromLTRB(40, 0, 40, 0), - child: Pinput( - onSubmitted: (String code) { + child: PinPut( + fieldsCount: 6, + onSubmit: (String code) { _verifyTwoFactorCode(code); }, - length: 6, - defaultPinTheme: const PinTheme(), - submittedPinTheme: PinTheme( - decoration: pinPutDecoration.copyWith( - borderRadius: BorderRadius.circular(20.0), - ), - ), - focusedPinTheme: PinTheme( - decoration: pinPutDecoration, - ), - followingPinTheme: PinTheme( - decoration: pinPutDecoration.copyWith( - borderRadius: BorderRadius.circular(5.0), - ), - ), onChanged: (String pin) { setState(() { _code = pin; }); }, controller: _pinController, + submittedFieldDecoration: _pinPutDecoration.copyWith( + borderRadius: BorderRadius.circular(20.0), + ), + selectedFieldDecoration: _pinPutDecoration, + followingFieldDecoration: _pinPutDecoration.copyWith( + borderRadius: BorderRadius.circular(5.0), + border: Border.all( + color: const Color.fromRGBO(45, 194, 98, 0.5), + ), + ), + inputDecoration: const InputDecoration( + focusedBorder: InputBorder.none, + border: InputBorder.none, + counterText: '', + ), autofocus: true, ), ), diff --git a/auth/pubspec.lock b/auth/pubspec.lock index 35dd96356..73b3075cb 100644 --- a/auth/pubspec.lock +++ b/auth/pubspec.lock @@ -1109,10 +1109,10 @@ packages: dependency: "direct main" description: name: pinput - sha256: a92b55ecf9c25d1b9e100af45905385d5bc34fc9b6b04177a9e82cb88fe4d805 + sha256: "27eb69042f75755bdb6544f6e79a50a6ed09d6e97e2d75c8421744df1e392949" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "1.2.2" platform: dependency: transitive description: @@ -1334,14 +1334,6 @@ packages: description: flutter source: sdk version: "0.0.99" - smart_auth: - dependency: transitive - description: - name: smart_auth - sha256: a25229b38c02f733d0a4e98d941b42bed91a976cb589e934895e60ccfa674cf6 - url: "https://pub.dev" - source: hosted - version: "1.1.1" sodium: dependency: transitive description: @@ -1551,14 +1543,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.2.2" - universal_platform: - dependency: transitive - description: - name: universal_platform - sha256: d315be0f6641898b280ffa34e2ddb14f3d12b1a37882557869646e0cc363d0cc - url: "https://pub.dev" - source: hosted - version: "1.0.0+1" url_launcher: dependency: "direct main" description: diff --git a/auth/pubspec.yaml b/auth/pubspec.yaml index 7f8e20bc8..049180fc4 100644 --- a/auth/pubspec.yaml +++ b/auth/pubspec.yaml @@ -75,7 +75,7 @@ dependencies: password_strength: ^0.2.0 path: ^1.8.3 path_provider: ^2.0.11 - pinput: ^3.0.1 + pinput: ^1.2.2 pointycastle: ^3.7.3 privacy_screen: ^0.0.6 protobuf: ^3.0.0