CPのラベルが切れている

This commit is contained in:
2024-04-15 01:57:18 +09:00
parent 4ef42216f8
commit 41264c4d76
2 changed files with 47 additions and 32 deletions

View File

@ -140,8 +140,18 @@ class _MapWidgetState extends State<MapWidget> {
// Widget getMarkerShape(GeoJSONFeature i, BuildContext context) {
Widget getMarkerShape(GeoJSONFeature i) {
final String labelText = TextUtils.getDisplayTextFeture(i);
//final double maxWidth = labelText.length * 40.0;
String labelText = TextUtils.getDisplayTextFeture(i);
if( i.properties!['cp'] == 0 ){
labelText="Start/Goal";
}else if(i.properties!['cp'] == -1 ){
labelText="Start";
}else if(i.properties!['cp'] == -2 ){
labelText="Goal";
//}else{
// labelText=i.properties!['cp'];
}
//debugPrint("Text=${labelText}");
final double maxWidth = labelText.length * 16.0;
GeoJSONMultiPoint p = i.geometry as GeoJSONMultiPoint;
return InkWell(
onTap: () {
@ -174,7 +184,7 @@ class _MapWidgetState extends State<MapWidget> {
child: Stack(
fit: StackFit.expand,
children: [
Container(
Container( // マーカー
height: 32,
width: 32,
decoration: BoxDecoration(
@ -193,38 +203,41 @@ class _MapWidgetState extends State<MapWidget> {
Icons.circle,
size: 6.0,
),
i.properties!['cp'] == -1
? Transform.translate(
offset: const Offset(18, 0),
child: Transform.rotate(
alignment: Alignment.centerLeft,
origin: Offset.fromDirection(1, 26),
angle: 270 * pi / 180,
child: const Icon(
Icons.play_arrow_outlined,
color: Colors.red,
size: 70,
),
),
)
i.properties!['cp'] <= 0
? Transform.translate
(
offset: const Offset(-3, 0),
child: Transform.rotate(
alignment: Alignment.centerLeft,
origin: Offset.fromDirection(1, 26),
angle: 270 * pi / 180,
child: const Icon(
Icons.play_arrow_outlined,
color: Colors.red,
size: 70,
),
),
)
: Container(
color: Colors.transparent,
),
color: Colors.transparent,
),
],
),
),
Transform.translate(
offset: const Offset(30, 0),
child: Align(
alignment: Alignment.center,
child: Container(
alignment: Alignment.centerLeft,
child: Container (
width: 800, // 幅を指定
height: 40,
color: Colors.transparent,
constraints: const BoxConstraints(maxWidth: 500), // 最大幅を設定
//constraints: const BoxConstraints(maxWidth: 1000), // 最大幅を設定
//constraints: BoxConstraints(maxWidth: maxWidth), // 最大幅を設定
//color: Colors.purple.withOpacity(0.2),
child: Stack(
children: <Widget>[
Text(
Text( // アウトライン
labelText,
style: TextStyle(
fontSize: 16,
@ -234,24 +247,22 @@ class _MapWidgetState extends State<MapWidget> {
..strokeWidth = 2
..color = Colors.white,
),
overflow: TextOverflow.ellipsis, // テキストが長すぎる場合に`...`で省略
//softWrap: true, // 複数行に渡って表示
//overflow: TextOverflow.visible, // テキストが切れないように
maxLines: 1, // テキストを1行に制限
softWrap: false, // テキストの折り返しを無効化
),
Text(
Text( // テキスト
labelText,
//TextUtils.getDisplayTextFeture(i),
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w700,
color: Colors.black,
),
overflow: TextOverflow.ellipsis, // テキストが長すぎる場合に`...`で省略
//softWrap: true, // 複数行に渡って表示
//overflow: TextOverflow.visible, // テキストが切れないように
maxLines: 1, // テキストを1行に制限
softWrap: false, // テキストの折り返しを無効化
),
],
),
),
),
)