"/" にファイルをアップロード

各ポジション選定の条件の作り替え、希少プレースタイルのオンオフ機能追加
This commit is contained in:
2025-12-16 11:54:03 +09:00
parent e4a0f60f3c
commit a34ea86cbc
3 changed files with 531 additions and 122 deletions

View File

@@ -57,101 +57,105 @@ class _HomeScreenState extends State<HomeScreen> {
return Colors.grey;
}
// カード:表示はプレースタイルのみ
Widget _buildPlayerCard(String pos, String style) {
final color = _getColor(pos);
Widget _buildPlayerCard(String pos, String style) {
final color = _getColor(pos);
return Container(
width: 80,
height: 60,
decoration: BoxDecoration(
color: color.withOpacity(0.9),
borderRadius: BorderRadius.circular(10),
border: Border.all(color: Colors.white, width: 1),
),
padding: const EdgeInsets.all(4),
child: Center(
child: Text(
style,
textAlign: TextAlign.center,
maxLines: 3,
overflow: TextOverflow.ellipsis,
return Container(
width: 80,
height: 60,
decoration: BoxDecoration(
color: color.withOpacity(0.9),
borderRadius: BorderRadius.circular(10),
border: Border.all(color: Colors.white, width: 1),
),
padding: const EdgeInsets.all(4),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
pos, // ★ポジション表示復活
style: const TextStyle(
color: Colors.white,
fontSize: 11,
fontWeight: FontWeight.bold,
),
),
),
);
}
const SizedBox(height: 2),
Text(
style, // プレースタイル
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: const TextStyle(
color: Colors.white,
fontSize: 10,
),
),
],
),
);
}
// ピッチにカードを並べる
Widget _buildPitch(String formation, List<Map<String, String>> roles) {
final layout = formationLayouts[formation];
if (layout == null) {
return Center(
child: Text(
'レイアウトが定義されていません: $formation',
style: const TextStyle(color: Colors.white),
),
);
}
Widget _buildPitch(String formation, List<Map<String, String>> roles) {
// ★ 直接 formationLayouts を見ず、getFormationLayout を使う
final layout = getFormationLayout(formation);
return LayoutBuilder(
builder: (context, constraints) {
final width = constraints.maxWidth;
final height = constraints.maxHeight;
const cardW = 80.0;
const cardH = 60.0;
return LayoutBuilder(
builder: (context, constraints) {
final width = constraints.maxWidth;
final height = constraints.maxHeight;
const cardW = 80.0;
const cardH = 60.0;
final List<Widget> children = [];
final List<Widget> children = [];
// 背景(ピッチ)
children.add(Container(
width: width,
height: height,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.green.shade800, Colors.green.shade700],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
// 背景
children.add(Container(
width: width,
height: height,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.green.shade800, Colors.green.shade700],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
));
),
));
int index = 0;
int index = 0;
for (int row = 0; row < layout.length; row++) {
for (int col = 0; col < layout[row].length; col++) {
if (index >= roles.length) break;
for (int row = 0; row < layout.length; row++) {
for (int col = 0; col < layout[row].length; col++) {
if (index >= roles.length) break;
final posData = roles[index];
index++;
final posData = roles[index];
index++;
final xNorm = layout[row][col]['x'] ?? 0.5;
final yNorm = layout[row][col]['y'] ?? 0.5;
final xNorm = layout[row][col]['x'] ?? 0.5;
final yNorm = layout[row][col]['y'] ?? 0.5;
final left = width * xNorm - cardW / 2;
final top = height * yNorm - cardH / 2;
final left = width * xNorm - cardW / 2;
final top = height * yNorm - cardH / 2;
children.add(
Positioned(
left: left,
top: top,
child: _buildPlayerCard(
posData['pos'] ?? '',
posData['style'] ?? '',
),
children.add(
Positioned(
left: left,
top: top,
child: _buildPlayerCard(
posData['pos'] ?? '',
posData['style'] ?? '',
),
);
}
),
);
}
}
return Stack(children: children);
},
);
}
return Stack(children: children);
},
);
}
@override
Widget build(BuildContext context) {
@@ -172,7 +176,7 @@ class _HomeScreenState extends State<HomeScreen> {
// 低確率モードスイッチ
SwitchListTile(
title: const Text(
'低確率スタイルモード(デコイラン等の出現率を下げる)',
'希少なプレースタイルを確率UP(デコイラン等)',
style: TextStyle(color: Colors.white),
),
value: _lowProbabilityMode,