8wDlpd.png
8wDFp9.png
8wDEOx.png
8wDMfH.png
8wDKte.png

Flutter Web 应用中折叠卡片上方和下方的下拉按钮不可见

jmcgriz 1月前

18 0

我有一个 Flutter 应用,已在 Android 设备上构建并测试过。我使用 Windows 11 计算机作为开发机器。我在可折叠卡片上方有一个下拉按钮,在下方有一个下拉按钮...

我有一个 Flutter 应用,已在 Android 设备上构建并测试。我使用 Windows 11 计算机作为开发机器。

我在可折叠卡片上方和下方各有一个下拉按钮,但是当我在生产 Web 服务器上查看页面时,下拉按钮不会显示。

当我在调试模式下使用 Chrome 浏览器并在本地主机中查看它时,它们可以在 Windows 机器上正常显示。当我使用 Chrome 浏览器并加载生产代码时,它们可以在我的 Android 移动设备上运行。但是,在我的 Windows 机器上,当我加载生产站点时,下拉菜单不可见。

以下是下拉菜单和可折叠卡片的代码:

const SizedBox(
                  height: 8.0,
                ),
                Container(
                  /* Populate the Agent dropdown only if
                       there is an agency to associate the agent with.
                     */
                  child: _currentCompany != null && _currentCompany != ""
                      ? StreamBuilder(
                          stream: _db
                              .collection('users')
                              .where('companyId', isEqualTo: _currentCompany)
                              .snapshots(),
                          builder:
                              (BuildContext context, AsyncSnapshot snapshot) {
                            List<DropdownMenuItem<String>> userItems = [];
                            userItems.add(
                              const DropdownMenuItem<String>(
                                value: 'Select User',
                                child: Text('Select User'),
                              ),
                            );
                            if (snapshot.hasData) {
                              final userList = snapshot.data.docs;
                              for (var user in userList) {
                                userItems.add(
                                  DropdownMenuItem(
                                    value: user.id,
                                    child: Text(
                                      user['fName'] + '' + user['lName'],
                                    ),
                                  ),
                                );
                              }
                            } else {
                              return const CircularProgressIndicator();
                            }
                            return DropdownButton<String>(
                              hint: const Text("Select User"),
                              value: _selectedUser,
                              onChanged: (userValue) {
                                setState(() {
                                  _selectedUser = userValue;
                                  ref
                                      .read(globalsNotifierProvider.notifier)
                                      .updatecurrentUserId(userValue!);
                                });
                              },
                              items: userItems,
                            );
                          })
                      : const Text('No users yet'),
                ),
                const SizedBox(height: 30,),
                /// Display the client information in a collapsable panel
                Card(
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.start,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    //mainAxisSize: MainAxisSize.min,
                    children: <Widget>[
                      ExpansionTile(
                        subtitle: Text(
                            '${clientFNameController.text} ${clientLNameController.text}'),
                        title: const Text(
                          'Client Information',
                          style: TextStyle(
                              fontWeight: FontWeight.bold, fontSize: 20),
                        ),
                        children: [
                          TextField(
                            textCapitalization: TextCapitalization.words,
                            keyboardType: TextInputType.text,
                            controller: clientFNameController,
                            textAlign: TextAlign.center,
                            onChanged: (value) {
                              ref
                                  .read(clientNotifierProvider.notifier)
                                  .updatefName(value);
                              bClientChanged = true;
                            },
                            decoration: const InputDecoration(
                                hintText: 'Client First Name',
                                labelText: 'Client First Name'),
                          ),
                          TextField(
                            textCapitalization: TextCapitalization.words,
                            keyboardType: TextInputType.text,
                            controller: clientLNameController,
                            textAlign: TextAlign.center,
                            onChanged: (value) {
                              ref
                                  .read(clientNotifierProvider.notifier)
                                  .updatelName(value);
                              bClientChanged = true;
                            },
                            decoration: const InputDecoration(
                                hintText: 'Client Last Name',
                                labelText: 'Client Last Name'),
                          ),
                          TextField(
                            textCapitalization: TextCapitalization.words,
                            keyboardType: TextInputType.text,
                            controller: clientAddress1Controller,
                            textAlign: TextAlign.center,
                            onChanged: (value) {
                              ref
                                  .read(clientNotifierProvider.notifier)
                                  .updateAddress1(value);
                              bClientChanged = true;
                            },
                            decoration: const InputDecoration(
                                hintText: 'Address 1', labelText: 'Address 1'),
                          ),
                          TextField(
                            textCapitalization: TextCapitalization.words,
                            keyboardType: TextInputType.text,
                            controller: clientAddress2Controller,
                            textAlign: TextAlign.center,
                            onChanged: (value) {
                              ref
                                  .read(clientNotifierProvider.notifier)
                                  .updateAddress2(value);
                              bClientChanged = true;
                            },
                            decoration: const InputDecoration(
                                hintText: 'Address 2', labelText: 'Address 2'),
                          ),
                          TextField(
                            textCapitalization: TextCapitalization.words,
                            keyboardType: TextInputType.text,
                            controller: clientCityController,
                            textAlign: TextAlign.center,
                            onChanged: (value) {
                              ref
                                  .read(clientNotifierProvider.notifier)
                                  .updateCity(value);
                              bClientChanged = true;
                            },
                            decoration: const InputDecoration(
                                hintText: 'City', labelText: 'City'),
                          ),
                          DropdownButton(
                            value: _currentClientState,
                            items: _dropDownState,
                            hint: const Text('Choose Client State'),
                            onChanged: changedClientDropDownState,
                          ),
                          TextField(
                            inputFormatters: [maskFormatter],
                            textCapitalization: TextCapitalization.words,
                            keyboardType: TextInputType.text,
                            controller: clientCellPhoneController,
                            textAlign: TextAlign.center,
                            onChanged: (value) {
                              ref
                                  .read(clientNotifierProvider.notifier)
                                  .updateCellPhone(value);
                              bClientChanged = true;
                            },
                            decoration: const InputDecoration(
                                hintText: 'Cell Phone',
                                labelText: 'Cell Phone'),
                          ),
                          TextField(
                            inputFormatters: [maskFormatter],
                            textCapitalization: TextCapitalization.words,
                            keyboardType: TextInputType.text,
                            controller: clientHomePhoneController,
                            textAlign: TextAlign.center,
                            onChanged: (value) {
                              ref
                                  .read(clientNotifierProvider.notifier)
                                  .updateHomePhone(value);
                              bClientChanged = true;
                            },
                            decoration: const InputDecoration(
                                hintText: 'Home Phone',
                                labelText: 'Home Phone'),
                          ),

                          /// Hide this row if on the web because they don't work on web
                          Visibility(
                            visible: _dontShowOnWeb,
                            child: Row(
                              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                              children: <Widget>[
                                Column(
                                  children: [
                                    IconButton(
                                      icon: const Icon(Icons.message),
                                      iconSize: 25,
                                      color: Colors.blueAccent,
                                      tooltip: 'Text Client',
                                      onPressed: () {
                                        setState(() {
                                          _launched = _makeCallOrSendText(
                                              'sms:$_clientCellPhoneNumber');
                                        });
                                      },
                                    ),
                                    const Text('Text'),
                                    const SizedBox(
                                      height: 8.0,
                                    ),
                                  ],
                                ),
                                Column(
                                  children: [
                                    IconButton(
                                      icon: const Icon(Icons.add_call),
                                      iconSize: 25,
                                      color: Colors.blueAccent,
                                      tooltip: 'Call Cell',
                                      onPressed: () {
                                        setState(() {
                                          _launched = _makeCallOrSendText(
                                              'tel:$_clientCellPhoneNumber');
                                        });
                                      },
                                    ),
                                    const Text('Call Cell'),
                                  ],
                                ),
                                Column(
                                  children: [
                                    IconButton(
                                      icon: const Icon(Icons.add_call),
                                      iconSize: 25,
                                      color: Colors.blueAccent,
                                      tooltip: 'Call Home',
                                      onPressed: () {
                                        setState(() {
                                          _launched = _makeCallOrSendText(
                                              'tel:$_clientHomePhoneNumber');
                                        });
                                      },
                                    ),
                                    const Text('Call Home'),
                                    const SizedBox(
                                      height: 8.0,
                                    ),
                                  ],
                                ),
                              ],
                            ),
                          ),

                          TextField(
                            textCapitalization: TextCapitalization.words,
                            keyboardType: TextInputType.text,
                            controller: clientEmailController,
                            textAlign: TextAlign.center,
                            onChanged: (value) {
                              ref
                                  .read(clientNotifierProvider.notifier)
                                  .updateEmail(value);
                              bClientChanged = true;
                            },
                            decoration: const InputDecoration(
                                hintText: 'Email', labelText: 'Email'),
                          ),
                        ],
                      ),
                    ],
                  ),
                ),

                const SizedBox(height: 30,),
                /// //////////////////////////////////////
                DropdownButton(
                  value: _currentClientType,
                  items: _dropdownClientType,
                  hint: const Text('Choose Client Type'),
                  onChanged: changedDropDownClientType,
                ),

                /// ////////////////////////////////////////
                const SizedBox(
                  height: 8.0,
                ),

我已经增加了 SizedBox 的高度来看看是否有效,但它们仍然没有显示。

我如何让这两个下拉按钮显示出来?

感谢您的帮助

帖子版权声明 1、本帖标题:Flutter Web 应用中折叠卡片上方和下方的下拉按钮不可见
    本站网址:http://xjnalaquan.com/
2、本网站的资源部分来源于网络,如有侵权,请联系站长进行删除处理。
3、会员发帖仅代表会员个人观点,并不代表本站赞同其观点和对其真实性负责。
4、本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
5、站长邮箱:yeweds@126.com 除非注明,本帖由jmcgriz在本站《flutter》版块原创发布, 转载请注明出处!
最新回复 (0)
返回
作者最近主题: