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

A text widget that automatically adds hyphenation. It was designed as a drop-in replacement for the default text widget. Added extra feature on auto_hyphenating_text package.

example/lib/main.dart

import 'package:auto_hyphe/auto_hyphe.dart';
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(
			title: 'Auto Hyphe Demo',
			theme: ThemeData(
				primarySwatch: Colors.blue,
			),
			home: const GermanExample(title: 'Auto Hyphe Demo'),
		);
	}
}

class GermanExample extends StatefulWidget {
	const GermanExample({super.key, required this.title});

	final String title;

	@override
	State<GermanExample> createState() => _GermanExampleState();
}

class _GermanExampleState extends State<GermanExample> {

	late Future<void> initOperation;

	@override
	void initState() {
		super.initState();
		initOperation = initHyphenation(DefaultResourceLoaderLanguage.de1996);
	}

	@override
	Widget build(BuildContext context) {
		return Scaffold(
			appBar: AppBar(
				title: Text(widget.title),
			),
			body: FutureBuilder<void>(
				future: initOperation,
				builder: (_, AsyncSnapshot<void> snapshot) {
					if (snapshot.connectionState == ConnectionState.done) {
						return Center(
							child: Container(color:Colors.amber,width: 100,child: AutoHyphe('Ändern Sie die Größe dieses Fensters, um die automatische Silbentrennung in Aktion zu sehen.',maxWidthOfLine: 0.7,)),
						);
					} else {
						return const Center(
							child: SizedBox(
								height: 40,
								width: 40,
								child: CircularProgressIndicator(),
							),
						);
					}
				},
			),
		);
	}
}
0
likes
40
points
35
downloads

Publisher

unverified uploader

Weekly Downloads

A text widget that automatically adds hyphenation. It was designed as a drop-in replacement for the default text widget. Added extra feature on auto_hyphenating_text package.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (license)

Dependencies

flutter, hyphenator_impure

More

Packages that depend on auto_hyphe