I would like to use New Gradient App Bar package text on my app using the code below. I used this code before on the past version of flutter and got no problem.
appBar: PreferredSize(
preferredSize: const Size(85,85), // here the desired height
child: NewGradientAppBar(
title: const Text(
'Project',
style: TextStyle(
fontStyle: FontStyle.italic,
letterSpacing: 0.1,
fontWeight: FontWeight.w800,
fontFamily: 'Roboto',
height: 1.3,
fontSize: 50,
),
textAlign: TextAlign.center,
),
gradient: LinearGradient(colors: [Colors.teal.shade300, Colors.teal, Colors.teal.shade800]),
but I’m getting errors on the console when I run the project which are below.
Running Gradle task ‘assembleDebug’…
../../AppData/Local/Pub/Cache/hosted/pub.dev/new_gradient_app_bar-0.2.0/lib/new_gradient_app_bar.dart:422:21: Error: The getter ‘textTheme’ isn’t defined for the class ‘AppBarTheme’.‘AppBarTheme’ is from ‘package:flutter/src/material/app_bar_theme.dart’ (‘/C:/flutter/packages/flutter/lib/src/material/app_bar_theme.dart’).
Try correcting the name to the name of an existing getter, or defining a getter or field named ‘textTheme’.
appBarTheme.textTheme?.headline6 ??
^^^^^^^^^
../../AppData/Local/Pub/Cache/hosted/pub.dev/new_gradient_app_bar-0.2.0/lib/new_gradient_app_bar.dart:425:21: Error: The getter ‘textTheme’ isn’t defined for the class ‘AppBarTheme’.‘AppBarTheme’ is from ‘package:flutter/src/material/app_bar_theme.dart’ (‘/C:/flutter/packages/flutter/lib/src/material/app_bar_theme.dart’).
Try correcting the name to the name of an existing getter, or defining a getter or field named ‘textTheme’.
appBarTheme.textTheme?.bodyText2 ??
^^^^^^^^^
../../AppData/Local/Pub/Cache/hosted/pub.dev/new_gradient_app_bar-0.2.0/lib/new_gradient_app_bar.dart:580:21: Error: The getter ‘brightness’ isn’t defined for the class ‘AppBarTheme’.‘AppBarTheme’ is from ‘package:flutter/src/material/app_bar_theme.dart’ (‘/C:/flutter/packages/flutter/lib/src/material/app_bar_theme.dart’).
Try correcting the name to the name of an existing getter, or defining a getter or field named ‘brightness’.
appBarTheme.brightness ??
^^^^^^^^^^
../../AppData/Local/Pub/Cache/hosted/pub.dev/new_gradient_app_bar-0.2.0/lib/new_gradient_app_bar.dart:581:19: Error: The getter ‘primaryColorBrightness’ isn’t defined for the class ‘ThemeData’.‘ThemeData’ is from ‘package:flutter/src/material/theme_data.dart’ (‘/C:/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 ‘primaryColorBrightness’.
themeData.primaryColorBrightness;
^^^^^^^^^^^^^^^^^^^^^^
../../AppData/Local/Pub/Cache/hosted/pub.dev/new_gradient_app_bar-0.2.0/lib/new_gradient_app_bar.dart:591:32: Error: The getter ‘color’ isn’t defined for the class ‘AppBarTheme’.‘AppBarTheme’ is from ‘package:flutter/src/material/app_bar_theme.dart’ (‘/C:/flutter/packages/flutter/lib/src/material/app_bar_theme.dart’).
Try correcting the name to the name of an existing getter, or defining a getter or field named ‘color’.
color: appBarTheme.color ?? themeData.primaryColor,
^^^^^
Target kernel_snapshot failed: ExceptionFAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ‘:app:compileFlutterBuildDebug’.Process ‘command ‘C:flutterbinflutter.bat” finished with non-zero exit value 1
Try:
Run with –stacktrace option to get the stack trace.
Run with –info or –debug option to get more log output.
Run with –scan to get full insights.
I tried to Pub get
and Pub Upgrade
hoping it is a dependencies issue but still the errors doesn’t still there.