flutterdarttext-decorations

How to make Curved Text in Flutter


I'm working on a Flutter project, and I'd like to add Curved Text to one of my widgets. I want the text to follow a curved rather than being displayed in a straight line. I've been searching for a way to achieve this effect in Flutter, but I haven't found a straightforward solution.

enter image description here

I want to curved my text just like this in above showed image.

Could someone please provide guidance on how to create curved text in Flutter?

I'd appreciate any code examples or tutorials that can help me get started with this curved text feature in Flutter. Thank you!


Solution

  • Use this curved_text: ^0.1.3

    import 'package:curved_text/curved_text.dart';
    
    
    
     Story(
            background: Colors.white,
            name: 'Curved text',
            builder: (_, k) {
              final curvature = k.slider(label: 'Curvature', initial: double.minPositive, min: -0.05, max: 0.05);
    
              final text = k.text(
                label: 'Text',
                initial: 'Hello, Flutter!',
              );
              const textStyle = TextStyle(fontSize: 18, color: Colors.black);
    
              return CurvedText(
                curvature: curvature,
                text: text,
                textStyle: textStyle,
                targetRadius: 50,
              );
            },
          )
    

    enter image description here