首页 > 解决方案 > 我在颤振 Web 应用程序中使用 country_code_picker 2.0.1。初始选择不起作用

问题描述

我在颤振 Web 应用程序中使用 country_code_picker 2.0.1。对于初始选择,我使用存储在数据库中的国家名称。不起作用。

CountryCodePicker(
                                              onChanged: (CountryCode
                                                  countryCode) {
                                                _countryOrigin = countryCode
                                                    .name
                                                    .toString();
                                              },
                                              alignLeft: true,
                                              initialSelection:
                                                  result.countryOrigin ==
                                                          null
                                                      ? ''
                                                      : result.countryOrigin
                                                          .substring(0, 2)
                                                          .toUpperCase()
                                                          .toString(),
                                              favorite: [
                                                '+65',
                                                '+62',
                                                '+86',
                                                '+81',
                                                '+66',
                                                '+82',
                                                '+1',
                                                '+91',
                                              ],
                                              showCountryOnly: true,
                                              enabled: true,
                                              showFlag: true,
                                              showOnlyCountryWhenClosed:
                                                  true),

标签: flutterweb

解决方案


推荐阅读