forui_firebase_ui_localizations 0.1.0
forui_firebase_ui_localizations: ^0.1.0 copied to clipboard
Localization package for forui_firebase_ui_auth, forui_firebase_ui_firestore and forui_firebase_ui_database
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:forui_firebase_ui_auth/forui_firebase_ui_auth.dart';
import 'package:forui_firebase_ui_localizations/forui_firebase_ui_localizations.dart';
import 'package:forui_firebase_ui_localizations_example/firebase_options.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:forui/forui.dart';
import 'package:material_ui/material_ui.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
var locale = const Locale('en', 'US');
return StatefulBuilder(
builder: (context, setState) {
return MaterialApp(
title: 'Firebase UI Localizations Demo',
builder: (context, child) =>
FTheme(data: FTheme.neutral.light.touch, child: child!),
supportedLocales: const [Locale('en'), Locale('fr')],
locale: locale,
localizationsDelegates: [
...GlobalMaterialLocalizations.delegates,
FirebaseUILocalizations.delegate,
],
home: Column(
children: [
Material(
child: Row(
children: [
Expanded(
child: GestureDetector(
onTap: () {
setState(() => locale = const Locale('en', 'US'));
},
child: const Chip(label: Text('en')),
),
),
Expanded(
child: GestureDetector(
onTap: () {
setState(() => locale = const Locale('fr', 'FR'));
},
child: const Chip(label: Text('fr')),
),
),
],
),
),
Expanded(child: SignInScreen(providers: [EmailAuthProvider()])),
],
),
);
},
);
}
}