Skip to content

armgit / ente

Public Imported from GitHub
0

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

refactor: replace Pinput with PinInputComponent and remove unused themes

AmanRajSinghMouryaad0c28ef9e96
diff --git a/mobile/apps/photos/lib/ui/account/ott_verification_page.dart b/mobile/apps/photos/lib/ui/account/ott_verification_page.dart
index bdfde2b7ff..b88da64cd9 100644
--- a/mobile/apps/photos/lib/ui/account/ott_verification_page.dart
+++ b/mobile/apps/photos/lib/ui/account/ott_verification_page.dart
@@ -2,7 +2,6 @@ import "package:ente_components/ente_components.dart";
import "package:ente_strings/ente_strings.dart";
import 'package:flutter/material.dart';
import 'package:photos/services/account/user_service.dart';
-import "package:pinput/pinput.dart";
class OTTVerificationPage extends StatefulWidget {
final String email;
@@ -108,31 +107,6 @@ class _OTTVerificationPageState extends State<OTTVerificationPage> {
Widget _getBody() {
final colors = context.componentColors;
- final defaultPinTheme = PinTheme(
- height: 52,
- width: 48,
- textStyle: TextStyles.body.copyWith(color: colors.textBase),
- decoration: BoxDecoration(
- border: Border.all(color: colors.strokeFaint),
- borderRadius: BorderRadius.circular(20),
- ),
- );
-
- final focusedPinTheme = defaultPinTheme.copyWith(
- decoration: BoxDecoration(
- border: Border.all(color: colors.primary, width: 2),
- borderRadius: BorderRadius.circular(20),
- ),
- );
-
- final submittedPinTheme = defaultPinTheme.copyWith(
- textStyle: TextStyles.h1.copyWith(color: colors.primary),
- decoration: BoxDecoration(
- color: colors.primaryLight,
- border: Border.all(color: colors.primary, width: 2),
- borderRadius: BorderRadius.circular(20),
- ),
- );
return SafeArea(
child: Padding(
@@ -156,15 +130,10 @@ class _OTTVerificationPageState extends State<OTTVerificationPage> {
),
const SizedBox(height: 32),
Center(
- child: Pinput(
+ child: PinInputComponent(
length: 6,
controller: _pinController,
autofocus: true,
- defaultPinTheme: defaultPinTheme,
- focusedPinTheme: focusedPinTheme,
- submittedPinTheme: submittedPinTheme,
- followingPinTheme: defaultPinTheme,
- keyboardType: TextInputType.number,
onChanged: (String pin) {
setState(() {
_code = pin;
diff --git a/mobile/packages/accounts/lib/pages/ott_verification_page.dart b/mobile/packages/accounts/lib/pages/ott_verification_page.dart
index e16a827568..0bcb296bb6 100644
--- a/mobile/packages/accounts/lib/pages/ott_verification_page.dart
+++ b/mobile/packages/accounts/lib/pages/ott_verification_page.dart
@@ -1,11 +1,11 @@
import 'package:dots_indicator/dots_indicator.dart';
import 'package:ente_accounts/ente_accounts.dart';
+import 'package:ente_components/ente_components.dart';
import 'package:ente_strings/ente_strings.dart';
import 'package:ente_ui/components/buttons/dynamic_fab.dart';
import 'package:ente_ui/theme/ente_theme.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
-import 'package:pinput/pinput.dart';
class OTTVerificationPage extends StatefulWidget {
final String email;
@@ -146,33 +146,6 @@ class _OTTVerificationPageState extends State<OTTVerificationPage> {
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
- final defaultPinTheme = PinTheme(
- height: 48,
- width: 48,
- decoration: BoxDecoration(
- color: colorScheme.backdropBase,
- border: Border.all(color: colorScheme.strokeFaint, width: 1.75),
- borderRadius: BorderRadius.circular(18),
- ),
- );
-
- final focusedPinTheme = defaultPinTheme.copyWith(
- decoration: BoxDecoration(
- color: colorScheme.backdropBase,
- border: Border.all(color: colorScheme.primary700, width: 1.75),
- borderRadius: BorderRadius.circular(18),
- ),
- );
-
- final submittedPinTheme = defaultPinTheme.copyWith(
- textStyle: textTheme.h3Bold.copyWith(color: colorScheme.primary700),
- decoration: BoxDecoration(
- color: colorScheme.backdropBase,
- border: Border.all(color: colorScheme.strokeFaint, width: 1.75),
- borderRadius: BorderRadius.circular(18),
- ),
- );
-
return SafeArea(
child: SingleChildScrollView(
child: Padding(
@@ -195,15 +168,10 @@ class _OTTVerificationPageState extends State<OTTVerificationPage> {
textAlign: TextAlign.center,
),
const SizedBox(height: 32),
- Pinput(
+ PinInputComponent(
length: 6,
controller: _pinController,
autofocus: true,
- defaultPinTheme: defaultPinTheme,
- focusedPinTheme: focusedPinTheme,
- submittedPinTheme: submittedPinTheme,
- showCursor: false,
- keyboardType: TextInputType.number,
onCompleted: (value) {
if (value.length == 6) {
onPressed();