-
Notifications
You must be signed in to change notification settings - Fork 136
Expand file tree
/
Copy pathmain.dart
More file actions
77 lines (72 loc) · 2.48 KB
/
main.dart
File metadata and controls
77 lines (72 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// 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:firebase_ui_auth/firebase_ui_auth.dart';
import 'package:firebase_ui_localizations/firebase_ui_localizations.dart';
import 'package:firebase_ui_localizations_example/firebase_options.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:firebase_core/firebase_core.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',
supportedLocales: const [
Locale('en'),
Locale('fr'),
],
locale: locale,
localizationsDelegates: const [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
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(),
],
),
),
],
),
);
},
);
}
}