2023-01-08 22:27:33 -05:00
|
|
|
import 'package:flutter/material.dart';
|
2023-01-09 22:50:34 -05:00
|
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
2023-07-07 19:33:28 -04:00
|
|
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
2023-01-09 22:50:34 -05:00
|
|
|
import 'package:animated_theme_switcher/animated_theme_switcher.dart';
|
|
|
|
import 'router/router.dart';
|
2023-07-07 19:33:28 -04:00
|
|
|
import 'package:flutter_translate/flutter_translate.dart';
|
2023-01-08 22:27:33 -05:00
|
|
|
|
2023-01-09 22:50:34 -05:00
|
|
|
class VeilidChatApp extends ConsumerWidget {
|
2023-01-08 22:27:33 -05:00
|
|
|
const VeilidChatApp({
|
|
|
|
Key? key,
|
|
|
|
required this.theme,
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
final ThemeData theme;
|
|
|
|
|
|
|
|
@override
|
2023-01-09 22:50:34 -05:00
|
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
|
|
final router = ref.watch(routerProvider);
|
|
|
|
|
2023-07-07 19:33:28 -04:00
|
|
|
var localizationDelegate = LocalizedApp.of(context).delegate;
|
|
|
|
|
2023-01-08 22:27:33 -05:00
|
|
|
return ThemeProvider(
|
|
|
|
initTheme: theme,
|
|
|
|
builder: (_, theme) {
|
2023-07-07 19:33:28 -04:00
|
|
|
return LocalizationProvider(
|
|
|
|
state: LocalizationProvider.of(context).state,
|
|
|
|
child: MaterialApp.router(
|
|
|
|
routerConfig: router,
|
|
|
|
title: 'VeilidChat',
|
|
|
|
theme: theme,
|
|
|
|
localizationsDelegates: [
|
|
|
|
GlobalMaterialLocalizations.delegate,
|
|
|
|
GlobalWidgetsLocalizations.delegate,
|
|
|
|
localizationDelegate
|
|
|
|
],
|
|
|
|
supportedLocales: localizationDelegate.supportedLocales,
|
|
|
|
locale: localizationDelegate.currentLocale,
|
|
|
|
));
|
2023-01-08 22:27:33 -05:00
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|