CPのラベルが切れている
This commit is contained in:
@ -5,13 +5,17 @@ class TextUtils {
|
|||||||
static String getDisplayTextFeture(GeoJSONFeature f) {
|
static String getDisplayTextFeture(GeoJSONFeature f) {
|
||||||
RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
|
RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
|
||||||
String txt = "";
|
String txt = "";
|
||||||
|
if (f.properties!["sub_loc_id"] != null) {
|
||||||
|
txt = "${f.properties!["sub_loc_id"]}";
|
||||||
|
}
|
||||||
// if(f.properties!["cp"] > 0){
|
// if(f.properties!["cp"] > 0){
|
||||||
// //print("-- sub-- ${f.properties!["cp"]} ----");
|
// //print("-- sub-- ${f.properties!["cp"]} ----");
|
||||||
// txt = "${f.properties!["cp"].toString().replaceAll(regex, '')}";
|
// txt = "${f.properties!["cp"].toString().replaceAll(regex, '')}";
|
||||||
// }
|
// }
|
||||||
//if(f.properties!["buy_point"] != null && f.properties!["buy_point"] > 0){
|
//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;
|
return txt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -140,8 +140,18 @@ class _MapWidgetState extends State<MapWidget> {
|
|||||||
|
|
||||||
// Widget getMarkerShape(GeoJSONFeature i, BuildContext context) {
|
// Widget getMarkerShape(GeoJSONFeature i, BuildContext context) {
|
||||||
Widget getMarkerShape(GeoJSONFeature i) {
|
Widget getMarkerShape(GeoJSONFeature i) {
|
||||||
final String labelText = TextUtils.getDisplayTextFeture(i);
|
String labelText = TextUtils.getDisplayTextFeture(i);
|
||||||
//final double maxWidth = labelText.length * 40.0;
|
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;
|
GeoJSONMultiPoint p = i.geometry as GeoJSONMultiPoint;
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
@ -174,7 +184,7 @@ class _MapWidgetState extends State<MapWidget> {
|
|||||||
child: Stack(
|
child: Stack(
|
||||||
fit: StackFit.expand,
|
fit: StackFit.expand,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container( // マーカー
|
||||||
height: 32,
|
height: 32,
|
||||||
width: 32,
|
width: 32,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -193,9 +203,10 @@ class _MapWidgetState extends State<MapWidget> {
|
|||||||
Icons.circle,
|
Icons.circle,
|
||||||
size: 6.0,
|
size: 6.0,
|
||||||
),
|
),
|
||||||
i.properties!['cp'] == -1
|
i.properties!['cp'] <= 0
|
||||||
? Transform.translate(
|
? Transform.translate
|
||||||
offset: const Offset(18, 0),
|
(
|
||||||
|
offset: const Offset(-3, 0),
|
||||||
child: Transform.rotate(
|
child: Transform.rotate(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
origin: Offset.fromDirection(1, 26),
|
origin: Offset.fromDirection(1, 26),
|
||||||
@ -216,15 +227,17 @@ class _MapWidgetState extends State<MapWidget> {
|
|||||||
Transform.translate(
|
Transform.translate(
|
||||||
offset: const Offset(30, 0),
|
offset: const Offset(30, 0),
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.centerLeft,
|
||||||
child: Container (
|
child: Container (
|
||||||
|
width: 800, // 幅を指定
|
||||||
|
height: 40,
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
constraints: const BoxConstraints(maxWidth: 500), // 最大幅を設定
|
//constraints: const BoxConstraints(maxWidth: 1000), // 最大幅を設定
|
||||||
//constraints: BoxConstraints(maxWidth: maxWidth), // 最大幅を設定
|
//constraints: BoxConstraints(maxWidth: maxWidth), // 最大幅を設定
|
||||||
//color: Colors.purple.withOpacity(0.2),
|
//color: Colors.purple.withOpacity(0.2),
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text( // アウトライン
|
||||||
labelText,
|
labelText,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
@ -234,24 +247,22 @@ class _MapWidgetState extends State<MapWidget> {
|
|||||||
..strokeWidth = 2
|
..strokeWidth = 2
|
||||||
..color = Colors.white,
|
..color = Colors.white,
|
||||||
),
|
),
|
||||||
overflow: TextOverflow.ellipsis, // テキストが長すぎる場合に`...`で省略
|
maxLines: 1, // テキストを1行に制限
|
||||||
//softWrap: true, // 複数行に渡って表示
|
softWrap: false, // テキストの折り返しを無効化
|
||||||
//overflow: TextOverflow.visible, // テキストが切れないように
|
|
||||||
),
|
),
|
||||||
Text(
|
Text( // テキスト
|
||||||
labelText,
|
labelText,
|
||||||
//TextUtils.getDisplayTextFeture(i),
|
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w700,
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
),
|
),
|
||||||
overflow: TextOverflow.ellipsis, // テキストが長すぎる場合に`...`で省略
|
maxLines: 1, // テキストを1行に制限
|
||||||
//softWrap: true, // 複数行に渡って表示
|
softWrap: false, // テキストの折り返しを無効化
|
||||||
//overflow: TextOverflow.visible, // テキストが切れないように
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user