import 'package:app/router/page/app_page_router.dart';
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:cs_resources/generated/assets.dart';
import 'package:router/componentRouter/app_service.dart';
import 'package:router/path/router_path.dart';
import 'package:shared/utils/size_config.dart';
import 'package:widgets/dialog/custom_error_widget.dart';
import 'package:widgets/ext/ex_widget.dart';
import 'package:widgets/my_load_image.dart';
import 'package:auto_route/annotations.dart';
import '../vm/splash_view_model.dart';
import 'package:auto_route/auto_route.dart';

@RoutePage()
class SplashPage extends HookConsumerWidget {
  const SplashPage({super.key});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    SizeConfig().init(context);

   final viewModel = ref.watch(splashViewModelProvider.notifier)..setContext(context);

    return Scaffold(
      body: Container(
        decoration: const BoxDecoration(
          gradient: LinearGradient(
            colors: [
              Color(0xFF091D44),
              Color(0xFF245A8A),
              Color(0xFF7F7CEC),
            ],
            begin: Alignment.topCenter,
            end: Alignment.bottomCenter,
          ),
        ),
        child:  Center(
          child: const MyAssetImage(
            Assets.assetsYyBusinessTopLogo,
            width: 166,
            height: 67.5,
            fit: BoxFit.contain,
          ).onTap((){
            context.router.pushNamed(RouterPath.main);
          }),
        ),
      ),
    );
  }
}
