loris/lib/main.dart
2022-06-28 22:05:24 +02:00

44 lines
1.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:localization/localization.dart';
import 'package:slothmu/partials/main_scaffold.dart';
import 'pages/login.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
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> {
List<Locale> supported = const [
Locale("en", "US"),
Locale("de", "DE"),
];
@override
Widget build(BuildContext context) {
LocalJsonLocalization.delegate.directories = ['lib/i18n'];
return MaterialApp(
supportedLocales: supported,
localizationsDelegates: [
GlobalCupertinoLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
LocalJsonLocalization.delegate,
],
initialRoute: '/login',
routes: {
'/': (context) => const MainScaffold(),
'/login': (context) => const Login(),
},
);
}
}