import 'package:fis_i18n/i18n.dart';
import 'package:fis_ui/base_define/page.dart';
import 'package:fis_ui/index.dart';
import 'package:flutter/material.dart';
import 'package:flyinsono/architecture/router/index.dart';
import 'package:flyinsono/managers/interfaces/vboxcontrol.dart';
import 'network_wifi_card.dart';

///Todo finlay 无线网络配置
class NetworkWifiSettingDialog extends FStatelessWidget implements FPage {
  final NetworkWifiResult networkWifiResult;
  NetworkWifiSettingDialog({
    required this.networkWifiResult,
  });
  @override
  String get pageName => 'NetworkWifiSettingDialog';

  @override
  FWidget build(BuildContext context) {
    var cardInfo = Interface(
        guid: networkWifiResult.data!.guid,
        macAddress: networkWifiResult.data!.macAddress,
        name: networkWifiResult.data!.name,
        description: networkWifiResult.data!.description,
        enableDHCP: networkWifiResult.data!.enableDHCP,
        ipAddress: networkWifiResult.data!.ipAddress,
        subnetMask: networkWifiResult.data!.subnetMask,
        gateway: networkWifiResult.data!.gateway,
        preferredDNS: networkWifiResult.data!.preferredDNS,
        standbyDNS: networkWifiResult.data!.standbyDNS);
    return FSimpleDialog(
      contentPadding: EdgeInsets.symmetric(vertical: 10, horizontal: 100),
      title: FText(
        i18nBook.setting.wirelessNetworkConnection.t,
        style: TextStyle(
          color: Colors.white,
          fontSize: 18,
        ),
      ),
      okString: i18nBook.common.confirm4Btn.t,
      onClose: () {
        router.back();
      },
      cancelString: i18nBook.common.cancel.t,
      children: [
        FContainer(
          width: 600,
          height: 800,
          child: NetworkWifiCard(
              networks: networkWifiResult.data!.points,
              cardInfos: <Interface>[cardInfo]),
        ),
      ],
    );
  }
}
