Skip to content
Snippets Groups Projects
Select Git revision
  • 48f25e351686878bc69e5e8f24173a9f581f6a2b
  • master default protected
  • 84-improve-app-metadata
  • 82-fix-colors
  • 23-add-timer
  • 65-update-icons
  • Release_0.10.1_88 protected
  • Release_0.10.0_87 protected
  • Release_0.9.2_86 protected
  • Release_0.9.1_85 protected
  • Release_0.9.0_84 protected
  • Release_0.8.0_83 protected
  • Release_0.7.0_82 protected
  • Release_0.6.0_81 protected
  • Release_0.5.2_80 protected
  • Release_0.5.1_79 protected
  • Release_0.5.0_78 protected
  • Release_0.4.1_77 protected
  • Release_0.4.0_76 protected
  • Release_0.3.1_75 protected
  • Release_0.3.0_74 protected
  • Release_0.2.1_73 protected
  • Release_0.2.0_72 protected
  • Release_0.1.22_71 protected
  • Release_0.1.21_70 protected
  • Release_0.1.20_69 protected
26 results

cell.dart

Blame
  • main.dart 2.71 KiB
    import 'dart:io';
    
    import 'package:easy_localization/easy_localization.dart';
    import 'package:flutter/material.dart';
    import 'package:flutter_bloc/flutter_bloc.dart';
    import 'package:hive/hive.dart';
    import 'package:hydrated_bloc/hydrated_bloc.dart';
    import 'package:path_provider/path_provider.dart';
    
    import 'package:scrobbles/config/theme.dart';
    import 'package:scrobbles/cubit/bottom_nav_cubit.dart';
    import 'package:scrobbles/cubit/data_counts_by_day_cubit.dart';
    import 'package:scrobbles/cubit/data_counts_by_hour_cubit.dart';
    import 'package:scrobbles/cubit/data_discoveries_cubit.dart';
    import 'package:scrobbles/cubit/data_statistics_global_cubit.dart';
    import 'package:scrobbles/cubit/data_statistics_recent_cubit.dart';
    import 'package:scrobbles/cubit/data_timeline_cubit.dart';
    import 'package:scrobbles/cubit/data_top_artists_cubit.dart';
    import 'package:scrobbles/ui/skeleton.dart';
    
    void main() async {
      /// Initialize packages
      WidgetsFlutterBinding.ensureInitialized();
      await EasyLocalization.ensureInitialized();
      final Directory tmpDir = await getTemporaryDirectory();
      Hive.init(tmpDir.toString());
      HydratedBloc.storage = await HydratedStorage.build(
        storageDirectory: tmpDir,
      );
    
      runApp(
        EasyLocalization(
          path: 'assets/translations',
          supportedLocales: const <Locale>[
            Locale('en'),
            Locale('fr'),
          ],
          fallbackLocale: const Locale('en'),
          useFallbackTranslations: true,
          child: const MyApp(),
        ),
      );
    }
    
    class MyApp extends StatelessWidget {
      const MyApp({super.key});
    
      @override
      Widget build(BuildContext context) {
        return MultiBlocProvider(
          providers: [
            BlocProvider<BottomNavCubit>(create: (context) => BottomNavCubit()),
            BlocProvider<DataCountsByDayCubit>(create: (context) => DataCountsByDayCubit()),
            BlocProvider<DataCountsByHourCubit>(create: (context) => DataCountsByHourCubit()),
            BlocProvider<DataDiscoveriesCubit>(create: (context) => DataDiscoveriesCubit()),
            BlocProvider<DataStatisticsGlobalCubit>(
                create: (context) => DataStatisticsGlobalCubit()),
            BlocProvider<DataStatisticsRecentCubit>(
                create: (context) => DataStatisticsRecentCubit()),
            BlocProvider<DataTimelineCubit>(create: (context) => DataTimelineCubit()),
            BlocProvider<DataTopArtistsCubit>(create: (context) => DataTopArtistsCubit()),
          ],
          child: MaterialApp(
            title: 'Scrobbles',
            theme: appTheme,
            home: const SkeletonScreen(),
    
            // Localization stuff
            localizationsDelegates: context.localizationDelegates,
            supportedLocales: context.supportedLocales,