pluto_grid
pluto_grid copied to clipboard
[Help] PlutoColumnTitle widgets require MaterialLocalizations
Hello, the root of my app is WidgetsApp and so I receive the following error when attempting to filter
The error message says the following:
To introduce a MaterialLocalizations, either use a MaterialApp at the root of your application to include them automatically, or add a Localization widget with a MaterialLocalizations delegate.
The specific widget that could not find a MaterialLocalizations ancestor was:
PlutoColumnTitle-[<'column_title_[#732d1]'>]
Widget build
looks as follows:
Widget build(BuildContext context) {
return Scaffold(
body: Localizations(
locale: const Locale('en', 'US'),
delegates: const <LocalizationsDelegate<dynamic>>[
DefaultWidgetsLocalizations.delegate,
DefaultMaterialLocalizations.delegate,
],
child: Container(
padding: const EdgeInsets.all(15),
child: PlutoGrid(
columns: columns,
rows: rows,
columnGroups: columnGroups,
onLoaded: (PlutoGridOnLoadedEvent event) {
stateManager = event.stateManager;
},
onChanged: (PlutoGridOnChangedEvent event) {
print(event);
},
configuration: PlutoGridConfiguration(
columnFilter: PlutoGridColumnFilterConfig(
filters: FilterHelper.defaultFilters,
resolveDefaultColumnFilter: (column, resolver) {
if (column.field == 'text') {
return resolver<PlutoFilterTypeContains>()
as PlutoFilterType;
} else if (column.field == 'number') {
return resolver<PlutoFilterTypeGreaterThan>()
as PlutoFilterType;
} else if (column.field == 'date') {
return resolver<PlutoFilterTypeLessThan>()
as PlutoFilterType;
} else if (column.field == 'select') {
// return resolver<ClassYouImplemented>() as PlutoFilterType;
}
return resolver<PlutoFilterTypeContains>()
as PlutoFilterType;
},
),
)),
),
),
floatingActionButton: FloatingActionButton(
child: Icon(Icons.settings_backup_restore),
onPressed: () {
var username = 'CassBeats';
Navigator.pushReplacementNamed(context, 'home/$username');
},
),
);
I added Localizations to root Widget build as well
@override
Widget build(BuildContext context) {
return WidgetsApp(
// Initial Page set to Login Page
debugShowCheckedModeBanner: false,
initialRoute: 'home/abc',
// Use the generator provided by Fluro package
onGenerateRoute: MyRouter.router.generator,
textStyle: const TextStyle(),
color: Colors.red,
locale: const Locale('en', 'US'),
localizationsDelegates: [
// delegate from flutter_localization
DefaultWidgetsLocalizations.delegate,
DefaultMaterialLocalizations.delegate,
// delegate from localization package.
LocalJsonLocalization.delegate,
],
);
}
Any suggestions?