// packages/feature_common/lib/screens/intro_screen.dart
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:service_api/service_api.dart'; // ThemeNotifier
import '../views/intro_view.dart'; // intro_view.dart 파일이 이 경로에 있어야 함

class IntroScreen extends StatelessWidget {
  /// 인트로가 끝난 후 이동할 '다음 화면' (예: SudokuLobby or SpiderLobby)
  final WidgetBuilder nextScreenBuilder; 
  
  const IntroScreen({
    Key? key,
    required this.nextScreenBuilder,
  }) : super(key: key);

  void _navigateToNextScreen(BuildContext context) {
    Navigator.of(context).pushReplacement(
      MaterialPageRoute(
        builder: nextScreenBuilder,
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    final Color currentColor = context.watch<ThemeNotifier>().currentColor;

    return Scaffold(
      backgroundColor: Theme.of(context).scaffoldBackgroundColor,
      body: Center(
        child: IntroViewFlutter(
          mainColor: currentColor, 
          onAnimationFinished: () {
            _navigateToNextScreen(context);
          },
        ),
      ),
    );
  }
}