You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter同一物理设备Debug与Release模式界面差异求助

Flutter Debug与Release模式物理设备界面差异排查求助

在同一物理设备上启动Flutter应用时,Debug模式与Release模式的界面存在明显差异,Release模式界面显示效果较差。但在Pixel模拟器上,两种模式下应用均运行正常。

相关配置代码

build.gradle

buildTypes {
    release {
        signingConfig signingConfigs.release
        minifyEnabled false
        shrinkResources false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}

proguard-rules.pro

# Please add these rules to your existing keep rules in order to suppress warnings.
# This is generated automatically by the Android Gradle plugin.
-dontwarn com.google.errorprone.annotations.CanIgnoreReturnValue
-dontwarn com.google.errorprone.annotations.CheckReturnValue
-dontwarn com.google.errorprone.annotations.Immutable
-dontwarn com.google.errorprone.annotations.RestrictedApi
-dontwarn javax.annotation.Nullable
-dontwarn javax.annotation.concurrent.GuardedBy
-keep class io.flutter.** { *; }
-keep class io.flutter.embedding.android.** { *; }
-keepattributes *Annotation*
-keepresources *.png
-keepresources *.ttf

界面差异截图

下拉组件"Uzmanlik Alani"示例代码

Expanded(
  flex: 3,
  child: SizedBox(
    height: 25.h,
    child: DropdownButtonHideUnderline(
      child: DropdownButton2<String>(
        hint: Text(
          'Uzmanlık Alanı',
          style: Theme.of(context)
              .textTheme
              .displaySmall
              ?.copyWith(
                  color: AppColors.inactiveGrey),
          overflow: TextOverflow.ellipsis,
        ),
        items: convertSpecializationAreas.keys
            .toList()
            .sublist(0, 5)
            .map<DropdownMenuItem<String>>(
                (String value) {
          return DropdownMenuItem<String>(
            value: value,
            child: Text(
              value,
              style: Theme.of(context)
                  .textTheme
                  .displaySmall,
              overflow: TextOverflow.ellipsis,
              maxLines: 2,
            ),
          );
        }).toList(),
        value: convertSpecializationAreas[
            _selectedSpecializationArea],
        onChanged: (String? newSpecializationArea) {
          if (newSpecializationArea != null &&
              _selectedSpecializationArea !=
                  convertSpecializationAreas[
                      newSpecializationArea]) {
            setState(() {
              _selectedSpecializationArea =
                  convertSpecializationAreas[
                      newSpecializationArea];
            });
          }
        },
        buttonStyleData: ButtonStyleData(
          height: 27.h,
          width: double.infinity,
          padding: EdgeInsets.symmetric(
            horizontal: AppSpacing.horizontalSpace,
            vertical: AppSpacing.verticalSpace,
          ),
          decoration: BoxDecoration(
            borderRadius: AppStyles.borderRadius,
            border: Border.all(
                color: AppColors.inactiveGrey),
          ),
        ),
        isDense: true,
        isExpanded: true,
        iconStyleData: IconStyleData(
          icon: Icon(
            size: 9.h,
            Icons.arrow_drop_down,
          ),
        ),
        dropdownStyleData: DropdownStyleData(
          maxHeight: 100.h,
        ),
      ),
    ),
  ),
),

我可以提供任何所需文件,恳请协助排查该问题,谢谢!

内容的提问来源于stack exchange,提问作者overseas

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.15 02:50:17