text_write_read_controller 0.0.4 copy "text_write_read_controller: ^0.0.4" to clipboard
text_write_read_controller: ^0.0.4 copied to clipboard

textfile read/write plugin

example/lib/main.dart

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

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

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final _textWriteReadControllerPlugin = TextWriteReadController();
  String readText = "";
  bool isWrote = false;

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Write/Read Controller'),
        ),
        body: Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: [
            _buildCreateComponent(),
            // _buildWriteComponent(),
            _buildReadComponent(),
          ],
        ),
      ),
    );
  }

  Widget _buildCreateComponent() {
    return Container(
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(15.0),
        border: Border.all(),
      ),
      child: Column(
        children: [
          OutlinedButton(
              onPressed: () async {
                isWrote = await _textWriteReadControllerPlugin.appendText("테스트");
                setState(() {

                });
              },
              child: Text('Write Text')),
          Text('Result ↓'),
          Text('$isWrote')
        ],
      ),
    );
  }

  Widget _buildWriteComponent() {
    return Container(
        decoration: BoxDecoration(
      borderRadius: BorderRadius.circular(15.0),
      border: Border.all(),
    ));
  }

  Widget _buildReadComponent() {
    return Container(
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(15.0),
        border: Border.all(),
      ),
      child: Column(
        children: [
          OutlinedButton(
              onPressed: () async {
                String resultText =
                    await _textWriteReadControllerPlugin.readFile();
                setState(() {
                  readText = resultText;
                });
              },
              child: Text('Read File')),
          Text('Result ↓'),
          Text(readText)
        ],
      ),
    );
  }
}
0
likes
135
points
57
downloads

Publisher

unverified uploader

Weekly Downloads

textfile read/write plugin

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter, path_provider, plugin_platform_interface

More

Packages that depend on text_write_read_controller

Packages that implement text_write_read_controller