330 lines
14 KiB
Dart
330 lines
14 KiB
Dart
import '/commons/widgets/flutter_flow_theme.dart';
|
|
import '/commons/widgets/flutter_flow_util.dart';
|
|
import '/commons/widgets/flutter_flow_widgets.dart';
|
|
import 'package:easy_debounce/easy_debounce.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
import 'model.dart';
|
|
export 'model.dart';
|
|
|
|
class QrCodePassKeyTemplateComponentWidget extends StatefulWidget {
|
|
const QrCodePassKeyTemplateComponentWidget({
|
|
super.key,
|
|
required this.toggleActionStatus,
|
|
});
|
|
|
|
final Future Function(String key)? toggleActionStatus;
|
|
|
|
@override
|
|
State<QrCodePassKeyTemplateComponentWidget> createState() =>
|
|
_QrCodePassKeyTemplateComponentWidgetState();
|
|
}
|
|
|
|
class _QrCodePassKeyTemplateComponentWidgetState
|
|
extends State<QrCodePassKeyTemplateComponentWidget> {
|
|
late QrCodePassKeyTemplateComponentModel _model;
|
|
|
|
@override
|
|
void setState(VoidCallback callback) {
|
|
super.setState(callback);
|
|
_model.onUpdate();
|
|
}
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_model = createModel(context, () => QrCodePassKeyTemplateComponentModel());
|
|
|
|
_model.keyTextFieldTextController ??= TextEditingController();
|
|
_model.keyTextFieldFocusNode ??= FocusNode();
|
|
_model.keyTextFieldFocusNode!.addListener(() => safeSetState(() {}));
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_model.maybeDispose();
|
|
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Align(
|
|
alignment: const AlignmentDirectional(0.0, 1.0),
|
|
child: Container(
|
|
width: double.infinity,
|
|
height: 300.0,
|
|
constraints: const BoxConstraints(
|
|
maxWidth: 570.0,
|
|
),
|
|
decoration: BoxDecoration(
|
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
|
borderRadius: const BorderRadius.only(
|
|
bottomLeft: Radius.circular(0.0),
|
|
bottomRight: Radius.circular(0.0),
|
|
topLeft: Radius.circular(15.0),
|
|
topRight: Radius.circular(15.0),
|
|
),
|
|
),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.max,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
// This row exists for when the "app bar" is hidden on desktop, having a way back for the user can work well.
|
|
if (responsiveVisibility(
|
|
context: context,
|
|
phone: false,
|
|
tablet: false,
|
|
))
|
|
Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 16.0, 8.0),
|
|
child: InkWell(
|
|
splashColor: Colors.transparent,
|
|
focusColor: Colors.transparent,
|
|
hoverColor: Colors.transparent,
|
|
highlightColor: Colors.transparent,
|
|
onTap: () async {
|
|
context.safePop();
|
|
},
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: [
|
|
const Padding(
|
|
padding: EdgeInsetsDirectional.fromSTEB(
|
|
0.0, 12.0, 0.0, 12.0),
|
|
child: Icon(
|
|
Icons.arrow_back_rounded,
|
|
color: Color(0xFF15161E),
|
|
size: 24.0,
|
|
),
|
|
),
|
|
Padding(
|
|
padding:
|
|
const EdgeInsetsDirectional.fromSTEB(12.0, 0.0, 0.0, 0.0),
|
|
child: Text(
|
|
'',
|
|
style:
|
|
FlutterFlowTheme.of(context).bodyMedium.override(
|
|
fontFamily: 'Plus Jakarta Sans',
|
|
color: const Color(0xFF15161E),
|
|
fontSize: 14.0,
|
|
letterSpacing: 0.0,
|
|
fontWeight: FontWeight.w500,
|
|
useGoogleFonts: GoogleFonts.asMap()
|
|
.containsKey('Plus Jakarta Sans'),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 0.0, 0.0),
|
|
child: Text(
|
|
FFLocalizations.of(context).getText(
|
|
'h1xilful' /* DIGITE A SUA SENHA */,
|
|
),
|
|
style: FlutterFlowTheme.of(context).headlineMedium.override(
|
|
fontFamily: 'Outfit',
|
|
color: FlutterFlowTheme.of(context).primaryText,
|
|
fontSize: 24.0,
|
|
letterSpacing: 0.0,
|
|
fontWeight: FontWeight.w500,
|
|
useGoogleFonts: GoogleFonts.asMap().containsKey('Outfit'),
|
|
),
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(16.0, 4.0, 16.0, 4.0),
|
|
child: Text(
|
|
FFLocalizations.of(context).getText(
|
|
'ujodm2ci' /* Para gerar o QR Code digite a ... */,
|
|
),
|
|
style: FlutterFlowTheme.of(context).labelMedium.override(
|
|
fontFamily: 'Plus Jakarta Sans',
|
|
color: FlutterFlowTheme.of(context).primaryText,
|
|
fontSize: 14.0,
|
|
letterSpacing: 0.0,
|
|
fontWeight: FontWeight.w500,
|
|
useGoogleFonts:
|
|
GoogleFonts.asMap().containsKey('Plus Jakarta Sans'),
|
|
),
|
|
),
|
|
),
|
|
Form(
|
|
key: _model.formKey,
|
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
|
child: Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(16.0, 12.0, 16.0, 0.0),
|
|
child: SizedBox(
|
|
width: double.infinity,
|
|
child: TextFormField(
|
|
controller: _model.keyTextFieldTextController,
|
|
focusNode: _model.keyTextFieldFocusNode,
|
|
onChanged: (_) => EasyDebounce.debounce(
|
|
'_model.keyTextFieldTextController',
|
|
const Duration(milliseconds: 2000),
|
|
() => safeSetState(() {}),
|
|
),
|
|
autofillHints: const [AutofillHints.password],
|
|
textCapitalization: TextCapitalization.none,
|
|
textInputAction: TextInputAction.done,
|
|
obscureText: !_model.keyTextFieldVisibility,
|
|
decoration: InputDecoration(
|
|
isDense: true,
|
|
labelText: FFLocalizations.of(context).getText(
|
|
'rfqrdet7' /* Senha */,
|
|
),
|
|
labelStyle:
|
|
FlutterFlowTheme.of(context).labelMedium.override(
|
|
fontFamily: 'Plus Jakarta Sans',
|
|
color: FlutterFlowTheme.of(context).primaryText,
|
|
fontSize: 14.0,
|
|
letterSpacing: 0.0,
|
|
fontWeight: FontWeight.w500,
|
|
useGoogleFonts: GoogleFonts.asMap()
|
|
.containsKey('Plus Jakarta Sans'),
|
|
),
|
|
hintText: FFLocalizations.of(context).getText(
|
|
'zz1haydj' /* digite a sua senha..... */,
|
|
),
|
|
hintStyle:
|
|
FlutterFlowTheme.of(context).labelMedium.override(
|
|
fontFamily: 'Plus Jakarta Sans',
|
|
color: FlutterFlowTheme.of(context).primaryText,
|
|
fontSize: 14.0,
|
|
letterSpacing: 0.0,
|
|
fontWeight: FontWeight.w500,
|
|
useGoogleFonts: GoogleFonts.asMap()
|
|
.containsKey('Plus Jakarta Sans'),
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).primary,
|
|
width: 2.0,
|
|
),
|
|
borderRadius: BorderRadius.circular(12.0),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).primary,
|
|
width: 2.0,
|
|
),
|
|
borderRadius: BorderRadius.circular(12.0),
|
|
),
|
|
errorBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).error,
|
|
width: 2.0,
|
|
),
|
|
borderRadius: BorderRadius.circular(12.0),
|
|
),
|
|
focusedErrorBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).error,
|
|
width: 2.0,
|
|
),
|
|
borderRadius: BorderRadius.circular(12.0),
|
|
),
|
|
filled: true,
|
|
fillColor: FlutterFlowTheme.of(context).primaryBackground,
|
|
contentPadding: const EdgeInsetsDirectional.fromSTEB(
|
|
24.0, 24.0, 20.0, 24.0),
|
|
suffixIcon: InkWell(
|
|
onTap: () => safeSetState(
|
|
() => _model.keyTextFieldVisibility =
|
|
!_model.keyTextFieldVisibility,
|
|
),
|
|
focusNode: FocusNode(skipTraversal: true),
|
|
child: Icon(
|
|
_model.keyTextFieldVisibility
|
|
? Icons.visibility_outlined
|
|
: Icons.visibility_off_outlined,
|
|
color: FlutterFlowTheme.of(context).accent1,
|
|
size: 22.0,
|
|
),
|
|
),
|
|
),
|
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
fontFamily: 'Plus Jakarta Sans',
|
|
color: FlutterFlowTheme.of(context).primaryText,
|
|
fontSize: 14.0,
|
|
letterSpacing: 0.0,
|
|
fontWeight: FontWeight.w500,
|
|
useGoogleFonts: GoogleFonts.asMap()
|
|
.containsKey('Plus Jakarta Sans'),
|
|
),
|
|
maxLength: 4,
|
|
maxLengthEnforcement: MaxLengthEnforcement.enforced,
|
|
buildCounter: (context,
|
|
{required currentLength,
|
|
required isFocused,
|
|
maxLength}) =>
|
|
null,
|
|
keyboardType: TextInputType.number,
|
|
cursorColor: FlutterFlowTheme.of(context).primary,
|
|
validator: _model.keyTextFieldTextControllerValidator
|
|
.asValidator(context),
|
|
inputFormatters: [
|
|
FilteringTextInputFormatter.allow(RegExp('[0-9]')),
|
|
LengthLimitingTextInputFormatter(4),
|
|
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Align(
|
|
alignment: const AlignmentDirectional(0.0, 0.0),
|
|
child: Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 24.0, 0.0, 0.0),
|
|
child: FFButtonWidget(
|
|
onPressed: () async {
|
|
if (_model.formKey.currentState == null ||
|
|
!_model.formKey.currentState!.validate()) {
|
|
return;
|
|
}
|
|
await widget.toggleActionStatus?.call(
|
|
_model.keyTextFieldTextController.text,
|
|
);
|
|
Navigator.pop(context);
|
|
},
|
|
text: FFLocalizations.of(context).getText(
|
|
'2cybbi5p' /* Enviar */,
|
|
),
|
|
options: FFButtonOptions(
|
|
width: 270.0,
|
|
height: 50.0,
|
|
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
|
|
iconPadding:
|
|
const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
|
|
color: const Color(0xFF1AAB5F),
|
|
textStyle: FlutterFlowTheme.of(context).titleSmall.override(
|
|
fontFamily: 'Plus Jakarta Sans',
|
|
color: Colors.white,
|
|
fontSize: 16.0,
|
|
letterSpacing: 0.0,
|
|
fontWeight: FontWeight.w500,
|
|
useGoogleFonts: GoogleFonts.asMap()
|
|
.containsKey('Plus Jakarta Sans'),
|
|
),
|
|
elevation: 3.0,
|
|
borderSide: const BorderSide(
|
|
color: Colors.transparent,
|
|
width: 1.0,
|
|
),
|
|
),
|
|
showLoadingIndicator: false,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|