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';

class JoinClass extends FStatelessWidget implements FPage {
  @override
  String get pageName => "JoinClass";
  final TextEditingController controller = TextEditingController();

  final void Function(String) onOk;

  JoinClass(this.onOk);

  @override
  FWidget build(BuildContext context) {
    return FSimpleDialog(
      isDefault: true,
      okString: i18nBook.common.confirm.t,
      cancelString: i18nBook.common.cancel.t,
      title: FText(
        i18nBook.common.joinClass.t,
        style: TextStyle(color: Colors.white),
      ),
      onCancel: router.back,
      onClose: router.back,
      onOk: () {
        onOk.call(controller.text);
      },
      contentPadding: EdgeInsets.all(20),
      children: [
        FContainer(
          height: 100,
          width: 300,
          child: FRow(
            children: [
              FText(i18nBook.college.classCode.t),
              FSizedBox(
                width: 20,
              ),
              FContainer(
                margin: EdgeInsets.symmetric(vertical: 10),
                height: kIsMobile ? 40 : 30,
                width: kIsMobile ? 160 : 230,
                child: FTextField(
                  decoration: InputDecoration(
                    contentPadding:
                        EdgeInsets.symmetric(vertical: 0, horizontal: 10),
                    border: OutlineInputBorder(
                      borderRadius: BorderRadius.circular(8.0), // 设置圆角的半径
                    ),
                  ),
                  controller: controller,
                ),
              ),
            ],
          ),
        ),
      ],
    );
  }
}
