Code Monkey home page Code Monkey logo

flutter_console's Introduction

Flutter console

With flutter console we can draw a console that allows us to scan and print data as well as being able to configure its size and colors.

Installation

Add to pubspec.yaml:

dependencies:
    flutter_console_widget: ^0.0.3

How to use

Attributes

  • Color? consoleBackground: background color of the console.
  • Color? consoleTextColor: color of the console text.
  • FlutterConsoleController controller: console controller.
  • double height: height of the console.
  • Color? inputBackground: background color of the text input field.
  • Color? inputTextColor: color of the text of the text input field.
  • Color? scrollColor: color of the scroll bar.
  • double width: width of the console.

FlutterConsoleController

Attributes:

  • FocusNode focusNode: focus node for the text input field.
  • TextEditingController inputController: controller of the text input field.
  • ScrollController scrollController: controller of the scroll bar.
  • Completer completer: completer object to manage the readings of the text input field.
  • FlutterConsoleData value: console data object.

Methods:

  • FlutterConsoleController: constructor of the class.
  • show: show the console.
  • hide: hides the console.
  • print: write a message to the console.
  • scan: reads a value from the text input field.
  • clear: clears the content of the console.

Example

import 'package:flutter/material.dart';
import 'package:flutter_console_widget/flutter_console.dart';

class HomePage extends StatelessWidget {
  HomePage({
    super.key,
  });

  final FlutterConsoleController controller = FlutterConsoleController();

  void echoLoop() {
    controller.scan().then((value) {
      controller.print(message: value, endline: true);
      controller.focusNode.requestFocus();
      echoLoop();
    });
  }

  @override
  Widget build(BuildContext context) {
    echoLoop();
    final size = MediaQuery.of(context).size;
    return Scaffold(
      appBar: AppBar(
        title: const Text('Example'),
      ),
      body: FlutterConsole(
        controller: controller,
        height: size.height,
        width: size.width,
      ),
    );
  }
}

flutter_console's People

Contributors

semakers avatar limcheekin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.