Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI Create PIN Code Screen #437

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/icons/password.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions lib/presentation/screen/app_lock_screens/app_lock.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import 'package:flutter/material.dart';
import 'package:star_book/presentation/shared/app_bar.dart';
import 'package:star_book/presentation/shared/elevated_buttons.dart';
import 'package:star_book/presentation/theme/styling/theme_color_style.dart';
import 'package:star_book/presentation/utils/extension.dart';
import 'package:star_book/presentation/utils/padding_style.dart';

class AppLockScreen extends StatelessWidget {
const AppLockScreen({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
final double deviceHeight = context.deviceHeight;
final TextTheme textTheme = context.textTheme;
final ThemeColorStyle themeColorStyle = context.themeColorStyle;
return Scaffold(
appBar: const PrimaryAppBar(
centerTitle: 'App Lock',
),
body: Padding(
padding:
const EdgeInsets.symmetric(horizontal: CustomPadding.mediumPadding),
child: Column(
children: [
SizedBox(height: deviceHeight * 0.3),
const Icon(
Icons.lock_person_outlined,
size: 28,
),
Text(
'Oops! Looks Like You Didn’t Setup Pin',
style: textTheme.bodyLarge!.copyWith(
fontWeight: FontWeight.w700,
color: themeColorStyle.secondaryColor,
height: 2.5,
),
),
Text(
'Click “Setup PIN” below to setup your pin',
style: textTheme.labelLarge!
.copyWith(fontWeight: FontWeight.w400, height: 1.5),
),
const Spacer(),
PrimaryFilledButton(onTap: () {}, label: 'Setup PIN'),
const SizedBox(height: 50),
],
),
),
);
}
}
48 changes: 48 additions & 0 deletions lib/presentation/screen/app_lock_screens/lock_type_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import 'package:flutter/material.dart';
import 'package:star_book/presentation/shared/app_bar.dart';
import 'package:star_book/presentation/shared/tile.dart';
import 'package:star_book/presentation/theme/styling/theme_color_style.dart';
import 'package:star_book/presentation/utils/extension.dart';
import 'package:star_book/presentation/utils/padding_style.dart';

class LockTypeScreen extends StatelessWidget {
const LockTypeScreen({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
final ThemeColorStyle themeColorStyle = context.themeColorStyle;
final TextTheme textTheme = context.textTheme;
return Scaffold(
appBar: const PrimaryAppBar(
centerTitle: 'App Lock',
),
body: Padding(
padding:
const EdgeInsets.symmetric(horizontal: CustomPadding.mediumPadding),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 30),
Text(
'Lock Type',
style: textTheme.bodyLarge!.copyWith(
fontWeight: FontWeight.w700,
color: themeColorStyle.secondaryColor,
height: 2.5,
),
),
Text(
'Please select type of lock you want to use',
style: textTheme.labelLarge!
.copyWith(fontWeight: FontWeight.w400, height: 1.5),
),
const SizedBox(height: 30),
const AppLockTile(title: 'PIN Lock'),
const SizedBox(height: 30),
const AppLockTile(title: 'Fingerprint'),
],
),
),
);
}
}
64 changes: 64 additions & 0 deletions lib/presentation/screen/app_lock_screens/pin_code_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import 'package:flutter/material.dart';
import 'package:pin_code_fields/pin_code_fields.dart';
import 'package:star_book/presentation/shared/app_bar.dart';
import 'package:star_book/presentation/shared/elevated_buttons.dart';
import 'package:star_book/presentation/theme/styling/theme_color_style.dart';
import 'package:star_book/presentation/utils/extension.dart';
import 'package:star_book/presentation/utils/padding_style.dart';

