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': '.*',
|
'accessType': '.*',
|
||||||
'search': '.*',
|
'search': '.*',
|
||||||
})),
|
})),
|
||||||
// FFRoute(
|
FFRoute(
|
||||||
// name: 'liberationHistory',
|
name: 'liberationHistory',
|
||||||
// path: '/liberationHistory',
|
path: '/liberationHistory',
|
||||||
// builder: (context, params) => const LiberationHistoryWidget(),
|
builder: (context, params) => const LiberationHistoryWidget(),
|
||||||
// ),
|
),
|
||||||
FFRoute(
|
FFRoute(
|
||||||
name: 'signInPage',
|
name: 'signInPage',
|
||||||
path: '/signInPage',
|
path: '/signInPage',
|
||||||
|
|
|
@ -48,12 +48,7 @@ class AcessHistoryPageModel extends FlutterFlowModel<AcessHistoryPageWidget> {
|
||||||
: FocusScope.of(context).unfocus(),
|
: FocusScope.of(context).unfocus(),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: MediaQuery.viewInsetsOf(context),
|
padding: MediaQuery.viewInsetsOf(context),
|
||||||
child: OptModalWidget(
|
child: const OptModalWidget(),
|
||||||
togglePersonType: (personType) async {
|
|
||||||
_model.pesType = personType;
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -5,14 +5,14 @@ import '/flutter_flow/request_manager.dart';
|
||||||
import 'liberation_history_widget.dart' show LiberationHistoryWidget;
|
import 'liberation_history_widget.dart' show LiberationHistoryWidget;
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
// class LiberationHistoryModel extends FlutterFlowModel<LiberationHistoryWidget> {
|
class LiberationHistoryModel extends FlutterFlowModel<LiberationHistoryWidget> {
|
||||||
// /// State fields for stateful widgets in this page.
|
/// State fields for stateful widgets in this page.
|
||||||
|
|
||||||
// final unfocusNode = FocusNode();
|
final unfocusNode = FocusNode();
|
||||||
// // State field(s) for TextField widget.
|
// State field(s) for TextField widget.
|
||||||
// FocusNode? textFieldFocusNode;
|
FocusNode? textFieldFocusNode;
|
||||||
// TextEditingController? textController;
|
TextEditingController? textController;
|
||||||
// String? Function(BuildContext, String?)? textControllerValidator;
|
String? Function(BuildContext, String?)? textControllerValidator;
|
||||||
|
|
||||||
/// Query cache managers for this widget.
|
/// Query cache managers for this widget.
|
||||||
|
|
||||||
|
|
|
@ -11,38 +11,38 @@ import 'package:provider/provider.dart';
|
||||||
import 'liberation_history_model.dart';
|
import 'liberation_history_model.dart';
|
||||||
export 'liberation_history_model.dart';
|
export 'liberation_history_model.dart';
|
||||||
|
|
||||||
// class LiberationHistoryWidget extends StatefulWidget {
|
class LiberationHistoryWidget extends StatefulWidget {
|
||||||
// const LiberationHistoryWidget({super.key});
|
const LiberationHistoryWidget({super.key});
|
||||||
|
|
||||||
// @override
|
@override
|
||||||
// State<LiberationHistoryWidget> createState() =>
|
State<LiberationHistoryWidget> createState() =>
|
||||||
// _LiberationHistoryWidgetState();
|
_LiberationHistoryWidgetState();
|
||||||
// }
|
}
|
||||||
|
|
||||||
// class _LiberationHistoryWidgetState extends State<LiberationHistoryWidget> {
|
class _LiberationHistoryWidgetState extends State<LiberationHistoryWidget> {
|
||||||
// late LiberationHistoryModel _model;
|
late LiberationHistoryModel _model;
|
||||||
|
|
||||||
// final scaffoldKey = GlobalKey<ScaffoldState>();
|
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||||
|
|
||||||
// @override
|
@override
|
||||||
// void initState() {
|
void initState() {
|
||||||
// super.initState();
|
super.initState();
|
||||||
// _model = createModel(context, () => LiberationHistoryModel());
|
_model = createModel(context, () => LiberationHistoryModel());
|
||||||
|
|
||||||
// _model.textController ??= TextEditingController();
|
_model.textController ??= TextEditingController();
|
||||||
// _model.textFieldFocusNode ??= FocusNode();
|
_model.textFieldFocusNode ??= FocusNode();
|
||||||
// }
|
}
|
||||||
|
|
||||||
// @override
|
@override
|
||||||
// void dispose() {
|
void dispose() {
|
||||||
// _model.dispose();
|
_model.dispose();
|
||||||
|
|
||||||
// super.dispose();
|
super.dispose();
|
||||||
// }
|
}
|
||||||
|
|
||||||
// @override
|
@override
|
||||||
// Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// context.watch<FFAppState>();
|
context.watch<FFAppState>();
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () => _model.unfocusNode.canRequestFocus
|
onTap: () => _model.unfocusNode.canRequestFocus
|
||||||
|
@ -97,7 +97,8 @@ export 'liberation_history_model.dart';
|
||||||
),
|
),
|
||||||
alignment: const AlignmentDirectional(0.0, -1.0),
|
alignment: const AlignmentDirectional(0.0, -1.0),
|
||||||
child: Padding(
|
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(
|
child: SizedBox(
|
||||||
width: 300.0,
|
width: 300.0,
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
|
@ -253,17 +254,16 @@ export 'liberation_history_model.dart';
|
||||||
MainAxisAlignment.spaceBetween,
|
MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding:
|
padding: const EdgeInsetsDirectional
|
||||||
const EdgeInsetsDirectional.fromSTEB(
|
.fromSTEB(0.0, 0.0, 10.0, 0.0),
|
||||||
0.0, 0.0, 10.0, 0.0),
|
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
borderRadius:
|
borderRadius:
|
||||||
BorderRadius.circular(100.0),
|
BorderRadius.circular(100.0),
|
||||||
child: CachedNetworkImage(
|
child: CachedNetworkImage(
|
||||||
fadeInDuration:
|
fadeInDuration: const Duration(
|
||||||
const Duration(milliseconds: 500),
|
milliseconds: 500),
|
||||||
fadeOutDuration:
|
fadeOutDuration: const Duration(
|
||||||
const Duration(milliseconds: 500),
|
milliseconds: 500),
|
||||||
imageUrl: valueOrDefault<String>(
|
imageUrl: valueOrDefault<String>(
|
||||||
'https://freaccess.com.br/freaccess/getImage.php?&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${getJsonField(
|
'https://freaccess.com.br/freaccess/getImage.php?&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${getJsonField(
|
||||||
liberationHistoryItem,
|
liberationHistoryItem,
|
||||||
|
@ -324,7 +324,8 @@ export 'liberation_history_model.dart';
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
.addToStart(
|
.addToStart(
|
||||||
const SizedBox(width: 10.0))
|
const SizedBox(
|
||||||
|
width: 10.0))
|
||||||
.addToEnd(const SizedBox(
|
.addToEnd(const SizedBox(
|
||||||
width: 10.0)),
|
width: 10.0)),
|
||||||
),
|
),
|
||||||
|
@ -396,10 +397,11 @@ export 'liberation_history_model.dart';
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
.divide(
|
.divide(const SizedBox(
|
||||||
const SizedBox(width: 10.0))
|
width: 10.0))
|
||||||
.addToStart(const SizedBox(
|
.addToStart(
|
||||||
width: 10.0)),
|
const SizedBox(
|
||||||
|
width: 10.0)),
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
mainAxisSize:
|
mainAxisSize:
|
||||||
|
@ -458,10 +460,11 @@ export 'liberation_history_model.dart';
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
.divide(
|
.divide(const SizedBox(
|
||||||
const SizedBox(width: 10.0))
|
width: 10.0))
|
||||||
.addToStart(const SizedBox(
|
.addToStart(
|
||||||
width: 10.0)),
|
const SizedBox(
|
||||||
|
width: 10.0)),
|
||||||
),
|
),
|
||||||
Align(
|
Align(
|
||||||
alignment:
|
alignment:
|
||||||
|
@ -471,7 +474,7 @@ export 'liberation_history_model.dart';
|
||||||
padding:
|
padding:
|
||||||
const EdgeInsetsDirectional
|
const EdgeInsetsDirectional
|
||||||
.fromSTEB(10.0, 0.0,
|
.fromSTEB(10.0, 0.0,
|
||||||
0.0, 0.0),
|
0.0, 0.0),
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 200.0,
|
width: 200.0,
|
||||||
height: 27.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