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

A Flutter Console UI

example/lib/main.dart

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

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final navKey = GlobalKey<NavigatorState>();

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      navigatorKey: navKey,
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Flutter Console'),
        ),
        body: Center(
          child: GestureDetector(
            onTap: showLog,
              child: Container(
            height: 50,
            width: 100,
            color: Colors.purple,
            child: Center(
              child: Text(
                'show',
                style: TextStyle(color: Colors.white, fontSize: 18),
              ),
            ),
          )),
        ),
      ),
    );
  }

  void showLog() {
    ConsoleStream logStream = ConsoleStream();
    ConsoleOverlay().show(baseOverlay:navKey.currentState!.overlay!, contentStream: logStream, y: 300,);
    pushLog(logStream);
  }

  void pushLog(ConsoleStream cr) {
    cr.push('Show Log:' + DateTime.now().millisecondsSinceEpoch.toString());
    Future.delayed(const Duration(milliseconds: 1000), () {
      pushLog(cr);
    });
  }
}
3
likes
95
pub points
70%
popularity

Publisher

unverified uploader

A Flutter Console UI

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_console