text_wrap_auto_size 1.0.6 copy "text_wrap_auto_size: ^1.0.6" to clipboard
text_wrap_auto_size: ^1.0.6 copied to clipboard

Wraps text and auto sizes it dynamically with respect to the given space.

example/example.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: MyHomePage(),
    );
  }
}

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

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  String _text = 'text';

  @override
  Widget build(BuildContext context) {
    return SafeArea(
        child: Scaffold(
      body: TextWrapAutoSize(Text(_text)),
      //
      // Add or clear text
      //
      floatingActionButton: Row(
        mainAxisAlignment: MainAxisAlignment.end,
        children: [
          FloatingActionButton(
            onPressed: () => setState(() => _text = ''),
            child: const Icon(Icons.clear),
          ),
          const SizedBox(width: 16),
          FloatingActionButton(
            onPressed: () => setState(() {
              _text = ('$_text text').trim();
            }),
            child: const Icon(Icons.add),
          ),
        ],
      ),
    ));
  }
}
5
likes
0
pub points
70%
popularity

Publisher

verified publishernovelplotter.com

Wraps text and auto sizes it dynamically with respect to the given space.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on text_wrap_auto_size