fixed deprecated warnings

This commit is contained in:
Marton Kiss
2025-01-31 10:24:37 +01:00
parent 67649cc5fd
commit b5ee1afe05
102 changed files with 755 additions and 557 deletions

View File

@@ -85,8 +85,8 @@ class LiveCardProvider extends ChangeNotifier {
}
Map<String, String> toMap() {
print("LIVE ACTIVITY COLOR BELOW:");
print(_settings.liveActivityColor.toHexString().substring(2));
// print("LIVE ACTIVITY COLOR BELOW:");
// print(_settings.liveActivityColor.toHexString().substring(2));
String color = '#${_settings.liveActivityColor.toHexString().substring(2)}';
switch (currentState) {

View File

@@ -115,42 +115,42 @@ class AppTheme {
primary: accent,
onPrimary:
(accent.computeLuminance() > 0.5 ? Colors.black : Colors.white)
.withOpacity(.9),
.withValues(alpha: .9),
secondary: newSecondary,
onSecondary: (newSecondary.computeLuminance() > 0.5
? Colors.black
: Colors.white)
.withOpacity(.9),
.withValues(alpha: .9),
tertiary: newTertiary,
onTertiary:
(newTertiary.computeLuminance() > 0.5 ? Colors.black : Colors.white)
.withOpacity(.9),
.withValues(alpha: .9),
brightness: Brightness.light,
error: lightColors.red,
onError: Colors.white.withOpacity(.9),
onError: Colors.white.withValues(alpha: .9),
surface: highlightColor,
onSurface: Colors.black.withOpacity(.9),
onSurface: Colors.black.withValues(alpha: .9),
),
shadowColor: lightColors.shadow.withOpacity(.5),
shadowColor: lightColors.shadow.withValues(alpha: .5),
appBarTheme: AppBarTheme(backgroundColor: backgroundColor),
indicatorColor: accent,
iconTheme: IconThemeData(color: lightColors.text.withOpacity(.75)),
iconTheme: IconThemeData(color: lightColors.text.withValues(alpha: .75)),
navigationBarTheme: NavigationBarThemeData(
indicatorColor:
accent.withOpacity(accentColor == AccentColor.adaptive ? 0.4 : 0.8),
indicatorColor: accent.withValues(
alpha: accentColor == AccentColor.adaptive ? 0.4 : 0.8),
iconTheme:
WidgetStateProperty.all(IconThemeData(color: lightColors.text)),
backgroundColor: highlightColor,
labelTextStyle: WidgetStateProperty.all(TextStyle(
fontSize: 13.0,
fontWeight: FontWeight.w500,
color: lightColors.text.withOpacity(0.8),
color: lightColors.text.withValues(alpha: 0.8),
)),
labelBehavior: NavigationDestinationLabelBehavior.alwaysShow,
height: 76.0,
),
sliderTheme: SliderThemeData(
inactiveTrackColor: accent.withOpacity(.3),
inactiveTrackColor: accent.withValues(alpha: .3),
),
progressIndicatorTheme: ProgressIndicatorThemeData(color: accent),
expansionTileTheme: ExpansionTileThemeData(iconColor: accent),
@@ -238,48 +238,48 @@ class AppTheme {
primary: accent,
onPrimary:
(accent.computeLuminance() > 0.5 ? Colors.black : Colors.white)
.withOpacity(.9),
.withValues(alpha: .9),
secondary: newSecondary,
onSecondary: (newSecondary.computeLuminance() > 0.5
? Colors.black
: Colors.white)
.withOpacity(.9),
.withValues(alpha: .9),
tertiary: newTertiary,
onTertiary:
(newTertiary.computeLuminance() > 0.5 ? Colors.black : Colors.white)
.withOpacity(.9),
.withValues(alpha: .9),
brightness: Brightness.dark,
error: darkColors.red,
onError: Colors.black.withOpacity(.9),
onError: Colors.black.withValues(alpha: .9),
surface: highlightColor,
onSurface: Colors.white.withOpacity(.9),
onSurface: Colors.white.withValues(alpha: .9),
),
shadowColor: highlightColor.withOpacity(.5), //darkColors.shadow,
shadowColor: highlightColor.withValues(alpha: .5), //darkColors.shadow,
appBarTheme: AppBarTheme(backgroundColor: backgroundColor),
indicatorColor: accent,
iconTheme: IconThemeData(color: darkColors.text.withOpacity(.75)),
iconTheme: IconThemeData(color: darkColors.text.withValues(alpha: .75)),
navigationBarTheme: NavigationBarThemeData(
indicatorColor:
accent.withOpacity(accentColor == AccentColor.adaptive ? 0.4 : 0.8),
indicatorColor: accent.withValues(
alpha: accentColor == AccentColor.adaptive ? 0.4 : 0.8),
iconTheme:
WidgetStateProperty.all(IconThemeData(color: darkColors.text)),
backgroundColor: highlightColor,
labelTextStyle: WidgetStateProperty.all(TextStyle(
fontSize: 13.0,
fontWeight: FontWeight.w500,
color: darkColors.text.withOpacity(0.8),
color: darkColors.text.withValues(alpha: 0.8),
)),
labelBehavior: NavigationDestinationLabelBehavior.alwaysShow,
height: 76.0,
),
sliderTheme: SliderThemeData(
inactiveTrackColor: accent.withOpacity(.3),
inactiveTrackColor: accent.withValues(alpha: .3),
),
progressIndicatorTheme: ProgressIndicatorThemeData(color: accent),
expansionTileTheme: ExpansionTileThemeData(iconColor: accent),
cardColor: highlightColor,
chipTheme: ChipThemeData(
backgroundColor: accent.withOpacity(.2),
backgroundColor: accent.withValues(alpha: .2),
elevation: 1,
),
bottomNavigationBarTheme: BottomNavigationBarThemeData(

View File

@@ -191,7 +191,7 @@ List<Widget> sortDateWidgets(
width: 150.0,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12.0),
color: AppColors.of(context).text.withOpacity(.25),
color: AppColors.of(context).text.withValues(alpha: .25),
),
),
),

