import 'package:bestapp_package/bestapp_package.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../../assets/theme/colors.dart';
import '../../../assets/theme/style.dart';

final apiServicesProvider = Provider<ApiServices>((ref){
  throw UnimplementedError();
});

final apiConfigProvider = Provider<ApiConfig>((ref){
  throw UnimplementedError();
});

final appController = ChangeNotifierProvider<AppController>((ref){
  return AppController();
});

class AppController extends ChangeNotifier{
  AppController(){
    _init();
  }
  ThemeData theme = AppStyle.lightTheme;

  Future<void> _init() async{
    setTheme(AppStyle.lightTheme, "light");
  }

  void setTheme(value, c) {
    SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
      statusBarColor: c == "dark" ? AppColorDark.darkPrimary : AppColorLight.primaryColor,
      statusBarIconBrightness: Brightness.dark,
    ));
    theme = value;
    notifyListeners();
  }

  ThemeData getTheme(value) {
    return theme;
  }
}