import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:get/get.dart';
import 'package:get/get_state_manager/src/simple/get_view.dart';

abstract class BaseView<T extends GetxController> extends GetView<T> {
  const BaseView({super.key});

  @override
  Widget build(BuildContext context) {
    return buildBoot(buildBody(context));
  }

  Widget buildBoot(Widget child) {
    return GestureDetector(
      onTap: () {
        backgroundOnTapEvent();
      },
      child: Container(
        height: viewHeight(),
        color: backgroundColor(),
        child: child,
      ),
    );
  }

  Widget buildBody(BuildContext context);

  // 点击空白处
  void backgroundOnTapEvent() {}

  Color backgroundColor() {
    return Colors.white;
  }

  double? viewHeight() {
    return null;
  }
}
