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

Markdown support for the Flame game engine, bridging the markdown package into Flame's text rendering pipeline.

example/lib/main.dart

import 'dart:async';

import 'package:flame/components.dart';
import 'package:flame/flame.dart';
import 'package:flame/game.dart';
import 'package:flame/text.dart';
import 'package:flame_markdown/flame_markdown.dart';
import 'package:flutter/widgets.dart' hide Animation;

void main() {
  runApp(GameWidget(game: MarkdownGame()));
}

/// This example game showcases the use of the FlameMarkdown package
/// to render rich-text components using a simple markdown syntax.
class MarkdownGame extends FlameGame {
  @override
  Future<void> onLoad() async {
    final markdown = await Flame.assets.readFile('fire_and_ice.md');
    await add(
      TextElementComponent.fromDocument(
        document: FlameMarkdown.toDocument(markdown),
        style: DocumentStyle(
          padding: const EdgeInsets.all(16),
        ),
        size: size,
      ),
    );
    await super.onLoad();
  }
}
2
likes
160
pub points
68%
popularity

Publisher

verified publisherflame-engine.org

Markdown support for the Flame game engine, bridging the markdown package into Flame's text rendering pipeline.

Repository (GitHub)
View/report issues
Contributing

Topics

#flame #markdown

Documentation

API reference

Funding

Consider supporting this project:

opencollective.com
github.com
patreon.com

License

MIT (LICENSE)

Dependencies

flame, flutter, markdown

More

Packages that depend on flame_markdown