build method

  1. @override
Widget build(
  1. BuildContext context
)
override

Implementation

@override
Widget build(BuildContext context) {
  return Row(children: [
    Focus(
        onFocusChange: (yes) {
          if (yes) {
            hourController.selection = TextSelection(baseOffset: 0, extentOffset: hourController.text.length);
          }
        },
        child: TextField(
          controller: hourController,
          textAlign: TextAlign.center,
          inputFormatters: [numberOnlyInpuFormater],
          decoration: const InputDecoration(hintText: "时", counterText: ""),
          onChanged: _onHourChanged,
          maxLength: 2,
        )).expanded(),
    const Text(":"),
    Focus(
        onFocusChange: (yes) {
          if (yes) {
            minController.selection = TextSelection(baseOffset: 0, extentOffset: minController.text.length);
          }
        },
        child: TextField(
          controller: minController,
          textAlign: TextAlign.center,
          inputFormatters: [numberOnlyInpuFormater],
          decoration: const InputDecoration(hintText: "分", counterText: ""),
          onChanged: _onMinChanged,
          maxLength: 2,
        )).expanded(),
  ]).sizedBox(width: 100, height: 42);
}