Giter VIP home page Giter VIP logo

prompt_dialog's People

Contributors

dakamojo avatar frfgccevcv avatar gtgalone avatar joachimvalente avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

prompt_dialog's Issues

Press Enter returns the value

In the Javascript prompt, pressing Enter will return the value. In this project, pressing Enter will unfocus the textbox.

For now, the workaround is to press Tab, Tab, Enter.

Btw, this is not urgent. I'm posting this to keep track of the issue.

Inactive InputConnection after second or more calls

I am testing your basic example and I see that when I start and open dialog so everything is OK.
But when I close and open it again so into Debug log it write:

W/IInputConnectionWrapper(16204): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(16204): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(16204): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper(16204): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(16204): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(16204): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(16204): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(16204): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper(16204): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(16204): endBatchEdit on inactive InputConnection

And it is writting there everytime when the dialog is opened.
It looks like that first input wasn't closed correctly and there is still some inactive InputConnection
Can you fix it please? My logs are quite messy when I use promp_dialog more times..:

Debug service listening on ws://127.0.0.1:46217/6YiWkl9qWqs=/ws
Syncing files to device Android SDK built for x86...
I/zygote  (16204): Do partial code cache collection, code=30KB, data=28KB
I/zygote  (16204): After code cache collection, code=30KB, data=28KB
I/zygote  (16204): Increasing code cache capacity to 128KB
I/flutter (16204): null
W/IInputConnectionWrapper(16204): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(16204): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(16204): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper(16204): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(16204): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(16204): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(16204): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(16204): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper(16204): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(16204): endBatchEdit on inactive InputConnection
I/flutter (16204): null
W/IInputConnectionWrapper(16204): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(16204): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(16204): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper(16204): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(16204): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(16204): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(16204): getTextBeforeCursor on inactive InputConnection
I/zygote  (16204): Do partial code cache collection, code=57KB, data=48KB
I/zygote  (16204): After code cache collection, code=57KB, data=48KB
I/zygote  (16204): Increasing code cache capacity to 256KB
W/IInputConnectionWrapper(16204): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper(16204): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(16204): endBatchEdit on inactive InputConnection
Application finished.

Set to autofocus: true by default

Thanks for implementing the autofocus option! It'd be even more useful if it was set to true by default, since most users will want to type right away, instead of tapping the text box.

initialValue not returned unless textchange

When setting initialValue to something and then using the prompt without editing that initialValue, pressing ok will return null unless you do some typing.

I think having a value as null but an initialValue set this prompt should return initialValue "onOK"

Selection of initial value

Hi, love your widget!

How to select all text of initial value show on display of the prompt, so user erases initial value as soon as entering a character?

Instead of ...
image

All initial input selected like ...

image

Cheers,

Add onCancel callback

Hi,

I really liked your package.

Please add onCancel callback. So that we can do something when that happens.

"isSelectedInitialValue" is never used

Please add the folloing code to initState() to make this field beneficial:

if (widget.isSelectedInitialValue) {
  controller.selection = TextSelection(baseOffset: 0, extentOffset: value?.length ?? 0);
}

Trying to get validator to work.

Thanks for the nice clean widget. I'm trying to get the validator to work. It may be that the validator message is displaying but the dialog still closes immediately.

So I tried the sample custom_message.dart.

First, the sample has some minor issues. The prompt widget needs a context that is a descendent of the MaterialApp. So I wrapped the Center Widget with a Builder for simplicity. Second I got some error related to the obscureText so I commented that out. Here is my updated sample.

import 'package:flutter/material.dart';

import 'package:prompt_dialog/prompt_dialog.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Welcome to Flutter',
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Welcome to Flutter'),
        ),
        body: Builder(builder: (context) {
          return Center(
            child: TextButton(
              onPressed: () async {
                return print(await prompt(
                  context,
                  title: const Text('Would you like to remove?'),
                  initialValue: 'Sure',
                  isSelectedInitialValue: false,
                  textOK: const Text('Yes'),
                  textCancel: const Text('No'),
                  hintText: 'Please write reason',
                  validator: (String? value) {
                    if (value == null || value.isEmpty) {
                      return 'Please enter some text';
                    }
                    return null;
                  },
                  minLines: 2,
                  maxLines: 3,
                  autoFocus: false,
                  // obscureText: true,
                  obscuringCharacter: '*',
                  showPasswordIcon: true,
                  barrierDismissible: true,
                  textCapitalization: TextCapitalization.words,
                ));
              },
              child: const Text('Prompt Dialog'),
            ),
          );
        }),
      ),
    );
  }
}

When running this sample the validator message is never presented to the user.

Exception from basic example

Hello, when I am trying you basic example so it throw me this error (after click on the button):
image

You should probably update it for latest Flutter version.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.