add support for token validation on login page
This commit is contained in:
@@ -2,6 +2,7 @@ import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:mileograph_flutter/components/calculator/calculator.dart';
|
||||
import 'package:mileograph_flutter/components/pages/traction.dart';
|
||||
@@ -444,10 +445,12 @@ class _NewEntryPageState extends State<NewEntryPage> {
|
||||
});
|
||||
_startController.text = data['start'] ?? '';
|
||||
_endController.text = data['end'] ?? '';
|
||||
_headcodeController.text = data['headcode'] ?? '';
|
||||
_headcodeController.text =
|
||||
data['headcode'] is String ? data['headcode'].toUpperCase() : '';
|
||||
_notesController.text = data['notes'] ?? '';
|
||||
_mileageController.text = data['mileage'] ?? '';
|
||||
_networkController.text = data['network'] ?? '';
|
||||
_networkController.text =
|
||||
data['network'] is String ? data['network'].toUpperCase() : '';
|
||||
} catch (_) {
|
||||
// Ignore corrupt draft data
|
||||
} finally {
|
||||
@@ -572,9 +575,11 @@ class _NewEntryPageState extends State<NewEntryPage> {
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
TextFormField(
|
||||
controller: _headcodeController,
|
||||
textCapitalization: TextCapitalization.characters,
|
||||
inputFormatters: const [_UpperCaseTextFormatter()],
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Headcode',
|
||||
border: OutlineInputBorder(),
|
||||
@@ -582,6 +587,8 @@ class _NewEntryPageState extends State<NewEntryPage> {
|
||||
),
|
||||
TextFormField(
|
||||
controller: _networkController,
|
||||
textCapitalization: TextCapitalization.characters,
|
||||
inputFormatters: const [_UpperCaseTextFormatter()],
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Network',
|
||||
border: OutlineInputBorder(),
|
||||
@@ -817,6 +824,21 @@ class _NewEntryPageState extends State<NewEntryPage> {
|
||||
}
|
||||
}
|
||||
|
||||
class _UpperCaseTextFormatter extends TextInputFormatter {
|
||||
const _UpperCaseTextFormatter();
|
||||
|
||||
@override
|
||||
TextEditingValue formatEditUpdate(
|
||||
TextEditingValue oldValue,
|
||||
TextEditingValue newValue,
|
||||
) {
|
||||
return newValue.copyWith(
|
||||
text: newValue.text.toUpperCase(),
|
||||
selection: newValue.selection,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _CalculatorPickerPage extends StatelessWidget {
|
||||
const _CalculatorPickerPage({required this.onResult});
|
||||
final ValueChanged<RouteResult> onResult;
|
||||
|
||||
Reference in New Issue
Block a user