Skip to content

Commit

Permalink
Updated LockScreen UI
Browse files Browse the repository at this point in the history
Signed-off-by: Khalid Warsame <dev@khalidwar.com>
Rate limit · GitHub

Whoa there!

You have triggered an abuse detection mechanism.

Please wait a few minutes before you try again;
in some cases this may take up to an hour.

KhalidWar committed Nov 13, 2022
1 parent 5d9503a commit beb4654
Showing 1 changed file with 42 additions and 51 deletions.
93 changes: 42 additions & 51 deletions lib/screens/authorization_screen/lock_screen.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'package:anonaddy/notifiers/authorization/auth_notifier.dart';
import 'package:anonaddy/shared_components/constants/app_colors.dart';
import 'package:anonaddy/shared_components/constants/app_strings.dart';
import 'package:anonaddy/shared_components/constants/lottie_images.dart';
import 'package:anonaddy/shared_components/lottie_widget.dart';
import 'package:anonaddy/shared_components/platform_aware_widgets/dialogs/platform_alert_dialog.dart';
import 'package:anonaddy/shared_components/platform_aware_widgets/platform_aware.dart';
import 'package:anonaddy/notifiers/authorization/auth_notifier.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

@@ -24,10 +24,37 @@ class _LockScreenState extends ConsumerState<LockScreen> {

@override
Widget build(BuildContext context) {
final size = MediaQuery.of(context).size;

return Scaffold(
backgroundColor: AppColors.primaryColor,
appBar: AppBar(
elevation: 0,
actions: [
TextButton(
child: Center(
child: Text(
'Logout',
style: Theme.of(context)
.textTheme
.caption
?.copyWith(color: Colors.red),
),
),
onPressed: () {
/// Show platform dialog
PlatformAware.platformDialog(
context: context,
child: PlatformAlertDialog(
title: 'Logout',
content: AppStrings.logOutAlertDialog,
method: () async {
await ref.read(authStateNotifier.notifier).logout(context);
},
),
);
},
),
],
),
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Column(
@@ -36,60 +63,24 @@ class _LockScreenState extends ConsumerState<LockScreen> {
const Expanded(
child: LottieWidget(
lottie: LottieImages.biometricAnimation,
lottieHeight: 600,
repeat: true,
),
),
unlockButton(context),
SizedBox(height: size.height * 0.01),
logoutButton(context),
SizedBox(height: size.height * 0.03),
ElevatedButton(
child: Center(
child: Text(
'Unlock',
style: Theme.of(context).textTheme.headline6,
),
),
onPressed: () =>
ref.read(authStateNotifier.notifier).authenticate(),
),
const SizedBox(height: 20),
],
),
),
);
}

Widget unlockButton(BuildContext context) {
return ElevatedButton(
style: ElevatedButton.styleFrom(),
child: SizedBox(
height: 40,
child: Center(
child: Text(
'Unlock',
style: Theme.of(context).textTheme.headline6,
),
),
),
onPressed: () => ref.read(authStateNotifier.notifier).authenticate(),
);
}

Widget logoutButton(BuildContext context) {
return ElevatedButton(
style: ElevatedButton.styleFrom(primary: Colors.red),
child: SizedBox(
height: 40,
child: Center(
child: Text(
'Logout',
style: Theme.of(context).textTheme.headline6,
),
),
),
onPressed: () {
/// Show platform dialog
PlatformAware.platformDialog(
context: context,
child: PlatformAlertDialog(
title: 'Logout',
content: AppStrings.logOutAlertDialog,
method: () async {
await ref.read(authStateNotifier.notifier).logout(context);
},
),
);
},
);
}
}

0 comments on commit beb4654

Please sign in to comment.