Added regcode qr dialog
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
// import 'package:account/src/features/linked_devices/presentation/app_users_screen.dart';
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:legacy_shared/legacy_shared.dart';
|
||||
import 'package:navigation/navigation.dart';
|
||||
import 'package:sf_localizations/sf_localizations.dart';
|
||||
import 'package:utils/utils.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:qr_flutter/qr_flutter.dart';
|
||||
|
||||
class AccountSettingsScreen extends ConsumerWidget {
|
||||
final NavigationContract navigationContract;
|
||||
@@ -15,75 +17,77 @@ class AccountSettingsScreen extends ConsumerWidget {
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final theme = ref.watch(themePortProvider);
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
|
||||
body: SafeArea(
|
||||
return PageLayout(
|
||||
title: context.translate(I18n.accountSettings),
|
||||
body: SingleChildScrollView(child: Container(
|
||||
padding: SizeUtils.getByScreen(
|
||||
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
|
||||
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: SizeUtils.getByScreen(
|
||||
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
|
||||
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
|
||||
),
|
||||
child: Stack(
|
||||
children: [
|
||||
IconButton(onPressed: () {Navigator.pop(context);},
|
||||
icon: Icon(Icons.arrow_back)),
|
||||
Center(
|
||||
child: Text(context.translate(I18n.accountSettings),
|
||||
style: TextStyle(
|
||||
fontSize: SizeUtils.getByScreen(small: 28, big: 27)
|
||||
),
|
||||
)
|
||||
)
|
||||
],
|
||||
),
|
||||
AppSectionButton(
|
||||
onPressed: (){navigationContract.pushTo(AppRoutes.personalData);},
|
||||
icon: SFIcons.account,
|
||||
text: I18n.legacyPersonalData
|
||||
),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
|
||||
AppSectionButton(
|
||||
onPressed: (){},
|
||||
icon: Icons.lock,
|
||||
text: I18n.legacyChangePassword
|
||||
),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
|
||||
AppSectionButton(
|
||||
onPressed: (){},
|
||||
icon: Icons.add_circle_outline,
|
||||
text: I18n.legacyAddNewSF
|
||||
),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
|
||||
AppSectionButton(
|
||||
onPressed: (){navigationContract.pushTo(AppRoutes.linkedDevices);},
|
||||
icon: Icons.account_circle_outlined,
|
||||
text: I18n.legacyLinkedDevices
|
||||
),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
|
||||
AppSectionButton(
|
||||
onPressed: (){navigationContract.pushTo(AppRoutes.appUsers);},
|
||||
icon: Icons.groups_outlined,
|
||||
text: I18n.legacyAppUsers
|
||||
),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
|
||||
AppSectionButton(
|
||||
onPressed: (){},
|
||||
icon: SFIcons.privacy,
|
||||
text: I18n.legacyPrivacyPolicy
|
||||
),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
|
||||
AppSectionButton(
|
||||
onPressed: (){
|
||||
showDialog(context: context, builder: (context)=>Dialog(
|
||||
backgroundColor: Colors.transparent,
|
||||
child: RegCodeDialog(regCode: 'regCode', deviceId: 'deviceId', name: 'name'),
|
||||
));
|
||||
},
|
||||
icon: Icons.qr_code,
|
||||
text: I18n.legacyRegCode
|
||||
),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
|
||||
AppSectionButton(
|
||||
onPressed: (){},
|
||||
icon: SFIcons.privacy,
|
||||
text: I18n.legacyDeleteAccount
|
||||
),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 30, big: 28)),
|
||||
SingleChildScrollView(child: Container(
|
||||
padding: SizeUtils.getByScreen(
|
||||
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
|
||||
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
AppSectionButton(
|
||||
onPressed: (){navigationContract.pushTo(AppRoutes.personalData);},
|
||||
icon: SFIcons.account,
|
||||
text: I18n.legacyPersonalData
|
||||
),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
|
||||
AppSectionButton(
|
||||
onPressed: (){},
|
||||
icon: Icons.add_circle_outline,
|
||||
text: I18n.legacyAddNewSF
|
||||
),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
|
||||
AppSectionButton(
|
||||
onPressed: (){navigationContract.pushTo(AppRoutes.linkedDevices);},
|
||||
icon: Icons.account_circle_outlined,
|
||||
text: I18n.legacyLinkedDevices
|
||||
),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
|
||||
AppSectionButton(
|
||||
onPressed: (){navigationContract.pushTo(AppRoutes.appUsers);},
|
||||
icon: Icons.groups_outlined,
|
||||
text: I18n.legacyAppUsers
|
||||
),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
|
||||
AppSectionButton(
|
||||
onPressed: (){},
|
||||
icon: SFIcons.privacy,
|
||||
text: I18n.legacyPrivacyPolicy
|
||||
),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 48, big: 47)),
|
||||
PrimaryButton(text: context.translate(I18n.legacyLogOut), color: Color(0xFF588EA5))
|
||||
],
|
||||
),
|
||||
)),
|
||||
],
|
||||
)
|
||||
),
|
||||
),
|
||||
)),
|
||||
footer: Container(
|
||||
padding: SizeUtils.getByScreen(
|
||||
small: EdgeInsets.symmetric(vertical: 12, horizontal: 30),
|
||||
big: EdgeInsets.symmetric(vertical: 10, horizontal: 28)
|
||||
),
|
||||
child: PrimaryButton(text: context.translate(I18n.legacyLogOut), color: Color(0xFF588EA5)),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -143,4 +147,103 @@ class AppSectionButton extends ConsumerWidget {
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class RegCodeDialog extends StatelessWidget {
|
||||
|
||||
final String regCode;
|
||||
final String deviceId;
|
||||
final String name;
|
||||
|
||||
const RegCodeDialog({
|
||||
super.key,
|
||||
required this.regCode,
|
||||
required this.deviceId,
|
||||
required this.name,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: SizeUtils.getByScreen(small: 330, big: 328),
|
||||
color: Colors.transparent,
|
||||
child: Stack(
|
||||
children: [
|
||||
Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Container(
|
||||
height: SizeUtils.getByScreen(small: 300, big: 298),
|
||||
width: SizeUtils.getByScreen(small: 350, big: 348),
|
||||
padding: SizeUtils.getByScreen(
|
||||
small: EdgeInsets.symmetric(vertical: 14, horizontal: 18),
|
||||
big: EdgeInsets.symmetric(vertical: 12, horizontal: 16)
|
||||
),
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Align(
|
||||
alignment: Alignment.topRight,
|
||||
child: IconButton(
|
||||
onPressed: (){Navigator.pop(context);},
|
||||
icon: Icon(Icons.close),
|
||||
padding: EdgeInsets.zero,
|
||||
),
|
||||
),
|
||||
Text(name, style: TextStyle()),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(context.translate(I18n.legacyDeviceIdLabel,
|
||||
args: {'deviceId': deviceId})),
|
||||
TextButton(
|
||||
onPressed: (){Clipboard.setData(ClipboardData(text: deviceId));},
|
||||
child: Text(context.translate(I18n.legacyCopy)),
|
||||
)
|
||||
],
|
||||
),
|
||||
QrImageView(
|
||||
data: regCode,
|
||||
version: QrVersions.auto,
|
||||
size: SizeUtils.getByScreen(small: 100, big: 98),
|
||||
padding: EdgeInsets.zero,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(context.translate(I18n.legacyRegCodeLabel,
|
||||
args: {'regCode': regCode})),
|
||||
TextButton(
|
||||
onPressed: (){Clipboard.setData(ClipboardData(text: regCode));},
|
||||
child: Text(context.translate(I18n.legacyCopy))
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Color(0xFF00A1C6),
|
||||
),
|
||||
padding: SizeUtils.getByScreen(
|
||||
small: EdgeInsets.all(12),
|
||||
big: EdgeInsets.all(12)
|
||||
),
|
||||
child: Icon(
|
||||
SFIcons.watch,
|
||||
size: SizeUtils.getByScreen(small: 68, big: 66),
|
||||
color: Colors.white,
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -155,10 +155,13 @@
|
||||
"enterMessage": "Your message",
|
||||
"sendEmail": "Send!",
|
||||
"personalData": "Personal Data",
|
||||
"changePassword": "Change password",
|
||||
"addNewSF": "Add a new SaveFamily",
|
||||
"linkedDevices": "Linked Devices",
|
||||
"appUsers": "App Users",
|
||||
"privacyPolicy": "User privacy policy",
|
||||
"regCode": "Device registration code",
|
||||
"deleteAccount": "Delete account",
|
||||
"logOut": "Log out",
|
||||
"loginEmail": "(Login email)",
|
||||
"userNameLabel": "User name",
|
||||
@@ -173,5 +176,8 @@
|
||||
"cancel": "Cancel",
|
||||
"delete": "Delete",
|
||||
"userAccount": "Account: {email}",
|
||||
"userRole": "Role: {role}"
|
||||
"userRole": "Role: {role}",
|
||||
"copy": "copy",
|
||||
"deviceIdLabel": "ID: {deviceId}",
|
||||
"regCodeLabel": "Registration code: {regCode}"
|
||||
}
|
||||
@@ -155,10 +155,13 @@
|
||||
"enterMessage": "Tu mensaje",
|
||||
"sendEmail": "Enviar",
|
||||
"personalData": "Datos Personales",
|
||||
"addNewSF": "Añadir un nuevo SaveFamily",
|
||||
"changePassword": "Cambiar contraseña",
|
||||
"addNewSF": "Agregar un nuevo SaveFamily",
|
||||
"linkedDevices": "Dispositivos vinculados",
|
||||
"appUsers": "Usuarios de la App",
|
||||
"privacyPolicy": "Política de privacidad",
|
||||
"appUsers": "Usuarios de la aplicación",
|
||||
"privacyPolicy": "Política de privacidad del usuario",
|
||||
"regCode": "Código de registro del dispositivo",
|
||||
"deleteAccount": "Eliminar cuenta",
|
||||
"logOut": "Cerrar sesión",
|
||||
"loginEmail": "(Correo electrónico)",
|
||||
"userNameLabel": "Nombre del usuario",
|
||||
@@ -173,5 +176,8 @@
|
||||
"cancel": "Cancelar",
|
||||
"delete": "Eliminar",
|
||||
"userAccount": "Cuenta: {email}",
|
||||
"userRole": "Rol: {role}"
|
||||
"userRole": "Rol: {role}",
|
||||
"copy": "copiar",
|
||||
"deviceIdLabel": "ID: {deviceId}",
|
||||
"regCodeLabel": "Código de registro: {regCode}"
|
||||
}
|
||||
@@ -185,6 +185,7 @@ class I18n {
|
||||
static const String enterMessage = 'enterMessage';
|
||||
static const String sendEmail = 'sendEmail';
|
||||
static const String legacyPersonalData = 'personalData';
|
||||
static const String legacyChangePassword = 'changePassword';
|
||||
static const String legacyAddNewSF = 'addNewSF';
|
||||
static const String legacyLinkedDevices = 'linkedDevices';
|
||||
static const String legacyAppUsers = 'appUsers';
|
||||
@@ -205,4 +206,9 @@ class I18n {
|
||||
static const String legacyDelete = 'delete';
|
||||
static const String legacyUserAccount = 'userAccount';
|
||||
static const String legacyUserRole = 'userRole';
|
||||
static const String legacyCopy = 'copy';
|
||||
static const String legacyDeviceIdLabel = 'deviceIdLabel';
|
||||
static const String legacyRegCodeLabel = 'regCodeLabel';
|
||||
static const String legacyRegCode = 'regCode';
|
||||
static const String legacyDeleteAccount = 'deleteAccount';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user