diff --git a/.flutter b/.flutter
index dec2ee5c1..8495dee1f 160000
--- a/.flutter
+++ b/.flutter
@@ -1 +1 @@
-Subproject commit dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668
+Subproject commit 8495dee1fd4aacbe9de707e7581203232f591b2f
diff --git a/.github/workflows/quality-check.yml b/.github/workflows/quality-check.yml
index d448a848a..5aaa78727 100644
--- a/.github/workflows/quality-check.yml
+++ b/.github/workflows/quality-check.yml
@@ -26,7 +26,7 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Get Flutter packages
- run: scripts/pub_get_all.sh
+ run: ./flutterw pub get
- name: Static analysis.
run: ./flutterw analyze
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index d647f6cf9..a6ea7caf5 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -34,7 +34,7 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Get Flutter packages
- run: scripts/pub_get_all.sh
+ run: ./flutterw pub get
- name: Update Flutter version file
run: scripts/update_flutter_version.sh
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c48e6e13d..507b64f11 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
## [Unreleased]
+### Changed
+
+- upgraded Flutter to stable v3.27.0
+
## [v1.11.20] - 2024-12-11
### Added
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index c12dd891b..c63fb87bf 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -330,9 +330,6 @@
android:name="flutterEmbedding"
android:value="2" />
diff --git a/lib/model/covers.dart b/lib/model/covers.dart
index edf189280..835f359d9 100644
--- a/lib/model/covers.dart
+++ b/lib/model/covers.dart
@@ -9,6 +9,7 @@ import 'package:aves/model/vaults/vaults.dart';
import 'package:aves/services/common/services.dart';
import 'package:aves/utils/android_file_utils.dart';
import 'package:aves_model/aves_model.dart';
+import 'package:aves_utils/aves_utils.dart';
import 'package:collection/collection.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/foundation.dart';
@@ -178,14 +179,14 @@ class Covers {
final volume = androidFileUtils.getStorageVolume(path)?.path;
final relativePath = volume != null ? path?.substring(volume.length) : null;
final packageName = row.packageName;
- final colorValue = row.color?.value;
+ final colorJson = row.color?.toJson();
return {
'filter': row.filter.toJson(),
if (volume != null) 'volume': volume,
if (relativePath != null) 'relativePath': relativePath,
if (packageName != null) 'packageName': packageName,
- if (colorValue != null) 'color': colorValue,
+ if (colorJson != null) 'color': colorJson,
};
})
.nonNulls
@@ -201,33 +202,39 @@ class Covers {
final visibleEntries = source.visibleEntries;
jsonList.forEach((row) {
- final filter = CollectionFilter.fromJson(row['filter']);
- if (filter == null) {
- debugPrint('failed to import cover for row=$row');
- return;
- }
-
- final volume = row['volume'] as String?;
- final relativePath = row['relativePath'] as String?;
- final packageName = row['packageName'] as String?;
- final colorValue = row['color'] as int?;
-
- AvesEntry? entry;
- if (volume != null && relativePath != null) {
- final path = pContext.join(volume, relativePath);
- entry = visibleEntries.firstWhereOrNull((entry) => entry.path == path && filter.test(entry));
- if (entry == null) {
- debugPrint('failed to import cover entry for path=$path, filter=$filter');
+ try {
+ final filter = CollectionFilter.fromJson(row['filter']);
+ if (filter == null) {
+ debugPrint('failed to import cover for row=$row');
+ return;
}
- }
- if (entry != null || packageName != null || colorValue != null) {
- set(
- filter: filter,
- entryId: entry?.id,
- packageName: packageName,
- color: colorValue != null ? Color(colorValue) : null,
- );
+ final volume = row['volume'] as String?;
+ final relativePath = row['relativePath'] as String?;
+ final packageName = row['packageName'] as String?;
+ final color = row['color'];
+ // for backward compatibility, color used to be an `int`, now a `string`
+ final colorJson = color is String ? color : null;
+
+ AvesEntry? entry;
+ if (volume != null && relativePath != null) {
+ final path = pContext.join(volume, relativePath);
+ entry = visibleEntries.firstWhereOrNull((entry) => entry.path == path && filter.test(entry));
+ if (entry == null) {
+ debugPrint('failed to import cover entry for path=$path, filter=$filter');
+ }
+ }
+
+ if (entry != null || packageName != null || colorJson != null) {
+ set(
+ filter: filter,
+ entryId: entry?.id,
+ packageName: packageName,
+ color: ExtraColor.fromJson(colorJson),
+ );
+ }
+ } catch (error, stack) {
+ debugPrint('failed to import cover for row=$row with error=$error\n$stack');
}
});
}
@@ -254,13 +261,15 @@ class CoverRow extends Equatable {
final filter = CollectionFilter.fromJson(map['filter']);
if (filter == null) return null;
- final colorValue = map['color'] as int?;
- final color = colorValue != null ? Color(colorValue) : null;
+ final entryId = map['entryId'] as int?;
+ final packageName = map['packageName'] as String?;
+ final colorJson = map['color'] as String?;
+
return CoverRow(
filter: filter,
- entryId: map['entryId'] as int?,
- packageName: map['packageName'] as String?,
- color: color,
+ entryId: entryId,
+ packageName: packageName,
+ color: ExtraColor.fromJson(colorJson),
);
}
@@ -268,6 +277,6 @@ class CoverRow extends Equatable {
'filter': filter.toJson(),
'entryId': entryId,
'packageName': packageName,
- 'color': color?.value,
+ 'color': color?.toJson(),
};
}
diff --git a/lib/model/db/db_sqflite.dart b/lib/model/db/db_sqflite.dart
index cb5e51d9d..6fbf88fe8 100644
--- a/lib/model/db/db_sqflite.dart
+++ b/lib/model/db/db_sqflite.dart
@@ -33,7 +33,8 @@ class SqfliteLocalMediaDb implements LocalMediaDb {
static const trashTable = 'trash';
static const videoPlaybackTable = 'videoPlayback';
- static const _queryCursorBufferSize = 1000;
+ static const _entryInsertSliceMaxCount = 10000; // number of entries
+ static const _queryCursorBufferSize = 1000; // number of rows
static int _lastId = 0;
@override
@@ -93,7 +94,7 @@ class SqfliteLocalMediaDb implements LocalMediaDb {
'filter TEXT PRIMARY KEY'
', entryId INTEGER'
', packageName TEXT'
- ', color INTEGER'
+ ', color TEXT'
')');
await db.execute('CREATE TABLE $dynamicAlbumTable('
'name TEXT PRIMARY KEY'
@@ -116,7 +117,7 @@ class SqfliteLocalMediaDb implements LocalMediaDb {
')');
},
onUpgrade: LocalMediaDbUpgrader.upgradeDb,
- version: 12,
+ version: 13,
);
final maxIdRows = await _db.rawQuery('SELECT MAX(id) AS maxId FROM $entryTable');
@@ -224,9 +225,15 @@ class SqfliteLocalMediaDb implements LocalMediaDb {
Future insertEntries(Set entries) async {
if (entries.isEmpty) return;
final stopwatch = Stopwatch()..start();
- final batch = _db.batch();
- entries.forEach((entry) => _batchInsertEntry(batch, entry));
- await batch.commit(noResult: true);
+ // slice entries to avoid memory issues
+ int inserted = 0;
+ await Future.forEach(entries.slices(_entryInsertSliceMaxCount), (slice) async {
+ debugPrint('$runtimeType saveEntries inserting slice of [${inserted + 1}, ${inserted + slice.length}] entries');
+ final batch = _db.batch();
+ slice.forEach((entry) => _batchInsertEntry(batch, entry));
+ await batch.commit(noResult: true);
+ inserted += slice.length;
+ });
debugPrint('$runtimeType saveEntries complete in ${stopwatch.elapsed.inMilliseconds}ms for ${entries.length} entries');
}
diff --git a/lib/model/db/db_sqflite_upgrade.dart b/lib/model/db/db_sqflite_upgrade.dart
index ab63f7564..0ce793b94 100644
--- a/lib/model/db/db_sqflite_upgrade.dart
+++ b/lib/model/db/db_sqflite_upgrade.dart
@@ -1,4 +1,8 @@
+import 'dart:ui';
+
+import 'package:aves/model/covers.dart';
import 'package:aves/model/db/db_sqflite.dart';
+import 'package:aves/model/filters/filters.dart';
import 'package:flutter/foundation.dart';
import 'package:sqflite/sqflite.dart';
@@ -41,6 +45,8 @@ class LocalMediaDbUpgrader {
await _upgradeFrom10(db);
case 11:
await _upgradeFrom11(db);
+ case 12:
+ await _upgradeFrom12(db);
}
oldVersion++;
}
@@ -388,4 +394,54 @@ class LocalMediaDbUpgrader {
', filter TEXT'
')');
}
+
+ static Future _upgradeFrom12(Database db) async {
+ debugPrint('upgrading DB from v12');
+
+ // retrieve covers stored with `int` color value
+ final rows = {};
+ final cursor = await db.queryCursor(coverTable);
+ while (await cursor.moveNext()) {
+ final Map map = cursor.current;
+ final filter = CollectionFilter.fromJson(map['filter']);
+ if (filter != null) {
+ final colorValue = map['color'] as int?;
+ final color = colorValue != null ? Color(colorValue) : null;
+ final row = CoverRow(
+ filter: filter,
+ entryId: map['entryId'] as int?,
+ packageName: map['packageName'] as String?,
+ color: color,
+ );
+ rows.add(row);
+ }
+ }
+
+ // convert `color` column type from value number to JSON string
+ await db.transaction((txn) async {
+ const newCoverTable = '${coverTable}TEMP';
+ await db.execute('CREATE TABLE $newCoverTable('
+ 'filter TEXT PRIMARY KEY'
+ ', entryId INTEGER'
+ ', packageName TEXT'
+ ', color TEXT'
+ ')');
+
+ // insert covers with `string` color value
+ if (rows.isNotEmpty) {
+ final batch = db.batch();
+ rows.forEach((row) {
+ batch.insert(
+ newCoverTable,
+ row.toMap(),
+ conflictAlgorithm: ConflictAlgorithm.replace,
+ );
+ });
+ await batch.commit(noResult: true);
+ }
+
+ await db.execute('DROP TABLE $coverTable;');
+ await db.execute('ALTER TABLE $newCoverTable RENAME TO $coverTable;');
+ });
+ }
}
diff --git a/lib/model/filters/filters.dart b/lib/model/filters/filters.dart
index a17eb11bd..e295d1c53 100644
--- a/lib/model/filters/filters.dart
+++ b/lib/model/filters/filters.dart
@@ -99,18 +99,18 @@ abstract class CollectionFilter extends Equatable implements Comparable) {
return _fromMap(jsonMap);
}
+ debugPrint('failed to parse filter from json=$jsonString');
} catch (error, stack) {
debugPrint('failed to parse filter from json=$jsonString error=$error\n$stack');
}
- debugPrint('failed to parse filter from json=$jsonString');
return null;
}
diff --git a/lib/model/settings/settings.dart b/lib/model/settings/settings.dart
index e1a52c276..87963e50c 100644
--- a/lib/model/settings/settings.dart
+++ b/lib/model/settings/settings.dart
@@ -368,8 +368,6 @@ class Settings with ChangeNotifier, SettingsAccess, AppSettings, DisplaySettings
}
} else {
switch (key) {
- case SettingKeys.subtitleTextColorKey:
- case SettingKeys.subtitleBackgroundColorKey:
case SettingKeys.convertQualityKey:
case SettingKeys.screenSaverIntervalKey:
case SettingKeys.slideshowIntervalKey:
@@ -466,6 +464,8 @@ class Settings with ChangeNotifier, SettingsAccess, AppSettings, DisplaySettings
case SettingKeys.videoResumptionModeKey:
case SettingKeys.subtitleTextAlignmentKey:
case SettingKeys.subtitleTextPositionKey:
+ case SettingKeys.subtitleTextColorKey:
+ case SettingKeys.subtitleBackgroundColorKey:
case SettingKeys.tagEditorExpandedSectionKey:
case SettingKeys.convertMimeTypeKey:
case SettingKeys.mapStyleKey:
diff --git a/lib/model/source/media_store_source.dart b/lib/model/source/media_store_source.dart
index eac2270fb..83751b84d 100644
--- a/lib/model/source/media_store_source.dart
+++ b/lib/model/source/media_store_source.dart
@@ -209,7 +209,7 @@ class MediaStoreSource extends CollectionSource {
},
onDone: () async {
if (newEntries.isNotEmpty) {
- debugPrint('$runtimeType load ${stopwatch.elapsed} save new entries');
+ debugPrint('$runtimeType load ${stopwatch.elapsed} save ${newEntries.length} new entries');
await localMediaDb.insertEntries(newEntries);
// TODO TLAD find duplication cause
diff --git a/lib/theme/themes.dart b/lib/theme/themes.dart
index 843fad424..b77ea96f8 100644
--- a/lib/theme/themes.dart
+++ b/lib/theme/themes.dart
@@ -41,11 +41,11 @@ class Themes {
static Color _schemeThirdLayer(ColorScheme colors) => _isDarkTheme(colors) ? colors.surfaceContainerHighest : colors.surfaceContainerHigh;
- static Color _unselectedWidgetColor(ColorScheme colors) => colors.onSurface.withAlpha((255.0 * .6).round());
+ static Color _unselectedWidgetColor(ColorScheme colors) => colors.onSurface.withValues(alpha: .6);
static Color backgroundTextColor(BuildContext context) {
final colors = Theme.of(context).colorScheme;
- return Color.alphaBlend(colors.surfaceTint, colors.onSurface).withAlpha((255.0 * .5).round());
+ return Color.alphaBlend(colors.surfaceTint, colors.onSurface).withValues(alpha: .5);
}
static final _typography = Typography.material2021(platform: TargetPlatform.android);
@@ -98,7 +98,7 @@ class Themes {
// adapted from M3 defaults
final TextStyle style = textTheme.labelLarge!;
if (states.contains(WidgetState.disabled)) {
- return style.apply(color: colors.onSurface.withAlpha((255.0 * .38).round()));
+ return style.apply(color: colors.onSurface.withValues(alpha: .38));
}
return style.apply(color: colors.onSurface);
}),
@@ -118,12 +118,12 @@ class Themes {
fillColor: WidgetStateProperty.resolveWith((states) {
if (states.contains(WidgetState.selected)) {
if (states.contains(WidgetState.disabled)) {
- return colors.onSurface.withAlpha((255.0 * .38).round());
+ return colors.onSurface.withValues(alpha: .38);
}
return colors.primary;
}
if (states.contains(WidgetState.disabled)) {
- return colors.onSurface.withAlpha((255.0 * .38).round());
+ return colors.onSurface.withValues(alpha: .38);
}
if (states.contains(WidgetState.pressed)) {
return colors.onSurface;
@@ -139,7 +139,7 @@ class Themes {
);
static SliderThemeData _sliderTheme(ColorScheme colors) => SliderThemeData(
- inactiveTrackColor: colors.primary.withAlpha((255.0 * .24).round()),
+ inactiveTrackColor: colors.primary.withValues(alpha: .24),
);
static SnackBarThemeData _snackBarTheme(ColorScheme colors) => SnackBarThemeData(
diff --git a/lib/widgets/about/about_tv_page.dart b/lib/widgets/about/about_tv_page.dart
index d61590307..34b8333b6 100644
--- a/lib/widgets/about/about_tv_page.dart
+++ b/lib/widgets/about/about_tv_page.dart
@@ -103,7 +103,7 @@ class _ContentState extends State<_Content> {
return ListTile(
title: DefaultTextStyle(
style: theme.textTheme.bodyLarge!.copyWith(
- color: isSelected ? colors.primary : colors.onSurface.withAlpha((255.0 * .64).round()),
+ color: isSelected ? colors.primary : colors.onSurface.withValues(alpha: .64),
),
child: _getTitle(_Section.values[index]),
),
diff --git a/lib/widgets/about/translators.dart b/lib/widgets/about/translators.dart
index 9bfe976e2..6f935e204 100644
--- a/lib/widgets/about/translators.dart
+++ b/lib/widgets/about/translators.dart
@@ -62,19 +62,19 @@ class _RandomTextSpanHighlighterState extends State<_RandomTextSpanHighlighter>
final color = widget.color;
_baseStyle = TextStyle(
- color: color.withAlpha((255.0 * .7).round()),
+ color: color.withValues(alpha: .7),
shadows: [
Shadow(
- color: color.withAlpha(0),
+ color: color.withValues(alpha: 0),
blurRadius: 0,
)
],
);
final highlightStyle = TextStyle(
- color: color.withAlpha(255),
+ color: color.withValues(alpha: 1),
shadows: [
Shadow(
- color: color.withAlpha(255),
+ color: color.withValues(alpha: 1),
blurRadius: 3,
)
],
diff --git a/lib/widgets/collection/collection_grid.dart b/lib/widgets/collection/collection_grid.dart
index b6236a80d..016f96b85 100644
--- a/lib/widgets/collection/collection_grid.dart
+++ b/lib/widgets/collection/collection_grid.dart
@@ -426,7 +426,7 @@ class _CollectionScaler extends StatelessWidget {
),
mosaicItemBuilder: (index, targetExtent) => DecoratedBox(
decoration: BoxDecoration(
- color: ThumbnailImage.computeLoadingBackgroundColor(index * 10, brightness).withAlpha((255.0 * .9).round()),
+ color: ThumbnailImage.computeLoadingBackgroundColor(index * 10, brightness).withValues(alpha: .9),
border: Border.all(
color: borderColor,
width: borderWidth,
diff --git a/lib/widgets/common/action_mixins/feedback.dart b/lib/widgets/common/action_mixins/feedback.dart
index 10de21fbb..6666ed606 100644
--- a/lib/widgets/common/action_mixins/feedback.dart
+++ b/lib/widgets/common/action_mixins/feedback.dart
@@ -257,7 +257,7 @@ class _ReportOverlayState extends State> with SingleTickerPr
percent: percent,
lineWidth: strokeWidth,
radius: diameter / 2,
- backgroundColor: colorScheme.onSurface.withAlpha((255.0 * .2).round()),
+ backgroundColor: colorScheme.onSurface.withValues(alpha: .2),
progressColor: progressColor,
animation: animate,
center: total != null
@@ -314,7 +314,7 @@ class ReportProgressIndicator extends StatelessWidget {
height: diameter,
padding: const EdgeInsets.all(strokeWidth / 2),
child: CircularProgressIndicator(
- color: progressColor.withAlpha((255.0 * opacity).round()),
+ color: progressColor.withValues(alpha: opacity),
strokeWidth: strokeWidth,
),
);
diff --git a/lib/widgets/common/app_bar/sliver_app_bar_title.dart b/lib/widgets/common/app_bar/sliver_app_bar_title.dart
index 40fb64145..08b15cfea 100644
--- a/lib/widgets/common/app_bar/sliver_app_bar_title.dart
+++ b/lib/widgets/common/app_bar/sliver_app_bar_title.dart
@@ -16,7 +16,7 @@ class SliverAppBarTitleWrapper extends StatelessWidget {
final toolbarOpacity = context.dependOnInheritedWidgetOfExactType()!.toolbarOpacity;
final baseColor = (DefaultTextStyle.of(context).style.color ?? Theme.of(context).textTheme.titleLarge!.color!);
return DefaultTextStyle.merge(
- style: TextStyle(color: baseColor.withAlpha((255.0 * toolbarOpacity).round())),
+ style: TextStyle(color: baseColor.withValues(alpha: toolbarOpacity)),
child: child,
);
}
diff --git a/lib/widgets/common/basic/text/background_painter.dart b/lib/widgets/common/basic/text/background_painter.dart
index d6a4254e1..e3757c1b8 100644
--- a/lib/widgets/common/basic/text/background_painter.dart
+++ b/lib/widgets/common/basic/text/background_painter.dart
@@ -23,7 +23,7 @@ class TextBackgroundPainter extends StatelessWidget {
@override
Widget build(BuildContext context) {
final backgroundColor = style.backgroundColor;
- if (backgroundColor == null || backgroundColor.alpha == 0) {
+ if (backgroundColor == null || backgroundColor.a == 0) {
return child;
}
diff --git a/lib/widgets/common/basic/wheel.dart b/lib/widgets/common/basic/wheel.dart
index 5cc7d9a34..a5c6dff0c 100644
--- a/lib/widgets/common/basic/wheel.dart
+++ b/lib/widgets/common/basic/wheel.dart
@@ -81,7 +81,7 @@ class _WheelSelectorState extends State> {
height: itemSize.height,
duration: transitionDuration,
decoration: BoxDecoration(
- color: foreground.withAlpha((255.0 * (focused ? .2 : 0)).round()),
+ color: foreground.withValues(alpha: focused ? .2 : 0),
borderRadius: const BorderRadius.all(Radius.circular(8)),
),
);
diff --git a/lib/widgets/common/grid/overlay.dart b/lib/widgets/common/grid/overlay.dart
index e897cbcb0..8d0149d44 100644
--- a/lib/widgets/common/grid/overlay.dart
+++ b/lib/widgets/common/grid/overlay.dart
@@ -31,7 +31,7 @@ class GridItemSelectionOverlay extends StatelessWidget {
alignment: AlignmentDirectional.topEnd,
padding: padding,
decoration: BoxDecoration(
- color: isSelected ? Theme.of(context).colorScheme.primary.withAlpha((255.0 * .6).round()) : Colors.transparent,
+ color: isSelected ? Theme.of(context).colorScheme.primary.withValues(alpha: .6) : Colors.transparent,
borderRadius: borderRadius,
),
duration: duration,
diff --git a/lib/widgets/common/grid/sections/fixed/scale_grid.dart b/lib/widgets/common/grid/sections/fixed/scale_grid.dart
index ed89640d8..c31b6ea2a 100644
--- a/lib/widgets/common/grid/sections/fixed/scale_grid.dart
+++ b/lib/widgets/common/grid/sections/fixed/scale_grid.dart
@@ -77,7 +77,7 @@ class FixedExtentGridPainter extends CustomPainter {
..shader = strokeShader;
final fillPaint = Paint()
..style = PaintingStyle.fill
- ..color = color.withAlpha((255.0 * .25).round());
+ ..color = color.withValues(alpha: .25);
final chipWidth = chipSize.width;
final chipHeight = chipSize.height;
diff --git a/lib/widgets/common/grid/sections/mosaic/scale_overlay.dart b/lib/widgets/common/grid/sections/mosaic/scale_overlay.dart
index 6fb215e2c..1e44634b4 100644
--- a/lib/widgets/common/grid/sections/mosaic/scale_overlay.dart
+++ b/lib/widgets/common/grid/sections/mosaic/scale_overlay.dart
@@ -51,7 +51,7 @@ class MosaicScaleOverlay extends StatelessWidget {
child: Stack(
alignment: Alignment.center,
children: [
- _buildBar(extentMax, colorScheme.onSurface.withAlpha((255.0 * .2).round())),
+ _buildBar(extentMax, colorScheme.onSurface.withValues(alpha: .2)),
_buildBar(scaledSize.width, colorScheme.primary),
],
),
diff --git a/lib/widgets/common/identity/aves_app_bar.dart b/lib/widgets/common/identity/aves_app_bar.dart
index 9089a2bc8..ed1b288fe 100644
--- a/lib/widgets/common/identity/aves_app_bar.dart
+++ b/lib/widgets/common/identity/aves_app_bar.dart
@@ -274,7 +274,7 @@ class _AvesFloatingBarState extends State with RouteAware {
borderRadius: AvesFloatingBar.borderRadius,
child: widget.builder(
context,
- blurred ? backgroundColor.withAlpha((255.0 * .85).round()) : backgroundColor,
+ blurred ? backgroundColor.withValues(alpha: .85) : backgroundColor,
widget.child,
),
),
diff --git a/lib/widgets/common/identity/buttons/captioned_button.dart b/lib/widgets/common/identity/buttons/captioned_button.dart
index e98ca2b5c..4d6df9232 100644
--- a/lib/widgets/common/identity/buttons/captioned_button.dart
+++ b/lib/widgets/common/identity/buttons/captioned_button.dart
@@ -164,7 +164,7 @@ class CaptionedButtonText extends StatelessWidget {
Widget build(BuildContext context) {
var style = DefaultTextStyle.of(context).style;
if (!enabled) {
- style = style.copyWith(color: style.color!.withAlpha((255.0 * .2).round()));
+ style = style.copyWith(color: style.color!.withValues(alpha: .2));
}
return Text(
diff --git a/lib/widgets/common/identity/buttons/outlined_button.dart b/lib/widgets/common/identity/buttons/outlined_button.dart
index 428089ab9..851ef9380 100644
--- a/lib/widgets/common/identity/buttons/outlined_button.dart
+++ b/lib/widgets/common/identity/buttons/outlined_button.dart
@@ -15,15 +15,17 @@ class AvesOutlinedButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
+ final foreground = WidgetStateProperty.resolveWith((states) {
+ return states.contains(WidgetState.disabled) ? theme.disabledColor : theme.colorScheme.onSurface;
+ });
final style = ButtonStyle(
+ foregroundColor: foreground,
+ iconColor: foreground,
side: WidgetStateProperty.resolveWith((states) {
return BorderSide(
color: states.contains(WidgetState.disabled) ? theme.disabledColor : theme.colorScheme.primary,
);
}),
- foregroundColor: WidgetStateProperty.resolveWith((states) {
- return states.contains(WidgetState.disabled) ? theme.disabledColor : theme.colorScheme.onSurface;
- }),
);
return icon != null
? OutlinedButton.icon(
diff --git a/lib/widgets/common/identity/buttons/overlay_button.dart b/lib/widgets/common/identity/buttons/overlay_button.dart
index 4fca3ccf0..17fdc1633 100644
--- a/lib/widgets/common/identity/buttons/overlay_button.dart
+++ b/lib/widgets/common/identity/buttons/overlay_button.dart
@@ -167,6 +167,7 @@ class OverlayTextButton extends StatelessWidget {
Widget build(BuildContext context) {
final blurred = settings.enableBlurEffect;
final theme = Theme.of(context);
+ final foreground = theme.colorScheme.onSurface;
return BlurredRRect.all(
enabled: blurred,
borderRadius: _borderRadius,
@@ -174,9 +175,10 @@ class OverlayTextButton extends StatelessWidget {
onPressed: onPressed,
style: ButtonStyle(
backgroundColor: WidgetStateProperty.all(Themes.overlayBackgroundColor(brightness: theme.brightness, blurred: blurred)),
- foregroundColor: WidgetStateProperty.all(theme.colorScheme.onSurface),
- overlayColor: theme.isDark ? WidgetStateProperty.all(Colors.white.withAlpha((255.0 * .12).round())) : null,
+ foregroundColor: WidgetStateProperty.all(foreground),
+ overlayColor: theme.isDark ? WidgetStateProperty.all(Colors.white.withValues(alpha: .12)) : null,
minimumSize: _minSize,
+ iconColor: WidgetStateProperty.all(foreground),
side: WidgetStateProperty.all(AvesBorder.curvedSide(context)),
shape: WidgetStateProperty.all(const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(_borderRadius)),
diff --git a/lib/widgets/common/identity/empty.dart b/lib/widgets/common/identity/empty.dart
index 43c51bd68..458d7a897 100644
--- a/lib/widgets/common/identity/empty.dart
+++ b/lib/widgets/common/identity/empty.dart
@@ -25,7 +25,7 @@ class EmptyContent extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final color = Theme.of(context).colorScheme.primary.withAlpha((255.0 * .5).round());
+ final color = Theme.of(context).colorScheme.primary.withValues(alpha: .5);
final durations = context.watch();
return Padding(
padding: safeBottom
diff --git a/lib/widgets/common/map/compass.dart b/lib/widgets/common/map/compass.dart
index da4b33652..2563ecf9c 100644
--- a/lib/widgets/common/map/compass.dart
+++ b/lib/widgets/common/map/compass.dart
@@ -26,7 +26,7 @@ class CompassPainter extends CustomPainter {
final fillPaint = Paint()
..style = PaintingStyle.fill
- ..color = color.withAlpha((255.0 * .6).round());
+ ..color = color.withValues(alpha: .6);
final strokePaint = Paint()
..style = PaintingStyle.stroke
..color = color
diff --git a/lib/widgets/common/map/leaflet/tile_layers.dart b/lib/widgets/common/map/leaflet/tile_layers.dart
index fd7d5085c..6ae3e845c 100644
--- a/lib/widgets/common/map/leaflet/tile_layers.dart
+++ b/lib/widgets/common/map/leaflet/tile_layers.dart
@@ -82,7 +82,7 @@ class _OsmLibertyLayerState extends State {
void initState() {
super.initState();
- _tileProviderFuture = StyleReaderExtra.readProviderByName(
+ _tileProviderFuture = ExtraStyleReader.readProviderByName(
{
_openMapTileProviderSource: {
'url': _americanaTileProviderUri,
diff --git a/lib/widgets/common/map/leaflet/vector_style_reader_extra.dart b/lib/widgets/common/map/leaflet/vector_style_reader_extra.dart
index 4f7649b0e..fa9b162c4 100644
--- a/lib/widgets/common/map/leaflet/vector_style_reader_extra.dart
+++ b/lib/widgets/common/map/leaflet/vector_style_reader_extra.dart
@@ -6,7 +6,7 @@ import 'package:latlong2/latlong.dart';
import 'package:vector_map_tiles/vector_map_tiles.dart';
import 'package:vector_tile_renderer/vector_tile_renderer.dart';
-extension StyleReaderExtra on StyleReader {
+extension ExtraStyleReader on StyleReader {
Future