class PINCodeScreen extends StatelessWidget {
const PINCodeScreen({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
final ThemeColorStyle themeColorStyle = context.themeColorStyle;
final TextTheme textTheme = context.textTheme;
return Scaffold(
appBar: const PrimaryAppBar(
centerTitle: 'Setup PIN Code',
),
body: Padding(
padding:
const EdgeInsets.symmetric(horizontal: CustomPadding.mediumPadding),
child: Column(
children: [
const SizedBox(height: 50),
const Image(
image: AssetImage('assets/icons/password.png'),
width: 32,
),
const SizedBox(height: 20),
Text(
'Choose Your 4 Digit PIN Code',
style: textTheme.bodyLarge!.copyWith(
fontWeight: FontWeight.w700,
color: themeColorStyle.secondaryColor,
),
),
const SizedBox(height: 30),
PinCodeTextField(
appContext: context,
keyboardType: TextInputType.number,
length: 5,
enablePinAutofill: false,
autoDismissKeyboard: true,
pinTheme: PinTheme(
activeColor: themeColorStyle.senaryColor,
selectedColor: themeColorStyle.primaryColor,
inactiveColor: themeColorStyle.octonaryColor,
),
onChanged: (value) {},
),
const Spacer(),
PrimaryFilledButton(
onTap: () {},
label: 'Save PIN Code',
color: themeColorStyle.senaryColor,
),
const SizedBox(height: 50),
],
),
),
);
}
}
10 changes: 8 additions & 2 deletions lib/presentation/shared/elevated_buttons.dart
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
import 'package:flutter/material.dart';
import 'package:star_book/presentation/theme/styling/filled_button_style.dart';
import 'package:star_book/presentation/theme/styling/theme_color_style.dart';
import 'package:star_book/presentation/utils/extension.dart';

class PrimaryFilledButton extends StatelessWidget {
final VoidCallback onTap;
final String label;

final Color? color;
const PrimaryFilledButton({
super.key,
required this.onTap,
required this.label,
this.color,
});

@override
Widget build(BuildContext context) {
final double deviceHeight = context.deviceHeight;
final double deviceWidth = context.deviceWidth;
final CustomButtonTheme customButtonTheme = context.customButtonTheme;
final ThemeColorStyle themeColorStyle = context.themeColorStyle;
return SizedBox(
width: deviceWidth,
height: deviceHeight * 0.052,
child: ElevatedButton(
onPressed: onTap,
style: customButtonTheme.primaryFilledButtonTheme,
style: customButtonTheme.primaryFilledButtonTheme.copyWith(
backgroundColor: MaterialStateProperty.all<Color>(
(color != null) ? color! : themeColorStyle.primaryColor),
),
child: Text(label),
),
);
Expand Down
70 changes: 70 additions & 0 deletions lib/presentation/shared/tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,73 @@ class _UxerShipTileState extends State<UxerShipTile> {
);
}
}

class AppLockTile extends StatefulWidget {
final String title;

const AppLockTile({Key? key, required this.title}) : super(key: key);

@override
State<AppLockTile> createState() => _AppLockTileState();
}

class _AppLockTileState extends State<AppLockTile> {
bool isSwitchOn = false;

@override
Widget build(BuildContext context) {
final ThemeColorStyle themeColorStyle = context.themeColorStyle;
final TextTheme textTheme = context.textTheme;
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(color: themeColorStyle.octonaryColor),
),
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8),
child: Row(
children: [
Text(
widget.title,
style: textTheme.bodyLarge!.copyWith(
fontWeight: FontWeight.w400,
color: themeColorStyle.secondaryColor,
),
),
const Spacer(),
Theme(
data: ThemeData(useMaterial3: true).copyWith(
colorScheme: Theme.of(context)
.colorScheme
.copyWith(outline: Colors.transparent),
),
child: SizedBox(
height: 30,
width: 38,
child: FittedBox(
fit: BoxFit.fill,

/// Change InActiveTrackColor of Switch
child: Switch(
value: isSwitchOn,
trackColor: MaterialStateProperty.resolveWith((states) {
if (states.contains(MaterialState.selected)) {
return themeColorStyle.senaryColor;
}
return themeColorStyle.octonaryColor.withOpacity(0.7);
}),
thumbColor: MaterialStateProperty.all(Colors.white),
// inactiveTrackColor: Colors.white,
onChanged: (value) {
setState(() {
isSwitchOn = value;
});
},
),
),
),
),
],
),
);
}
}
2 changes: 1 addition & 1 deletion lib/presentation/theme/ultramarine_light.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class UltramarineLightTheme extends BaseTheme {
tertiaryColor: Color(0xFF8B8B8B),
quaternaryColor: Color(0xFF7B7CFF),
quinaryColor: Color(0xFFFFFFFF),
senaryColor: Color(0xFFFF3932),
senaryColor: Color(0xff32C74F),
septenaryColor: Color(0xFFF1F2F4),
octonaryColor: Color(0xFFBCBCBC),
nonaryColor: Color(0xFFE31414),
Expand Down
10 changes: 9 additions & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,15 @@ packages:
sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750
url: "https://pub.dev"
source: hosted
version: "5.4.0"
version: "5.1.0"
pin_code_fields:
dependency: "direct main"
description:
name: pin_code_fields
sha256: c8652519d14688f3fe2a8288d86910a46aa0b9046d728f292d3bf6067c31b4c7
url: "https://pub.dev"
source: hosted
version: "7.4.0"
platform:
dependency: transitive
description:
Expand Down
3 changes: 3 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ dependencies:
intl: ^0.18.0
go_router: ^7.1.1
path_provider: ^2.0.12
flutter_launcher_icons: ^0.11.0
flutter_form_builder: ^7.7.0
pin_code_fields: ^7.4.0
flutter_form_builder: ^9.0.0
form_builder_validators: ^9.0.0
url_launcher: ^6.1.11
Expand Down