mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-08 23:18:16 -07:00
fix: duration-picker not working (#134)
Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
parent
59a5fa6ac6
commit
35e74258d9
5 changed files with 26 additions and 14 deletions
|
|
@ -18,13 +18,20 @@ class InputHandler extends StatefulWidget {
|
|||
class _InputHandlerState extends State<InputHandler> {
|
||||
final focusNode = FocusNode();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
//Focus on start
|
||||
focusNode.requestFocus();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Focus(
|
||||
autofocus: widget.autoFocus,
|
||||
focusNode: focusNode,
|
||||
onFocusChange: (value) {
|
||||
if (!focusNode.hasFocus) {
|
||||
if (!focusNode.hasFocus && widget.autoFocus) {
|
||||
focusNode.requestFocus();
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import 'package:fladder/screens/shared/outlined_text_field.dart';
|
||||
import 'package:fladder/util/localization_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
String timePickerString(BuildContext context, Duration? duration) {
|
||||
if (duration == null) return context.localized.never;
|
||||
|
|
@ -113,8 +115,10 @@ class SimpleDurationPicker extends ConsumerWidget {
|
|||
final parsedValue = int.parse(value);
|
||||
if (parsedValue >= 60) {
|
||||
secondsTextController.text = (parsedValue % 60).toString().padLeft(2, '0');
|
||||
minuteTextController.text =
|
||||
(int.parse(minuteTextController.text) + parsedValue / 60).floor().toString().padLeft(2, '0');
|
||||
minuteTextController.text = (int.parse(minuteTextController.text) + parsedValue / 60)
|
||||
.floor()
|
||||
.toString()
|
||||
.padLeft(2, '0');
|
||||
}
|
||||
onChanged(
|
||||
Duration(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue