사전 정의된 글꼴 두께와 직관적인 사용자 정의 옵션을 통해 텍스트 스타일링을 간소화하는 플러터 패키지입니다. 즉시 사용 가능한 텍스트 구성 설정을 제공하여 개발자의 생산성을 높이고 반복 코드를 줄입니다. 이 위젯은 안드로이드, iOS, 웹, 맥OS, 윈도우, 리눅스 등 다양한 플랫폼을 지원하며 크로스플랫폼 애플리케이션에 적합합니다. 적용이 쉬운 스타일과 일관된 타이포그래피를 통해 UI 개발을 간소화하면서도 유연성을 유지합니다.
사용 사례
빠른 UI 프로토타이핑
크로스 플랫폼 텍스트 스타일링
화면 간 일관된 타이포그래피
반복되는 텍스트 코드 줄이기
빠른 테마 구현
주요 기능
사전 정의된 폰트 무게
간편한 스타일 문법
크로스 플랫폼 지원
최소한의 보일러플레이트
사용자 정의 가능한 외관
반응형 텍스트 처리
적합한 대상
초보자 플러터 개발자
일관성을 우선시하는 팀
자주 텍스트가 업데이트되는 앱
빠른 UI 반복이 필요한 프로젝트
복잡성보다 단순성을 추구하는 개발자
고려 사항
텍스트 전용 기능에 한정
복잡한 애니메이션에 적합하지 않습니다
고급 효과를 위해 추가 패키지가 필요할 수 있습니다
특수한 경우에 원시 텍스트 위젯보다 유연성이 낮음
업데이트를 위해 외부 소스 코드에 의존합니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
Simplified Text Widget Package
A Flutter package that provides beautifully styled text widgets with enforced font consistency.
📦 Installation
Use this package as a library
🔗 Depend on it
Run this command:
With Flutter:
flutter pub add simplified_text_widget
🚀 Getting Started
[!IMPORTANT]
⚙️ Configuration
Before using the widgets, you must initialize the SimplifiedTextWidgetConfig in your main() function. This class controls the global behavior, responsiveness, and default styles for all text variants.
import'package:simplified_text_widget/simplified_text_widget.dart';
voidmain() {
SimplifiedTextWidgetConfig.config(
responsiveFonts: bool, **required** // Enable/Disable font responsiveness globally
maxSizeMultiplier: double, (optional) // Max font scale factor (Default: 1.5)
baseScreenWidth: double, (optional) // Design width for calculation (Default: 375)
defaultFontWeight: FontWeight, (optional) // Default weight for Text[size] variants
defaultColor: Color (optional) // Default color for all widgets (Default: Color(0xFF000000))
);
runApp(constMyApp());
}
Configuration Options
Property
Type
Default
Description
responsiveFonts
bool
required
Whether fonts should scale based on screen width.
maxSizeMultiplier
double
1.5
Limits how large the font can grow on large screens.
baseScreenWidth
double
375
The screen width (in logical pixels) your UI was designed for.
defaultFontWeight
DefaultFontWeight
w500
The weight used by base Text[size] variants (e.g., Text14).
defaultColor
Color
Color(0xFF000000)
The fallback color if no color is provided to a widget.
📐 How Responsiveness Works
When responsiveFonts is set to true, the font size is calculated dynamically based on the current screen width.
Example Calculations
Assuming baseScreenWidth: 375 (Default):
Initial Size
Current Width
Multiplier
Resulting Size
14px
375px (Mobile)
1.5x
14.0px
14px
562px (Tablet)
1.5x
21.0px
14px
750px (Desktop)
1.5x
21.0px (Clamped by 1.5x)
14px
750px (Desktop)
2.0x
28.0px
Features
Centrally Managed Configuration: Introducing SimplifiedTextWidgetConfig to control global defaults like color and font weight across your entire app.
Smart Responsiveness: Effortlessly scale your typography based on baseScreenWidth with built-in maxSizeMultiplier guards to ensure readability on cross platform.
Rich Debug Logging: Get instant visibility into your global setup with beautifully formatted console logs, featuring color previews for your defaultColor.
Global Default Color: Declare a fallback defaultColor (e.g., Colors.navy) during initialization to maintain brand consistency without repeating color parameters.
Base Variants: Simplified usage with Text[size] (e.g., Text14) which dynamically inherits your globally configured font weight.
[!IMPORTANT]
If migrating from an older version, add this in main() to avoid any error.
import'package:simplified_text_widget/simplified_text_widget.dart';
SimplifiedTextWidgetConfig.config(
responsiveFonts: false// false if you don't need responsiveness
);
To boost your productivity and ensure consistency, we've included a set of VS Code snippets to instantly generate styled text widgets with predefined font sizes and weights.
✅ How to Use
1. Open VS Code
2. Go to `Preferences` → `Configure Snippets`
3. Choose `dart.json` (or create if it doesn't exist)
4. Copy contents from the root `dart.json` file in this package
5. Save and restart VS Code
Now you can type shortcuts like:
t14w4 → Text14w400('Your text here')
t18w7 → Text18w700('Bold title')