Using flutter and google_maps_flutter, I am trying to implement a map on my project.
However, I can’t seem to find how to change the language in which the map should be displayed from within the code. The map only changes its language when the language of the device itself is changed.
I tried following the documentation on The official flutter documentation website, but to avail.
Here is are snippets of what I have so far:
app.dart
...
return MaterialApp(
//debugShowCheckedModeBanner: false,
title: 'Magen David Adom',
localizationsDelegates: const [
DefaultMaterialLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: const [
Locale('en'),
Locale('he'),
],
locale: const Locale.fromSubtags(languageCode: 'he', countryCode: 'IL'),
...
);
main_screen.dart:
...
@override
Widget build(BuildContext context) {
return Scaffold(
body: Row(
Flexible(
child: Localizations.override(
context: context,
locale: const Locale('he'),
child: Builder(
builder: (context) {
// A toy example for an internationalized Material widget.
return GoogleMap(initialCameraPosition: defaultCameraPosition);
},
),
),
),
],
),
);
}
...
New contributor
Raphael Goldstein is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.