I need to display an Arabic date picker , I can't control this with Locale constructor . It's only display an English view .
Pick date metod
DateTime selectedDate = DateTime.now();
Future<void> _selectDate(BuildContext context) async {
final DateTime picked = await showDatePicker(
context: context,
initialDate: selectedDate,
firstDate: DateTime(2000, 1),
lastDate: DateTime(2100),
builder: (BuildContext context, Widget child) {
return Theme(
data: Theme.of(context).copyWith(
colorScheme: ColorScheme.light(primary: primaryColor)),
child: child,
);
});
if (picked != null && picked != selectedDate) {
selectedDate = picked;
}
}
Main Screen
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await GetStorage.init();
runApp(
MyApp(),
);
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return GetMaterialApp(
debugShowCheckedModeBanner: false,
translations: Translation(),
locale: Locale(AuthController().appLocal.value),
fallbackLocale: Locale(AuthController().appLocal.value),
title: 'Hesabate App',
theme: ThemeData(
canvasColor: Colors.transparent,
fontFamily: "NotoNaskhArabic_font",
),
initialRoute: AppRoutes.splashScreen,
getPages: AppRoutes.routes,
);
}
}
I have an updated language(en&ar) at this variable
AuthController().appLocal.value