feat: Support text align on new text rendering pipeline (#3147)

Support text align on new text rendering pipeline.

![image](https://github.com/flame-engine/flame/assets/882703/62f91c8e-f38f-48b0-8c59-06efb10acdf3)

![image](https://github.com/flame-engine/flame/assets/882703/b00afb90-6051-4a2c-aac6-ac36ea1bcba2)
This commit is contained in:
Luan Nico
2024-05-06 08:13:10 -04:00
committed by GitHub
parent ce9392abd8
commit 194d553656
4 changed files with 44 additions and 2 deletions

View File

@ -4,6 +4,10 @@ import 'package:flame/text.dart';
import 'package:flutter/painting.dart';
class RichTextExample extends FlameGame {
final TextAlign textAlign;
RichTextExample({this.textAlign = TextAlign.left});
static const String description =
'A non-interactive example of how to render rich text in Flame.';
@ -23,11 +27,15 @@ class RichTextExample extends FlameGame {
),
paragraph: BlockStyle(
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
textAlign: textAlign,
background: BackgroundStyle(
color: const Color(0xFF004D40),
borderColor: const Color(0xFFAAAAAA),
),
),
header1: BlockStyle(
textAlign: textAlign,
),
);
final document = DocumentRoot([
HeaderNode.simple('1984', level: 1),