[mob][photos] Custom keypad position fixed

This commit is contained in:
Aman Raj Singh Mourya
2024-07-06 16:58:26 +05:30
parent 9982c73d5a
commit 45331de54e
6 changed files with 150 additions and 130 deletions

View File

@@ -10,108 +10,116 @@ class CustomPinKeypad extends StatelessWidget {
return SafeArea(
child: Container(
padding: const EdgeInsets.all(2),
color: getEnteColorScheme(context).strokeFainter,
// color: getEnteColorScheme(context).strokeFainter,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Row(
children: [
_Button(
text: '',
number: '1',
onTap: () {
_onKeyTap('1');
},
),
_Button(
text: "ABC",
number: '2',
onTap: () {
_onKeyTap('2');
},
),
_Button(
text: "DEF",
number: '3',
onTap: () {
_onKeyTap('3');
},
),
],
),
Row(
children: [
_Button(
number: '4',
text: "GHI",
onTap: () {
_onKeyTap('4');
},
),
_Button(
number: '5',
text: 'JKL',
onTap: () {
_onKeyTap('5');
},
),
_Button(
number: '6',
text: 'MNO',
onTap: () {
_onKeyTap('6');
},
),
],
),
Row(
children: [
_Button(
number: '7',
text: 'PQRS',
onTap: () {
_onKeyTap('7');
},
),
_Button(
number: '8',
text: 'TUV',
onTap: () {
_onKeyTap('8');
},
),
_Button(
number: '9',
text: 'WXYZ',
onTap: () {
_onKeyTap('9');
},
),
],
),
Row(
children: [
const _Button(
number: '',
text: '',
muteButton: true,
onTap: null,
),
_Button(
number: '0',
text: '',
onTap: () {
_onKeyTap('0');
},
),
_Button(
number: '',
text: '',
icon: const Icon(Icons.backspace_outlined),
onTap: () {
_onBackspace();
},
),
],
Container(
color: getEnteColorScheme(context).strokeFainter,
child: Column(
children: [
Row(
children: [
_Button(
text: '',
number: '1',
onTap: () {
_onKeyTap('1');
},
),
_Button(
text: "ABC",
number: '2',
onTap: () {
_onKeyTap('2');
},
),
_Button(
text: "DEF",
number: '3',
onTap: () {
_onKeyTap('3');
},
),
],
),
Row(
children: [
_Button(
number: '4',
text: "GHI",
onTap: () {
_onKeyTap('4');
},
),
_Button(
number: '5',
text: 'JKL',
onTap: () {
_onKeyTap('5');
},
),
_Button(
number: '6',
text: 'MNO',
onTap: () {
_onKeyTap('6');
},
),
],
),
Row(
children: [
_Button(
number: '7',
text: 'PQRS',
onTap: () {
_onKeyTap('7');
},
),
_Button(
number: '8',
text: 'TUV',
onTap: () {
_onKeyTap('8');
},
),
_Button(
number: '9',
text: 'WXYZ',
onTap: () {
_onKeyTap('9');
},
),
],
),
Row(
children: [
const _Button(
number: '',
text: '',
muteButton: true,
onTap: null,
),
_Button(
number: '0',
text: '',
onTap: () {
_onKeyTap('0');
},
),
_Button(
number: '',
text: '',
icon: const Icon(Icons.backspace_outlined),
onTap: () {
_onBackspace();
},
),
],
),
],
),
),
],
),

View File

@@ -138,7 +138,7 @@ class _LockScreenConfirmPasswordState extends State<LockScreenConfirmPassword> {
height: 75,
width: 75,
child: CircularProgressIndicator(
backgroundColor: colorTheme.fillFaintPressed,
color: colorTheme.fillFaintPressed,
value: 1,
strokeWidth: 1.5,
),

View File

@@ -69,14 +69,19 @@ class _LockScreenConfirmPinState extends State<LockScreenConfirmPin> {
),
),
),
body: OrientationBuilder(
builder: (context, orientation) {
return orientation == Orientation.portrait
? _getBody(colorTheme, textTheme, isPortrait: true)
: SingleChildScrollView(
child: _getBody(colorTheme, textTheme, isPortrait: false),
);
},
floatingActionButton: CustomPinKeypad(controller: _confirmPinController),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
// body: OrientationBuilder(
// builder: (context, orientation) {
// return orientation == Orientation.portrait
// ? _getBody(colorTheme, textTheme, isPortrait: true)
// : SingleChildScrollView(
// child: _getBody(colorTheme, textTheme, isPortrait: false),
// );
// },
// ),
body: SingleChildScrollView(
child: _getBody(colorTheme, textTheme, isPortrait: true),
),
);
}
@@ -195,10 +200,10 @@ class _LockScreenConfirmPinState extends State<LockScreenConfirmPin> {
await _confirmPinMatch();
},
),
isPortrait
? const Spacer()
: const Padding(padding: EdgeInsets.all(12)),
CustomPinKeypad(controller: _confirmPinController),
// isPortrait
// ? const Spacer()
// : const Padding(padding: EdgeInsets.all(12)),
// CustomPinKeypad(controller: _confirmPinController),
],
),
);

