mirror of
https://github.com/flame-engine/flame.git
synced 2025-10-30 16:36:57 +08:00
feat: Support text align on new text rendering pipeline (#3147)
Support text align on new text rendering pipeline.  
This commit is contained in:
@ -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),
|
||||
|
||||
Reference in New Issue
Block a user