CPのラベルが切れている
This commit is contained in:
@ -5,13 +5,17 @@ class TextUtils {
|
||||
static String getDisplayTextFeture(GeoJSONFeature f) {
|
||||
RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
|
||||
String txt = "";
|
||||
if (f.properties!["sub_loc_id"] != null) {
|
||||
txt = "${f.properties!["sub_loc_id"]}";
|
||||
}
|
||||
// if(f.properties!["cp"] > 0){
|
||||
// //print("-- sub-- ${f.properties!["cp"]} ----");
|
||||
// txt = "${f.properties!["cp"].toString().replaceAll(regex, '')}";
|
||||
// }
|
||||
//if(f.properties!["buy_point"] != null && f.properties!["buy_point"] > 0){
|
||||
txt = "$txt${f.properties!["sub_loc_id"]}";
|
||||
//txt = "$txt${f.properties!["sub_loc_id"]}";
|
||||
//}
|
||||
//print("Text = ${txt}");
|
||||
return txt;
|
||||
}
|
||||
|
||||
|
||||
@ -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,9 +203,10 @@ class _MapWidgetState extends State<MapWidget> {
|
||||
Icons.circle,
|
||||
size: 6.0,
|
||||
),
|
||||
i.properties!['cp'] == -1
|
||||
? Transform.translate(
|
||||
offset: const Offset(18, 0),
|
||||
i.properties!['cp'] <= 0
|
||||
? Transform.translate
|
||||
(
|
||||
offset: const Offset(-3, 0),
|
||||
child: Transform.rotate(
|
||||
alignment: Alignment.centerLeft,
|
||||
origin: Offset.fromDirection(1, 26),
|
||||
@ -216,15 +227,17 @@ class _MapWidgetState extends State<MapWidget> {
|
||||
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, // テキストの折り返しを無効化
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user