text_style_editor 0.2.1 copy "text_style_editor: ^0.2.1" to clipboard
text_style_editor: ^0.2.1 copied to clipboard

outdated

TextSyleEditor is a flutter widget that help you to edit a text style dynamically.

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'TextStyleEditor Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'TextStyleEditor Demo'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  TextStyle textStyle;
  TextAlign textAlign;

  @override
  void initState() {
    textStyle =
        TextStyle(fontSize: 25, color: Colors.black, fontFamily: 'Billabong');

    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        child: Column(
          children: <Widget>[
            Expanded(
              child: Container(
                padding: EdgeInsets.only(top: 350),
                width: 500,
                child: Text(
                  'Sample text',
                  style: textStyle,
                  textAlign: textAlign,
                ),
              ),
            ),
            Expanded(
              child: SafeArea(
                child: Container(
                  child: Align(
                    alignment: Alignment.topCenter,
                    child: TextStyleEditor(
                      height: 250,
                      textStyle: textStyle,
                      onTextStyleChanged: (value) {
                        setState(() {
                          textStyle = value;
                        });
                      },
                      onTextAlignChanged: (value) {
                        setState(() {
                          textAlign = value;
                        });
                      },
                    ),
                  ),
                ),
              ),
            )
          ],
        ),
      ),
    );
  }
}
55
likes
40
pub points
77%
popularity

Publisher

unverified uploader

TextSyleEditor is a flutter widget that help you to edit a text style dynamically.

Repository (GitHub)
View/report issues
Contributing

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on text_style_editor