-
Notifications
You must be signed in to change notification settings - Fork 3.3k
/
Copy pathmain.dart
53 lines (49 loc) · 1.37 KB
/
main.dart
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
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'nn_intl.dart';
void main() {
runApp(
// #docregion material-app
const MaterialApp(
localizationsDelegates: [
GlobalWidgetsLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
NnMaterialLocalizations.delegate, // Add the newly created delegate
],
supportedLocales: [Locale('en', 'US'), Locale('nn')],
home: Home(),
),
// #enddocregion material-app
);
}
class Home extends StatelessWidget {
const Home({super.key});
@override
Widget build(BuildContext context) {
return Localizations.override(
context: context,
locale: const Locale('nn'),
child: Scaffold(
appBar: AppBar(),
drawer: Drawer(
child: ListTile(
leading: const Icon(Icons.change_history),
title: const Text('Change history'),
onTap: () {
Navigator.pop(context); // close the drawer
},
),
),
body: const Center(
child: Padding(
padding: EdgeInsets.all(50),
child: Text(
'Long press hamburger icon in the app bar (aka the drawer menu)'
'to see a localized tooltip for the `nn` locale. ',
),
),
),
),
);
}
}