wachtwoord_vergeten_widget.dart 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. import '/backend/api_requests/api_calls.dart';
  2. import '/flutter_flow/flutter_flow_theme.dart';
  3. import '/flutter_flow/flutter_flow_util.dart';
  4. import '/flutter_flow/flutter_flow_widgets.dart';
  5. import 'dart:ui';
  6. import 'package:flutter/material.dart';
  7. import 'package:flutter_spinkit/flutter_spinkit.dart';
  8. import 'package:google_fonts/google_fonts.dart';
  9. import 'package:provider/provider.dart';
  10. import 'wachtwoord_vergeten_model.dart';
  11. export 'wachtwoord_vergeten_model.dart';
  12. class WachtwoordVergetenWidget extends StatefulWidget {
  13. const WachtwoordVergetenWidget({super.key});
  14. static String routeName = 'wachtwoordVergeten';
  15. static String routePath = '/wachtwoordVergeten';
  16. @override
  17. State<WachtwoordVergetenWidget> createState() =>
  18. _WachtwoordVergetenWidgetState();
  19. }
  20. class _WachtwoordVergetenWidgetState extends State<WachtwoordVergetenWidget>
  21. with RouteAware {
  22. late WachtwoordVergetenModel _model;
  23. final scaffoldKey = GlobalKey<ScaffoldState>();
  24. @override
  25. void initState() {
  26. super.initState();
  27. _model = createModel(context, () => WachtwoordVergetenModel());
  28. _model.naamOfEmailFieldTextController ??= TextEditingController()
  29. ..addListener(() {
  30. debugLogWidgetClass(_model);
  31. });
  32. _model.naamOfEmailFieldFocusNode ??= FocusNode();
  33. }
  34. @override
  35. void dispose() {
  36. routeObserver.unsubscribe(this);
  37. _model.dispose();
  38. super.dispose();
  39. }
  40. @override
  41. void didUpdateWidget(WachtwoordVergetenWidget oldWidget) {
  42. super.didUpdateWidget(oldWidget);
  43. _model.widget = widget;
  44. }
  45. @override
  46. void didChangeDependencies() {
  47. super.didChangeDependencies();
  48. final route = DebugModalRoute.of(context);
  49. if (route != null) {
  50. routeObserver.subscribe(this, route);
  51. }
  52. debugLogGlobalProperty(context);
  53. }
  54. @override
  55. void didPopNext() {
  56. if (mounted && DebugFlutterFlowModelContext.maybeOf(context) == null) {
  57. setState(() => _model.isRouteVisible = true);
  58. debugLogWidgetClass(_model);
  59. }
  60. }
  61. @override
  62. void didPush() {
  63. if (mounted && DebugFlutterFlowModelContext.maybeOf(context) == null) {
  64. setState(() => _model.isRouteVisible = true);
  65. debugLogWidgetClass(_model);
  66. }
  67. }
  68. @override
  69. void didPop() {
  70. _model.isRouteVisible = false;
  71. }
  72. @override
  73. void didPushNext() {
  74. _model.isRouteVisible = false;
  75. }
  76. @override
  77. Widget build(BuildContext context) {
  78. DebugFlutterFlowModelContext.maybeOf(context)
  79. ?.parentModelCallback
  80. ?.call(_model);
  81. return GestureDetector(
  82. onTap: () {
  83. FocusScope.of(context).unfocus();
  84. FocusManager.instance.primaryFocus?.unfocus();
  85. },
  86. child: Scaffold(
  87. key: scaffoldKey,
  88. backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
  89. body: SafeArea(
  90. top: true,
  91. child: Column(
  92. mainAxisSize: MainAxisSize.max,
  93. children: [
  94. Text(
  95. FFLocalizations.of(context).getText(
  96. 'vrbz9a3l' /* Wachtwoord vergeten */,
  97. ),
  98. style: FlutterFlowTheme.of(context).bodyMedium.override(
  99. font: GoogleFonts.inter(
  100. fontWeight:
  101. FlutterFlowTheme.of(context).bodyMedium.fontWeight,
  102. fontStyle:
  103. FlutterFlowTheme.of(context).bodyMedium.fontStyle,
  104. ),
  105. letterSpacing: 0.0,
  106. fontWeight:
  107. FlutterFlowTheme.of(context).bodyMedium.fontWeight,
  108. fontStyle:
  109. FlutterFlowTheme.of(context).bodyMedium.fontStyle,
  110. ),
  111. ),
  112. Text(
  113. FFLocalizations.of(context).getText(
  114. '503u6v73' /* Vul je gebruikersnaam of e-mai... */,
  115. ),
  116. style: FlutterFlowTheme.of(context).bodyMedium.override(
  117. font: GoogleFonts.inter(
  118. fontWeight:
  119. FlutterFlowTheme.of(context).bodyMedium.fontWeight,
  120. fontStyle:
  121. FlutterFlowTheme.of(context).bodyMedium.fontStyle,
  122. ),
  123. letterSpacing: 0.0,
  124. fontWeight:
  125. FlutterFlowTheme.of(context).bodyMedium.fontWeight,
  126. fontStyle:
  127. FlutterFlowTheme.of(context).bodyMedium.fontStyle,
  128. ),
  129. ),
  130. Container(
  131. width: 200.0,
  132. child: TextFormField(
  133. controller: _model.naamOfEmailFieldTextController,
  134. focusNode: _model.naamOfEmailFieldFocusNode,
  135. autofocus: false,
  136. enabled: true,
  137. obscureText: false,
  138. decoration: InputDecoration(
  139. isDense: true,
  140. labelStyle:
  141. FlutterFlowTheme.of(context).labelMedium.override(
  142. font: GoogleFonts.inter(
  143. fontWeight: FlutterFlowTheme.of(context)
  144. .labelMedium
  145. .fontWeight,
  146. fontStyle: FlutterFlowTheme.of(context)
  147. .labelMedium
  148. .fontStyle,
  149. ),
  150. letterSpacing: 0.0,
  151. fontWeight: FlutterFlowTheme.of(context)
  152. .labelMedium
  153. .fontWeight,
  154. fontStyle: FlutterFlowTheme.of(context)
  155. .labelMedium
  156. .fontStyle,
  157. ),
  158. hintText: FFLocalizations.of(context).getText(
  159. 'ush5uxz1' /* Gebruikersnaam of e-mailadres */,
  160. ),
  161. hintStyle:
  162. FlutterFlowTheme.of(context).labelMedium.override(
  163. font: GoogleFonts.inter(
  164. fontWeight: FlutterFlowTheme.of(context)
  165. .labelMedium
  166. .fontWeight,
  167. fontStyle: FlutterFlowTheme.of(context)
  168. .labelMedium
  169. .fontStyle,
  170. ),
  171. letterSpacing: 0.0,
  172. fontWeight: FlutterFlowTheme.of(context)
  173. .labelMedium
  174. .fontWeight,
  175. fontStyle: FlutterFlowTheme.of(context)
  176. .labelMedium
  177. .fontStyle,
  178. ),
  179. enabledBorder: OutlineInputBorder(
  180. borderSide: BorderSide(
  181. color: Color(0x00000000),
  182. width: 1.0,
  183. ),
  184. borderRadius: BorderRadius.circular(8.0),
  185. ),
  186. focusedBorder: OutlineInputBorder(
  187. borderSide: BorderSide(
  188. color: Color(0x00000000),
  189. width: 1.0,
  190. ),
  191. borderRadius: BorderRadius.circular(8.0),
  192. ),
  193. errorBorder: OutlineInputBorder(
  194. borderSide: BorderSide(
  195. color: FlutterFlowTheme.of(context).error,
  196. width: 1.0,
  197. ),
  198. borderRadius: BorderRadius.circular(8.0),
  199. ),
  200. focusedErrorBorder: OutlineInputBorder(
  201. borderSide: BorderSide(
  202. color: FlutterFlowTheme.of(context).error,
  203. width: 1.0,
  204. ),
  205. borderRadius: BorderRadius.circular(8.0),
  206. ),
  207. filled: true,
  208. fillColor: FlutterFlowTheme.of(context).secondaryBackground,
  209. ),
  210. style: FlutterFlowTheme.of(context).bodyMedium.override(
  211. font: GoogleFonts.inter(
  212. fontWeight: FlutterFlowTheme.of(context)
  213. .bodyMedium
  214. .fontWeight,
  215. fontStyle:
  216. FlutterFlowTheme.of(context).bodyMedium.fontStyle,
  217. ),
  218. letterSpacing: 0.0,
  219. fontWeight:
  220. FlutterFlowTheme.of(context).bodyMedium.fontWeight,
  221. fontStyle:
  222. FlutterFlowTheme.of(context).bodyMedium.fontStyle,
  223. ),
  224. cursorColor: FlutterFlowTheme.of(context).primaryText,
  225. enableInteractiveSelection: true,
  226. validator: _model.naamOfEmailFieldTextControllerValidator
  227. .asValidator(context),
  228. ),
  229. ),
  230. FFButtonWidget(
  231. onPressed: () async {
  232. _model.apiResultuoz = await RequestNewPasswordCall.call(
  233. name: _model.naamOfEmailFieldTextController.text,
  234. );
  235. if ((_model.apiResultuoz?.succeeded ?? true)) {
  236. ScaffoldMessenger.of(context).showSnackBar(
  237. SnackBar(
  238. content: Text(
  239. 'Als dit account bestaat, ontvang je een e-mail om je wachtwoord opnieuw in te stellen.',
  240. style: TextStyle(
  241. color: FlutterFlowTheme.of(context).primaryText,
  242. ),
  243. ),
  244. duration: Duration(milliseconds: 4000),
  245. backgroundColor: FlutterFlowTheme.of(context).secondary,
  246. ),
  247. );
  248. } else {
  249. ScaffoldMessenger.of(context).showSnackBar(
  250. SnackBar(
  251. content: Text(
  252. RequestNewPasswordCall.errorMessage(
  253. (_model.apiResultuoz?.jsonBody ?? ''),
  254. )!,
  255. style: TextStyle(
  256. color: FlutterFlowTheme.of(context).primaryText,
  257. ),
  258. ),
  259. duration: Duration(milliseconds: 4000),
  260. backgroundColor: FlutterFlowTheme.of(context).secondary,
  261. ),
  262. );
  263. }
  264. safeSetState(() {});
  265. },
  266. text: FFLocalizations.of(context).getText(
  267. '0gfuq6i7' /* Verstuur */,
  268. ),
  269. options: FFButtonOptions(
  270. height: 40.0,
  271. padding: EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 16.0, 0.0),
  272. iconPadding:
  273. EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
  274. color: FlutterFlowTheme.of(context).primary,
  275. textStyle: FlutterFlowTheme.of(context).titleSmall.override(
  276. font: GoogleFonts.interTight(
  277. fontWeight: FlutterFlowTheme.of(context)
  278. .titleSmall
  279. .fontWeight,
  280. fontStyle:
  281. FlutterFlowTheme.of(context).titleSmall.fontStyle,
  282. ),
  283. color: Colors.white,
  284. letterSpacing: 0.0,
  285. fontWeight:
  286. FlutterFlowTheme.of(context).titleSmall.fontWeight,
  287. fontStyle:
  288. FlutterFlowTheme.of(context).titleSmall.fontStyle,
  289. ),
  290. elevation: 0.0,
  291. borderRadius: BorderRadius.circular(8.0),
  292. ),
  293. ),
  294. ],
  295. ),
  296. ),
  297. ),
  298. );
  299. }
  300. }