| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648 |
- import '/components/header_buttons_component_widget.dart';
- import '/flutter_flow/flutter_flow_theme.dart';
- import '/flutter_flow/flutter_flow_util.dart';
- import '/flutter_flow/flutter_flow_widgets.dart';
- import '/shared/drawer_component/drawer_component_widget.dart';
- import 'dart:ui';
- import '/custom_code/actions/index.dart' as actions;
- import '/index.dart';
- import 'package:aligned_tooltip/aligned_tooltip.dart';
- import 'package:easy_debounce/easy_debounce.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter/scheduler.dart';
- import 'package:flutter_spinkit/flutter_spinkit.dart';
- import 'package:google_fonts/google_fonts.dart';
- import 'package:provider/provider.dart';
- import 'login_model.dart';
- export 'login_model.dart';
- class LoginWidget extends StatefulWidget {
- const LoginWidget({super.key});
- static String routeName = 'login';
- static String routePath = '/login';
- @override
- State<LoginWidget> createState() => _LoginWidgetState();
- }
- class _LoginWidgetState extends State<LoginWidget> with RouteAware {
- late LoginModel _model;
- final scaffoldKey = GlobalKey<ScaffoldState>();
- @override
- void initState() {
- super.initState();
- _model = createModel(context, () => LoginModel());
- // On page load action.
- SchedulerBinding.instance.addPostFrameCallback((_) async {
- if (FFAppState().gemeenteSelectId == null ||
- FFAppState().gemeenteSelectId == '') {
- FFAppState().gemeenteSelectId = '28694';
- FFAppState().provincieSelectId = '28666';
- safeSetState(() {});
- }
- });
- _model.usernameFieldTextController ??= TextEditingController()
- ..addListener(() {
- debugLogWidgetClass(_model);
- });
- _model.usernameFieldFocusNode ??= FocusNode();
- _model.passwordFieldTextController ??= TextEditingController()
- ..addListener(() {
- debugLogWidgetClass(_model);
- });
- _model.passwordFieldFocusNode ??= FocusNode();
- }
- @override
- void dispose() {
- routeObserver.unsubscribe(this);
- _model.dispose();
- super.dispose();
- }
- @override
- void didUpdateWidget(LoginWidget oldWidget) {
- super.didUpdateWidget(oldWidget);
- _model.widget = widget;
- }
- @override
- void didChangeDependencies() {
- super.didChangeDependencies();
- final route = DebugModalRoute.of(context);
- if (route != null) {
- routeObserver.subscribe(this, route);
- }
- debugLogGlobalProperty(context);
- }
- @override
- void didPopNext() {
- if (mounted && DebugFlutterFlowModelContext.maybeOf(context) == null) {
- setState(() => _model.isRouteVisible = true);
- debugLogWidgetClass(_model);
- }
- }
- @override
- void didPush() {
- if (mounted && DebugFlutterFlowModelContext.maybeOf(context) == null) {
- setState(() => _model.isRouteVisible = true);
- debugLogWidgetClass(_model);
- }
- }
- @override
- void didPop() {
- _model.isRouteVisible = false;
- }
- @override
- void didPushNext() {
- _model.isRouteVisible = false;
- }
- @override
- Widget build(BuildContext context) {
- DebugFlutterFlowModelContext.maybeOf(context)
- ?.parentModelCallback
- ?.call(_model);
- context.watch<FFAppState>();
- return GestureDetector(
- onTap: () {
- FocusScope.of(context).unfocus();
- FocusManager.instance.primaryFocus?.unfocus();
- },
- child: Scaffold(
- key: scaffoldKey,
- backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
- drawer: Drawer(
- elevation: 16.0,
- child: wrapWithModel(
- model: _model.drawerComponentModel,
- updateCallback: () => safeSetState(() {}),
- child: Builder(builder: (_) {
- return DebugFlutterFlowModelContext(
- rootModel: _model.rootModel,
- child: DrawerComponentWidget(),
- );
- }),
- ),
- ),
- appBar: PreferredSize(
- preferredSize: Size.fromHeight(80.0),
- child: AppBar(
- backgroundColor: FlutterFlowTheme.of(context).info,
- iconTheme:
- IconThemeData(color: FlutterFlowTheme.of(context).secondary),
- automaticallyImplyLeading: false,
- actions: [],
- flexibleSpace: FlexibleSpaceBar(
- background: wrapWithModel(
- model: _model.headerButtonsComponentModel,
- updateCallback: () => safeSetState(() {}),
- child: Builder(builder: (_) {
- return DebugFlutterFlowModelContext(
- rootModel: _model.rootModel,
- child: HeaderButtonsComponentWidget(
- showBackButton: false,
- ),
- );
- }),
- ),
- centerTitle: true,
- expandedTitleScale: 1.0,
- ),
- bottom: PreferredSize(
- preferredSize: Size.fromHeight(70.0),
- child: Container(),
- ),
- toolbarHeight: MediaQuery.sizeOf(context).height * 0.25,
- elevation: 2.0,
- ),
- ),
- body: SafeArea(
- top: true,
- child: Column(
- mainAxisSize: MainAxisSize.max,
- children: [
- Column(
- mainAxisSize: MainAxisSize.max,
- children: [
- Stack(
- children: [
- Column(
- mainAxisSize: MainAxisSize.max,
- children: [
- AlignedTooltip(
- content: Padding(
- padding: EdgeInsets.all(4.0),
- child: Text(
- FFLocalizations.of(context).getText(
- 'pj545url' /* Veld wissen */,
- ),
- style: FlutterFlowTheme.of(context)
- .bodyLarge
- .override(
- font: GoogleFonts.roboto(
- fontWeight: FlutterFlowTheme.of(context)
- .bodyLarge
- .fontWeight,
- fontStyle: FlutterFlowTheme.of(context)
- .bodyLarge
- .fontStyle,
- ),
- letterSpacing: 0.0,
- fontWeight: FlutterFlowTheme.of(context)
- .bodyLarge
- .fontWeight,
- fontStyle: FlutterFlowTheme.of(context)
- .bodyLarge
- .fontStyle,
- ),
- ),
- ),
- offset: 4.0,
- preferredDirection: AxisDirection.down,
- borderRadius: BorderRadius.circular(8.0),
- backgroundColor: FlutterFlowTheme.of(context)
- .secondaryBackground,
- elevation: 4.0,
- tailBaseWidth: 24.0,
- tailLength: 12.0,
- waitDuration: Duration(milliseconds: 100),
- showDuration: Duration(milliseconds: 1500),
- triggerMode: TooltipTriggerMode.tap,
- child: Container(
- width: 200.0,
- child: TextFormField(
- controller: _model.usernameFieldTextController,
- focusNode: _model.usernameFieldFocusNode,
- onChanged: (_) => EasyDebounce.debounce(
- '_model.usernameFieldTextController',
- Duration(milliseconds: 2000),
- () => safeSetState(() {}),
- ),
- autofocus: false,
- textInputAction: TextInputAction.next,
- obscureText: false,
- decoration: InputDecoration(
- isDense: true,
- labelStyle: FlutterFlowTheme.of(context)
- .labelMedium
- .override(
- font: GoogleFonts.roboto(
- fontWeight:
- FlutterFlowTheme.of(context)
- .labelMedium
- .fontWeight,
- fontStyle:
- FlutterFlowTheme.of(context)
- .labelMedium
- .fontStyle,
- ),
- letterSpacing: 0.0,
- fontWeight: FlutterFlowTheme.of(context)
- .labelMedium
- .fontWeight,
- fontStyle: FlutterFlowTheme.of(context)
- .labelMedium
- .fontStyle,
- ),
- hintText: FFLocalizations.of(context).getText(
- 'd507d3b9' /* E-mailadres */,
- ),
- hintStyle: FlutterFlowTheme.of(context)
- .labelMedium
- .override(
- font: GoogleFonts.roboto(
- fontWeight:
- FlutterFlowTheme.of(context)
- .labelMedium
- .fontWeight,
- fontStyle:
- FlutterFlowTheme.of(context)
- .labelMedium
- .fontStyle,
- ),
- letterSpacing: 0.0,
- fontWeight: FlutterFlowTheme.of(context)
- .labelMedium
- .fontWeight,
- fontStyle: FlutterFlowTheme.of(context)
- .labelMedium
- .fontStyle,
- ),
- enabledBorder: OutlineInputBorder(
- borderSide: BorderSide(
- color: Color(0x00000000),
- width: 1.0,
- ),
- borderRadius: BorderRadius.circular(8.0),
- ),
- focusedBorder: OutlineInputBorder(
- borderSide: BorderSide(
- color: Color(0x00000000),
- width: 1.0,
- ),
- borderRadius: BorderRadius.circular(8.0),
- ),
- errorBorder: OutlineInputBorder(
- borderSide: BorderSide(
- color: FlutterFlowTheme.of(context).error,
- width: 1.0,
- ),
- borderRadius: BorderRadius.circular(8.0),
- ),
- focusedErrorBorder: OutlineInputBorder(
- borderSide: BorderSide(
- color: FlutterFlowTheme.of(context).error,
- width: 1.0,
- ),
- borderRadius: BorderRadius.circular(8.0),
- ),
- filled: true,
- fillColor: FlutterFlowTheme.of(context)
- .secondaryBackground,
- suffixIcon: _model
- .usernameFieldTextController!
- .text
- .isNotEmpty
- ? InkWell(
- onTap: () async {
- _model.usernameFieldTextController
- ?.clear();
- safeSetState(() {});
- },
- child: Icon(
- Icons.clear,
- size: 24.0,
- ),
- )
- : null,
- ),
- style: FlutterFlowTheme.of(context)
- .bodyMedium
- .override(
- font: GoogleFonts.roboto(
- fontWeight: FlutterFlowTheme.of(context)
- .bodyMedium
- .fontWeight,
- fontStyle: FlutterFlowTheme.of(context)
- .bodyMedium
- .fontStyle,
- ),
- letterSpacing: 0.0,
- fontWeight: FlutterFlowTheme.of(context)
- .bodyMedium
- .fontWeight,
- fontStyle: FlutterFlowTheme.of(context)
- .bodyMedium
- .fontStyle,
- ),
- cursorColor:
- FlutterFlowTheme.of(context).primaryText,
- enableInteractiveSelection: true,
- validator: _model
- .usernameFieldTextControllerValidator
- .asValidator(context),
- ),
- ),
- ),
- AlignedTooltip(
- content: Padding(
- padding: EdgeInsets.all(4.0),
- child: Text(
- FFLocalizations.of(context).getText(
- 'n3cyffso' /* Wachtwoord tonen/verbergen */,
- ),
- style: FlutterFlowTheme.of(context)
- .bodyLarge
- .override(
- font: GoogleFonts.roboto(
- fontWeight: FlutterFlowTheme.of(context)
- .bodyLarge
- .fontWeight,
- fontStyle: FlutterFlowTheme.of(context)
- .bodyLarge
- .fontStyle,
- ),
- letterSpacing: 0.0,
- fontWeight: FlutterFlowTheme.of(context)
- .bodyLarge
- .fontWeight,
- fontStyle: FlutterFlowTheme.of(context)
- .bodyLarge
- .fontStyle,
- ),
- ),
- ),
- offset: 4.0,
- preferredDirection: AxisDirection.down,
- borderRadius: BorderRadius.circular(8.0),
- backgroundColor: FlutterFlowTheme.of(context)
- .secondaryBackground,
- elevation: 4.0,
- tailBaseWidth: 24.0,
- tailLength: 12.0,
- waitDuration: Duration(milliseconds: 100),
- showDuration: Duration(milliseconds: 1500),
- triggerMode: TooltipTriggerMode.tap,
- child: Container(
- width: 200.0,
- child: TextFormField(
- controller: _model.passwordFieldTextController,
- focusNode: _model.passwordFieldFocusNode,
- autofocus: false,
- textInputAction: TextInputAction.next,
- obscureText: !_model.passwordFieldVisibility,
- decoration: InputDecoration(
- isDense: true,
- labelStyle: FlutterFlowTheme.of(context)
- .labelMedium
- .override(
- font: GoogleFonts.roboto(
- fontWeight:
- FlutterFlowTheme.of(context)
- .labelMedium
- .fontWeight,
- fontStyle:
- FlutterFlowTheme.of(context)
- .labelMedium
- .fontStyle,
- ),
- letterSpacing: 0.0,
- fontWeight: FlutterFlowTheme.of(context)
- .labelMedium
- .fontWeight,
- fontStyle: FlutterFlowTheme.of(context)
- .labelMedium
- .fontStyle,
- ),
- hintText: FFLocalizations.of(context).getText(
- 't8h5f8ir' /* Wachtwoord */,
- ),
- hintStyle: FlutterFlowTheme.of(context)
- .labelMedium
- .override(
- font: GoogleFonts.roboto(
- fontWeight:
- FlutterFlowTheme.of(context)
- .labelMedium
- .fontWeight,
- fontStyle:
- FlutterFlowTheme.of(context)
- .labelMedium
- .fontStyle,
- ),
- letterSpacing: 0.0,
- fontWeight: FlutterFlowTheme.of(context)
- .labelMedium
- .fontWeight,
- fontStyle: FlutterFlowTheme.of(context)
- .labelMedium
- .fontStyle,
- ),
- enabledBorder: OutlineInputBorder(
- borderSide: BorderSide(
- color: Color(0x00000000),
- width: 1.0,
- ),
- borderRadius: BorderRadius.circular(8.0),
- ),
- focusedBorder: OutlineInputBorder(
- borderSide: BorderSide(
- color: Color(0x00000000),
- width: 1.0,
- ),
- borderRadius: BorderRadius.circular(8.0),
- ),
- errorBorder: OutlineInputBorder(
- borderSide: BorderSide(
- color: FlutterFlowTheme.of(context).error,
- width: 1.0,
- ),
- borderRadius: BorderRadius.circular(8.0),
- ),
- focusedErrorBorder: OutlineInputBorder(
- borderSide: BorderSide(
- color: FlutterFlowTheme.of(context).error,
- width: 1.0,
- ),
- borderRadius: BorderRadius.circular(8.0),
- ),
- filled: true,
- fillColor: FlutterFlowTheme.of(context)
- .secondaryBackground,
- suffixIcon: InkWell(
- onTap: () async {
- safeSetState(() =>
- _model.passwordFieldVisibility =
- !_model.passwordFieldVisibility);
- },
- focusNode: FocusNode(skipTraversal: true),
- child: Icon(
- _model.passwordFieldVisibility
- ? Icons.visibility_outlined
- : Icons.visibility_off_outlined,
- size: 24.0,
- ),
- ),
- ),
- style: FlutterFlowTheme.of(context)
- .bodyMedium
- .override(
- font: GoogleFonts.roboto(
- fontWeight: FlutterFlowTheme.of(context)
- .bodyMedium
- .fontWeight,
- fontStyle: FlutterFlowTheme.of(context)
- .bodyMedium
- .fontStyle,
- ),
- letterSpacing: 0.0,
- fontWeight: FlutterFlowTheme.of(context)
- .bodyMedium
- .fontWeight,
- fontStyle: FlutterFlowTheme.of(context)
- .bodyMedium
- .fontStyle,
- ),
- cursorColor:
- FlutterFlowTheme.of(context).primaryText,
- enableInteractiveSelection: true,
- validator: _model
- .passwordFieldTextControllerValidator
- .asValidator(context),
- ),
- ),
- ),
- FFButtonWidget(
- onPressed: () async {
- _model.resultDrupalLogin =
- await actions.drupalLogin(
- _model.usernameFieldTextController.text,
- _model.passwordFieldTextController.text,
- 'https://uitgaanskrant.com/en/flutterdrup/user/login.json',
- );
- if (_model.resultDrupalLogin != null) {
- ScaffoldMessenger.of(context).showSnackBar(
- SnackBar(
- content: Text(
- 'Succesvol ingelogd!',
- style: TextStyle(
- color: FlutterFlowTheme.of(context)
- .primaryText,
- ),
- ),
- duration: Duration(milliseconds: 4000),
- backgroundColor:
- FlutterFlowTheme.of(context).secondary,
- ),
- );
- } else {
- ScaffoldMessenger.of(context).showSnackBar(
- SnackBar(
- content: Text(
- 'Inloggen mislukt. Controleer je gebruikersnaam en wachtwoord.',
- style: TextStyle(
- color: FlutterFlowTheme.of(context)
- .primaryText,
- ),
- ),
- duration: Duration(milliseconds: 4000),
- backgroundColor:
- FlutterFlowTheme.of(context).secondary,
- ),
- );
- }
- safeSetState(() {});
- },
- text: FFLocalizations.of(context).getText(
- 'gkx4luhw' /* Inloggen */,
- ),
- options: FFButtonOptions(
- height: 40.0,
- padding: EdgeInsetsDirectional.fromSTEB(
- 16.0, 0.0, 16.0, 0.0),
- iconPadding: EdgeInsetsDirectional.fromSTEB(
- 0.0, 0.0, 0.0, 0.0),
- color: FlutterFlowTheme.of(context).secondary,
- textStyle: FlutterFlowTheme.of(context)
- .titleSmall
- .override(
- font: GoogleFonts.roboto(
- fontWeight: FontWeight.bold,
- fontStyle: FlutterFlowTheme.of(context)
- .titleSmall
- .fontStyle,
- ),
- color: Colors.white,
- fontSize: 24.0,
- letterSpacing: 0.0,
- fontWeight: FontWeight.bold,
- fontStyle: FlutterFlowTheme.of(context)
- .titleSmall
- .fontStyle,
- ),
- elevation: 0.0,
- borderRadius: BorderRadius.circular(8.0),
- ),
- ),
- InkWell(
- splashColor: Colors.transparent,
- focusColor: Colors.transparent,
- hoverColor: Colors.transparent,
- highlightColor: Colors.transparent,
- onTap: () async {
- context.pushNamed(
- WachtwoordVergetenWidget.routeName);
- },
- child: Text(
- FFLocalizations.of(context).getText(
- 'utppw2si' /* Wachtwoord vergeten? */,
- ),
- style: FlutterFlowTheme.of(context)
- .bodyMedium
- .override(
- font: GoogleFonts.roboto(
- fontWeight: FlutterFlowTheme.of(context)
- .bodyMedium
- .fontWeight,
- fontStyle: FlutterFlowTheme.of(context)
- .bodyMedium
- .fontStyle,
- ),
- letterSpacing: 0.0,
- fontWeight: FlutterFlowTheme.of(context)
- .bodyMedium
- .fontWeight,
- fontStyle: FlutterFlowTheme.of(context)
- .bodyMedium
- .fontStyle,
- ),
- ),
- ),
- ],
- ),
- ],
- ),
- ],
- ),
- ],
- ),
- ),
- ),
- );
- }
- }
|