You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
2.4 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/services.dart';
  3. import 'package:flutter_bloc/flutter_bloc.dart';
  4. import 'package:flutter_riverpod/flutter_riverpod.dart';
  5. import 'package:my_flutter_puzzle/cubits/count_down_timer_cubit.dart';
  6. import 'package:my_flutter_puzzle/res/palette.dart';
  7. import 'package:my_flutter_puzzle/screens/level_list/screen/level_list_screen.dart';
  8. import 'package:my_flutter_puzzle/screens/puzzle/puzzle_starter_screen.dart';
  9. import 'package:my_flutter_puzzle/screens/splash/screen/splash_screen.dart';
  10. import 'package:my_flutter_puzzle/utils/color_brightness.dart';
  11. import 'package:my_flutter_puzzle/utils/extensions/string_extensions.dart';
  12. import 'package:url_strategy/url_strategy.dart';
  13. void main() async {
  14. setPathUrlStrategy();
  15. WidgetsFlutterBinding.ensureInitialized();
  16. runApp(const ProviderScope(child: MyApp()));
  17. }
  18. class MyApp extends StatelessWidget {
  19. const MyApp({Key? key}) : super(key: key);
  20. @override
  21. Widget build(BuildContext context) {
  22. SystemChrome.setPreferredOrientations([
  23. DeviceOrientation.landscapeLeft,
  24. DeviceOrientation.landscapeRight,
  25. ]);
  26. Level level = Level(
  27. image: 'level-1'.jpgPath,
  28. duration: 4,
  29. puzzleSize: 3,
  30. level: 1,
  31. );
  32. SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);
  33. return BlocProvider(
  34. create: (context) => CountDownTimerCubit(),
  35. child: MaterialApp(
  36. title: 'Flutter Puzzle',
  37. debugShowCheckedModeBanner: false,
  38. theme: ThemeData(
  39. primarySwatch: Colors.blue,
  40. fontFamily: 'GoogleSans',
  41. backgroundColor: Palette.blue.darken(0.3),
  42. colorScheme: ColorScheme(
  43. brightness: Theme.of(context).brightness,
  44. primary: Palette.blue,
  45. onPrimary: Colors.white,
  46. secondary: Palette.blue.withOpacity(0.6),
  47. onSecondary: Palette.blue.withOpacity(0.3),
  48. error: Theme.of(context).colorScheme.error,
  49. onError: Theme.of(context).colorScheme.onError,
  50. background: Palette.blue.darken(0.3),
  51. onBackground: Colors.white,
  52. surface: Palette.crimson,
  53. onSurface: Colors.white38,
  54. ),
  55. ),
  56. home: PuzzleStarterScreen(
  57. duration: level.duration,
  58. puzzleSize: level.puzzleSize,
  59. image: level.image,
  60. level: level.level,
  61. ),
  62. ),
  63. );
  64. }
  65. }