import 'dart:io';

import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutterpi_gstreamer_video_player/flutterpi_gstreamer_video_player.dart';
import 'package:scaled_app/scaled_app.dart';
import 'package:intl/date_symbol_data_local.dart';

import 'app.dart';
import 'common/settings/sharedPrefs.dart';

void main() async {
  ScaledWidgetsFlutterBinding.ensureInitialized(
    scaleFactor: (deviceSize) {
      const double widthOfDesign = 960;
      return deviceSize.width / widthOfDesign;
    },
  );
  await SharedPrefs().init();

  initializeDateFormatting('de_DE');

  // initialize the video player for Linux devices
  if (Platform.isLinux) {
    FlutterpiVideoPlayer.registerWith();
  }

  runAppScaled(
    const ProviderScope(
      overrides: [],
      child: App(),
    ),
  );
}
