GithubHelp home page GithubHelp logo

Selecting a dropdownItem multiple times will trigger the WillPopScope time, resulting in a return to the previous page h about dropdown_button2 HOT 4 CLOSED

ahmedlsayed9 avatar ahmedlsayed9 commented on June 4, 2024
Selecting a dropdownItem multiple times will trigger the WillPopScope time, resulting in a return to the previous page h

from dropdown_button2.

Comments (4)

runkobe24 avatar runkobe24 commented on June 4, 2024

Clicking the same dropdownitem multiple times will cause the page to go back to the previous page

from dropdown_button2.

AhmedLSayed9 avatar AhmedLSayed9 commented on June 4, 2024

I think this can't happen as the removeDropdownRoute method just dismiss _dropdownRoute. It doesn't call navigator.pop().

Can you post a sample code clarify how this issue happen?

from dropdown_button2.

AhmedLSayed9 avatar AhmedLSayed9 commented on June 4, 2024

Closing this issue due to lack of information. Feel free to reopen with more details if you still have trouble.

from dropdown_button2.

runkobe24 avatar runkobe24 commented on June 4, 2024

``> 我认为这不可能发生,因为removeDropdownRoute方法只是 dismiss `_dropdownRoute`。它不叫`navigator.pop()`。

你能发布一个示例代码来澄清这个问题是如何发生的吗?

f108e606d833fd6a8855d3283ce7375b.mp4
  String? selectedValue;
  List<String> items = [
    'Item1',
    'Item2',
    'Item3',
    'Item4',
  ];

  StickyPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final size = MediaQuery.of(context).size;
    final width = size.width;

    return Scaffold(
      appBar: AppBar(title: Text("select demo")),
      body: Stack(
        children: [
          CustomScrollView(
            slivers: <Widget>[
              _selectMean(context, width),
            ],
          ),
        ],
      ),
    );
  }

  Widget _selectMean(context, width) {
    return SliverToBoxAdapter(
      child: DropdownButtonHideUnderline(
        child: DropdownButtonFormField2(
          onTap: () {},
          offset: const Offset(10, 50),
          alignment: AlignmentDirectional.centerStart,
          // selectedItemHighlightColor: Colors.blue,
          dropdownWidth: width - 20.w,
          decoration: InputDecoration(
            isDense: true,
            contentPadding: EdgeInsets.zero,
            border: OutlineInputBorder(
              borderRadius: BorderRadius.circular(15),
            ),
          ),
          hint: const Text(
            'Choose Text',
            style: TextStyle(fontSize: 14, color: Colors.blue),
          ),
          icon: const Icon(
            Icons.arrow_drop_down,
            color: Colors.black45,
          ),
          iconSize: 30,
          buttonHeight: 60,
          buttonPadding: const EdgeInsets.only(left: 20, right: 10),
          dropdownDecoration: BoxDecoration(
            color: Colors.white,
            borderRadius: BorderRadius.circular(15),
            boxShadow: const [],
          ),
          items: items
              .map((item) => DropdownMenuItem<String>(
                    value: item,
                    child: Text(
                      item,
                      style: const TextStyle(fontSize: 14, color: Colors.red),
                    ),
                  ))
              .toList(),
          validator: (value) {
            if (value == null) {
              return 'Please select gender.';
            }
          },
          dropdownFullScreen: true,
          onChanged: (value) {},
          onSaved: (value) {
            selectedValue = value.toString();
          },
        ),
      ),
    );
  }
}```

from dropdown_button2.

Related Issues (20)

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.