View File

@@ -178,8 +178,7 @@ Future<List<DateWidget>> getFilterWidgets(FilterType activeData,
// Ads
case FilterType.ads:
if (adProvider.available) {
items = ad_filter.getWidgets(
adProvider.ads, context);
items = ad_filter.getWidgets(adProvider.ads, context);
}
break;
}
@@ -233,8 +232,8 @@ Widget filterItemBuilder(
BoxShadow(
offset: const Offset(0, 21),
blurRadius: 23.0,
color: Theme.of(context).shadowColor.withOpacity(
Theme.of(context).shadowColor.opacity *
color: Theme.of(context).shadowColor.withValues(
alpha: Theme.of(context).shadowColor.opacity *
CurvedAnimation(
parent: CurvedAnimation(
parent: animation,

View File

@@ -73,7 +73,7 @@ Widget _defaultItemBuilder(
color: color,
boxShadow: [
BoxShadow(
color: color.withOpacity(0.8),
color: color.withValues(alpha: 0.8),
offset: const Offset(1, 2),
blurRadius: 5)
],

View File

@@ -380,7 +380,7 @@ class FilcColorPickerState extends State<FilcColorPicker> {
fontSize: 16.0,
color: AppColors.of(context)
.text
.withOpacity(isAdvancedView ? 1.0 : .5),
.withValues(alpha: isAdvancedView ? 1.0 : .5),
),
),
],

View File

@@ -210,32 +210,32 @@ class TrackPainter extends CustomPainter {
break;
case TrackType.red:
final List<Color> colors = [
hsvColor.toColor().withRed(0).withOpacity(1.0),
hsvColor.toColor().withRed(255).withOpacity(1.0),
hsvColor.toColor().withRed(0).withValues(alpha: 1.0),
hsvColor.toColor().withRed(255).withValues(alpha: 1.0),
];
Gradient gradient = LinearGradient(colors: colors);
canvas.drawRect(rect, Paint()..shader = gradient.createShader(rect));
break;
case TrackType.green:
final List<Color> colors = [
hsvColor.toColor().withGreen(0).withOpacity(1.0),
hsvColor.toColor().withGreen(255).withOpacity(1.0),
hsvColor.toColor().withGreen(0).withValues(alpha: 1.0),
hsvColor.toColor().withGreen(255).withValues(alpha: 1.0),
];
Gradient gradient = LinearGradient(colors: colors);
canvas.drawRect(rect, Paint()..shader = gradient.createShader(rect));
break;
case TrackType.blue:
final List<Color> colors = [
hsvColor.toColor().withBlue(0).withOpacity(1.0),
hsvColor.toColor().withBlue(255).withOpacity(1.0),
hsvColor.toColor().withBlue(0).withValues(alpha: 1.0),
hsvColor.toColor().withBlue(255).withValues(alpha: 1.0),
];
Gradient gradient = LinearGradient(colors: colors);
canvas.drawRect(rect, Paint()..shader = gradient.createShader(rect));
break;
case TrackType.alpha:
final List<Color> colors = [
hsvColor.toColor().withOpacity(0.0),
hsvColor.toColor().withOpacity(1.0),
hsvColor.toColor().withValues(alpha: 0.0),
hsvColor.toColor().withValues(alpha: 1.0),
];
Gradient gradient = LinearGradient(colors: colors);
canvas.drawRect(rect, Paint()..shader = gradient.createShader(rect));
@@ -390,7 +390,7 @@ class ColorPickerInputState extends State<ColorPickerInput> {
),
contentPadding:
const EdgeInsets.symmetric(vertical: 8.0, horizontal: 8.0),
fillColor: AppColors.of(context).text.withOpacity(.1),
fillColor: AppColors.of(context).text.withValues(alpha: .1),
),
onChanged: (String value) {
String input = value;
@@ -603,20 +603,20 @@ class ColorPickerSlider extends StatelessWidget {
break;
case TrackType.red:
thumbOffset += (box.maxWidth - 30.0) * hsvColor.toColor().red / 0xff;
thumbColor = hsvColor.toColor().withOpacity(1.0);
thumbColor = hsvColor.toColor().withValues(alpha: 1.0);
break;
case TrackType.green:
thumbOffset +=
(box.maxWidth - 30.0) * hsvColor.toColor().green / 0xff;
thumbColor = hsvColor.toColor().withOpacity(1.0);
thumbColor = hsvColor.toColor().withValues(alpha: 1.0);
break;
case TrackType.blue:
thumbOffset += (box.maxWidth - 30.0) * hsvColor.toColor().blue / 0xff;
thumbColor = hsvColor.toColor().withOpacity(1.0);
thumbColor = hsvColor.toColor().withValues(alpha: 1.0);
break;
case TrackType.alpha:
thumbOffset += (box.maxWidth - 30.0) * hsvColor.toColor().opacity;
thumbColor = hsvColor.toColor().withOpacity(hsvColor.alpha);
thumbColor = hsvColor.toColor().withValues(alpha: hsvColor.alpha);
break;
}
@@ -709,8 +709,8 @@ class ColorIndicator extends StatelessWidget {
boxShadow: [
BoxShadow(
color: useWhiteForeground(color)
? Colors.white.withOpacity(.5)
: Colors.black.withOpacity(.5),
? Colors.white.withValues(alpha: .5)
: Colors.black.withValues(alpha: .5),
offset: const Offset(0, 0),
blurRadius: 5)
],

View File

@@ -199,7 +199,7 @@ class GradeTile extends StatelessWidget {
: Icon(
SubjectIcon.resolveVariant(
context: context, subject: grade.subject),
color: AppColors.of(context).text.withOpacity(.5),
color: AppColors.of(context).text.withValues(alpha: .5),
),
minLeadingWidth: isSubjectView ? 32.0 : 0,
),
@@ -288,7 +288,8 @@ class GradeValueWidget extends StatelessWidget {
shadows: [
if (value.weight >= 200)
Shadow(
color: (contrast ? Colors.white : color).withOpacity(.4),
color:
(contrast ? Colors.white : color).withValues(alpha: .4),
offset: const Offset(-4, -3),
)
],
@@ -312,7 +313,7 @@ class GradeValueWidget extends StatelessWidget {
width: size * 1.4,
height: size * 1.4,
decoration: BoxDecoration(
color: color.withOpacity(contrast ? 1.0 : .25),
color: color.withValues(alpha: contrast ? 1.0 : .25),
shape: BoxShape.circle,
boxShadow: [
if (shadow &&

View File

@@ -75,7 +75,7 @@ class LessonTile extends StatelessWidget {
}
if (lesson.isEmpty) {
accent = AppColors.of(context).text.withOpacity(0.6);
accent = AppColors.of(context).text.withValues(alpha: 0.6);
}
if (!lesson.studentPresence) {
@@ -182,9 +182,8 @@ class LessonTile extends StatelessWidget {
fontSize: 16.5,
color: fill
? accent
: AppColors.of(context)
.text
.withOpacity(!lesson.isEmpty ? 1.0 : 0.5),
: AppColors.of(context).text.withValues(
alpha: !lesson.isEmpty ? 1.0 : 0.5),
fontStyle: lesson.subject.isRenamed &&
settingsProvider.renamedSubjectsItalics
? FontStyle.italic
@@ -199,8 +198,10 @@ class LessonTile extends StatelessWidget {
fontWeight: FontWeight.w600,
fontSize: 14.0,
color: fill
? accent.withOpacity(.9)
: AppColors.of(context).text.withOpacity(.9),
? accent.withValues(alpha: .9)
: AppColors.of(context)
.text
.withValues(alpha: .9),
),
),
),
@@ -217,7 +218,7 @@ class LessonTile extends StatelessWidget {
// color: Theme.of(context)
// .colorScheme
// .secondary
// .withOpacity(.15),
// .withValues(alpha: .15),
// borderRadius: BorderRadius.circular(10.0),
// ),
// child: Text(
@@ -229,7 +230,7 @@ class LessonTile extends StatelessWidget {
// color: Theme.of(context)
// .colorScheme
// .secondary
// .withOpacity(.9),
// .withValues(alpha: .9),
// ),
// ),
// )
@@ -246,11 +247,11 @@ class LessonTile extends StatelessWidget {
horizontal: 5.5, vertical: 3.0),
decoration: BoxDecoration(
color: fill
? accent.withOpacity(.15)
? accent.withValues(alpha: .15)
: Theme.of(context)
.colorScheme
.tertiary
.withOpacity(.15),
.withValues(alpha: .15),
borderRadius: BorderRadius.circular(10.0),
),
child: Text(
@@ -261,11 +262,11 @@ class LessonTile extends StatelessWidget {
fontSize: 12.0,
fontWeight: FontWeight.w600,
color: fill
? accent.withOpacity(0.9)
? accent.withValues(alpha: 0.9)
: Theme.of(context)
.colorScheme
.secondary
.withOpacity(.9),
.withValues(alpha: .9),
),
),
),
@@ -277,7 +278,9 @@ class LessonTile extends StatelessWidget {
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 14.0,
color: fill ? accent.withOpacity(0.5) : null,
color: fill
? accent.withValues(alpha: 0.5)
: null,
),
),
],
@@ -344,7 +347,7 @@ class LessonTile extends StatelessWidget {
? Theme.of(context)
.colorScheme
.secondary
.withOpacity(.3)
.withValues(alpha: .3)
: const Color(0x00000000),
borderRadius: BorderRadius.circular(12.0),
boxShadow: [
@@ -353,7 +356,7 @@ class LessonTile extends StatelessWidget {
color: Theme.of(context)
.colorScheme
.secondary
.withOpacity(.25),
.withValues(alpha: .25),
blurRadius: 6.0,
)
],
@@ -386,7 +389,7 @@ class LessonTile extends StatelessWidget {
// fontWeight: FontWeight.w500,
// color: AppColors.of(context)
// .text
// .withOpacity(.75),
// .withValues(alpha: .75),
// ),
// ),
// ),
@@ -398,11 +401,11 @@ class LessonTile extends StatelessWidget {
horizontal: 6.0, vertical: 3.5),
decoration: BoxDecoration(
color: fill
? accent.withOpacity(.15)
? accent.withValues(alpha: .15)
: Theme.of(context)
.colorScheme
.tertiary
.withOpacity(.15),
.withValues(alpha: .15),
borderRadius: BorderRadius.circular(10.0),
),
child: Text(
@@ -413,11 +416,11 @@ class LessonTile extends StatelessWidget {
fontSize: 12.5,
fontWeight: FontWeight.w600,
color: fill
? accent.withOpacity(0.9)
? accent.withValues(alpha: 0.9)
: Theme.of(context)
.colorScheme
.secondary
.withOpacity(.9),
.withValues(alpha: .9),
),
),
),
@@ -438,10 +441,10 @@ class LessonTile extends StatelessWidget {
style: TextStyle(
fontWeight: FontWeight.w500,
color: fill
? accent.withOpacity(.9)
? accent.withValues(alpha: .9)
: AppColors.of(context)
.text
.withOpacity(.9),
.withValues(alpha: .9),
),
),
],
@@ -502,8 +505,8 @@ class LessonSubtile extends StatelessWidget {
Center(
child: SizedBox(
width: 30.0,
child:
Icon(icon, color: iconColor.withOpacity(.75), size: 20.0),
child: Icon(icon,
color: iconColor.withValues(alpha: .75), size: 20.0),
),
),
Expanded(
@@ -515,7 +518,8 @@ class LessonSubtile extends StatelessWidget {
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.w500,
color: AppColors.of(context).text.withOpacity(.65)),
color:
AppColors.of(context).text.withValues(alpha: .65)),
),
),
),

View File

@@ -58,7 +58,8 @@ class MessageTile extends StatelessWidget {
width: 105,
height: 15,
decoration: BoxDecoration(
color: AppColors.of(context).text.withOpacity(.85),
color:
AppColors.of(context).text.withValues(alpha: .85),
borderRadius: BorderRadius.circular(8.0),
),
),
@@ -89,7 +90,8 @@ class MessageTile extends StatelessWidget {
width: 150,
height: 10,
decoration: BoxDecoration(
color: AppColors.of(context).text.withOpacity(.45),
color:
AppColors.of(context).text.withValues(alpha: .45),
borderRadius: BorderRadius.circular(8.0),
),
),
@@ -109,7 +111,8 @@ class MessageTile extends StatelessWidget {
width: 35,
height: 15,
decoration: BoxDecoration(
color: AppColors.of(context).text.withOpacity(.45),
color:
AppColors.of(context).text.withValues(alpha: .45),
borderRadius: BorderRadius.circular(8.0),
),
),
@@ -120,7 +123,7 @@ class MessageTile extends StatelessWidget {
style: TextStyle(
fontWeight: FontWeight.w500,
fontSize: 14.0,
color: AppColors.of(context).text.withOpacity(.75),
color: AppColors.of(context).text.withValues(alpha: .75),
),
),
),