flutter_keyboard_actions icon indicating copy to clipboard operation
flutter_keyboard_actions copied to clipboard

Why Column last widget move? dialog move delay

Open xxxIxxxx opened this issue 3 years ago • 2 comments

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"),
                    ),
                  )
                ],
              ),
            ));
      });
}

xxxIxxxx avatar Oct 25 '22 05:10 xxxIxxxx

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

diegoveloper avatar Oct 25 '22 13:10 diegoveloper

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

xxxIxxxx avatar Oct 26 '22 02:10 xxxIxxxx