79580019

Date: 2025-04-17 20:19:43
Score: 0.5
Natty:
Report link

You can now use the flutter_bidi_text package — it automatically detects text direction for Text, TextField, and TextFormField based on content.

Example:

import 'package:flutter_bidi_text/bidi_text.dart';

String rtlString = 'فارسی';
String mixedString = 'This is mixed string English and فارسی';

Column(
  children: <Widget>[
    const BidiText('English'), // Always LTR
    const BidiText('فارسی'), // Always RTL
    BidiText(ltrString), // Based on content, RTL
    BidiText(mixedString), // Based on content, LTR
  ],
)

It uses bidirectional algorithms under the hood for seamless mixed-language support.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: Mohammed Al-Zubiri