prasule/lib/main.dart

57 lines
1.8 KiB
Dart
Raw Normal View History

2023-09-08 11:50:21 +02:00
import 'dart:io';
import 'package:dynamic_color/dynamic_color.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
2023-10-11 18:37:18 +02:00
import 'package:flutter_localizations/flutter_localizations.dart';
2023-09-08 11:50:21 +02:00
import 'package:logger/logger.dart';
import 'package:prasule/util/color_schemes.g.dart';
import 'package:prasule/views/home.dart';
2023-10-11 18:37:18 +02:00
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
2023-09-08 11:50:21 +02:00
void main() {
runApp(const MyApp());
}
final logger = Logger();
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return (Platform.isAndroid)
? DynamicColorBuilder(
builder: (light, dark) => MaterialApp(
2023-10-11 18:37:18 +02:00
localizationsDelegates: const [
AppLocalizations.delegate,
...GlobalMaterialLocalizations.delegates,
...GlobalCupertinoLocalizations.delegates
],
supportedLocales: AppLocalizations.supportedLocales,
2023-09-08 11:50:21 +02:00
title: 'Prašule',
theme: ThemeData(
colorScheme: light ?? lightColorScheme,
useMaterial3: true,
),
darkTheme: ThemeData(
useMaterial3: true, colorScheme: dark ?? darkColorScheme),
home: const HomeView(),
),
)
: Theme(
data: ThemeData(
useMaterial3: true,
colorScheme: (MediaQuery.of(context).platformBrightness ==
Brightness.dark)
? darkColorScheme
: lightColorScheme),
2023-09-08 11:50:21 +02:00
child: const CupertinoApp(
title: 'Prašule',
home: HomeView(),
),
);
}
}