Git Product home page Git Product logo

Comments (6)

vcestra avatar vcestra commented on June 30, 2024

I have the same problem. How do you fix @Hosam11 ? Thanks

from multi_select_flutter.

Hosam11 avatar Hosam11 commented on June 30, 2024

@vcestra there is an height attribute you can give it double value

from multi_select_flutter.

vcestra avatar vcestra commented on June 30, 2024

Ok @Hosam11 . So you fix the height. Thanks

from multi_select_flutter.

Hosam11 avatar Hosam11 commented on June 30, 2024

in version 3.1.7 the dialog height is fit to content of element inside the dropdown dialog and the below code work fine
MultiSelectDialog.dart in build method inside alert dialog the content

  content: Container(
        height: widget.height,
        child: SingleChildScrollView(
          child: widget.listType == null ||
                  widget.listType == MultiSelectListType.LIST
              ? ListTileTheme(
                  contentPadding: EdgeInsets.fromLTRB(14.0, 0.0, 24.0, 0.0),
                  child: ListBody(
                    children: _items.map(_buildListItem).toList(),
                  ),
                )
              : Wrap(
                  children: _items.map(_buildChipItem).toList(),
                ),
        ),
      ),

the new code

  content: Container(
        height: widget.height,
        child: SingleChildScrollView(
          child: widget.listType == null ||
                  widget.listType == MultiSelectListType.LIST
              ? ListTileTheme(
                  contentPadding: EdgeInsets.fromLTRB(14.0, 0.0, 24.0, 0.0),
                  child: ListBody(
                    children: _items.map(_buildListItem).toList(),
                  ),
                )
              : Wrap(
                  children: _items.map(_buildChipItem).toList(),
                ),
        ),
      )

here's I fix it use with v 4.0.0, wrap the Container with Column then give it MainAxisSize.min, then make ListView shrinkWrap: true

  content: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          Container(
            height: widget.height,
            width: MediaQuery.of(context).size.width * 0.72,
            child: widget.listType == null ||
                    widget.listType == MultiSelectListType.LIST
                ? ListView.builder(
                    shrinkWrap: true,
                    itemCount: _items.length,
                    itemBuilder: (context, index) {
                      return _buildListItem(_items[index]);
                    },
                  )
                : SingleChildScrollView(
                    child: Wrap(
                      children: _items.map(_buildChipItem).toList(),
                    ),
                  ),
          ),
        ],
      )

from multi_select_flutter.

NRMrYang avatar NRMrYang commented on June 30, 2024

@Hosam11 Hi, I use 4.1.2 ,and find content still uses Container instead of Column , should i alert source code?

from multi_select_flutter.

NRMrYang avatar NRMrYang commented on June 30, 2024

I have tried wrap the Container with Column then give it MainAxisSize.min, then make ListView shrinkWrap: true. If height is null, there is errors.I believe following steps will helps.

  1. wrap the Container with ConstrainedBox
  2. set minHeight: 0
  3. make ListView shrinkWrap: true
      content: ConstrainedBox(
        constraints: BoxConstraints(
          minHeight: 0,
        ),
        child: Container(
          height: widget.height,
          width: widget.width ?? MediaQuery.of(context).size.width * 0.73,
          child: widget.listType == null ||
              widget.listType == MultiSelectListType.LIST
              ? ListView.builder(
            itemCount: _items.length,
            shrinkWrap: true,
            itemBuilder: (context, index) {
              return _buildListItem(_items[index]);
            },
          )
              : SingleChildScrollView(
            child: Wrap(
              children: _items.map(_buildChipItem).toList(),
            ),
          ),
        ),
      ),

from multi_select_flutter.

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.