Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why Column last widget move? dialog move delay #210

Open
xxxIxxxx opened this issue Oct 25, 2022 · 2 comments
Open

Why Column last widget move? dialog move delay #210

xxxIxxxx opened this issue Oct 25, 2022 · 2 comments

Comments

@xxxIxxxx
Copy link

import 'package:flutter/material.dart';
import 'package:keyboard_actions/keyboard_actions.dart';

void main() => runApp(const MyApp());

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

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: 'Material App',
      home: TestWidget(),
    );
  }
}

class TestWidget extends StatelessWidget {
  const TestWidget({super.key});
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: [
          Expanded(
            child: ListView.builder(
              itemCount: 100,
              itemBuilder: (BuildContext context, int index) {
                return Text("data $index");
              },
            ),
          ),
          Container(
            padding: const EdgeInsets.all(20),
            height: 80,
            width: double.infinity,
            color: Colors.redAccent,
            child: GestureDetector(
              onTap: () => showWriteComment2(context),
              child: const Text("touch me. Why do I move ?"),
            ),
          ),
        ],
      ),
    );
  }
}

Future showWriteComment2(BuildContext context) async {
  var focusNode = FocusNode();
  focusNode.requestFocus();
  var controller = TextEditingController();
  return showDialog(
      context: context,
      builder: (context) {
        return GestureDetector(
            onTap: () => Navigator.pop(context),
            child: KeyboardActions(
              // isDialog: true,
              config: KeyboardActionsConfig(
                  keyboardActionsPlatform: KeyboardActionsPlatform.ALL,
                  actions: [
                    KeyboardActionsItem(
                      focusNode: focusNode,
                      displayActionBar: false,
                    ),
                  ]),
              child: Column(
                mainAxisSize: MainAxisSize.min,
                mainAxisAlignment: MainAxisAlignment.end,
                children: [
                  Container(
                    padding: const EdgeInsets.all(8),
                    color: Colors.white,
                    child: TextField(
                      controller: controller,
                      cursorColor: Colors.black,
                      decoration: const InputDecoration(
                        hintText: "Can you remove the delay in my popping up?",
                      ),
                      focusNode: focusNode,
                      maxLines: 7,
                    ),
                  ),
                  GestureDetector(
                    onTap: () {
                      Navigator.pop(context);
                    },
                    child: Container(
                      padding: const EdgeInsets.all(8),
                      color: Colors.amber,
                      width: double.infinity,
                      height: 40,
                      child: const Text("send"),
                    ),
                  )
                ],
              ),
            ));
      });
}

@diegoveloper
Copy link
Owner

Can you add a gif/screenshot and give us more explanation?

@xxxIxxxx
Copy link
Author

Can you add a gif/screenshot and give us more explanation?

Thank you for your reply!

Why is the red widget at the end of the column moving? It shouldn't be moving, right?

The Dialog moves very slowly when the keyboard pops up, can this be changed?

I wanted to achieve an effect like this

⬇️

https://files.catbox.moe/jid539.gif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants