Search
 
SCRIPT & CODE EXAMPLE
 

DART

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
Comment

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
Comment

PREVIOUS NEXT
Code Example
Dart :: flutter ios status bar is dark 
Dart :: srring reverse dart 
Dart :: scroll with mouse in flutter 
Dart :: Flutter bottom navigation bar change page programmatically 
Dart :: extension function flutter 
Dart :: how to get isoCode based on location in flutter 
Dart :: dart list from 0 to n 
Dart :: FlutterError (Navigator operation requested with a context that does not include a Navigator. The context used to push or pop routes from the Navigator must be that of a widget that is a descendant of a Navigator widget.) 
Dart :: custom marker google maps flutter 
Dart :: upload a file to ec2 instance 
Dart :: flutter push and pop doesnt work 
Dart :: dart enums 
Dart :: align column to center of flex flutter 
Dart :: how to give width based on screen size flutter 
Dart :: dart if else 
Dart :: dart list remove item by text 
Dart :: inkwell splash color not working flutter 
Dart :: How to create maps in flutter 
Dart :: comments in dart 
Dart :: flutter multi icon button 
Dart :: flutter add checkbox 
Dart :: flutter ignore keyboard 
Dart :: how to change primary color in flutter 
Dart :: cricle in flutter 
Dart :: app bar for chat flutter 
Swift :: swift self.present full screen 
Swift :: shadow color swiftui 
Swift :: add toggle without text swiftui 
Swift :: check when webview finish loading swift 
Swift :: connect old iphone with latest xcode 12 or 13 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =