import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:my_flutter_puzzle/cubits/count_down_timer_cubit.dart'; import 'package:my_flutter_puzzle/res/palette.dart'; import 'package:my_flutter_puzzle/screens/level_list/screen/level_list_screen.dart'; import 'package:my_flutter_puzzle/screens/puzzle/puzzle_starter_screen.dart'; import 'package:my_flutter_puzzle/screens/splash/screen/splash_screen.dart'; import 'package:my_flutter_puzzle/utils/color_brightness.dart'; import 'package:my_flutter_puzzle/utils/extensions/string_extensions.dart'; import 'package:url_strategy/url_strategy.dart'; void main() async { setPathUrlStrategy(); WidgetsFlutterBinding.ensureInitialized(); runApp(const ProviderScope(child: MyApp())); } class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { SystemChrome.setPreferredOrientations([ DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight, ]); Level level = Level( image: 'level-1'.jpgPath, duration: 4, puzzleSize: 3, level: 1, ); SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []); return BlocProvider( create: (context) => CountDownTimerCubit(), child: MaterialApp( title: 'Flutter Puzzle', debugShowCheckedModeBanner: false, theme: ThemeData( primarySwatch: Colors.blue, fontFamily: 'GoogleSans', backgroundColor: Palette.blue.darken(0.3), colorScheme: ColorScheme( brightness: Theme.of(context).brightness, primary: Palette.blue, onPrimary: Colors.white, secondary: Palette.blue.withOpacity(0.6), onSecondary: Palette.blue.withOpacity(0.3), error: Theme.of(context).colorScheme.error, onError: Theme.of(context).colorScheme.onError, background: Palette.blue.darken(0.3), onBackground: Colors.white, surface: Palette.crimson, onSurface: Colors.white38, ), ), home: PuzzleStarterScreen( duration: level.duration, puzzleSize: level.puzzleSize, image: level.image, level: level.level, ), ), ); } }