Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
yi-boide opened this issue Dec 25, 2024 · 1 comment

Comments

@yi-boide
Copy link

yi-boide commented Dec 25, 2024

开发模式下一切正常,打包后,主题中的字体大小,和使用了的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(),
          ),
        );
      },
    );
@Jewel105
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants