flutter_screenutil icon indicating copy to clipboard operation
flutter_screenutil copied to clipboard

开发模式下一切正常,打包后,主题中的字体大小,和使用了的padding大小都失效了

Open yi-boide opened this issue 1 year ago • 4 comments

开发模式下一切正常,打包后,主题中的字体大小,和使用了的padding大小都失效了

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:xxxx/common/theme/color_scheme.dart';

final defaultTextStyle = TextStyle(
  fontSize: 14.sp,
  color: SimiColorScheme.textPrimary,
);

final specialNumberTextStyle = TextStyle(
  fontSize: 18.sp,
  fontFamily: 'DINPro',
  fontWeight: FontWeight.w500,
);

final specialTextStyle = TextStyle(
  fontSize: 18.sp,
  fontFamily: 'YouSheBiaoTiHei',
  fontWeight: FontWeight.bold,
);

final textTheme = TextTheme(
  headlineMedium: TextStyle(
    fontSize: 28.sp,
    fontWeight: FontWeight.bold,
  ),
  titleMedium: TextStyle(
    fontSize: 16.sp,
    fontWeight: FontWeight.bold,
  ),
  bodyLarge: TextStyle(
    fontSize: 18.sp,
    fontWeight: FontWeight.bold,
  ),
  bodyMedium: defaultTextStyle,
  bodySmall: TextStyle(
    fontSize: 12.sp,
    color: SimiColorScheme.textSecondary,
  ),
);

Widget app = ScreenUtilInit(
      designSize: const Size(375, 812),
      minTextAdapt: true,
      splitScreenMode: true,
      builder: (context, child) {
        return DefaultTextStyle(
          style: defaultTextStyle,
          child: GetMaterialApp(
            title: "XXXX",
            initialRoute: AppPages.INITIAL,
            getPages: AppPages.routes,
            theme: themeData,
            debugShowCheckedModeBanner: false,
            builder: FToastBuilder(),
          ),
        );
      },
    );

yi-boide avatar Dec 25 '24 17:12 yi-boide

需要初始化屏幕尺寸
await ScreenUtil.ensureScreenSize();
runApp(const MyApp());

Jewel105 avatar Dec 31 '24 09:12 Jewel105

遇到了同样的问题,并且 5.9.3 Member not found: 'ScreenUtil. ensureScreenSize'.

shichunlei avatar Jan 15 '25 03:01 shichunlei

我也遇到了同样的问题,我是Android pad存在这个问题,打包后页面的布局完全变化了。安卓手机就没有这个问题。我尝试了await ScreenUtil.ensureScreenSize();没有效果 。各位大佬们都怎么解决的? @shichunlei @yi-boide @Jewel105 @techouse @dmakeev

gidy-moon avatar Mar 13 '25 05:03 gidy-moon

我也遇到了同样的问题,我是Android pad存在这个问题,备份后页面的布局完全变化了。安卓手机就没有这个问题。我尝试了await ScreenUtil.ensureScreenSize();没有效果。各位大佬们都怎么解决的?@shichunlei @yi-boide @Jewel105 @techouse @dmakeev 退回到5.8.4 在clean

Nolan1357 avatar Apr 17 '25 02:04 Nolan1357