📜  颤振自动调整大小文本 - Dart 代码示例

📅  最后修改于: 2022-03-11 14:48:09.377000             🧑  作者: Mango

代码示例2
add the flutter_screenutil package: https://pub.dev/packages/flutter_screenutil

then add .sp to the fontSize property of your text as follows:

import 'package:flutter_screenutil/flutter_screenutil.dart';

Center(
  child: Text(
   "Salty beans!",
   style: TextStyle(
     color: Colors.black,
     fontSize: 18.sp, // add .sp here
   ),
  )
)

the package also lets you auto size the height, width, radius of your widgets and also screenWidth/Height of your device:
use .h for height
use .w for width
use .r for radius
use .sw for screen-width
use .sh for screen-height