I am working on a project which was built on Flutter 2.2.3 but I updated all the dependencies. Also, I have fixed many errors which were the result of upgrading the flutter from 2.2.3 to 2.5.2. Now i am facing an issue with two files. One issue is with the PersistentTabController and it is saying 'The named parameter is not found' for many lines like controller, navBarHeight, onItemSelected, screens, items. Well I am sharing the code. The left side is totally red. How can I fix that?
PersistentTabController(
controller: controller,
navBarHeight: MediaQuery.of(context).size.width > 768 ? 90 : 64,
onItemSelected: (item) {
int index = controller.index;
if (index == 0) {
setState(() {
appbarTitle = Languages.of(context).homeScreenTitle;
});
} else if (index == 1) {
setState(() {
appbarTitle = Languages.of(context).appointmentsScreenTitle;
});
} else if (index == 2) {
setState(() {
appbarTitle = Languages.of(context).favouriteScreenTitle;
});
} else if (index == 3) {
setState(() {
appbarTitle =
Languages.of(context).notificationsScreenTitle;
});
} else if (index == 4) {
setState(() {
appbarTitle = Languages.of(context).accountScreenTitle;
});
}
},
screens: _pages,
items: [
PersistentBottomNavBarItem(
icon: Icon(
Icons.home_outlined,
size: MediaQuery.of(context).size.width > 768 ? 40 : 24,
),
title: Languages.of(context).bottomNavHome,
activeColor: ColorConstants.primaryColor,
inactiveColor: ColorConstants.iconColor,
titleStyle: TextStyle(
fontSize:
MediaQuery.of(context).size.width > 768 ? 20 : 12)),
PersistentBottomNavBarItem(
icon: Icon(
Icons.calendar_today_outlined,
size: MediaQuery.of(context).size.width > 768 ? 40 : 24,
),
title: Languages.of(context).bottomNavAppointments,
activeColor: ColorConstants.primaryColor,
inactiveColor: ColorConstants.iconColor,
titleStyle: TextStyle(
fontSize:
MediaQuery.of(context).size.width > 768 ? 20 : 12)),
PersistentBottomNavBarItem(
icon: Icon(
Icons.favorite_border,
size: MediaQuery.of(context).size.width > 768 ? 40 : 24,
),
title: Languages.of(context).bottomNavFavourites,
activeColor: ColorConstants.primaryColor,
inactiveColor: ColorConstants.iconColor,
titleStyle: TextStyle(
fontSize:
MediaQuery.of(context).size.width > 768 ? 20 : 12)),
PersistentBottomNavBarItem(
icon: Icon(
Icons.notifications,
size: MediaQuery.of(context).size.width > 768 ? 40 : 24,
),
title: Languages.of(context).bottomNavNotifications,
activeColor: ColorConstants.primaryColor,
inactiveColor: ColorConstants.iconColor,
titleStyle: TextStyle(
fontSize:
MediaQuery.of(context).size.width > 768 ? 20 : 12)),
PersistentBottomNavBarItem(
icon: Icon(
Icons.person_outline,
size: MediaQuery.of(context).size.width > 768 ? 40 : 24,
),
title: Languages.of(context).bottomNavAccount,
activeColor: ColorConstants.primaryColor,
inactiveColor: ColorConstants.iconColor,
titleStyle: TextStyle(
fontSize:
MediaQuery.of(context).size.width > 768 ? 20 : 12)),
],
confineInSafeArea: true,
backgroundColor: Colors.white,
handleAndroidBackButtonPress: true,
resizeToAvoidBottomInset: true,
// This needs to be true if you want to move up the screen when keyboard appears.
stateManagement: false,
hideNavigationBarWhenKeyboardShows: true,
// Recommended to set 'resizeToAvoidBottomInset' as true while using this argument.
decoration: NavBarDecoration(
border: Border.all(color: Colors.white),
borderRadius: BorderRadius.circular(1.0),
colorBehindNavBar: Colors.black,
),
popAllScreensOnTapOfSelectedTab: true,
popActionScreens: PopActionScreensType.all,
itemAnimationProperties: ItemAnimationProperties(
// Navigation Bar's items animation properties.
duration: Duration(milliseconds: 200),
curve: Curves.ease,
),
screenTransitionAnimation: ScreenTransitionAnimation(
// Screen transition animation on change of selected tab.
animateTabTransition: true,
curve: Curves.ease,
duration: Duration(milliseconds: 200),
),
navBarStyle: NavBarStyle.style6,
),
Also in another file, I am facing OneSignal issues like 'The method setInFocusDisplayType isn't defined for the type 'OneSignal' and 'The method 'setNotificationReceivedHandler isn't defined for the type 'OneSignal'. Here is the code
OneSignal.shared
.setInFocusDisplayType(OSNotificationDisplayType.notification);
OneSignal.shared
.setNotificationReceivedHandler((OSNotification notification) {
this.setState(() {
outPutString =
"Received notification: \n${notification.jsonRepresentation().replaceAll("\\n", "\n")}";
});
How can i fix these?
I am sharing my pubspec.yaml file here.
name: test_app
description: A Test Application
publish_to: 'none'
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
cupertino_icons: ^1.0.0
shared_preferences: ^2.0.8
cached_network_image: ^3.1.0
flutter_rating_bar: ^4.0.0
url_launcher: ^6.0.12
country_code_picker: ^2.0.2
flutter_range_slider: "^1.5.0"
group_radio_button: ^1.0.1
carousel_slider: ^4.0.0
persistent_bottom_nav_bar: ^4.0.2
intl: ^0.17.0
provider: ^6.0.1
flutter_bloc: ^7.3.0
equatable: ^2.0.3
image_picker: ^0.8.4+2
dio: ^4.0.0
otp_text_field: ^1.0.2
path: ^1.7.0
mime: ^1.0.0
fluttertoast: ^8.0.8
date_format: ^2.0.4
html: ^0.15.0
flutter_calendar_carousel: ^2.0.3
onesignal_flutter: ^3.2.3
flutter_paytabs_bridge: ^2.1.1
http:
share: ^2.0.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
fonts:
- family: Quicksand
fonts:
- asset: assets/fonts/Quicksand/Quicksand-Bold.ttf
- asset: assets/fonts/Quicksand/Quicksand-Light.ttf
- asset: assets/fonts/Quicksand/Quicksand-Medium.ttf
- asset: assets/fonts/Quicksand/Quicksand-Regular.ttf
- asset: assets/fonts/Quicksand/Quicksand-SemiBold.ttf
- asset: assets/fonts/Quicksand/Quicksand-VariableFont_wght.ttf
assets:
- assets/images/
- assets/icons/