58 lines
1.5 KiB
Dart
58 lines
1.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'dart:async';
|
|
|
|
/// MBTI診断専用の分析中ダイアログ
|
|
/// 写真解析ではなくローカルデータ分析用のメッセージを表示
|
|
class MBTIAnalyzingDialog extends StatefulWidget {
|
|
const MBTIAnalyzingDialog({super.key});
|
|
|
|
@override
|
|
State<MBTIAnalyzingDialog> createState() => _MBTIAnalyzingDialogState();
|
|
}
|
|
|
|
class _MBTIAnalyzingDialogState extends State<MBTIAnalyzingDialog> {
|
|
int _messageIndex = 0;
|
|
|
|
final List<String> _messages = [
|
|
'記録データを収集しています...',
|
|
'飲酒傾向を分析しています...',
|
|
'あなたの酒向タイプを判定中...',
|
|
];
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_startMessageRotation();
|
|
}
|
|
|
|
void _startMessageRotation() {
|
|
Future.delayed(const Duration(milliseconds: 800), () {
|
|
if (mounted && _messageIndex < _messages.length - 1) {
|
|
setState(() => _messageIndex++);
|
|
_startMessageRotation();
|
|
}
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Dialog(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(24.0),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
const CircularProgressIndicator(),
|
|
const SizedBox(height: 24),
|
|
Text(
|
|
_messages[_messageIndex],
|
|
style: Theme.of(context).textTheme.titleMedium,
|
|
textAlign: TextAlign.center,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|