loris/lib/main.dart

45 lines
1.2 KiB
Dart
Raw Normal View History

2022-06-16 20:30:02 +00:00
import 'package:flutter/material.dart';
2022-06-28 20:05:24 +00:00
import 'package:intl/intl.dart';
2022-06-17 10:38:28 +00:00
import 'package:localization/localization.dart';
2022-06-16 20:30:02 +00:00
import 'package:slothmu/partials/main_scaffold.dart';
import 'pages/login.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
2022-06-16 20:30:02 +00:00
2022-06-28 20:05:24 +00:00
void main() {
Intl.defaultLocale = 'en_US';
runApp(const Slothmu());
}
class Slothmu extends StatefulWidget {
const Slothmu({Key? key}) : super(key: key);
@override
State<Slothmu> createState() => _SlothmuState();
}
class _SlothmuState extends State<Slothmu> {
2022-06-28 20:05:24 +00:00
List<Locale> supported = const [
Locale("en", "US"),
Locale("de", "DE"),
];
@override
Widget build(BuildContext context) {
LocalJsonLocalization.delegate.directories = ['lib/i18n'];
return MaterialApp(
2022-06-28 20:05:24 +00:00
supportedLocales: supported,
2022-06-17 10:38:28 +00:00
localizationsDelegates: [
GlobalCupertinoLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
2022-06-17 10:38:28 +00:00
LocalJsonLocalization.delegate,
],
2022-06-16 20:30:02 +00:00
initialRoute: '/login',
routes: {
'/': (context) => const MainScaffold(),
'/login': (context) => const Login(),
},
);
}
}