You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
467 lines
20 KiB
Dart
467 lines
20 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
|
|
import '../../../core/constants/translation_keys.dart';
|
|
import '../../../custom_widgets/bottom_sheet.dart';
|
|
import '../../../custom_widgets/custom_app_bar.dart';
|
|
import '../../../custom_widgets/custom_toasty.dart';
|
|
import '../../../res/app_colors.dart';
|
|
import '../../../routes/app_pages.dart';
|
|
import '../controllers/app_setting_controller.dart';
|
|
import 'model/Language.dart';
|
|
|
|
class AppSettingView extends GetView<AppSettingController> {
|
|
const AppSettingView({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: DashBoardAppBar(
|
|
title: TranslationKeys.makeTranslation(TranslationKeys.textAppSettingTitle),
|
|
onBackButtonPressed: () {
|
|
Get.back();
|
|
},
|
|
),
|
|
body: SingleChildScrollView(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Expanded(
|
|
flex: 0,
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 5),
|
|
child: InkWell(
|
|
onTap: () {
|
|
showBottomSheet(context, "FROM_ACCOUNT", controller);
|
|
},
|
|
child: Container(
|
|
height: 50,
|
|
margin: const EdgeInsets.only(top: 10),
|
|
decoration: BoxDecoration(
|
|
border: Border.all(color: AppColors.colorGrey300),
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
const Padding(
|
|
padding: EdgeInsets.all(6.0),
|
|
child: Card(
|
|
elevation: 0.0,
|
|
color: AppColors.colorGrey200,
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(22))),
|
|
child: CircleAvatar(
|
|
backgroundColor: AppColors.colorGrey200,
|
|
minRadius: 15,
|
|
child: Icon(Icons.language, color: AppColors.colorPrimary, size: 18),
|
|
),
|
|
),
|
|
),
|
|
Text(TranslationKeys.makeTranslation(TranslationKeys.textLanguagesTitle), style: Theme.of(context).textTheme.titleSmall?.copyWith(fontSize: 14, fontWeight: FontWeight.w400)),
|
|
const Spacer(),
|
|
const Padding(
|
|
padding: EdgeInsets.all(16.0),
|
|
child: Icon(Icons.arrow_forward_ios_outlined, size: 15, color: AppColors.colorGrey700),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Visibility(
|
|
// visible: SessionCache.instance.fingerPrintController.isFingerprintSupported.value,
|
|
child: Expanded(
|
|
flex: 0,
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 5),
|
|
child: InkWell(
|
|
onTap: () {
|
|
// showBottomSheet(
|
|
// context, "FROM_ACCOUNT", controller);
|
|
},
|
|
child: Container(
|
|
height: 50,
|
|
margin: const EdgeInsets.only(top: 10),
|
|
decoration: BoxDecoration(
|
|
border: Border.all(color: AppColors.colorGrey300),
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
const Padding(
|
|
padding: EdgeInsets.all(6.0),
|
|
child: Card(
|
|
elevation: 0.0,
|
|
color: AppColors.colorGrey200,
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(22))),
|
|
child: CircleAvatar(
|
|
backgroundColor: AppColors.colorGrey200,
|
|
minRadius: 15,
|
|
child: Icon(
|
|
Icons.fingerprint_outlined,
|
|
color: AppColors.colorPrimary,
|
|
size: 15,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Text(TranslationKeys.makeTranslation(TranslationKeys.textFingerPrintTitle), style: Theme.of(context).textTheme.titleSmall?.copyWith(fontWeight: FontWeight.w400)),
|
|
const Spacer(),
|
|
// Obx(() {
|
|
// return Switch(
|
|
// value: SessionCache.instance.fingerPrintController.isFingerprintSupported.value && SessionCache.instance.fingerPrintController.isFingerPrintExistInDB.value,
|
|
// onChanged: (bool value) {
|
|
// if (value) {
|
|
// SessionCache.instance.fingerPrintController.authenticate(null, true);
|
|
// } else {
|
|
// print("---------------->>>");
|
|
// SessionCache.instance.fingerPrintController.clearFromDB();
|
|
// }
|
|
// },
|
|
// activeColor: AppColors.colorButton,
|
|
// );
|
|
// }),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
flex: 0,
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 5),
|
|
child: InkWell(
|
|
onTap: () {
|
|
Get.toNamed(Routes.DAIL_TRANSACTION_LIMIT);
|
|
},
|
|
child: Container(
|
|
height: 50,
|
|
margin: const EdgeInsets.only(top: 0),
|
|
decoration: BoxDecoration(
|
|
border: Border.all(color: AppColors.colorGrey300),
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
const Padding(
|
|
padding: EdgeInsets.all(6.0),
|
|
child: Card(
|
|
elevation: 0.0,
|
|
color: AppColors.colorGrey200,
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(22))),
|
|
child: CircleAvatar(
|
|
backgroundColor: AppColors.colorGrey200,
|
|
minRadius: 15,
|
|
child: Icon(
|
|
Icons.monetization_on_outlined,
|
|
color: AppColors.colorPrimary,
|
|
size: 15,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Text(TranslationKeys.makeTranslation(TranslationKeys.textDailyTransactionLimit), style: Theme.of(context).textTheme.titleSmall?.copyWith(fontWeight: FontWeight.w400)),
|
|
const Spacer(),
|
|
const Padding(
|
|
padding: EdgeInsets.all(16.0),
|
|
child: Icon(
|
|
Icons.arrow_forward_ios_outlined,
|
|
size: 15,
|
|
color: AppColors.colorGrey700,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
flex: 0,
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 5),
|
|
child: InkWell(
|
|
onTap: () {
|
|
Get.toNamed(Routes.QR_SETTING);
|
|
},
|
|
child: Container(
|
|
height: 50,
|
|
margin: const EdgeInsets.only(top: 0),
|
|
decoration: BoxDecoration(
|
|
border: Border.all(color: AppColors.colorGrey300),
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
const Padding(
|
|
padding: EdgeInsets.all(6.0),
|
|
child: Card(
|
|
elevation: 0.0,
|
|
color: AppColors.colorGrey200,
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(22))),
|
|
child: CircleAvatar(
|
|
backgroundColor: AppColors.colorGrey200,
|
|
minRadius: 15,
|
|
child: Icon(
|
|
Icons.qr_code,
|
|
color: AppColors.colorPrimary,
|
|
size: 15,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Text(TranslationKeys.makeTranslation(TranslationKeys.textQRSetting), style: Theme.of(context).textTheme.titleSmall?.copyWith(fontWeight: FontWeight.w400)),
|
|
const Spacer(),
|
|
const Padding(
|
|
padding: EdgeInsets.all(16.0),
|
|
child: Icon(
|
|
Icons.arrow_forward_ios_outlined,
|
|
size: 15,
|
|
color: AppColors.colorGrey700,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
flex: 0,
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 5),
|
|
child: InkWell(
|
|
onTap: () {
|
|
Get.toNamed(Routes.CHANGE_TRANSACTION_PIN);
|
|
},
|
|
child: Container(
|
|
height: 50,
|
|
margin: const EdgeInsets.only(top: 0),
|
|
decoration: BoxDecoration(
|
|
border: Border.all(color: AppColors.colorGrey300),
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
const Padding(
|
|
padding: EdgeInsets.all(6.0),
|
|
child: Card(
|
|
elevation: 0.0,
|
|
color: AppColors.colorGrey200,
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(22))),
|
|
child: CircleAvatar(
|
|
backgroundColor: AppColors.colorGrey200,
|
|
minRadius: 15,
|
|
child: Icon(
|
|
Icons.password,
|
|
color: AppColors.colorPrimary,
|
|
size: 15,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Text(TranslationKeys.makeTranslation(TranslationKeys.textChangeTransactionPin), style: Theme.of(context).textTheme.titleSmall?.copyWith(fontWeight: FontWeight.w400)),
|
|
const Spacer(),
|
|
const Padding(
|
|
padding: EdgeInsets.all(16.0),
|
|
child: Icon(
|
|
Icons.arrow_forward_ios_outlined,
|
|
size: 15,
|
|
color: AppColors.colorGrey700,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
flex: 0,
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 5),
|
|
child: InkWell(
|
|
onTap: () {
|
|
Toasty.success("Transaction Pin Already Generate");
|
|
// Get.toNamed(Routes.CREATE_TRANSACTION_PIN);
|
|
},
|
|
child: Container(
|
|
height: 50,
|
|
margin: const EdgeInsets.only(top: 0),
|
|
decoration: BoxDecoration(
|
|
border: Border.all(color: AppColors.colorGrey300),
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
const Padding(
|
|
padding: EdgeInsets.all(6.0),
|
|
child: Card(
|
|
elevation: 0.0,
|
|
color: AppColors.colorGrey200,
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(22))),
|
|
child: CircleAvatar(
|
|
backgroundColor: AppColors.colorGrey200,
|
|
minRadius: 15,
|
|
child: Icon(
|
|
Icons.password,
|
|
color: AppColors.colorPrimary,
|
|
size: 15,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Text(TranslationKeys.makeTranslation(TranslationKeys.textCreateTransactionPin), style: Theme.of(context).textTheme.titleSmall?.copyWith(fontWeight: FontWeight.w400)),
|
|
const Spacer(),
|
|
const Padding(
|
|
padding: EdgeInsets.all(16.0),
|
|
child: Icon(
|
|
Icons.arrow_forward_ios_outlined,
|
|
size: 15,
|
|
color: AppColors.colorGrey700,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
flex: 0,
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 5),
|
|
child: InkWell(
|
|
onTap: () {
|
|
controller.showLogoutDialog(context);
|
|
},
|
|
child: Container(
|
|
height: 50,
|
|
margin: const EdgeInsets.only(top: 0),
|
|
decoration: BoxDecoration(
|
|
border: Border.all(color: AppColors.colorGrey300),
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
const Padding(
|
|
padding: EdgeInsets.all(6.0),
|
|
child: Card(
|
|
elevation: 0.0,
|
|
color: AppColors.colorGrey200,
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(22))),
|
|
child: CircleAvatar(
|
|
backgroundColor: AppColors.colorGrey200,
|
|
minRadius: 15,
|
|
child: Icon(
|
|
Icons.logout,
|
|
color: AppColors.colorPrimary,
|
|
size: 15,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Text(TranslationKeys.makeTranslation(TranslationKeys.textLogOut), style: Theme.of(context).textTheme.titleSmall?.copyWith(fontWeight: FontWeight.w400)),
|
|
const Spacer(),
|
|
const Padding(
|
|
padding: EdgeInsets.all(16.0),
|
|
child: Icon(
|
|
Icons.arrow_forward_ios_outlined,
|
|
size: 15,
|
|
color: AppColors.colorGrey700,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
const Expanded(flex: 0, child: SizedBox(height: 15)),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
/// Change Language Function For Search Bar
|
|
void showBottomSheet(BuildContext context, String accountType, AppSettingController controller) {
|
|
//
|
|
|
|
List<OptionData> options = [];
|
|
|
|
for (int i = 0; i < Languages.supportedLanguages.length; i++) {
|
|
//
|
|
|
|
Languages language = Languages.supportedLanguages[i];
|
|
|
|
options.add(OptionData.withData(language.lable, "", language));
|
|
|
|
//
|
|
}
|
|
|
|
Get.bottomSheet(
|
|
Container(
|
|
decoration: BoxDecoration(color: Colors.white, border: Border.all(color: AppColors.colorGrey800, width: 1), borderRadius: const BorderRadius.only(topLeft: Radius.circular(30), topRight: Radius.circular(30))),
|
|
margin: const EdgeInsets.only(left: 20, right: 20),
|
|
child: DialogDesign(options, (selectedOption) {
|
|
Languages language = selectedOption.dataObject as Languages;
|
|
print("===========$language");
|
|
controller.updateLanguage(language.locale);
|
|
}),
|
|
),
|
|
backgroundColor: Colors.transparent,
|
|
isScrollControlled: true,
|
|
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.only(topLeft: Radius.circular(10), topRight: Radius.circular(10))),
|
|
);
|
|
}
|
|
}
|
|
|
|
class DialogDesign extends StatelessWidget {
|
|
List<OptionData> options = [];
|
|
Function(OptionData) onSelect;
|
|
|
|
DialogDesign(this.options, this.onSelect);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
padding: const EdgeInsets.all(16.0),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
TranslationKeys.makeTranslation(TranslationKeys.textSelectYourOption),
|
|
style: Theme.of(context).textTheme.titleLarge?.copyWith(color: AppColors.titleColor, fontSize: 12, fontWeight: FontWeight.w600),
|
|
),
|
|
InkWell(
|
|
onTap: () {
|
|
Get.back(); // Close the bottom sheet using Get
|
|
},
|
|
child: const CircleAvatar(
|
|
radius: 12.5,
|
|
backgroundColor: Colors.transparent,
|
|
child: Icon(
|
|
Icons.close,
|
|
size: 16.0,
|
|
color: Colors.red,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 10.0),
|
|
FilterableBottomSheet(options: options, onSelect: onSelect),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|