Manoj
Manoj

Reputation: 3

keyboard hidding the text form field in flutter

hi team i face issue in the text form field. Im using one android device with low screen resolution so in this i have one text form field if i try to type anything keyboard hide that text form field so i changed the code in scaffold and added resizeToAvoidBottomInset:false but after that i have one view summary button in the end of screen that is not came above keyboard

child: Scaffold( resizeToAvoidBottomInset: false, backgroundColor: AppColors.greyscaleBackground, appBar: SimpleAppBarWithTitleAndLeadingButton( title: '', leadingIcon: IconButton( padding: EdgeInsets.zero, iconSize: 50, icon: const CustomSvg( name: AppIcons.close, height: 50, width: 50, ), onPressed: () => getCancelAddNewModal(context), ), ), body: const EnterTagsForm(), ), );

code fir EnterTagsForm ->

 return Column(
      children: [
        Padding(
          padding: const EdgeInsets.only(bottom: 24),
          child: Align(
            alignment: Alignment.centerLeft,
            child: Padding(
              padding: const EdgeInsets.symmetric(
                horizontal: 24,
              ),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text('Enter Tag',
                          style: isSmallDevice
                              ? TextStyleCatalog.title1_dark2
                              : TextStyleCatalog.title1_dark),
                      Text(
                        'Enter Tag ID on the YourTag',
                        style: isSmallDevice
                            ? TextStyleCatalog.body1_medium2
                            : TextStyleCatalog.body1_medium,
                        textAlign: TextAlign.start,
                      ),
                    ],
                  ),
                  Expanded(
                    child: Column(
                      children: [
                        Text(
                          'Tags Entered',
                          style: isSmallDevice
                              ? TextStyleCatalog.body1_medium2
                              : TextStyleCatalog.body1_dark,
                          overflow: TextOverflow.ellipsis,
                        ),
                        Text(
                          state.animalList.length.toString(),
                          style: TextStyleCatalog.title2_dark,
                        ),
                      ],
                    ),
                  ),
                ],
              ),
            ),
          ),
        ),
        Padding(
          padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 8),
          child: Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              const Text(
                'EPC Prefix',
                style: TextStyleCatalog.title2_dark,
              ),
              DecoratedBox(
                decoration: BoxDecoration(
                  color: AppColors.greyscaleFields,
                  borderRadius: BorderRadius.circular(12),
                ),
                child: Padding(
                  padding: const EdgeInsets.all(16),
                  child: Text(
                    state.data!.getTagsAssetsAssign.first!.epcprefix,
                    style: TextStyleCatalog.body1_dark,
                  ),
                ),
              ),
            ],
          ),
        ),
        const Expanded(
          child: EnterTagDataList(),
        ),
        Builder(
          builder: (context) {
            if (state.selectedAttributes.isOneSpecificAttributeSelected()) {
              return BottomButton(
                disabled: false,
                label: 'View Summary',
                onPressed: () {
                  addNewAnimalsCubit
                      .updateCurrentScreen(CurrentScreen.createNewAnimals);
                },
              );
            }

need help

Upvotes: 0

Views: 46

Answers (1)

Mark
Mark

Reputation: 11

Have tired wrapping the Column widget (after the return) in SingleChildScrollView Widget and giving MediaQuery.of(context).viewInsets to the padding parameter.

and remove the resizeToAvoidBottomInset: false from the Scaffold and change any Expanded to Flexible

hope that helps.

Upvotes: 0

Related Questions