성운명 오류 문구 줄바꿈 · 옛 행성 그림 통일 · 광고 안내 모달 줄바꿈
This commit is contained in:
@@ -3,6 +3,14 @@ import 'package:flutter/material.dart';
|
|||||||
import '../i18n/app_locale.dart';
|
import '../i18n/app_locale.dart';
|
||||||
import '../theme/tokens.dart';
|
import '../theme/tokens.dart';
|
||||||
|
|
||||||
|
/// 한국어 어절 단위 줄바꿈 — 글자 사이에 WORD JOINER(U+2060)를 넣어 공백에서만 줄을 바꾼다.
|
||||||
|
/// Flutter 는 한글을 음절마다 끊어 「얻으세 / 요.」처럼 낱말 중간에서 줄을 바꾼다(10/6 실기기 D-4).
|
||||||
|
/// 한 어절이 한 줄보다 길면 그 어절만 글자 단위로 끊긴다(엔진 기본).
|
||||||
|
String keepWords(String text) => text.splitMapJoin(
|
||||||
|
RegExp(r'\s+'),
|
||||||
|
onNonMatch: (word) => word.characters.join('\u2060'),
|
||||||
|
);
|
||||||
|
|
||||||
/// 앱 공통 확인 창 — Figma `2066:17799`(행성 생성 확인) · `554:24669`(설정 확인 팝업).
|
/// 앱 공통 확인 창 — Figma `2066:17799`(행성 생성 확인) · `554:24669`(설정 확인 팝업).
|
||||||
///
|
///
|
||||||
/// 카드 312 폭 · #282828 r12 · 안쪽 24/16 · 문구 16/600 가운데 정렬,
|
/// 카드 312 폭 · #282828 r12 · 안쪽 24/16 · 문구 16/600 가운데 정렬,
|
||||||
|
|||||||
@@ -54,6 +54,35 @@ class LivePlanet25D extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 정지 그림의 실시간판 — 지켜보는 행성의 형태 · 색, 없으면 [planetFallbackImage].
|
||||||
|
/// 히어로([LivePlanet25D])와 같은 원천이라 접힌 앱 바의 작은 그림이 히어로와 갈리지 않는다.
|
||||||
|
class LivePlanetArt extends StatelessWidget {
|
||||||
|
const LivePlanetArt({
|
||||||
|
super.key,
|
||||||
|
required this.fandomId,
|
||||||
|
required this.watch,
|
||||||
|
required this.size,
|
||||||
|
this.nebula = false,
|
||||||
|
});
|
||||||
|
final String fandomId;
|
||||||
|
final PlanetWatch watch;
|
||||||
|
final double size;
|
||||||
|
final bool nebula;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) => LiveStreamBuilder<PlanetVisualState>(
|
||||||
|
key: ValueKey(('planet-art', fandomId)),
|
||||||
|
create: () => watch(fandomId),
|
||||||
|
builder: (context, state) => PlanetArt(
|
||||||
|
fallback: planetFallbackImage(fandomId, nebula: nebula),
|
||||||
|
planetType: nebula ? null : state?.planetType,
|
||||||
|
colorKey: state?.colorKey,
|
||||||
|
width: size,
|
||||||
|
height: size,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/// 배경 광량만 바꿔 콘텐츠의 가독성과 화면 구조는 유지한다.
|
/// 배경 광량만 바꿔 콘텐츠의 가독성과 화면 구조는 유지한다.
|
||||||
class LivePlanetLighting extends StatelessWidget {
|
class LivePlanetLighting extends StatelessWidget {
|
||||||
const LivePlanetLighting({
|
const LivePlanetLighting({
|
||||||
|
|||||||
@@ -71,6 +71,16 @@ String? planetShapeImage(String? planetType) {
|
|||||||
return n == null ? null : 'assets/figma/planet-shape-$n.png';
|
return n == null ? null : 'assets/figma/planet-shape-$n.png';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 형태(`planetType`)가 없는 행성 · 성운의 그림 — **앱 전체가 이 한 함수로 고른다.** 화면마다
|
||||||
|
/// 따로 고르면 같은 옛 행성이 내 행성 격자에서는 파란 행성, 검색 · 상세에서는 보라 행성으로
|
||||||
|
/// 달라진다(10/6 실기기 C-5). 성운은 성운 그림, 행성은 시안 행성 그림 두 장 중 id 로 하나.
|
||||||
|
// ponytail: 형태 없는 옛 데이터용 고정 두 그림. 모든 행성에 형태가 생기면 지운다.
|
||||||
|
String planetFallbackImage(String id, {bool nebula = false}) => nebula
|
||||||
|
? 'assets/figma/nebula-card.png'
|
||||||
|
: id.codeUnits.fold<int>(0, (a, c) => a + c).isEven
|
||||||
|
? 'assets/figma/planet-detail-hero.png'
|
||||||
|
: 'assets/figma/planet-earth.png';
|
||||||
|
|
||||||
/// 정지 그림 — 형태 · 색을 입힌 행성(목록 카드 · MY). 형태가 없으면 [fallback] 그림 그대로다.
|
/// 정지 그림 — 형태 · 색을 입힌 행성(목록 카드 · MY). 형태가 없으면 [fallback] 그림 그대로다.
|
||||||
/// 색은 [Planet25D] 와 같은 곱하기 합성이다.
|
/// 색은 [Planet25D] 와 같은 곱하기 합성이다.
|
||||||
class PlanetArt extends StatelessWidget {
|
class PlanetArt extends StatelessWidget {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import '../../core/data/planet_visual_state.dart';
|
|||||||
import '../../core/theme/tokens.dart';
|
import '../../core/theme/tokens.dart';
|
||||||
import '../../core/ui/app_dialog.dart';
|
import '../../core/ui/app_dialog.dart';
|
||||||
import '../../core/ui/app_icons.dart';
|
import '../../core/ui/app_icons.dart';
|
||||||
import '../../core/ui/planet_25d.dart' show PlanetArt;
|
import '../../core/ui/planet_25d.dart' show PlanetArt, planetFallbackImage;
|
||||||
import '../notification/notification_screen.dart';
|
import '../notification/notification_screen.dart';
|
||||||
import '../eclipse/eclipse_data.dart';
|
import '../eclipse/eclipse_data.dart';
|
||||||
import '../eclipse/widgets/eclipse_banner.dart';
|
import '../eclipse/widgets/eclipse_banner.dart';
|
||||||
@@ -31,13 +31,10 @@ class GalaxyHomeScreen extends StatefulWidget {
|
|||||||
/// 카드 그림 — HOME · 맵과 같이 팬덤 `stage` 로 고른다. Stage0 성운만 성운 그림이고
|
/// 카드 그림 — HOME · 맵과 같이 팬덤 `stage` 로 고른다. Stage0 성운만 성운 그림이고
|
||||||
/// 정식 행성은 시안 행성 그림(`image 8` · 파란 행성 벡터)을 칸마다 번갈아 쓴다.
|
/// 정식 행성은 시안 행성 그림(`image 8` · 파란 행성 벡터)을 칸마다 번갈아 쓴다.
|
||||||
/// 예전엔 칸 순서로 골라 둘째 칸이 행성이어도 성운 그림이 됐다.
|
/// 예전엔 칸 순서로 골라 둘째 칸이 행성이어도 성운 그림이 됐다.
|
||||||
// ponytail: 형태가 없는 행성(옛 데이터)만 고정된 두 그림 중 하나(id 기준). 형태가 있으면
|
// 형태가 없는 행성(옛 데이터)만 [planetFallbackImage]. 형태가 있으면
|
||||||
// 카드가 [PlanetArt] 로 생성 때 고른 형태 · 색을 그린다.
|
// 카드가 [PlanetArt] 로 생성 때 고른 형태 · 색을 그린다.
|
||||||
static String cardImageOf(PlanetNode p, [int _ = 0]) => p.stage == 0
|
static String cardImageOf(PlanetNode p, [int _ = 0]) =>
|
||||||
? 'assets/figma/nebula-card.png'
|
planetFallbackImage(p.id, nebula: p.stage == 0);
|
||||||
: (p.id.codeUnits.fold<int>(0, (a, c) => a + c).isEven
|
|
||||||
? 'assets/figma/planet-detail-hero.png'
|
|
||||||
: 'assets/figma/planet-earth.png');
|
|
||||||
|
|
||||||
const GalaxyHomeScreen({
|
const GalaxyHomeScreen({
|
||||||
super.key,
|
super.key,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import 'package:shared_preferences/shared_preferences.dart';
|
|||||||
|
|
||||||
import '../../core/theme/tokens.dart';
|
import '../../core/theme/tokens.dart';
|
||||||
import '../../core/data/backend.dart' show BackendException;
|
import '../../core/data/backend.dart' show BackendException;
|
||||||
import '../../core/ui/planet_25d.dart' show PlanetArt;
|
import '../../core/ui/planet_25d.dart' show PlanetArt, planetFallbackImage;
|
||||||
import '../../core/ui/play_banner.dart';
|
import '../../core/ui/play_banner.dart';
|
||||||
import '../planet/widgets/fandom_size_badge.dart';
|
import '../planet/widgets/fandom_size_badge.dart';
|
||||||
import 'galaxy_data.dart';
|
import 'galaxy_data.dart';
|
||||||
@@ -546,9 +546,7 @@ class _Hit extends StatelessWidget {
|
|||||||
SizedBox.square(
|
SizedBox.square(
|
||||||
dimension: 70,
|
dimension: 70,
|
||||||
child: PlanetArt(
|
child: PlanetArt(
|
||||||
fallback: nebula
|
fallback: planetFallbackImage(planet.id, nebula: nebula),
|
||||||
? 'assets/figma/nebula-card.png'
|
|
||||||
: 'assets/figma/planet-detail-hero.png',
|
|
||||||
planetType: nebula ? null : planet.planetType,
|
planetType: nebula ? null : planet.planetType,
|
||||||
colorKey: planet.colorKey,
|
colorKey: planet.colorKey,
|
||||||
semanticLabel: planet.name,
|
semanticLabel: planet.name,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
|
|||||||
|
|
||||||
import '../../../core/theme/tokens.dart';
|
import '../../../core/theme/tokens.dart';
|
||||||
import '../../../core/ui/live_planet.dart';
|
import '../../../core/ui/live_planet.dart';
|
||||||
import '../../../core/ui/planet_25d.dart' show planetShapeImage;
|
import '../../../core/ui/planet_25d.dart' show planetFallbackImage, planetShapeImage;
|
||||||
import '../../../core/data/planet_visual_state.dart';
|
import '../../../core/data/planet_visual_state.dart';
|
||||||
import '../galaxy_data.dart';
|
import '../galaxy_data.dart';
|
||||||
import '../galaxy_motion.dart';
|
import '../galaxy_motion.dart';
|
||||||
@@ -134,15 +134,10 @@ class GalaxyField extends StatelessWidget {
|
|||||||
return radiusOf(p) * depthScaleOf(at);
|
return radiusOf(p) * depthScaleOf(at);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 행성 일러스트 — 생성 때 고른 형태([planetShapeImage]). 형태가 없는 행성(성운 · 옛 데이터)만
|
/// 행성 일러스트 — 생성 때 고른 형태([planetShapeImage]). 형태가 없는 행성(성운 · 옛 데이터)은
|
||||||
/// 내 행성은 홈과 같은 그림, 나머지는 시안 행성 2종을 돌려 쓴다. 색은 [LivePlanet25D] 가 입힌다.
|
/// 다른 화면과 같은 [planetFallbackImage](10/6 C-5). 색은 [LivePlanet25D] 가 입힌다.
|
||||||
static String imageOf(PlanetNode p, int index) =>
|
static String imageOf(PlanetNode p, int index) =>
|
||||||
planetShapeImage(p.planetType) ??
|
planetShapeImage(p.planetType) ?? planetFallbackImage(p.id);
|
||||||
(p.isMine
|
|
||||||
? 'assets/figma/planet-home.png'
|
|
||||||
: (index.isEven
|
|
||||||
? 'assets/figma/planet-1.png'
|
|
||||||
: 'assets/figma/planet-2.png'));
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|||||||
@@ -137,8 +137,10 @@ class _NebulaCreateScreenState extends State<NebulaCreateScreen> {
|
|||||||
const SizedBox(height: AppSpace.s5),
|
const SizedBox(height: AppSpace.s5),
|
||||||
_NameInput(controller: _name, error: _taken || _invalid),
|
_NameInput(controller: _name, error: _taken || _invalid),
|
||||||
const SizedBox(height: 6),
|
const SizedBox(height: 6),
|
||||||
SizedBox(
|
// 한 줄 자리(17)는 비어 있어도 잡아 두되, 두 줄 문구는 잘리지 않게 늘어난다
|
||||||
height: 17,
|
// (10/6 실기기 「…연속/앞뒤 공」 잘림).
|
||||||
|
ConstrainedBox(
|
||||||
|
constraints: const BoxConstraints(minHeight: 17),
|
||||||
child: _taken || _invalid
|
child: _taken || _invalid
|
||||||
? Text(
|
? Text(
|
||||||
_taken
|
_taken
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import 'package:flutter/material.dart';
|
|||||||
import '../../../core/theme/tokens.dart';
|
import '../../../core/theme/tokens.dart';
|
||||||
import '../../../core/ui/app_icons.dart';
|
import '../../../core/ui/app_icons.dart';
|
||||||
import '../../../core/ui/live_planet.dart';
|
import '../../../core/ui/live_planet.dart';
|
||||||
|
import '../../../core/ui/planet_25d.dart' show planetFallbackImage;
|
||||||
import '../../../core/data/planet_visual_state.dart';
|
import '../../../core/data/planet_visual_state.dart';
|
||||||
import '../home_data.dart';
|
import '../home_data.dart';
|
||||||
import '../home_screen.dart' show formatPop;
|
import '../home_screen.dart' show formatPop;
|
||||||
@@ -220,8 +221,8 @@ class _HomeHeroState extends State<HomeHero> {
|
|||||||
fandomId: fandomId,
|
fandomId: fandomId,
|
||||||
watch: watchPlanet,
|
watch: watchPlanet,
|
||||||
stage: growth.stage,
|
stage: growth.stage,
|
||||||
image:
|
// 형태 없는 옛 행성은 다른 화면과 같은 그림(10/6 C-5).
|
||||||
'assets/figma/planet-home.png',
|
image: planetFallbackImage(fandomId),
|
||||||
size: math.min(
|
size: math.min(
|
||||||
planet,
|
planet,
|
||||||
box.maxHeight,
|
box.maxHeight,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../core/theme/tokens.dart';
|
import '../../core/theme/tokens.dart';
|
||||||
import '../../core/ui/planet_25d.dart' show PlanetArt;
|
import '../../core/ui/planet_25d.dart' show PlanetArt, planetFallbackImage;
|
||||||
import '../home/home_screen.dart' show formatPop;
|
import '../home/home_screen.dart' show formatPop;
|
||||||
import '../planet/planet_data.dart' show PlanetRepositoryFactory;
|
import '../planet/planet_data.dart' show PlanetRepositoryFactory;
|
||||||
import '../planet/planet_history_screen.dart';
|
import '../planet/planet_history_screen.dart';
|
||||||
@@ -214,7 +214,7 @@ class _PlanetCard extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
PlanetArt(
|
PlanetArt(
|
||||||
fallback: 'assets/figma/my-planet-1.png',
|
fallback: planetFallbackImage(planet.fandomId),
|
||||||
planetType: planet.planetType,
|
planetType: planet.planetType,
|
||||||
colorKey: planet.colorKey,
|
colorKey: planet.colorKey,
|
||||||
width: 60,
|
width: 60,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../core/theme/tokens.dart';
|
import '../../core/theme/tokens.dart';
|
||||||
import '../../core/ui/planet_25d.dart' show PlanetArt;
|
import '../../core/ui/planet_25d.dart' show PlanetArt, planetFallbackImage;
|
||||||
import 'planet_data.dart';
|
import 'planet_data.dart';
|
||||||
import 'widgets/action_sheet.dart';
|
import 'widgets/action_sheet.dart';
|
||||||
import '../../core/i18n/app_locale.dart';
|
import '../../core/i18n/app_locale.dart';
|
||||||
@@ -412,7 +412,7 @@ Widget _avatar(int index, double size, {bool planet = false, FpiRankRow? row}) =
|
|||||||
? SizedBox.square(
|
? SizedBox.square(
|
||||||
dimension: size,
|
dimension: size,
|
||||||
child: PlanetArt(
|
child: PlanetArt(
|
||||||
fallback: 'assets/figma/planet-detail-hero.png',
|
fallback: planetFallbackImage(row?.id ?? ''),
|
||||||
planetType: row?.planetType,
|
planetType: row?.planetType,
|
||||||
colorKey: row?.colorKey,
|
colorKey: row?.colorKey,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import '../campaign/widgets/campaign_rank.dart' show RankPodium;
|
|||||||
|
|
||||||
import '../../core/data/backend.dart' show BackendException;
|
import '../../core/data/backend.dart' show BackendException;
|
||||||
import '../../core/data/planet_visual_state.dart';
|
import '../../core/data/planet_visual_state.dart';
|
||||||
|
import '../../core/ui/live_planet.dart' show LivePlanetArt;
|
||||||
|
|
||||||
import '../../core/theme/tokens.dart';
|
import '../../core/theme/tokens.dart';
|
||||||
import '../../core/ui/app_dialog.dart';
|
import '../../core/ui/app_dialog.dart';
|
||||||
@@ -158,6 +159,7 @@ class _PlanetDetailScreenState extends State<PlanetDetailScreen> {
|
|||||||
],
|
],
|
||||||
flexibleSpace: _CollapsingHero(
|
flexibleSpace: _CollapsingHero(
|
||||||
detail: d,
|
detail: d,
|
||||||
|
watchPlanet: widget.watchPlanet,
|
||||||
min: top + kToolbarHeight + _tabHeight,
|
min: top + kToolbarHeight + _tabHeight,
|
||||||
hero: PlanetDetailHero(
|
hero: PlanetDetailHero(
|
||||||
fandomId: d.fandomId,
|
fandomId: d.fandomId,
|
||||||
@@ -322,9 +324,11 @@ class _CollapsingHero extends StatelessWidget {
|
|||||||
required this.detail,
|
required this.detail,
|
||||||
required this.min,
|
required this.min,
|
||||||
required this.hero,
|
required this.hero,
|
||||||
|
required this.watchPlanet,
|
||||||
});
|
});
|
||||||
|
|
||||||
final PlanetDetail detail;
|
final PlanetDetail detail;
|
||||||
|
final PlanetWatch watchPlanet;
|
||||||
final double min;
|
final double min;
|
||||||
final Widget hero;
|
final Widget hero;
|
||||||
|
|
||||||
@@ -356,10 +360,11 @@ class _CollapsingHero extends StatelessWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Image.asset(
|
LivePlanetArt(
|
||||||
'assets/figma/planet-detail-hero.png',
|
fandomId: detail.fandomId,
|
||||||
width: 28,
|
watch: watchPlanet,
|
||||||
height: 28,
|
size: 28,
|
||||||
|
nebula: detail.isNebula,
|
||||||
),
|
),
|
||||||
const SizedBox(width: AppSpace.s2),
|
const SizedBox(width: AppSpace.s2),
|
||||||
Flexible(
|
Flexible(
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
|||||||
|
|
||||||
import '../../../core/theme/tokens.dart';
|
import '../../../core/theme/tokens.dart';
|
||||||
import '../../../core/ui/live_planet.dart';
|
import '../../../core/ui/live_planet.dart';
|
||||||
|
import '../../../core/ui/planet_25d.dart' show planetFallbackImage;
|
||||||
import '../../../core/data/planet_visual_state.dart';
|
import '../../../core/data/planet_visual_state.dart';
|
||||||
import '../../home/home_screen.dart' show formatPop;
|
import '../../home/home_screen.dart' show formatPop;
|
||||||
import '../../../core/i18n/app_locale.dart';
|
import '../../../core/i18n/app_locale.dart';
|
||||||
@@ -155,7 +156,9 @@ class PlanetDetailHero extends StatelessWidget {
|
|||||||
onOpenHistory: onOpenHistory,
|
onOpenHistory: onOpenHistory,
|
||||||
fandomId: fandomId,
|
fandomId: fandomId,
|
||||||
watch: watchPlanet,
|
watch: watchPlanet,
|
||||||
image: 'assets/figma/planet-detail-hero.png',
|
image: nebula
|
||||||
|
? 'assets/figma/planet-detail-hero.png'
|
||||||
|
: planetFallbackImage(fandomId),
|
||||||
size: 200,
|
size: 200,
|
||||||
glow: AppColors.neonViolet,
|
glow: AppColors.neonViolet,
|
||||||
stage: stage,
|
stage: stage,
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import '../../core/monetization/store.dart';
|
|||||||
import '../home/home_screen.dart' show formatPop;
|
import '../home/home_screen.dart' show formatPop;
|
||||||
|
|
||||||
import '../../core/theme/tokens.dart';
|
import '../../core/theme/tokens.dart';
|
||||||
|
import '../../core/ui/app_dialog.dart' show keepWords;
|
||||||
import '../../core/ui/app_icons.dart';
|
import '../../core/ui/app_icons.dart';
|
||||||
import '../../core/i18n/app_locale.dart';
|
import '../../core/i18n/app_locale.dart';
|
||||||
|
|
||||||
@@ -62,7 +63,8 @@ class _AdBonusDialog extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
Text(
|
Text(
|
||||||
context.l10n.adMoreChance,
|
// 25pt 두 줄 제목 — 낱말 중간(「얻으세 / 요.」)이 아니라 어절에서 바꾼다.
|
||||||
|
keepWords(context.l10n.adMoreChance),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 25,
|
fontSize: 25,
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
import 'package:fancake/core/ui/app_dialog.dart' show keepWords;
|
||||||
|
import 'package:flutter/painting.dart';
|
||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
|
||||||
|
/// 10/6 실기기 D-4 — 광고 안내 모달 제목이 「얻으세 / 요.」로 낱말 중간에서 바뀌었다.
|
||||||
|
void main() {
|
||||||
|
test('줄은 공백에서만 바뀐다', () {
|
||||||
|
const text = '더 많은 기여의 기회를 얻으세요.';
|
||||||
|
final joined = keepWords(text);
|
||||||
|
expect(joined.replaceAll('', ''), text);
|
||||||
|
// 여러 폭에서 줄 끝이 늘 공백 앞뒤다.
|
||||||
|
// 가장 긴 어절(「얻으세요.」)보다 넓은 폭만 — 그보다 좁으면 엔진이 어절 안을 끊는다.
|
||||||
|
for (var width = 160.0; width <= 400; width += 7) {
|
||||||
|
final painter = TextPainter(
|
||||||
|
text: TextSpan(text: joined, style: const TextStyle(fontSize: 25)),
|
||||||
|
textDirection: TextDirection.ltr,
|
||||||
|
)..layout(maxWidth: width);
|
||||||
|
for (final line in painter.computeLineMetrics().skip(1)) {
|
||||||
|
final start = painter
|
||||||
|
.getPositionForOffset(Offset(0, line.baseline - line.ascent + 1))
|
||||||
|
.offset;
|
||||||
|
expect(
|
||||||
|
start == 0 || joined[start - 1] == ' ',
|
||||||
|
isTrue,
|
||||||
|
reason: 'width $width: 「${joined.substring(start).replaceAll('', '')}」',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user