formatted_text 4.0.0 copy "formatted_text: ^4.0.0" to clipboard
formatted_text: ^4.0.0 copied to clipboard

A simple text formatting package. Use to format text in TextField and Text widgets

example/lib/main.dart

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

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Formatted Text Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const HomePage(),
    );
  }
}

class HomePage extends StatefulWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  final textEditingController = FormattedTextEditingController();

  String _value = '';

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Formatted Text Demo'),
      ),
      body: Column(
        children: <Widget>[
          Expanded(
            child: Center(
              child: FormattedText(
                _value,
              ),
            ),
          ),
          Expanded(
            child: Center(
              child: TextField(
                controller: textEditingController,
                onChanged: (value) {
                  setState(() {
                    _value = value;
                  });
                },
              ),
            ),
          ),
        ],
      ),
    );
  }
}
9
likes
150
points
4.18k
downloads

Publisher

verified publishernirmalcode.com

Weekly Downloads

A simple text formatting package. Use to format text in TextField and Text widgets

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

equatable, flutter

More

Packages that depend on formatted_text