import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'base_view.dart';

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

  @override
  Widget build(BuildContext context) {
    return AnnotatedRegion<SystemUiOverlayStyle>(
      value: SystemUiOverlayStyle.light.copyWith(
        statusBarColor: Colors.transparent,
        statusBarBrightness: _getStatusBarDarkFont(),
        statusBarIconBrightness: _getStatusIconBarDarkFont(),
        systemNavigationBarColor: navigationBarColor(),
        systemNavigationBarIconBrightness: _getNavigationBarDarkFont(),
      ),
      child: buildBoot(immersive()
          ? buildBody(context)
          : SafeArea(child: buildBody(context))),
    );
  }

  Brightness _getStatusBarDarkFont() {
    return statusBarDarkFont() ? Brightness.light : Brightness.dark;
  }

  Brightness _getStatusIconBarDarkFont() {
    return statusBarDarkFont() ? Brightness.dark : Brightness.light;
  }

  Brightness _getNavigationBarDarkFont() {
    return statusBarDarkFont() ? Brightness.dark : Brightness.light;
  }

  bool statusBarDarkFont() {
    return true;
  }

  bool navigationBarDarkFont() {
    return true;
  }

  bool immersive() {
    return false;
  }

  Color navigationBarColor() {
    return Colors.transparent;
  }
}
