- Notifications
You must be signed in to change notification settings - Fork504
Open
Description
I'm using flutter_screenutil: ^5.9.3 and Flutter 3.29.3
After setting the minTextAdapt to true and used chrome for testing text adaption
the problem i'm facing is that when i set container with .r height and .r width (also if i specified .h and .w instead of .r), the text overflowed the container in big screens like laptop (1440x900)
After printing the scaling values, I found that the text always takes the highest scaling ratio, not the minimum between the height and width scaling
class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return ScreenUtilInit( designSize: const Size(375, 812), minTextAdapt: true, builder: (_, child) { return MaterialApp( debugShowCheckedModeBanner: false, theme: ThemeData.light(), darkTheme: ThemeData.dark(), home: child, ); }, child: const HomePage3(), ); }}and this is my HomePage3 code
class HomePage3 extends StatelessWidget { const HomePage3({Key? key}) : super(key: key); @override Widget build(BuildContext context) { print('width: ${1.sw}, scale width = ${1.sw / 375}'); print('height: ${1.sh}, scale height = ${1.sh / 812}'); print('text scale: ${1.sp}'); return Scaffold( backgroundColor: Colors.white, body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox( width: 52.r, height: 20.r, child: ElevatedButton( onPressed: () {}, style: ElevatedButton.styleFrom( elevation: 0, padding: EdgeInsets.zero, backgroundColor: Colors.transparent, foregroundColor: const Color(0xFF121212), shape: RoundedRectangleBorder( side: BorderSide( color: const Color(0xFF2C262C), width: 1.r, ), borderRadius: BorderRadius.circular(16.r), ), ), child: Text( 'تفاصيل', style: TextStyle( fontSize: 11.sp, color: const Color(0xFF121212), fontWeight: FontWeight.normal, ), ), ), ), ], )), ); }}Am I missing something?
Metadata
Metadata
Assignees
Labels
No labels