View File

@@ -135,7 +135,7 @@ class _LockScreenPasswordState extends State<LockScreenPassword> {
height: 75,
width: 75,
child: CircularProgressIndicator(
backgroundColor: colorTheme.fillFaintPressed,
color: colorTheme.fillFaintPressed,
value: 1,
strokeWidth: 1.5,
),
@@ -202,8 +202,8 @@ class _LockScreenPasswordState extends State<LockScreenPassword> {
} else {
if (widget.isOnOpeningApp) {
invalidAttemptsCount++;
await _lockscreenSetting.setInvalidAttemptCount(invalidAttemptsCount);
if (invalidAttemptsCount > 4) {
await _lockscreenSetting.setInvalidAttemptCount(invalidAttemptsCount);
Navigator.of(context).pop(false);
}
}

View File

@@ -77,8 +77,8 @@ class _LockScreenPinState extends State<LockScreenPin> {
if (widget.isOnOpeningApp) {
invalidAttemptsCount++;
await _lockscreenSetting.setInvalidAttemptCount(invalidAttemptsCount);
if (invalidAttemptsCount > 4) {
await _lockscreenSetting.setInvalidAttemptCount(invalidAttemptsCount);
Navigator.of(context).pop(false);
}
}
@@ -128,14 +128,19 @@ class _LockScreenPinState extends State<LockScreenPin> {
),
),
),
body: OrientationBuilder(
builder: (context, orientation) {
return orientation == Orientation.portrait
? _getBody(colorTheme, textTheme, isPortrait: true)
: SingleChildScrollView(
child: _getBody(colorTheme, textTheme, isPortrait: false),
);
},
floatingActionButton: CustomPinKeypad(controller: _pinController),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
// body: OrientationBuilder(
// builder: (context, orientation) {
// return orientation == Orientation.portrait
// ? _getBody(colorTheme, textTheme, isPortrait: true)
// : SingleChildScrollView(
// child: _getBody(colorTheme, textTheme, isPortrait: false),
// );
// },
// ),
body: SingleChildScrollView(
child: _getBody(colorTheme, textTheme, isPortrait: true),
),
);
}
@@ -258,10 +263,10 @@ class _LockScreenPinState extends State<LockScreenPin> {
await _confirmPin(_pinController.text);
},
),
isPortrait
? const Spacer()
: const Padding(padding: EdgeInsets.all(12)),
CustomPinKeypad(controller: _pinController),
// isPortrait
// ? const Spacer()
// : const Padding(padding: EdgeInsets.all(12)),
// CustomPinKeypad(controller: _pinController),
],
),
);

View File

@@ -109,8 +109,10 @@ class _LockScreenState extends State<LockScreen> with WidgetsBindingObserver {
width: 75,
child: TweenAnimationBuilder<double>(
tween: Tween<double>(
begin: 0,
end: _getFractionOfTimeElapsed(),
begin: isTimerRunning ? 0 : 1,
end: isTimerRunning
? _getFractionOfTimeElapsed()
: 1,
),
duration: const Duration(seconds: 1),
builder: (context, value, _) =>