feat: Add OptModalWidget to AcessHistoryPageModel
The OptModalWidget is added to the AcessHistoryPageModel to display a modal for selecting person types. This improves the user experience by allowing them to easily toggle between different person types. The togglePersonType function is called when a person type is selected, updating the pesType field in the model and triggering a state update.
This commit is contained in:
parent
07ed93513d
commit
40511a4b47
|
@ -140,11 +140,11 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) => GoRouter(
|
|||
'accessType': '.*',
|
||||
'search': '.*',
|
||||
})),
|
||||
// FFRoute(
|
||||
// name: 'liberationHistory',
|
||||
// path: '/liberationHistory',
|
||||
// builder: (context, params) => const LiberationHistoryWidget(),
|
||||
// ),
|
||||
FFRoute(
|
||||
name: 'liberationHistory',
|
||||
path: '/liberationHistory',
|
||||
builder: (context, params) => const LiberationHistoryWidget(),
|
||||
),
|
||||
FFRoute(
|
||||
name: 'signInPage',
|
||||
path: '/signInPage',
|
||||
|
|
|
@ -48,12 +48,7 @@ class AcessHistoryPageModel extends FlutterFlowModel<AcessHistoryPageWidget> {
|
|||
: FocusScope.of(context).unfocus(),
|
||||
child: Padding(
|
||||
padding: MediaQuery.viewInsetsOf(context),
|
||||
child: OptModalWidget(
|
||||
togglePersonType: (personType) async {
|
||||
_model.pesType = personType;
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
child: const OptModalWidget(),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
|
|
@ -5,14 +5,14 @@ import '/flutter_flow/request_manager.dart';
|
|||
import 'liberation_history_widget.dart' show LiberationHistoryWidget;
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// class LiberationHistoryModel extends FlutterFlowModel<LiberationHistoryWidget> {
|
||||
// /// State fields for stateful widgets in this page.
|
||||
class LiberationHistoryModel extends FlutterFlowModel<LiberationHistoryWidget> {
|
||||
/// State fields for stateful widgets in this page.
|
||||
|
||||
// final unfocusNode = FocusNode();
|
||||
// // State field(s) for TextField widget.
|
||||
// FocusNode? textFieldFocusNode;
|
||||
// TextEditingController? textController;
|
||||
// String? Function(BuildContext, String?)? textControllerValidator;
|
||||
final unfocusNode = FocusNode();
|
||||
// State field(s) for TextField widget.
|
||||
FocusNode? textFieldFocusNode;
|
||||
TextEditingController? textController;
|
||||
String? Function(BuildContext, String?)? textControllerValidator;
|
||||
|
||||
/// Query cache managers for this widget.
|
||||
|
||||
|
|
|
@ -11,38 +11,38 @@ import 'package:provider/provider.dart';
|
|||
import 'liberation_history_model.dart';
|
||||
export 'liberation_history_model.dart';
|
||||
|
||||
// class LiberationHistoryWidget extends StatefulWidget {
|
||||
// const LiberationHistoryWidget({super.key});
|
||||
class LiberationHistoryWidget extends StatefulWidget {
|
||||
const LiberationHistoryWidget({super.key});
|
||||
|
||||
// @override
|
||||
// State<LiberationHistoryWidget> createState() =>
|
||||
// _LiberationHistoryWidgetState();
|
||||
// }
|
||||
@override
|
||||
State<LiberationHistoryWidget> createState() =>
|
||||
_LiberationHistoryWidgetState();
|
||||
}
|
||||
|
||||
// class _LiberationHistoryWidgetState extends State<LiberationHistoryWidget> {
|
||||
// late LiberationHistoryModel _model;
|
||||
class _LiberationHistoryWidgetState extends State<LiberationHistoryWidget> {
|
||||
late LiberationHistoryModel _model;
|
||||
|
||||
// final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
// @override
|
||||
// void initState() {
|
||||
// super.initState();
|
||||
// _model = createModel(context, () => LiberationHistoryModel());
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_model = createModel(context, () => LiberationHistoryModel());
|
||||
|
||||
// _model.textController ??= TextEditingController();
|
||||
// _model.textFieldFocusNode ??= FocusNode();
|
||||
// }
|
||||
_model.textController ??= TextEditingController();
|
||||
_model.textFieldFocusNode ??= FocusNode();
|
||||
}
|
||||
|
||||
// @override
|
||||
// void dispose() {
|
||||
// _model.dispose();
|
||||
@override
|
||||
void dispose() {
|
||||
_model.dispose();
|
||||
|
||||
// super.dispose();
|
||||
// }
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// context.watch<FFAppState>();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
context.watch<FFAppState>();
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () => _model.unfocusNode.canRequestFocus
|
||||
|
@ -97,7 +97,8 @@ export 'liberation_history_model.dart';
|
|||
),
|
||||
alignment: const AlignmentDirectional(0.0, -1.0),
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(8.0, 0.0, 8.0, 0.0),
|
||||
padding:
|
||||
const EdgeInsetsDirectional.fromSTEB(8.0, 0.0, 8.0, 0.0),
|
||||
child: SizedBox(
|
||||
width: 300.0,
|
||||
child: TextFormField(
|
||||
|
@ -253,17 +254,16 @@ export 'liberation_history_model.dart';
|
|||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsetsDirectional.fromSTEB(
|
||||
0.0, 0.0, 10.0, 0.0),
|
||||
padding: const EdgeInsetsDirectional
|
||||
.fromSTEB(0.0, 0.0, 10.0, 0.0),
|
||||
child: ClipRRect(
|
||||
borderRadius:
|
||||
BorderRadius.circular(100.0),
|
||||
child: CachedNetworkImage(
|
||||
fadeInDuration:
|
||||
const Duration(milliseconds: 500),
|
||||
fadeOutDuration:
|
||||
const Duration(milliseconds: 500),
|
||||
fadeInDuration: const Duration(
|
||||
milliseconds: 500),
|
||||
fadeOutDuration: const Duration(
|
||||
milliseconds: 500),
|
||||
imageUrl: valueOrDefault<String>(
|
||||
'https://freaccess.com.br/freaccess/getImage.php?&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${getJsonField(
|
||||
liberationHistoryItem,
|
||||
|
@ -324,7 +324,8 @@ export 'liberation_history_model.dart';
|
|||
),
|
||||
]
|
||||
.addToStart(
|
||||
const SizedBox(width: 10.0))
|
||||
const SizedBox(
|
||||
width: 10.0))
|
||||
.addToEnd(const SizedBox(
|
||||
width: 10.0)),
|
||||
),
|
||||
|
@ -396,10 +397,11 @@ export 'liberation_history_model.dart';
|
|||
),
|
||||
),
|
||||
]
|
||||
.divide(
|
||||
const SizedBox(width: 10.0))
|
||||
.addToStart(const SizedBox(
|
||||
width: 10.0)),
|
||||
.divide(const SizedBox(
|
||||
width: 10.0))
|
||||
.addToStart(
|
||||
const SizedBox(
|
||||
width: 10.0)),
|
||||
),
|
||||
Row(
|
||||
mainAxisSize:
|
||||
|
@ -458,10 +460,11 @@ export 'liberation_history_model.dart';
|
|||
),
|
||||
),
|
||||
]
|
||||
.divide(
|
||||
const SizedBox(width: 10.0))
|
||||
.addToStart(const SizedBox(
|
||||
width: 10.0)),
|
||||
.divide(const SizedBox(
|
||||
width: 10.0))
|
||||
.addToStart(
|
||||
const SizedBox(
|
||||
width: 10.0)),
|
||||
),
|
||||
Align(
|
||||
alignment:
|
||||
|
@ -471,7 +474,7 @@ export 'liberation_history_model.dart';
|
|||
padding:
|
||||
const EdgeInsetsDirectional
|
||||
.fromSTEB(10.0, 0.0,
|
||||
0.0, 0.0),
|
||||
0.0, 0.0),
|
||||
child: Container(
|
||||
width: 200.0,
|
||||
height: 27.0,
|
||||
|
@ -609,7 +612,8 @@ export 'liberation_history_model.dart';
|
|||
),
|
||||
),
|
||||
),
|
||||
].divide(const SizedBox(height: 3.0)),
|
||||
].divide(
|
||||
const SizedBox(height: 3.0)),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
Loading…
Reference in New Issue