formatted_text_hooks 3.1.0 copy "formatted_text_hooks: ^3.1.0" to clipboard
formatted_text_hooks: ^3.1.0 copied to clipboard

A simple text formatting package. Use to format text in TextField and Text widgets. Hooks version of formatted_text.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:formatted_text_hooks/formatted_text_hooks.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 Hook Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const HomePage(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    final textEditingController = useFormattedTextController();
    final textValue = useState('');

    return Scaffold(
      appBar: AppBar(
        title: const Text('Formatted Text Hook Demo'),
      ),
      body: Column(
        children: <Widget>[
          Expanded(
            child: Center(
              child: FormattedText(
                textValue.value,
              ),
            ),
          ),
          Expanded(
            child: Center(
              child: TextField(
                controller: textEditingController,
                onChanged: (value) {
                  textValue.value = value;
                },
              ),
            ),
          ),
        ],
      ),
    );
  }
}
2
likes
150
pub points
37%
popularity

Publisher

verified publishernirmalcode.com

A simple text formatting package. Use to format text in TextField and Text widgets. Hooks version of formatted_text.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

equatable, flutter, flutter_hooks, formatted_text

More

Packages that depend on formatted_text_hooks