wachtwoord_vergeten_widget.dart 12 KB

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