aagarwal1012 / aagarwal1012/Animated-Text-Kit

Text not aligning to center properly with AnimatedTextKit and DefaultTextStyle

Đang mở Phù hợp với người mới
#361 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Dart
Star
1.8k
Fork
321
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

I'm encountering an issue with aligning text to the center when using the `AnimatedTextKit` widget along with the `DefaultTextStyle` widget in Flutter. Despite specifying` textAlign: TextAlign.center` in `DefaultTextStyle`, the text isn't being aligned in the center of the widget.

**Steps to Reproduce:**

- Wrap an AnimatedTextKit widget inside DefaultTextStyle with textAlign: TextAlign.center.
- Set the style of the DefaultTextStyle and use TyperAnimatedText as one of the animated texts.
- The text appears misaligned or not centered as expected.

```
DefaultTextStyle(
textAlign: TextAlign.center,
style: contentTextStyle ??
AppTextStyle.kInter19x400.copyWith(
fontSize: 20.sp,
color: Colors.white,
),
child: AnimatedTextKit(
isRepeatingAnimation: false,
animatedTexts: [
TyperAnimatedText(
"${controller.chats[index].content?.toLowerCase()}",
speed: const Duration(
milliseconds: 30,
),
),
],
),
),

```

**Expected Behavior:**
The text should be properly centered within the AnimatedTextKit widget, respecting the textAlign: TextAlign.center property.

**Actual Behavior:**
The text is not aligned to the center as expected, even with textAlign: TextAlign.center set in the DefaultTextStyle.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Look at the AnimatedTextKit widget and its TyperAnimatedText implementation to see how text alignment is handled. Check if DefaultTextStyle's textAlign is being respected or overridden. Run the provided code snippet in a Flutter project to reproduce the issue, then examine the widget tree and alignment logic. The fix likely involves modifying the AnimatedTextKit or its animated text widgets to properly pass textAlign.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
dart, flutter
Lĩnh vực
frontend, mobile
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
65/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.