Answers for "flutter auto size text"

1

flutter autosize text

You can also wrap the text in a Wrap, use overflow in Text(overflow: TextOverflow.Ellipsis)
https://pub.dev/packages/auto_size_text
Posted by: Guest on December-13-2021
0

flutter auto size text

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
Posted by: Guest on January-01-2022

Code answers related to "Dart"

Browse Popular Code Answers by Language