calendar_date_picker2 icon indicating copy to clipboard operation
calendar_date_picker2 copied to clipboard

[Bug] if keyboard active then klik textformfield datepicker error a renderflex overflow by 74 pixels on bottom

Open anggadedysaputro opened this issue 5 months ago • 0 comments

Describe the bug if keyboard active then klik textformfield datepicker error a renderflex overflow by 74 pixels on bottom

To Reproduce Steps to reproduce the behavior:

  1. type value in textformfield
  2. Click on 'textformfield datepicker'
  3. error a renderflex overflow by 74 pixels on bottom

Expected behavior A clear and concise description of what you expected to happen.

Actual Behaviour The actual behaviour of the issue you encountered.

Screenshots gambar

Platforms (please complete the following information):

  • Platforms: Android

Minimum Reproducible Example (Required) import 'package:calendar_date_picker2/calendar_date_picker2.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:gembala/app/modules/fattening/controllers/fattening_controller.dart'; import 'package:gembala/core/utils/functions/global.dart'; import 'package:get/get.dart';

class FatteningFormView extends StatelessWidget { const FatteningFormView({super.key});

@override Widget build(BuildContext context) { final dc = Get.find<FatteningController>(); return Scaffold( resizeToAvoidBottomInset: true, body: SingleChildScrollView( child: Padding( padding: const EdgeInsets.all(10).w, child: Form( key: dc.fatteningFormKey, child: Column( children: [ TextFormField( onTapOutside: (event) => FocusManager.instance.primaryFocus?.unfocus(), validator: (value) { if (value == null || value.isEmpty) { return 'Judul wajib diisi!'; } }, controller: dc.judulController, decoration: const InputDecoration( label: Text("Judul"), floatingLabelBehavior: FloatingLabelBehavior.always, border: OutlineInputBorder(), hintText: "Input judul", ), ), SizedBox( height: 10.h, ), TextFormField( controller: dc.tanggalMulaiController, keyboardType: TextInputType.none, onTap: () async { final values = await showCalendarDatePicker2Dialog( context: context, config: dc.typeDate, value: dc.tanggalMulai, dialogSize: const Size(325, 400), dialogBackgroundColor: Colors.white, ); if (values != null) { String value = getDateValueText( CalendarDatePicker2Type.single, values, );

                  dc.tanggalMulaiController.value = TextEditingValue(
                    text: convertDateToIndoView(date: value),
                  );
                }
              },
              readOnly: true,
              decoration: const InputDecoration(
                label: Text("Tanggal mulai"),
                floatingLabelBehavior: FloatingLabelBehavior.always,
                border: OutlineInputBorder(),
                hintText: "Tanggal mulai",
              ),
              validator: (value) {
                if (value == null || value.isEmpty) {
                  return 'Tanggal mulai wajib diisi!';
                }
                return null;
              },
            ),
            SizedBox(
              height: 10.h,
            ),
            TextFormField(
              controller: dc.tanggalAkhirController,
              onTap: () async {
                final values = await showCalendarDatePicker2Dialog(
                  context: context,
                  config: dc.typeDate,
                  value: dc.tanggalAkhir,
                  dialogSize: const Size(360, 370),
                  borderRadius: BorderRadius.circular(15).r,
                  dialogBackgroundColor: Colors.white,
                );
                if (values != null) {
                  String value = getDateValueText(
                    CalendarDatePicker2Type.single,
                    values,
                  );
                  dc.tanggalAkhirController.value = TextEditingValue(
                    text: convertDateToIndoView(date: value),
                  );
                }
              },
              readOnly: true,
              decoration: const InputDecoration(
                label: Text("Tanggal akhir"),
                floatingLabelBehavior: FloatingLabelBehavior.always,
                border: OutlineInputBorder(),
                hintText: "Tanggal akhir",
              ),
              validator: (value) {
                if (value == null || value.isEmpty) {
                  return 'Tanggal akhir wajib diisi!';
                }
                return null;
              },
            ),
            SizedBox(
              height: 10,
            ),
            TextFormField(
              validator: (value) {
                if (value == null || value.isEmpty) {
                  return 'Keterangan wajib diisi!';
                }
              },
              controller: dc.keteranganController,
              onTapOutside: (event) =>
                  FocusManager.instance.primaryFocus?.unfocus(),
              decoration: const InputDecoration(
                label: Text("Keterangan"),
                floatingLabelBehavior: FloatingLabelBehavior.always,
                border: OutlineInputBorder(),
                hintText: "Input keterangan",
              ),
              keyboardType: TextInputType.multiline,

              minLines: 2, //Normal textInputField will be displayed
              maxLines: 5, // when user presses enter it will adapt to it
            ),
            Row(
              mainAxisAlignment: MainAxisAlignment.end,
              children: [
                TextButton(
                  style: const ButtonStyle(
                    foregroundColor: MaterialStatePropertyAll(Colors.green),
                  ),
                  onPressed: dc.simpan,
                  child: const Text("Simpan"),
                ),
                TextButton(
                  style: const ButtonStyle(
                    foregroundColor: MaterialStatePropertyAll(Colors.grey),
                  ),
                  onPressed: () {
                    dc.mode.value = "list";
                  },
                  child: const Text("Batal"),
                )
              ],
            )
          ],
        ),
      ),
    ),
  ),
);

} }

anggadedysaputro avatar Sep 22 '24 14:09 anggadedysaputro