import 'package:cs_resources/generated/assets.dart';
import 'package:cs_resources/generated/l10n.dart';
import 'package:domain/entity/garage_sale_rent_entity.dart';
import 'package:flutter/material.dart';
import 'package:auto_route/auto_route.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:plugin_basic/provider/app_config/app_config_service.dart';
import 'package:router/componentRouter/component_service_manager.dart';
import 'package:router/ext/auto_router_extensions.dart';
import 'package:shared/utils/color_utils.dart';
import 'package:shared/utils/ext_dart.dart';
import 'package:shared/utils/log_utils.dart';
import 'package:shared/utils/screen_util.dart';
import 'package:widgets/load_state_layout.dart';
import 'package:widgets/my_button.dart';
import 'package:widgets/my_load_image.dart';
import 'package:widgets/ext/ex_widget.dart';
import 'package:widgets/my_text_view.dart';
import 'package:widgets/my_appbar.dart';
import 'package:cs_resources/theme/app_colors_theme.dart';
import 'package:widgets/utils/dark_theme_util.dart';
import 'package:widgets/widget_export.dart';

import '../../../router/page/services_page_router.dart';
import '../homeService/home_service_page.dart';

@RoutePage()
class EvaluateCreateSuccessPage extends HookConsumerWidget {
  const EvaluateCreateSuccessPage({
    Key? key,
  }) : super(key: key);

  //启动当前页面
  static void startInstance({BuildContext? context}) {
    if (context != null) {
      context.router.push(const EvaluateCreateSuccessPageRoute());
    } else {
      appRouter.push(const EvaluateCreateSuccessPageRoute());
    }
  }

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    // final appConfigState = ref.watch(appConfigServiceProvider)

    useEffect(() {
      // 组件挂载时执行 - 执行接口请求
      // Future.microtask(() => vm.initPageData());
      return () {
        // 组件卸载时执行
        // Log.d("EvaluateCreateSuccess_page 组件卸载时执行");
      };
    }, []);

    return Scaffold(
        appBar: MyAppBar.appBar(
          context,
          S.current.evaluation,
          backgroundColor: context.appColors.whiteBG,
        ),
        backgroundColor: DarkThemeUtil.multiColors(context, ColorUtils.string2Color('#F2F3F6'), darkColor: Colors.black)?? Colors.black,
        body: Center(
          child: Container(
            margin: EdgeInsets.only(top: 50),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.start,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                const MyAssetImage(
                  Assets.serviceEvaluateSuccussIcon,
                  width: 78,
                  height: 78,
                ),
                MyTextView(
                  S.current.thank_evaluation,
                  fontSize: 15,
                  isFontRegular: true,
                  boxWidth: 122.5,
                  textAlign: TextAlign.center,
                  textColor: ColorUtils.string2Color('#333333'),
                  marginTop: 17,
                  marginBottom: 50,
                ),
                MyButton(
                  text: S.current.back_home,
                  onPressed: () {
                    // 回到首页
                    ComponentServiceManager().mainService.startMainPage();
                  },
                  fontSize: 15,
                  fontWeight: FontWeight.w500,
                  textColor: context.appColors.textWhite,
                  backgroundColor: context.appColors.textPrimary,
                  minHeight: 45,
                  minWidth: 310,
                )
              ],
            ),
          ),
        ));
  }
}
