import 'package:fis_ui/index.dart';
import 'package:fis_ui/interface/interactive_container.dart';
import 'package:flutter/material.dart';
import 'package:flyinsono/architecture/define.dart';
import 'package:flyinsono/pages/schedule/calendar/utils/calendar_utils.dart';
import 'package:get/get.dart';

import '../index.dart';

/// 移动端日历标题栏
class TitleBar extends FisView<MobileCalendarController>
    implements FInteractiveContainer {
  const TitleBar({Key? key}) : super(key: key);

  @override
  String get pageName => "mobile title bar";

  @override
  FWidget build(BuildContext context) {
    return FRow(
      children: [
        // 返回按钮
        FIconButton(
          name: "back",
          businessParent: this,
          icon: const FIcon(Icons.arrow_back_ios),
          onPressed: () => Get.back(),
        ),
        FExpanded(
          child: FCenter(
            child: FObx(() => FText(
                  CalendarUtils.formatYearMonth(
                      controller.state.selectedDate4MonthView),
                  style: const TextStyle(
                    fontWeight: FontWeight.bold,
                    // 字间距
                    letterSpacing: 1.3,
                  ),
                )),
          ),
        ),
        // 菜单按钮
        /// TODO:[Gavin] 占位功能区，暂时屏蔽，待实现
        FSizedBox(width: 48), // 占位
        // FIconButton(
        //   name: "menu",
        //   businessParent: this,
        //   icon: const FIcon(Icons.menu),
        //   onPressed: () {
        //     controller.openMenu();
        //   },
        // ),
      ],
    );
  }
}
