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/router.dart';

class CreateClass extends FStatelessWidget implements FPage {
  final TextEditingController controller = TextEditingController();

  final void Function(String) onOk;

  CreateClass(this.onOk);

  @override
  FWidget build(BuildContext context) {
    return FSimpleDialog(
      isDefault: true,
      title: FText(
        i18nBook.college.createClass.t,
        style: TextStyle(color: Colors.white),
      ),
      onCancel: router.back,
      onClose: router.back,
      onOk: () {
        onOk.call(controller.text);
      },
      okString: i18nBook.common.confirm.t,
      cancelString: i18nBook.common.cancel.t,
      contentPadding: EdgeInsets.all(20),
      children: [
        FContainer(
          width: kIsMobile ? 200 : 300,
          child: FRow(
            children: [
              FText(i18nBook.college.className.t),
              FSizedBox(
                width: 20,
              ),
              FBorderInput(
                hintSize: 16,
                contentSize: 16,
                maxLength: 40,
                borderColor: Color.fromRGBO(234, 234, 234, 1),
                height: 38,
                controller: controller,
              ),
            ],
          ),
        ),
      ],
    );
  }

  @override
  String get pageName => "CreateClass";
}
