import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:penguin_flutter_sample/penguin/nativeLauncher.dart';

class HomePage extends StatefulWidget {
  const HomePage({super.key});

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  void _launchStoryboard(BuildContext context, String storyboardName) {
    NativePluginLauncher.launchStoryboard(storyboardName);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        width: double.infinity,
        height: double.infinity,
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.center,
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Padding(
              padding: const EdgeInsets.all(100.0),
              child: ElevatedButton(
                onPressed: () {
                  print("demooo");
                  _launchStoryboard(context, "PenguinStory");
                },
                child: Center(
                  child: Text("Click Me"),
                ),
              ),
            ),
          ],
        ),
      ),
    );
    //  const viewType = 'penguin_lib';

    //  final creationParams = <String, dynamic>{};
    // return Container(
    //   child: Platform.isIOS
    //       ? UiKitView(
    //           viewType: viewType,
    //           layoutDirection: TextDirection.ltr,
    //           creationParams: creationParams,
    //           onPlatformViewCreated: onPlatformViewCreated,
    //           creationParamsCodec: const StandardMessageCodec(),
    //         )
    //
    //       : AndroidView(
    //           viewType: viewType,
    //           layoutDirection: TextDirection.ltr,
    //           creationParams: creationParams,
    //           onPlatformViewCreated: onPlatformViewCreated,
    //           creationParamsCodec: const StandardMessageCodec(),
    //         ),
    // );
  }

  Future<void> onPlatformViewCreated(int id) async {}
}
