import 'package:fis_i18n/i18n.dart';
import 'package:fis_ui/base_define/page.dart';
import 'package:fis_ui/index.dart';
import 'package:fis_ui/widgets/layout/button_group.dart';
import 'package:flutter/material.dart';
import 'package:flyinsono/architecture/router/index.dart';
import 'package:flyinsono/managers/interfaces/remote_maintenance.dart';
import 'package:get/get.dart';

class InstallPrinterEnd extends FStatefulWidget implements FPage {
  @override
  String get pageName => 'InstallPrinterEnd';

  final String printerName;

  InstallPrinterEnd(this.printerName);

  @override
  FState<FStatefulWidget> createState() {
    return InstallPrinterEndState();
  }
}

class InstallPrinterEndState extends FState<InstallPrinterEnd> {
  final remoteMaintenanceManager = Get.find<IRemoteMaintenanceManager>();
  @override
  FWidget build(BuildContext context) {
    return FRow(
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        FColumn(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            FText(widget.printerName),
            FExpanded(child: FSizedBox()),
            FButtonGroup(
              buttonPadding: 20,
              spacing: 20,
              children: [
                FElevatedButton(
                  child: FText(i18nBook.common.finish.t),
                  onPressed: router.back,
                  businessParent: this.widget,
                  name: i18nBook.common.finish.t,
                ),
                FElevatedButton(
                  child: FText(i18nBook.common.printTestPage.t),
                  onPressed: () {
                    remoteMaintenanceManager.printTestPage(widget.printerName);
                  },
                  businessParent: this.widget,
                  name: 'print test',
                )
              ],
            )
          ],
        ),
      ],
    );
  }
}
