I encountered an error when using the persistent_bottom_nav_bar package. The error message is as follows:
/C:/Users/username/AppData/Local/Pub/Cache/hosted/pub.dev/persistent_bottom_nav_bar-5.0.2/lib/neumorphic_package_by_serge_software/neumorphic_card.dart:57:57: Error: The getter 'backgroundColor' isn't defined for the class 'ThemeData'.
- 'ThemeData' is from 'package:flutter/src/material/theme_data.dart' ('../../flutter%20system/flutter/packages/flutter/lib/src/material/theme_data.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'backgroundColor'.
final color = decoration.color ?? Theme.of(context).backgroundColor;
^^^^^^^^^^^^^^^
Steps to Reproduce
Add persistent_bottom_nav_bar version 5.0.2 to your pubspec.yaml.
Run the application on an Android or iOS device.
Observe the error during the build process.
Suggested Fix
The issue is due to the use of the backgroundColor property, which does not exist in the ThemeData class. Instead, scaffoldBackgroundColor should be used.
In the neumorphic_card.dart file, replace:
final color = decoration.color ?? Theme.of(context).backgroundColor;
with:
final color = decoration.color ?? Theme.of(context).scaffoldBackgroundColor;
Description
I encountered an error when using the
persistent_bottom_nav_bar
package. The error message is as follows:Steps to Reproduce
persistent_bottom_nav_bar
version5.0.2
to yourpubspec.yaml
.Suggested Fix
The issue is due to the use of the
backgroundColor
property, which does not exist in theThemeData
class. Instead,scaffoldBackgroundColor
should be used.In the
neumorphic_card.dart
file, replace:with:
Environment
Thank you!