bypass check for flutter ownership
Some checks failed
Release / meta (push) Successful in 2s
Release / linux-build (push) Failing after 1m25s
Release / android-build (push) Failing after 5m4s
Release / windows-build (push) Has been cancelled
Release / release-dev (push) Has been cancelled
Release / release-master (push) Has been cancelled

This commit is contained in:
2025-12-11 01:45:38 +00:00
parent 0d896786ca
commit 40fb88a089
2 changed files with 30 additions and 7 deletions

View File

@@ -21,6 +21,7 @@ class TractionPage extends StatefulWidget {
class _TractionPageState extends State<TractionPage> {
final _classController = TextEditingController();
final _classFocusNode = FocusNode();
final _numberController = TextEditingController();
bool _mileageFirst = true;
bool _initialised = false;
@@ -37,6 +38,12 @@ class _TractionPageState extends State<TractionPage> {
final _domainController = TextEditingController();
final _typeController = TextEditingController();
@override
void initState() {
super.initState();
_classController.addListener(_onClassTextChanged);
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
@@ -52,7 +59,9 @@ class _TractionPageState extends State<TractionPage> {
@override
void dispose() {
_classController.removeListener(_onClassTextChanged);
_classController.dispose();
_classFocusNode.dispose();
_numberController.dispose();
_nameController.dispose();
_operatorController.dispose();
@@ -131,6 +140,15 @@ class _TractionPageState extends State<TractionPage> {
_refreshTraction();
}
void _onClassTextChanged() {
if (_selectedClass != null &&
_classController.text.trim() != (_selectedClass ?? '')) {
setState(() {
_selectedClass = null;
});
}
}
@override
Widget build(BuildContext context) {
final data = context.watch<DataService>();
@@ -202,9 +220,8 @@ class _TractionPageState extends State<TractionPage> {
(c) => c.toLowerCase().contains(query),
);
},
initialValue: TextEditingValue(
text: _classController.text,
),
textEditingController: _classController,
focusNode: _classFocusNode,
fieldViewBuilder:
(
context,
@@ -212,7 +229,6 @@ class _TractionPageState extends State<TractionPage> {
focusNode,
onFieldSubmitted,
) {
controller.value = _classController.value;
return TextField(
controller: controller,
focusNode: focusNode,
@@ -220,9 +236,6 @@ class _TractionPageState extends State<TractionPage> {
labelText: 'Class',
border: OutlineInputBorder(),
),
onChanged: (val) {
_classController.text = val;
},
onSubmitted: (_) => _refreshTraction(),
);
},