islamic_text 1.0.0 copy "islamic_text: ^1.0.0" to clipboard
islamic_text: ^1.0.0 copied to clipboard

A Flutter package for processing Islamic text, including ligature replacement and glyph rendering.

Islamic Text #

A Flutter widget to render Islamic phrases with compact ligatures and custom font.
This package replaces common phrases like "صلى الله عليه وسلم" with symbols such as "ﷺ" and paints them in a dedicated font. It is designed to be safe, performant, and extensible for future glyph rendering.


Font Setup (Required) #

This package uses a custom font called IslamicPhrases.

Add the following to your host app pubspec.yaml:

flutter:
  fonts:
    - family: IslamicPhrases
      fonts:
        - asset: packages/islamic_text/fonts/islamic_phrases.ttf

⚠️ Without this, the IslamicText widget will fallback to normal text or throw an error if fallback is disabled.


Features #

  • Replace Islamic phrases with compact ligatures
  • Render ligatures using a custom font
  • Configurable vertical offset for perfect alignment
  • Support for multi-line text and text styling
  • Safe fallback if the font is missing (Web or misconfigured apps)
  • Future-ready: can extend to glyph rendering and complex shaping
  • Fully reversible text encoding/decoding for serialization or testing

Preview #

Without IslamicText With IslamicText
[] []

Getting Started #

Prerequisites #

  • Flutter >= 3.7.0
  • Dart >= 3.0.0
  • Add the custom font as shown above

Installation #

Add to your pubspec.yaml:

dependencies:
  islamic_text: ^1.0.0

Then run:

flutter pub get

Usage #

Simple Example #

import 'package:flutter/material.dart';
import 'package:islamic_text/islamic_text.dart';

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('IslamicText Example')),
      body: const Padding(
        padding: EdgeInsets.all(16),
        child: IslamicText(
          text: 'محمد صلى الله عليه وسلم',
          islamicVerticalOffset: -0.05,
        ),
      ),
    );
  }
}

Custom Styles #

IslamicText(
  text: 'محمد صلى الله عليه وسلم',
  normalTextStyle: TextStyle(fontSize: 18, color: Colors.black87),
  islamicTextStyle: TextStyle(fontSize: 20, color: Colors.green),
  islamicVerticalOffset: 0.0,
  textAlign: TextAlign.center,
)

The islamicVerticalOffset helps align the ligatures correctly with surrounding text.


Advanced Usage #

  • Encode/decode text programmatically:
import 'package:islamic_text/src/ligature_replacer.dart';

final replacer = LigatureReplacer();
final encoded = replacer.encode('محمد صلى الله عليه وسلم');
final decoded = replacer.decode(encoded);
  • Handle fallback if font is not registered:
const useFallback = true;
final textWidget = IslamicText(
  text: 'محمد صلى الله عليه وسلم',
  islamicVerticalOffset: 0.0,
  enableFallback: useFallback,
);

Example App #

Check the /example folder for a working Flutter application that demonstrates:

  • Ligature replacement
  • Custom styling
  • Long multi-line text
  • Font fallback

Run the example:

cd example
flutter run

Additional Information #

Contributing #

  1. Fork the repository
  2. Create a feature branch
  3. Submit a pull request
  4. Include tests for new features

Issues #

  • File issues on GitHub
  • Include Flutter/Dart version and error details
  • Expect response within 1–3 business days

License #

MIT License. See LICENSE file.

0
likes
0
points
207
downloads

Publisher

verified publishertripletroop.com

Weekly Downloads

A Flutter package for processing Islamic text, including ligature replacement and glyph rendering.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on islamic_text