import 'package:cpt_main/modules/main/main_page.dart';
import 'package:cs_resources/generated/assets.dart';
import 'package:cs_resources/generated/l10n.dart';
import 'package:cs_resources/theme/app_colors_theme.dart';
import 'package:flutter/material.dart';
import 'package:auto_route/auto_route.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:router/ext/auto_router_extensions.dart';
import 'package:widgets/ext/ex_widget.dart';
import 'package:widgets/my_appbar.dart';
import 'package:widgets/my_button.dart';
import 'package:widgets/my_load_image.dart';
import 'package:widgets/my_text_view.dart';
import 'package:widgets/utils/dark_theme_util.dart';

import '../../../router/page/main_page_router.dart';

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

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

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    return Scaffold(
      appBar: MyAppBar.appBar(context, S.current.published_successfully),
      backgroundColor: context.appColors.backgroundWhite,
      body: Column(
        children: [
          Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              MyAssetImage(
                Assets.mainSuccessIcon,
                width: 54,
                height: 54,
                color: DarkThemeUtil.multiColors(context, AppColorsTheme.colorPrimary, darkColor: Colors.white),
              ),
              MyTextView(
                S.current.published_successful_txt,
                marginTop: 12,
                marginLeft: 55,
                textAlign: TextAlign.center,
                marginRight: 55,
                fontSize: 18,
                textColor: context.appColors.textBlack,
                isFontMedium: true,
              ),
            ],
          ).marginOnly(top: 68),
          const Spacer(),
          MyButton(
            onPressed: () {
              appRouter.maybePop();
            },
            text: S.current.back_home,
            textColor: Colors.white,
            backgroundColor: context.appColors.btnBgDefault,
            fontWeight: FontWeight.w500,
            type: ClickType.throttle,
            fontSize: 16,
            minHeight: 50,
            radius: 0,
          )
        ],
      ),
    );
  }
}
