fingerprint auth added
This commit is contained in:
@@ -95,10 +95,12 @@ class AppColor {
|
||||
|
||||
//Wallet Color
|
||||
static const Color onHoldTextColor = Color(0xFF0172CB);
|
||||
|
||||
static const Color depositListIconColor = Color(0xFF0FA4A4);
|
||||
static const Color withdrawalListIconColor = Color(0xFFE6681F);
|
||||
static const Color investmentListIconColor = Color(0xFF0172CB);
|
||||
static const Color yieldListIconColor = Color(0xFF4C4AEF);
|
||||
static const Color refundListIconColor = Color(0xFF0E9445);
|
||||
|
||||
//Security
|
||||
static const Color permissionTextClr = Color(0xFF007AFF);
|
||||
}
|
||||
|
||||
@@ -96,6 +96,15 @@ class AppText {
|
||||
static const String areYouSureYouWantToExitText =
|
||||
"Are you sure you want to Exit?";
|
||||
|
||||
//Security
|
||||
static const String unlockText = "Unlock";
|
||||
static const String tanamiAppIsLocked = "Tanami Capital is locked";
|
||||
static const String securityMssgText =
|
||||
"For your security, you can only use Tanami Capital when it's unlocked";
|
||||
static const String faceIdText = "Face Id";
|
||||
static const String appAskPermissionText =
|
||||
"Tanami App ask permission to use Face ID (or Fingerprint)";
|
||||
|
||||
//OTP
|
||||
static const String checkYourMessages = "Check your messages";
|
||||
static const String referToSameOtpMessage =
|
||||
@@ -273,7 +282,8 @@ class AppText {
|
||||
static const String balanceText = "Balance";
|
||||
static const String applePayText = "Apple Pay";
|
||||
static const String gPayText = "Gpay Pay";
|
||||
static const String bankTransferText = "Directly transfer funds from your bank account into your Tanami wallet.";
|
||||
static const String bankTransferText =
|
||||
"Directly transfer funds from your bank account into your Tanami wallet.";
|
||||
static const String instantTransferFundsApplePayText =
|
||||
"Instant transfer of funds using Apple Pay!";
|
||||
static const String instantTransferFundsGpayPayText =
|
||||
|
||||
42
lib/core/utils/biometric/biometric_bloc.dart
Normal file
42
lib/core/utils/biometric/biometric_bloc.dart
Normal file
@@ -0,0 +1,42 @@
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:local_auth/local_auth.dart';
|
||||
|
||||
import 'biometric_event.dart';
|
||||
import 'biometric_state.dart';
|
||||
|
||||
class BiometricBloc extends Bloc<BiometricEvent, BiometricState> {
|
||||
final LocalAuthentication localAuthentication;
|
||||
|
||||
BiometricBloc(this.localAuthentication) : super(BiometricInitial()) {
|
||||
on<CheckBiometricEvent>(_onCheckBiometric);
|
||||
on<AuthenticateBiometricEvent>(_onAuthenticateBiometric);
|
||||
}
|
||||
|
||||
Future<void> _onCheckBiometric(
|
||||
CheckBiometricEvent event, Emitter<BiometricState> emit) async {
|
||||
emit(BiometricChecking());
|
||||
bool canAuthenticate = await localAuthentication.canCheckBiometrics;
|
||||
emit(BiometricChecked(canAuthenticate));
|
||||
}
|
||||
|
||||
Future<void> _onAuthenticateBiometric(
|
||||
AuthenticateBiometricEvent event, Emitter<BiometricState> emit) async {
|
||||
emit(BiometricAuthenticating());
|
||||
try {
|
||||
bool authenticated = await localAuthentication.authenticate(
|
||||
localizedReason: 'Please authenticate to access the app',
|
||||
options: const AuthenticationOptions(
|
||||
useErrorDialogs: true,
|
||||
stickyAuth: true,
|
||||
),
|
||||
);
|
||||
if (authenticated) {
|
||||
emit(BiometricAuthenticated());
|
||||
} else {
|
||||
emit(BiometricFailed('Authentication failed'));
|
||||
}
|
||||
} catch (e) {
|
||||
emit(BiometricFailed(e.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
5
lib/core/utils/biometric/biometric_event.dart
Normal file
5
lib/core/utils/biometric/biometric_event.dart
Normal file
@@ -0,0 +1,5 @@
|
||||
abstract class BiometricEvent {}
|
||||
|
||||
class CheckBiometricEvent extends BiometricEvent {}
|
||||
|
||||
class AuthenticateBiometricEvent extends BiometricEvent {}
|
||||
21
lib/core/utils/biometric/biometric_state.dart
Normal file
21
lib/core/utils/biometric/biometric_state.dart
Normal file
@@ -0,0 +1,21 @@
|
||||
abstract class BiometricState {}
|
||||
|
||||
class BiometricInitial extends BiometricState {}
|
||||
|
||||
class BiometricChecking extends BiometricState {}
|
||||
|
||||
class BiometricChecked extends BiometricState {
|
||||
final bool canAuthenticate;
|
||||
|
||||
BiometricChecked(this.canAuthenticate);
|
||||
}
|
||||
|
||||
class BiometricAuthenticating extends BiometricState {}
|
||||
|
||||
class BiometricAuthenticated extends BiometricState {}
|
||||
|
||||
class BiometricFailed extends BiometricState {
|
||||
final String message;
|
||||
|
||||
BiometricFailed(this.message);
|
||||
}
|
||||
@@ -37,7 +37,21 @@ class GeneralSettingsSection extends StatelessWidget {
|
||||
clr: AppColor.textLabelColor,
|
||||
),
|
||||
BlocProvider(
|
||||
create: (_) => ToggleBloc(),
|
||||
create: (_) => ToggleBloc("notification"),
|
||||
child: const CustomToggle(),
|
||||
)
|
||||
],
|
||||
),
|
||||
const Gap(15),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
TextWidget().text14W600(
|
||||
AppText.biometricText,
|
||||
clr: AppColor.textLabelColor,
|
||||
),
|
||||
BlocProvider(
|
||||
create: (_) => ToggleBloc("biometric"),
|
||||
child: const CustomToggle(),
|
||||
)
|
||||
],
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:tanami_app/core/styles/app_color.dart';
|
||||
import 'package:tanami_app/core/styles/app_images.dart';
|
||||
import 'package:tanami_app/core/styles/app_text.dart';
|
||||
import 'package:tanami_app/shared/components/bloc/toggle/toggle_bloc.dart';
|
||||
import 'package:tanami_app/shared/components/text_widget.dart';
|
||||
|
||||
import '../../../../../core/routes/route_name.dart';
|
||||
import '../../../../../core/routes/routes.dart';
|
||||
import '../../../../../shared/components/toggle_widget.dart';
|
||||
import 'settings_list_tile_item.dart';
|
||||
|
||||
class PrivacySettingsSection extends StatelessWidget {
|
||||
@@ -29,20 +26,6 @@ class PrivacySettingsSection extends StatelessWidget {
|
||||
clr: AppColor.hintTextColor,
|
||||
),
|
||||
const Gap(5),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
TextWidget().text14W600(
|
||||
AppText.biometricText,
|
||||
clr: AppColor.textLabelColor,
|
||||
),
|
||||
BlocProvider(
|
||||
create: (_) => ToggleBloc(),
|
||||
child: const CustomToggle(),
|
||||
)
|
||||
],
|
||||
),
|
||||
const Gap(12),
|
||||
SettingsListItem(
|
||||
onTapFunc: () {
|
||||
goRouter.pushNamed(
|
||||
|
||||
@@ -34,7 +34,7 @@ class SettingsBottomSection extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const Gap(5),
|
||||
Container(
|
||||
SizedBox(
|
||||
width: 1.sw,
|
||||
height: 56.h,
|
||||
child: ButtonWidget().textBorderBtn(
|
||||
|
||||
@@ -1,447 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:tanami_app/core/routes/route_name.dart';
|
||||
import 'package:tanami_app/core/routes/routes.dart';
|
||||
import 'package:tanami_app/core/styles/app_text.dart';
|
||||
|
||||
class WalletScreen extends StatefulWidget {
|
||||
const WalletScreen({super.key});
|
||||
|
||||
@override
|
||||
State<WalletScreen> createState() => _WalletScreenState();
|
||||
}
|
||||
|
||||
class _WalletScreenState extends State<WalletScreen> {
|
||||
List data = [
|
||||
{
|
||||
'title': AppText.deposit,
|
||||
'subTitle': '',
|
||||
'dateTime': '10/04/2024 22:04',
|
||||
'value': '+ SAR 100,000',
|
||||
'subValue': '',
|
||||
'onHold': false,
|
||||
},
|
||||
{
|
||||
'title': AppText.withdrawal,
|
||||
'subTitle': '',
|
||||
'dateTime': '10/04/2024 22:04',
|
||||
'value': '- SAR 100,000',
|
||||
'subValue': '',
|
||||
'onHold': true,
|
||||
},
|
||||
{
|
||||
'title': AppText.investment,
|
||||
'subTitle': 'Name of Investment',
|
||||
'dateTime': '10/04/2024 22:04',
|
||||
'value': '- SAR 100,000',
|
||||
'subValue': '',
|
||||
'onHold': false,
|
||||
},
|
||||
{
|
||||
'title': AppText.yield,
|
||||
'subTitle': 'Name of Investment',
|
||||
'dateTime': '10/04/2024 22:04',
|
||||
'value': '+ SAR 100,000',
|
||||
'subValue': '+ \$100,00',
|
||||
'onHold': false,
|
||||
},
|
||||
{
|
||||
'title': AppText.refund,
|
||||
'subTitle': '',
|
||||
'dateTime': '10/04/2024 22:04',
|
||||
'value': '- SAR 100,000',
|
||||
'subValue': '',
|
||||
'onHold': true,
|
||||
},
|
||||
];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
// _savebottomsheet();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: AppBar(
|
||||
elevation: 0,
|
||||
scrolledUnderElevation: 0.0,
|
||||
automaticallyImplyLeading: false,
|
||||
toolbarHeight: 260.h,
|
||||
titleSpacing: 22.w,
|
||||
title: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
AppText.walletTitle,
|
||||
style: GoogleFonts.dmSans(
|
||||
color: const Color(0xFF343434),
|
||||
fontSize: 14.sp,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 4.h,
|
||||
),
|
||||
Text(
|
||||
'SAR 178,000',
|
||||
style: GoogleFonts.dmSans(
|
||||
color: const Color(0xFF191B1E),
|
||||
fontSize: 28.sp,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 80.h,
|
||||
)
|
||||
],
|
||||
),
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
background: Stack(
|
||||
children: [
|
||||
Image.asset(
|
||||
'assets/images/wallet_screen/bg.png', // Replace with your image asset
|
||||
fit: BoxFit.fitWidth,
|
||||
alignment: Alignment.topCenter,
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.8),
|
||||
borderRadius:
|
||||
const BorderRadius.all(Radius.circular(20.0)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 20.0, vertical: 20.0),
|
||||
child: IntrinsicHeight(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
goRouter.pushNamed(RouteName.depositScreen);
|
||||
},
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black,
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Image.asset(
|
||||
'assets/images/wallet_screen/deposit.png',
|
||||
height: 20.h,
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Deposit',
|
||||
style: GoogleFonts.dmSans(
|
||||
color: const Color(0xFF363636),
|
||||
fontSize: 12.sp,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const VerticalDivider(
|
||||
color: Colors.black,
|
||||
width: 20.0,
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
goRouter.pushNamed(RouteName.withdrawalScreen);
|
||||
},
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black,
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Image.asset(
|
||||
'assets/images/wallet_screen/withdraw.png',
|
||||
height: 20.h,
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Withdraw',
|
||||
style: GoogleFonts.dmSans(
|
||||
color: const Color(0xFF363636),
|
||||
fontSize: 12.sp,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
backgroundColor: Colors
|
||||
.transparent, // Make the AppBar transparent to show the background image
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(18.0, 10.0, 18.0, 0.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
AppText.day,
|
||||
style: GoogleFonts.dmSans(
|
||||
color: const Color(0xFF8D8D8D),
|
||||
fontSize: 11.sp,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
decoration: const BoxDecoration(
|
||||
color: Color(0xFFF6F6F6),
|
||||
borderRadius: BorderRadius.all(Radius.circular(12.0)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Image.asset(
|
||||
'assets/images/wallet_screen/search.png',
|
||||
height: 20.h,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 5.w,
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
goRouter.pushNamed(RouteName.filterScreen);
|
||||
},
|
||||
child: Container(
|
||||
decoration: const BoxDecoration(
|
||||
color: Color(0xFFF6F6F6),
|
||||
borderRadius: BorderRadius.all(Radius.circular(12.0)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Image.asset(
|
||||
'assets/images/wallet_screen/filter.png',
|
||||
height: 20.h,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: data.length,
|
||||
itemBuilder: (context, index) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 10.0),
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
goRouter.pushNamed(RouteName.walletDetails,
|
||||
pathParameters: {
|
||||
"type": data[index]['title'],
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
height: 92.h,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(22.r),
|
||||
color: const Color(0xFFF6F6F6),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: Row(
|
||||
children: [
|
||||
getIcon(data[index]['title']),
|
||||
SizedBox(width: 12.w),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
data[index]['title'],
|
||||
style: GoogleFonts.dmSans(
|
||||
color: const Color(0xFF191B1E),
|
||||
fontSize: 14.sp,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 4.h),
|
||||
(data[index]['subTitle'] != '')
|
||||
? Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
data[index]['subTitle'],
|
||||
style: GoogleFonts.dmSans(
|
||||
color: const Color(0xFF191B1E),
|
||||
fontSize: 14.sp,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 4.h),
|
||||
],
|
||||
)
|
||||
: Container(),
|
||||
Text(
|
||||
data[index]['dateTime'],
|
||||
style: GoogleFonts.dmSans(
|
||||
color: const Color(0xFF8D8D8D),
|
||||
fontSize: 11.sp,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Spacer(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
(data[index]['onHold'])
|
||||
? Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
AppText.onHold,
|
||||
style: GoogleFonts.dmSans(
|
||||
color: const Color(0xFF0172CB),
|
||||
fontSize: 14.sp,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 4.h),
|
||||
],
|
||||
)
|
||||
: Container(),
|
||||
Text(
|
||||
data[index]['value'],
|
||||
style: GoogleFonts.dmSans(
|
||||
color: const Color(0xFF191B1E),
|
||||
fontSize: 14.sp,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 4.h),
|
||||
(data[index]['subValue'] != '')
|
||||
? Text(
|
||||
data[index]['subValue'],
|
||||
style: GoogleFonts.dmSans(
|
||||
color: const Color(0xFF191B1E),
|
||||
fontSize: 12.sp,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget getIcon(String title) {
|
||||
if (title == 'Deposit') {
|
||||
return Container(
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle, color: Color(0xFF0FA4A4)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Image.asset(
|
||||
'assets/images/wallet_screen/deposit_list.png',
|
||||
height: 25.h,
|
||||
),
|
||||
),
|
||||
);
|
||||
} else if (title == 'Withdrawal') {
|
||||
return Container(
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle, color: Color(0xFFE6681F)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Image.asset('assets/images/wallet_screen/withdraw_list.png',
|
||||
height: 25.h),
|
||||
),
|
||||
);
|
||||
} else if (title == 'Investment') {
|
||||
return Container(
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle, color: Color(0xFF0172CB)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Image.asset('assets/images/wallet_screen/invest_list.png',
|
||||
height: 25.h),
|
||||
),
|
||||
);
|
||||
} else if (title == 'Yield') {
|
||||
return Container(
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle, color: Color(0xFF4C4AEF)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Image.asset('assets/images/wallet_screen/yield_list.png',
|
||||
height: 25.h),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Container(
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle, color: Color(0xFF0E9445)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Image.asset('assets/images/wallet_screen/refund_list.png',
|
||||
height: 25.h),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,298 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:tanami_app/core/styles/app_color.dart';
|
||||
|
||||
import '../../../../../core/routes/route_name.dart';
|
||||
import '../../../../../core/routes/routes.dart';
|
||||
import '../../../../../core/styles/app_text.dart';
|
||||
|
||||
List data = [
|
||||
{
|
||||
'title': AppText.deposit,
|
||||
'subTitle': '',
|
||||
'dateTime': '10/04/2024 22:04',
|
||||
'value': '+ SAR 100,000',
|
||||
'subValue': '',
|
||||
'onHold': false,
|
||||
},
|
||||
{
|
||||
'title': AppText.withdrawal,
|
||||
'subTitle': '',
|
||||
'dateTime': '10/04/2024 22:04',
|
||||
'value': '- SAR 100,000',
|
||||
'subValue': '',
|
||||
'onHold': true,
|
||||
},
|
||||
{
|
||||
'title': AppText.investment,
|
||||
'subTitle': 'Name of Investment',
|
||||
'dateTime': '10/04/2024 22:04',
|
||||
'value': '- SAR 100,000',
|
||||
'subValue': '',
|
||||
'onHold': false,
|
||||
},
|
||||
{
|
||||
'title': AppText.yield,
|
||||
'subTitle': 'Name of Investment',
|
||||
'dateTime': '10/04/2024 22:04',
|
||||
'value': '+ SAR 100,000',
|
||||
'subValue': '+ \$100,00',
|
||||
'onHold': false,
|
||||
},
|
||||
{
|
||||
'title': AppText.refund,
|
||||
'subTitle': '',
|
||||
'dateTime': '10/04/2024 22:04',
|
||||
'value': '- SAR 100,000',
|
||||
'subValue': '',
|
||||
'onHold': true,
|
||||
},
|
||||
];
|
||||
|
||||
class WalletLayout extends StatelessWidget {
|
||||
const WalletLayout({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColor.plainWhite,
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(18.0, 10.0, 18.0, 0.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
AppText.day,
|
||||
style: GoogleFonts.dmSans(
|
||||
color: const Color(0xFF8D8D8D),
|
||||
fontSize: 11.sp,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
decoration: const BoxDecoration(
|
||||
color: Color(0xFFF6F6F6),
|
||||
borderRadius: BorderRadius.all(Radius.circular(12.0)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Image.asset(
|
||||
'assets/images/wallet_screen/search.png',
|
||||
height: 20.h,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 5.w,
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
goRouter.pushNamed(RouteName.filterScreen);
|
||||
},
|
||||
child: Container(
|
||||
decoration: const BoxDecoration(
|
||||
color: Color(0xFFF6F6F6),
|
||||
borderRadius: BorderRadius.all(Radius.circular(12.0)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Image.asset(
|
||||
'assets/images/wallet_screen/filter.png',
|
||||
height: 20.h,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: data.length,
|
||||
itemBuilder: (context, index) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 10.0),
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
goRouter.pushNamed(RouteName.walletDetails,
|
||||
pathParameters: {
|
||||
"type": data[index]['title'],
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
height: 92.h,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(22.r),
|
||||
color: const Color(0xFFF6F6F6),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: Row(
|
||||
children: [
|
||||
getIcon(data[index]['title']),
|
||||
SizedBox(width: 12.w),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
data[index]['title'],
|
||||
style: GoogleFonts.dmSans(
|
||||
color: const Color(0xFF191B1E),
|
||||
fontSize: 14.sp,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 4.h),
|
||||
(data[index]['subTitle'] != '')
|
||||
? Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
data[index]['subTitle'],
|
||||
style: GoogleFonts.dmSans(
|
||||
color: const Color(0xFF191B1E),
|
||||
fontSize: 14.sp,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 4.h),
|
||||
],
|
||||
)
|
||||
: Container(),
|
||||
Text(
|
||||
data[index]['dateTime'],
|
||||
style: GoogleFonts.dmSans(
|
||||
color: const Color(0xFF8D8D8D),
|
||||
fontSize: 11.sp,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const Spacer(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
(data[index]['onHold'])
|
||||
? Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
AppText.onHold,
|
||||
style: GoogleFonts.dmSans(
|
||||
color: const Color(0xFF0172CB),
|
||||
fontSize: 14.sp,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 4.h),
|
||||
],
|
||||
)
|
||||
: Container(),
|
||||
Text(
|
||||
data[index]['value'],
|
||||
style: GoogleFonts.dmSans(
|
||||
color: const Color(0xFF191B1E),
|
||||
fontSize: 14.sp,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 4.h),
|
||||
(data[index]['subValue'] != '')
|
||||
? Text(
|
||||
data[index]['subValue'],
|
||||
style: GoogleFonts.dmSans(
|
||||
color: const Color(0xFF191B1E),
|
||||
fontSize: 12.sp,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Widget getIcon(String title) {
|
||||
if (title == 'Deposit') {
|
||||
return Container(
|
||||
decoration:
|
||||
const BoxDecoration(shape: BoxShape.circle, color: Color(0xFF0FA4A4)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Image.asset(
|
||||
'assets/images/wallet_screen/deposit_list.png',
|
||||
height: 25.h,
|
||||
),
|
||||
),
|
||||
);
|
||||
} else if (title == 'Withdrawal') {
|
||||
return Container(
|
||||
decoration:
|
||||
const BoxDecoration(shape: BoxShape.circle, color: Color(0xFFE6681F)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Image.asset('assets/images/wallet_screen/withdraw_list.png',
|
||||
height: 25.h),
|
||||
),
|
||||
);
|
||||
} else if (title == 'Investment') {
|
||||
return Container(
|
||||
decoration:
|
||||
const BoxDecoration(shape: BoxShape.circle, color: Color(0xFF0172CB)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Image.asset('assets/images/wallet_screen/invest_list.png',
|
||||
height: 25.h),
|
||||
),
|
||||
);
|
||||
} else if (title == 'Yield') {
|
||||
return Container(
|
||||
decoration:
|
||||
const BoxDecoration(shape: BoxShape.circle, color: Color(0xFF4C4AEF)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Image.asset('assets/images/wallet_screen/yield_list.png',
|
||||
height: 25.h),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Container(
|
||||
decoration:
|
||||
const BoxDecoration(shape: BoxShape.circle, color: Color(0xFF0E9445)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Image.asset('assets/images/wallet_screen/refund_list.png',
|
||||
height: 25.h),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:tanami_app/core/routes/route_name.dart';
|
||||
import 'package:tanami_app/core/routes/routes.dart';
|
||||
import 'package:tanami_app/core/styles/app_text.dart';
|
||||
|
||||
import 'wallet_layout.dart';
|
||||
|
||||
class WalletScreen extends StatefulWidget {
|
||||
const WalletScreen({super.key});
|
||||
|
||||
@override
|
||||
State<WalletScreen> createState() => _WalletScreenState();
|
||||
}
|
||||
|
||||
class _WalletScreenState extends State<WalletScreen> {
|
||||
@override
|
||||
void initState() {
|
||||
// _savebottomsheet();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: AppBar(
|
||||
elevation: 0,
|
||||
scrolledUnderElevation: 0.0,
|
||||
automaticallyImplyLeading: false,
|
||||
toolbarHeight: 260.h,
|
||||
titleSpacing: 22.w,
|
||||
title: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
AppText.walletTitle,
|
||||
style: GoogleFonts.dmSans(
|
||||
color: const Color(0xFF343434),
|
||||
fontSize: 14.sp,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
Gap(4.h),
|
||||
Text(
|
||||
'SAR 178,000',
|
||||
style: GoogleFonts.dmSans(
|
||||
color: const Color(0xFF191B1E),
|
||||
fontSize: 28.sp,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
Gap(80.h)
|
||||
],
|
||||
),
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
background: Stack(
|
||||
children: [
|
||||
Image.asset(
|
||||
'assets/images/wallet_screen/bg.png', // Replace with your image asset
|
||||
fit: BoxFit.fitWidth,
|
||||
alignment: Alignment.topCenter,
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.8),
|
||||
borderRadius:
|
||||
const BorderRadius.all(Radius.circular(20.0)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 20.0, vertical: 20.0),
|
||||
child: IntrinsicHeight(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
goRouter.pushNamed(RouteName.depositScreen);
|
||||
},
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black,
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Image.asset(
|
||||
'assets/images/wallet_screen/deposit.png',
|
||||
height: 20.h,
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Deposit',
|
||||
style: GoogleFonts.dmSans(
|
||||
color: const Color(0xFF363636),
|
||||
fontSize: 12.sp,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const VerticalDivider(
|
||||
color: Colors.black,
|
||||
width: 20.0,
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
goRouter.pushNamed(RouteName.withdrawalScreen);
|
||||
},
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black,
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Image.asset(
|
||||
'assets/images/wallet_screen/withdraw.png',
|
||||
height: 20.h,
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Withdraw',
|
||||
style: GoogleFonts.dmSans(
|
||||
color: const Color(0xFF363636),
|
||||
fontSize: 12.sp,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
backgroundColor: Colors
|
||||
.transparent, // Make the AppBar transparent to show the background image
|
||||
),
|
||||
body: const WalletLayout(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import 'package:tanami_app/features/MainScreens/Academy/presentation/pages/acade
|
||||
import 'package:tanami_app/features/MainScreens/Invest/presentation/pages/invest_screen.dart';
|
||||
import 'package:tanami_app/features/MainScreens/Portfolio/presentation/pages/portfolio_screen.dart';
|
||||
import 'package:tanami_app/features/MainScreens/Settings/presentation/pages/settings_Screen.dart';
|
||||
import 'package:tanami_app/features/MainScreens/Wallet/presentation/pages/walletScreen.dart';
|
||||
import 'package:tanami_app/features/MainScreens/Wallet/presentation/pages/wallet_screen.dart';
|
||||
import 'package:tanami_app/shared/components/common_bottom_navigation.dart';
|
||||
|
||||
import '../../shared/components/bloc/bottom_nav_bar/bottom_navigation_bloc.dart';
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
import '../../../../core/routes/route_name.dart';
|
||||
import '../../../../core/routes/routes.dart';
|
||||
import '../../../../core/styles/app_images.dart';
|
||||
import '../../../../core/utils/biometric/biometric_bloc.dart';
|
||||
import '../../../../core/utils/biometric/biometric_event.dart';
|
||||
import '../../../../core/utils/biometric/biometric_state.dart';
|
||||
import '../../../../shared/components/device_locked_dialog.dart';
|
||||
|
||||
class BiometricLayout extends StatelessWidget {
|
||||
const BiometricLayout({super.key});
|
||||
@@ -19,31 +26,46 @@ class BiometricLayout extends StatelessWidget {
|
||||
}
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
body: SizedBox(
|
||||
width: 1.sw,
|
||||
height: 1.sh,
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: SvgPicture.asset(
|
||||
height: 1.sh,
|
||||
width: 1.sw,
|
||||
AppImages.biometricBg,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
Positioned.fill(
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Image.asset(
|
||||
biometricImage,
|
||||
width: 133,
|
||||
height: 155,
|
||||
body: BlocConsumer<BiometricBloc, BiometricState>(
|
||||
listener: (context, state) {
|
||||
if (state is BiometricChecked && state.canAuthenticate) {
|
||||
context.read<BiometricBloc>().add(AuthenticateBiometricEvent());
|
||||
} else if (state is BiometricFailed) {
|
||||
deviceLockedDialog(context);
|
||||
} else if (state is BiometricAuthenticated) {
|
||||
goRouter.goNamed(RouteName.pinScreen, pathParameters: {
|
||||
"fromScreen": "LoginedInUser",
|
||||
});
|
||||
}
|
||||
},
|
||||
builder: (context, state) {
|
||||
return SizedBox(
|
||||
width: 1.sw,
|
||||
height: 1.sh,
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: SvgPicture.asset(
|
||||
height: 1.sh,
|
||||
width: 1.sw,
|
||||
AppImages.biometricBg,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned.fill(
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Image.asset(
|
||||
biometricImage,
|
||||
width: 133,
|
||||
height: 155,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -13,13 +13,13 @@ import 'package:tanami_app/shared/components/checkbox_widget.dart';
|
||||
import 'package:tanami_app/shared/components/loader.dart';
|
||||
import 'package:tanami_app/shared/components/toast_message.dart';
|
||||
|
||||
import '../../../../core/routes/route_name.dart';
|
||||
import '../../../../core/routes/routes.dart';
|
||||
import '../../../../core/styles/app_color.dart';
|
||||
import '../../../../core/styles/app_text.dart';
|
||||
import '../../../../shared/components/bloc/checkbox/checkbox_bloc.dart';
|
||||
import '../../../../shared/components/bloc/checkbox/checkbox_state.dart';
|
||||
import '../../../../shared/components/button_widget.dart';
|
||||
import '../../../../shared/components/permission_dialog.dart';
|
||||
import '../bloc/register_user_bloc.dart';
|
||||
import '../bloc/register_user_event.dart';
|
||||
import '../bloc/register_user_state.dart';
|
||||
@@ -93,12 +93,8 @@ class RegisterUserBottomSection extends StatelessWidget {
|
||||
if (state is RegisterUserLoading) {
|
||||
Loader.loader(context);
|
||||
} else if (state is RegisterUserSuccess) {
|
||||
successToastMessage(context, "successful !");
|
||||
goRouter.pop();
|
||||
|
||||
goRouter.goNamed(RouteName.pinScreen, pathParameters: {
|
||||
"fromScreen": "register",
|
||||
});
|
||||
permissionDialog(context);
|
||||
} else if (state is RegisterUserFailure) {
|
||||
goRouter.pop();
|
||||
errorToastMessage(
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
|
||||
import 'app_version_event.dart';
|
||||
import 'app_version_state.dart';
|
||||
|
||||
|
||||
@@ -44,9 +44,14 @@ class SplashScreen extends StatelessWidget {
|
||||
// Navigate to the WelcomeScreen using the goRouter
|
||||
goRouter.goNamed(RouteName.welcomeScreen);
|
||||
} else {
|
||||
goRouter.goNamed(RouteName.pinScreen, pathParameters: {
|
||||
"fromScreen": "LoginedInUser",
|
||||
});
|
||||
if (await secureStorageService.read('biometric') != null &&
|
||||
await secureStorageService.read('biometric') == 'on') {
|
||||
goRouter.goNamed(RouteName.biometricScreen);
|
||||
} else {
|
||||
goRouter.goNamed(RouteName.pinScreen, pathParameters: {
|
||||
"fromScreen": "LoginedInUser",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,12 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:local_auth/local_auth.dart';
|
||||
import 'package:statsfl/statsfl.dart';
|
||||
|
||||
import 'core/routes/routes.dart';
|
||||
import 'core/utils/biometric/biometric_bloc.dart';
|
||||
import 'core/utils/biometric/biometric_event.dart';
|
||||
import 'core/utils/connectivity/network_connectivity.dart';
|
||||
import 'features/countrySelection/presentation/bloc/choose_country_bloc.dart';
|
||||
import 'shared/components/bloc/bottom_nav_bar/bottom_navigation_bloc.dart';
|
||||
@@ -25,7 +29,16 @@ Future<void> main() async {
|
||||
// Set the preferred orientations of the device.
|
||||
SystemChrome.setPreferredOrientations([
|
||||
DeviceOrientation.portraitUp,
|
||||
]).then((value) => runApp(const MyApp()));
|
||||
]).then((value) => runApp(StatsFl(
|
||||
isEnabled: true, //Toggle on/off
|
||||
width: 200, //Set size
|
||||
height: 50, //
|
||||
maxFps: 60, // Support custom FPS target (default is 60)
|
||||
showText: true, // Hide text label
|
||||
sampleTime: .5, //Interval between fps calculations, in seconds.
|
||||
totalTime: 15, //Total length of timeline, in seconds.
|
||||
align: Alignment.center, //Alignment of statsbox
|
||||
child: const MyApp())));
|
||||
}
|
||||
|
||||
class MyApp extends StatefulWidget {
|
||||
@@ -63,6 +76,10 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
|
||||
),
|
||||
BlocProvider(
|
||||
create: (_) => BottomNavigationBloc(),
|
||||
),
|
||||
BlocProvider(
|
||||
create: (_) =>
|
||||
BiometricBloc(LocalAuthentication())..add(CheckBiometricEvent()),
|
||||
)
|
||||
],
|
||||
child: ScreenUtilInit(
|
||||
|
||||
@@ -1,19 +1,33 @@
|
||||
// Bloc
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:tanami_app/core/utils/secure/secure_storage_service.dart';
|
||||
|
||||
import 'toggle_event.dart';
|
||||
import 'toggle_state.dart';
|
||||
|
||||
class ToggleBloc extends Bloc<ToggleEvent, ToggleState> {
|
||||
ToggleBloc() : super(ToggleInitial()) {
|
||||
final String type;
|
||||
|
||||
final SecureStorageService secureStorageService = SecureStorageService();
|
||||
|
||||
ToggleBloc(this.type) : super(ToggleInitial()) {
|
||||
on<ToggleSwitch>(_onToggleSwitch);
|
||||
_initializeToggleState();
|
||||
}
|
||||
|
||||
void _onToggleSwitch(ToggleSwitch event, Emitter<ToggleState> emit) {
|
||||
void _onToggleSwitch(ToggleSwitch event, Emitter<ToggleState> emit) async {
|
||||
if (state is ToggleOn) {
|
||||
emit(ToggleOff());
|
||||
await secureStorageService.write(type, 'off');
|
||||
} else {
|
||||
emit(ToggleOn());
|
||||
await secureStorageService.write(type, 'on');
|
||||
}
|
||||
}
|
||||
|
||||
void _initializeToggleState() async {
|
||||
final toggleValue = await secureStorageService.read(type);
|
||||
if (toggleValue == 'on') {
|
||||
add(ToggleSwitch()); // Initializing the state by adding an event
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,9 +16,9 @@ class CheckBoxWidget extends StatelessWidget {
|
||||
return Checkbox(
|
||||
activeColor: AppColor.checkBoxActiveColor,
|
||||
checkColor: Colors.white,
|
||||
side: MaterialStateBorderSide.resolveWith(
|
||||
side: WidgetStateBorderSide.resolveWith(
|
||||
(states) {
|
||||
if (states.contains(MaterialState.selected)) {
|
||||
if (states.contains(WidgetState.selected)) {
|
||||
return const BorderSide(
|
||||
color: AppColor.checkBoxActiveColor, width: 2);
|
||||
}
|
||||
|
||||
138
lib/shared/components/device_locked_dialog.dart
Normal file
138
lib/shared/components/device_locked_dialog.dart
Normal file
@@ -0,0 +1,138 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:tanami_app/core/routes/routes.dart';
|
||||
import 'package:tanami_app/core/styles/app_color.dart';
|
||||
import 'package:tanami_app/core/styles/app_text.dart';
|
||||
import 'package:tanami_app/core/utils/biometric/biometric_bloc.dart';
|
||||
|
||||
import '../../core/utils/biometric/biometric_event.dart';
|
||||
import '../../core/utils/biometric/biometric_state.dart';
|
||||
import 'text_widget.dart';
|
||||
|
||||
deviceLockedDialog(
|
||||
context,
|
||||
) {
|
||||
return showDialog(
|
||||
barrierDismissible: false,
|
||||
context: context,
|
||||
builder: (context) => WillPopScope(
|
||||
onWillPop: () async {
|
||||
return false;
|
||||
},
|
||||
child: BlocBuilder<BiometricBloc, BiometricState>(
|
||||
builder: (context, state) {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
AlertDialog(
|
||||
insetPadding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
backgroundColor: AppColor.plainWhite,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(20)),
|
||||
side: BorderSide(
|
||||
color: AppColor.plainWhite,
|
||||
),
|
||||
),
|
||||
content: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Align(
|
||||
alignment: Alignment.center,
|
||||
child: CircleAvatar(
|
||||
radius: 25,
|
||||
backgroundColor: AppColor.inactiveBtnColor,
|
||||
child: Center(
|
||||
child: Icon(
|
||||
Icons.lock,
|
||||
size: 25,
|
||||
color: AppColor.primaryColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Gap(22.h),
|
||||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 30),
|
||||
child: TextWidget().text17W700(
|
||||
AppText.tanamiAppIsLocked,
|
||||
clr: AppColor.textLabelColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
const Gap(5),
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Container(
|
||||
// margin: const EdgeInsets.symmetric(horizontal: 30),
|
||||
child: TextWidget().text14W400(
|
||||
AppText.securityMssgText,
|
||||
clr: AppColor.textLabelColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
Gap(21.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
SystemNavigator.pop();
|
||||
},
|
||||
child: Container(
|
||||
height: 48.h,
|
||||
width: 140.w,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: AppColor.primaryColor,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10.h),
|
||||
color: AppColor.plainWhite,
|
||||
),
|
||||
child: Center(
|
||||
child: TextWidget().text18W700(
|
||||
AppText.cancelText,
|
||||
clr: AppColor.primaryColor2,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Gap(15.w),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
goRouter.pop();
|
||||
context
|
||||
.read<BiometricBloc>()
|
||||
.add(AuthenticateBiometricEvent());
|
||||
},
|
||||
child: Container(
|
||||
height: 48.h,
|
||||
width: 140.w,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10.h),
|
||||
color: AppColor.primaryColor),
|
||||
child: Center(
|
||||
child: TextWidget().text18W700(
|
||||
AppText.unlockText,
|
||||
clr: AppColor.plainWhite,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
138
lib/shared/components/permission_dialog.dart
Normal file
138
lib/shared/components/permission_dialog.dart
Normal file
@@ -0,0 +1,138 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:tanami_app/core/styles/app_color.dart';
|
||||
|
||||
import '../../core/routes/route_name.dart';
|
||||
import '../../core/routes/routes.dart';
|
||||
import '../../core/styles/app_text.dart';
|
||||
import '../../core/utils/secure/secure_storage_service.dart';
|
||||
import 'text_widget.dart';
|
||||
import 'toast_message.dart';
|
||||
|
||||
permissionDialog(
|
||||
context,
|
||||
) {
|
||||
final SecureStorageService secureStorageService = SecureStorageService();
|
||||
|
||||
return showDialog(
|
||||
barrierDismissible: true,
|
||||
context: context,
|
||||
builder: (context) => WillPopScope(
|
||||
onWillPop: () async {
|
||||
return true;
|
||||
},
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
AlertDialog(
|
||||
contentPadding: const EdgeInsets.all(0),
|
||||
// insetPadding: const EdgeInsets.all(0),
|
||||
backgroundColor: AppColor.plainWhite,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(14)),
|
||||
side: BorderSide(
|
||||
color: AppColor.plainWhite,
|
||||
),
|
||||
),
|
||||
content: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Column(
|
||||
children: [
|
||||
const Gap(20),
|
||||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 30),
|
||||
child: TextWidget().text17W600(
|
||||
AppText.biometricText,
|
||||
clr: AppColor.plainBlack,
|
||||
),
|
||||
),
|
||||
),
|
||||
const Gap(5),
|
||||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: Container(
|
||||
// margin: const EdgeInsets.symmetric(horizontal: 30),
|
||||
child: TextWidget().text13W400(
|
||||
AppText.appAskPermissionText,
|
||||
txtAlign: TextAlign.center,
|
||||
clr: AppColor.plainBlack,
|
||||
),
|
||||
),
|
||||
),
|
||||
Gap(21.h),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 1.sw,
|
||||
height: 1,
|
||||
decoration: const BoxDecoration(color: Color(0x5B3C3C43)),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
successToastMessage(context, "successful !");
|
||||
goRouter.pop();
|
||||
|
||||
goRouter.goNamed(RouteName.pinScreen, pathParameters: {
|
||||
"fromScreen": "register",
|
||||
});
|
||||
},
|
||||
child: SizedBox(
|
||||
height: 48.h,
|
||||
width: 140.w,
|
||||
child: Center(
|
||||
child: TextWidget().text17W600(
|
||||
AppText.declineText,
|
||||
clr: AppColor.permissionTextClr,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 1,
|
||||
height: 50,
|
||||
decoration: const BoxDecoration(color: Color(0x5B3C3C43)),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
await secureStorageService.write("biometric", 'on');
|
||||
successToastMessage(
|
||||
context, "Biometric/Face Id Enabled Sucessfully !");
|
||||
// successToastMessage(context, "successful !");
|
||||
goRouter.pop();
|
||||
|
||||
goRouter.goNamed(RouteName.pinScreen, pathParameters: {
|
||||
"fromScreen": "register",
|
||||
});
|
||||
},
|
||||
child: SizedBox(
|
||||
height: 48.h,
|
||||
width: 140.w,
|
||||
child: Center(
|
||||
child: TextWidget().text17W600(
|
||||
AppText.allowText,
|
||||
clr: AppColor.permissionTextClr,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -76,6 +76,18 @@ class TextWidget {
|
||||
}
|
||||
|
||||
//Text Size 13
|
||||
Widget text13W400(String text, {Color? clr, TextAlign? txtAlign}) {
|
||||
return Text(
|
||||
text,
|
||||
textAlign: txtAlign ?? TextAlign.start,
|
||||
style: GoogleFonts.dmSans(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: clr ?? AppColor.plainWhite,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget text13W500(String text, {Color? clr}) {
|
||||
return Text(
|
||||
text,
|
||||
|
||||
Reference in New Issue
Block a user