From db1f35e294cb029a860a1cc15fc855a482971058 Mon Sep 17 00:00:00 2001 From: ahmedhanafy725 Date: Sun, 25 Feb 2024 02:12:16 +0200 Subject: [PATCH] Change the usage of the pin code in the change pin screen --- app/lib/screens/change_pin_screen.dart | 42 ++++---------------------- 1 file changed, 6 insertions(+), 36 deletions(-) diff --git a/app/lib/screens/change_pin_screen.dart b/app/lib/screens/change_pin_screen.dart index 3b40c166..d710e299 100644 --- a/app/lib/screens/change_pin_screen.dart +++ b/app/lib/screens/change_pin_screen.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; import 'package:threebotlogin/services/shared_preference_service.dart'; -import 'package:threebotlogin/widgets/pin_field.dart'; +import 'package:threebotlogin/widgets/pin_code.dart'; class ChangePinScreen extends StatefulWidget { const ChangePinScreen({super.key, this.currentPin, this.hideBackButton}); @@ -38,41 +38,11 @@ class _ChangePinScreenState extends State { @override Widget build(BuildContext context) { - return WillPopScope( - child: Scaffold( - appBar: AppBar( - title: widget.currentPin == null - ? const Text('Choose your pincode') - : const Text('Change pincode'), - elevation: 0.0, - automaticallyImplyLeading: widget.hideBackButton == false), - body: Column( - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - children: [ - Container( - padding: const EdgeInsets.only(top: 0.0, bottom: 32.0), - child: Center( - child: Text( - getText(), - style: Theme.of(context) - .textTheme - .bodyLarge! - .copyWith(color: Theme.of(context).colorScheme.onBackground), - )), - ), - PinField( - callback: (p) => changePin(p), - ) - ], - ), - ), - onWillPop: () { - if (state != _State.done && widget.hideBackButton == true) { - return Future(() => false); - } - return Future(() => true); - }, + return PincodeWidget( + title: + widget.currentPin == null ? 'Choose your pincode' : 'Change pincode', + userMessage: getText(), + handler: changePin, ); }