As you can see, there is am empty space on the Text
right side, how can i remove it.
Use CustomPainter
can solve this problem but I need to calculate text width first.
Is there another way to remove this empty space?
example code:
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: Row(
children: [
Flexible(
child: Container(
color: Colors.green,
child: Text(
"TEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXT",
style: TextStyle(fontSize: 20)
)
)
)
],
)
)
)
);
}
}
dartPad: https://dartpad.dev