2024-09-02 ほぼOK
This commit is contained in:
@ -151,26 +151,23 @@ class _GameStateWidgetState extends State<GameStateWidget> {
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
child: StreamBuilder<List<Destination>>(
|
||||
stream: dbService.destinationUpdatesStream,
|
||||
initialData: const [], // 初期値を設定
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState ==
|
||||
ConnectionState.waiting) {
|
||||
return const CircularProgressIndicator();
|
||||
} else if (snapshot.hasError) {
|
||||
return LocationVisitedWidget(
|
||||
count: 0,
|
||||
minimized: !isExpanded,
|
||||
);
|
||||
} else if (snapshot.hasData) {
|
||||
return LocationVisitedWidget(
|
||||
count: snapshot.data!.length,
|
||||
minimized: !isExpanded,
|
||||
);
|
||||
} else {
|
||||
if (snapshot.hasError) {
|
||||
print('Error: ${snapshot.error}');
|
||||
return LocationVisitedWidget(
|
||||
count: 0,
|
||||
minimized: !isExpanded,
|
||||
);
|
||||
}
|
||||
// データがある場合はそのデータを使用し、ない場合は空のリストを使用
|
||||
final destinations = snapshot.data ?? [];
|
||||
|
||||
return LocationVisitedWidget(
|
||||
count: destinations.length,
|
||||
minimized: !isExpanded,
|
||||
);
|
||||
|
||||
},
|
||||
),
|
||||
|
||||
@ -183,12 +180,12 @@ class _GameStateWidgetState extends State<GameStateWidget> {
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
child: Obx(() => ConnectionStatusIndicator(
|
||||
connectionStatus: (indexController
|
||||
.connectionStatusName.value ==
|
||||
.connectionStatusName.value.toLowerCase() ==
|
||||
"wifi" ||
|
||||
indexController
|
||||
.connectionStatusName.value ==
|
||||
.connectionStatusName.value.toLowerCase() ==
|
||||
"mobile")
|
||||
? indexController.connectionStatusName.value ==
|
||||
? indexController.connectionStatusName.value.toLowerCase() ==
|
||||
"wifi"
|
||||
? ConnectionStatus.wifi
|
||||
: ConnectionStatus.mobile
|
||||
|
||||
Reference in New Issue
Block a user