Here is my code
Container(
child: Positioned(
left: offset.dx,
top: offset.dy,
child: GestureDetector(
onPanUpdate: (details) {
setState(() {
offset = Offset(offset.dx details.delta.dx, offset.dy details.delta.dy);
print('offset $offset');
});
},
child: Text(_controller.text, textAlign: TextAlign.center, maxLines: 3,
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0, color: colorrr)),),
),
)
CodePudding user response:
The easiest way would be for you to put the fontSize
in the State
of your Widget, and update it from a button or tap somewhere.
Essentially, just like you update the offset
, you can update a state variable named fontSize
and use it in your TextStyle
.
CodePudding user response:
For resize text you may use
dependencies: auto_size_text: ^3.0.0
import dart code:
import 'package:auto_size_text/auto_size_text.dart';
GestureDetector ontap inside use that code :
onTap: () {
child: AutoSizeText(
'This string will be automatically resized to fit in two lines.',
style: TextStyle(fontSize: 30),
maxLines: 2,
);
Hope you will get solution . Also to know about package: https://pub.dev/packages/auto_size_text/install