import 'package:fis_ui/base_define/page.dart';
import 'package:flyinsono/architecture/define.dart';
import 'package:get/get.dart';
import 'package:fis_ui/index.dart';
import 'package:fis_i18n/i18n.dart';
import 'package:flutter/material.dart';
import 'package:flyinsono/pages/organization/org_info/controller.dart';

/// PC完善机构信息的弹窗
class OrgInfoDialog extends FisView<OrgInfoController>
    implements FPage {
  const OrgInfoDialog({
    Key? key,
    required this.orgInfoDialogChild,
    this.pageName = 'OrgInfoDialog',
  }) : super(key: key);
  @override
  final String pageName;

  /// 机构信息
  final FWidget orgInfoDialogChild;

  @override
  FWidget build(BuildContext context) {
    return FSimpleDialog(
      title: FText(
        i18nBook.organization.fullfillOrgInfo.t,
        style: TextStyle(
          color: Colors.white,
          fontSize: 18,
        ),
      ),
      insetPadding: const EdgeInsets.symmetric(
        vertical: 100,
      ),
      backgroundColor: const Color.fromARGB(
        255,
        230,
        230,
        230,
      ),
      children: [
        FContainer(
          /// TODO:[Gavin] 多语言-UI-整合
          width: i18nBook.isCurrentChinese ? 800 : 1000,
          child: orgInfoDialogChild,
        ),
      ],
      bottomButton: FContainer(
        alignment: Alignment.center,
        padding: EdgeInsets.symmetric(vertical: 15),
        child: FFlex(
          direction: Axis.horizontal,
          mainAxisSize: MainAxisSize.min,
          children: [
            FElevatedButton(
              name: "submit",
              businessParent: this,
              onPressed: () {
                Get.find<OrgInfoController>().onSubmit();
              },
              style: ButtonStyle(
                padding: MaterialStateProperty.all(
                  const EdgeInsets.symmetric(
                    vertical: 15,
                    horizontal: 25,
                  ),
                ),
              ),
              child: FText(
                i18nBook.common.save.t,
              ),
            ),
            FSizedBox(
              width: 20,
            ),
            FOutlinedButton(
              name: "cancel",
              businessParent: this,
              onPressed: () => Get.back(),
              style: ButtonStyle(
                backgroundColor: MaterialStateProperty.all(
                  Colors.white,
                ),
                padding: MaterialStateProperty.all(
                  EdgeInsets.symmetric(
                    vertical: 15,
                    horizontal: 25,
                  ),
                ),
              ),
              child: FText(
                i18nBook.common.cancel.t,
                style: TextStyle(
                  color: Color.fromRGBO(61, 146, 252, 1),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
