markdown_flutter 0.0.12 copy "markdown_flutter: ^0.0.12" to clipboard
markdown_flutter: ^0.0.12 copied to clipboard

A Markdown Flutter library.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:general_lib_flutter/extension/build_context.dart';
import 'package:general_lib_flutter/widget/widget.dart';
import 'package:markdown_flutter/markdown_flutter.dart';

void main(List<String> args) {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(const App());
}

class App extends StatelessWidget {
  static final GeneralLibFlutterApp generalLibFlutterApp =
      GeneralLibFlutterApp();
  const App({super.key});

  @override
  Widget build(BuildContext context) {
    return GeneralLibFlutterAppMain(
      generalLibFlutterApp: generalLibFlutterApp,
      builder: (themeMode, lightTheme, darkTheme, widget) {
        final Widget child = MaterialApp(
          theme: lightTheme,
          themeMode: themeMode,
          darkTheme: darkTheme,
          debugShowCheckedModeBanner: false,
          home: MyApp(),
        );
        return child;
      },
    );
  }
}

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

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

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    // TODO: implement initState
    super.initState();
  }

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Markdown Flutter"),
      ),
      body: RefreshIndicator(
        onRefresh: () async {},
        child: SingleChildScrollView(
          child: ConstrainedBox(
            constraints: BoxConstraints(
              minHeight: context.height,
              minWidth: context.width,
            ),
            child: Column(
              children: [
                MarkdownFlutterWidget(
                  data: content_text,
                  shrinkWrap: true,
                  padding: EdgeInsets.all(5),
                ),
                SizedBox(
                  height: context.mediaQueryData.padding.bottom,
                ),
              ],
            ),
          ),
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          App.generalLibFlutterApp.autoChangeTheme(
            onChangeBrightness: () {
              return context.mediaQueryData.platformBrightness;
            },
          );
        },
      ),
    );
  }

  String get content_text {
    return """
![](/home/galaxeus/Documents/galaxeus/app/markdown_flutter/example/20240714_201411.png)

# Terminal Library
 
**Terminal Library** for dart and flutter support cross platform with user friendly, so this will help you to integrated terminal to your app without any hastle

## Demo
 

## đŸ“šī¸ Docs

1. [Documentation]({url_documentation})
2. [Youtube](https://youtube.com/azkadev)
3. [Telegram Support Group](https://t.me/{telegram_support_username})
4. [Contact Developer](https://github.com/azkadev) (check social media or readme profile github)

## đŸ”–ī¸ Features

1. [x] đŸ“ąī¸ **Cross Platform** support (Device)
2. [x] đŸ“œī¸ **Standarization** Style Code
3. [x] âŒ¨ī¸ **Cli** (Terminal for help you use this library or create project)
4. [x] đŸ”Ĩī¸ **Api** (If you developer bot / userbot you can use this library without interact cli just add library and use đŸš€ī¸)
5. [x] đŸ§Šī¸ **Customizable Extension** (if you want add extension so you can more speed up on development)
6. [x] âœ¨ī¸ **Pretty Information** (user friendly for newbie)
7. [x] đŸ”Ĩī¸ **Multi Function** One library with multi function (INCLUDE SSH CLIENT) so you can connect ssh terminal or acces file using SFTP without any hastle

## â”ī¸ Fun Fact

This library work on everywhere platform (cli, server, web, gui) ignore flutter flag only pub.dev

## Support

I Really need energy for make this library easy to use please help me like

1. [Sponsor / Donate Me On Github](https://github.com/azkadev)
2. [Follow My Youtube Account](https://youtube.com/@azkadev)
3. [Buy Services On Telegram Bot](https://t.me/azkadevbot?start=buy_services)

### đŸ“Ĩī¸ Install Library

1. **Dart**

```bash
dart pub add terminal_library
```

2. **Flutter**

```bash
flutter pub add terminal_library
```
 
## ? Who use this project / EXAMPLE PROJECT USE THIS LIBRARY


1. General Studio Developer App


2. General Bot App / General Automation App


3. General Application


## đŸš€ī¸ Quick Start

Example Quickstart script minimal for insight you or make you use this library because very simple 

```bash
// ignore_for_file: empty_catches, non_constant_identifier_names
import 'dart:convert';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:general_lib/general_lib.dart';
import 'package:general_lib_flutter/extension/build_context.dart';
import 'package:general_lib_flutter/widget/widget.dart';
import 'package:terminal_library/pty_library/pty_library.dart';
import 'package:terminal_library/xterm_library/xterm.dart';

void main(List<String> args) {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(const App());
}

class App extends StatelessWidget {
  static GeneralLibFlutterApp generalLibFlutterApp = GeneralLibFlutterApp();
  const App({super.key});
  @override
  Widget build(BuildContext context) {
    return GeneralLibFlutterAppMain(
      generalLibFlutterApp: generalLibFlutterApp,
      builder: (themeMode, lightTheme, darkTheme, widget) {
        Widget child = MaterialApp(
          theme: lightTheme,
          darkTheme: darkTheme,
          themeMode: themeMode,
          debugShowCheckedModeBanner: false,
          home: const MyApp(),
        );
        return child;
      },
    );
  }
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});
  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  TerminalLibraryFlutterController terminalLibraryFlutterController = TerminalLibraryFlutterController();
//  TerminalLibraryFlutterInputHandler terminalLibraryFlutterInputHandler = TerminalLibraryFlutterInputHandler;
  final TerminalLibraryFlutter terminalLibraryFlutter = TerminalLibraryFlutter(
    maxLines: 1000,
    // inputHandler:
  );
  late final PtyLibrary ptyLibrary;
  @override
  void initState() {
    super.initState();
    WidgetsBinding.instance.addPostFrameCallback((_) async {
      await refresh();
    });
  }

  @override
  void dispose() {
    ptyLibrary.kill();
    terminalLibraryFlutterController.dispose();
    super.dispose();
  }

  bool is_loading = false;
  Future<void> refresh() async {
    if (is_loading) {
      return;
    }
    setState(() {
      is_loading = true;
    });
    await Future(() async {
      await Future.delayed(Durations.short1);
      ptyLibrary = PtyLibrary.start(
        shell,
        columns: terminalLibraryFlutter.viewWidth,
        rows: terminalLibraryFlutter.viewHeight,
      );
      ptyLibrary.output.listen((event) {
        if (event.isNotEmpty) {
          try {
            terminalLibraryFlutter.write(utf8.decode(event, allowMalformed: true));
          } catch (e) {}
        }
      });
      terminalLibraryFlutter.onOutput = (String value) {
        if (value.isNotEmpty) {
          try {
            ptyLibrary.write(utf8.encode(value));
          } catch (e) {}
        }
      };
      terminalLibraryFlutter.onResize = (w, h, pw, ph) {
        ptyLibrary.resize(h, w);
      };
      terminalLibraryFlutter.buffer.clear();
      terminalLibraryFlutter.buffer.setCursor(0, 0);
      terminalLibraryFlutter.textInput("clear");
      terminalLibraryFlutter.keyInput(TerminalLibraryFlutterKey.enter);
      setState(() {});
    });
    setState(() {
      is_loading = false;
    });
  }

  @override
  Widget build(BuildContext context) {
    if (is_loading) {
      return Scaffold(
        body: Center(
          child: CircularProgressIndicator(
            color: context.theme.indicatorColor,
          ),
        ),
      );
    }
    return Scaffold(
      appBar: AppBar(
        title: const Text("Terminal Library:"),
      ),
      body: TerminalLibraryFlutterViewWidget(
        terminalLibraryFlutter,
        controller: terminalLibraryFlutterController,
        autofocus: true,
        backgroundOpacity: 0,
        simulateScroll: true,
        padding: const EdgeInsets.all(5),
        alwaysShowCursor: true,
        deleteDetection: Dart.isMobile,
      ),
    );
  }

  static String get shell {
    if (Platform.isMacOS || Platform.isLinux) {
      return Platform.environment['SHELL'] ?? 'bash';
    }
    if (Platform.isWindows) {
      return 'cmd.exe';
    }
    return 'sh';
  }
}
```

""";
  }
}
1
likes
120
points
75
downloads

Publisher

unverified uploader

Weekly Downloads

A Markdown Flutter library.

Homepage
Repository (GitHub)
View/report issues

Documentation

Documentation
API reference

Funding

Consider supporting this project:

github.com
github.com

License

unknown (license)

Dependencies

flutter, flutter_highlight, general_lib, general_lib_flutter, html, markdown, markdown_widget

More

Packages that depend on markdown_flutter