Skip to content

Commit 6a96abb

Browse files
committed
Move from deprecated functions :
withOpacity -> withValues(alpha : ) onPopInvoked -> onPopInvokedWithResult _onWillPop(bool) -> _onWillPop(bool,Object?)
1 parent ac5c165 commit 6a96abb

16 files changed

Lines changed: 45 additions & 45 deletions

lib/components/cards/album_card.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class AlbumCard extends StatelessWidget {
115115
isAdmin: true,
116116
),
117117
shadow: Shadow(
118-
color: Colors.black.withOpacity(0.3),
118+
color: Colors.black.withValues(alpha: 0.3),
119119
blurRadius: 3.0,
120120
offset: const Offset(1.0, 0.0),
121121
),

lib/components/cards/image_card.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class ImageCard extends StatelessWidget {
7474
gradient: LinearGradient(
7575
colors: [
7676
Colors.black,
77-
Colors.black.withOpacity(0),
77+
Colors.black.withValues(alpha: 0),
7878
],
7979
begin: Alignment.bottomCenter,
8080
end: Alignment.topCenter),
@@ -137,7 +137,7 @@ class ImageCard extends StatelessWidget {
137137
decoration: BoxDecoration(
138138
shape: BoxShape.circle,
139139
border: Border.all(color: Theme.of(context).primaryColor),
140-
color: Colors.black.withOpacity(0.3),
140+
color: Colors.black.withValues(alpha: 0.3),
141141
),
142142
),
143143
),

lib/components/cards/image_details_card.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ class _LocalVideoDetailsCardState extends State<LocalVideoDetailsCard> {
418418
child: Container(
419419
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 2),
420420
decoration: BoxDecoration(
421-
borderRadius: BorderRadius.circular(5), color: AppColors.black.withOpacity(0.7)),
421+
borderRadius: BorderRadius.circular(5), color: AppColors.black.withValues(alpha: 0.7)),
422422
child: Text(
423423
_duration,
424424
style: TextStyle(color: AppColors.white, fontSize: 10, fontWeight: FontWeight.bold),

lib/components/dialogs/confirm_dialog.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class ConfirmDialog extends StatelessWidget {
3131
(states) => Theme.of(context).textTheme.bodySmall?.color ?? AppColors.disabled,
3232
),
3333
overlayColor: WidgetStateColor.resolveWith(
34-
(states) => AppColors.accent.withOpacity(0.3),
34+
(states) => AppColors.accent.withValues(alpha: 0.3),
3535
),
3636
),
3737
onPressed: () => Navigator.of(context).pop(false),
@@ -45,7 +45,7 @@ class ConfirmDialog extends StatelessWidget {
4545
(states) => confirmColor ?? AppColors.accent,
4646
),
4747
overlayColor: WidgetStateColor.resolveWith(
48-
(states) => AppColors.accent.withOpacity(0.3),
48+
(states) => AppColors.accent.withValues(alpha: 0.3),
4949
),
5050
),
5151
onPressed: () => Navigator.of(context).pop(true),

lib/components/modals/move_or_copy_modal.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ class _ExpansionAlbumTileState extends State<ExpansionAlbumTile> {
231231
child: Text(
232232
appStrings.albumCount(widget.album.nbCategories),
233233
style: TextStyle(
234-
color: Theme.of(context).primaryColor.withOpacity(0.7),
234+
color: Theme.of(context).primaryColor.withValues(alpha: 0.7),
235235
fontSize: 14,
236236
),
237237
),

lib/components/player_controls.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ class _PlayerControlsState extends State<PlayerControls>
256256
duration: const Duration(milliseconds: 300),
257257
opacity: notifier.hideStuff ? 0.0 : 1.0,
258258
child: Material(
259-
color: Colors.black.withOpacity(0.5),
259+
color: Colors.black.withValues(alpha: 0.5),
260260
),
261261
),
262262
),
@@ -477,7 +477,7 @@ class _PlayerControlsState extends State<PlayerControls>
477477
text: '/ ${formatDuration(duration)}',
478478
style: TextStyle(
479479
fontSize: 14.0,
480-
color: Colors.white.withOpacity(.75),
480+
color: Colors.white.withValues(alpha: 0.75),
481481
fontWeight: FontWeight.normal,
482482
),
483483
)
@@ -510,10 +510,10 @@ class _PlayerControlsState extends State<PlayerControls>
510510
_startHideTimer();
511511
},
512512
colors: ChewieProgressColors(
513-
playedColor: Theme.of(context).colorScheme.secondary.withOpacity(0.7),
513+
playedColor: Theme.of(context).colorScheme.secondary.withValues(alpha: 0.7),
514514
handleColor: Theme.of(context).colorScheme.secondary,
515-
bufferedColor: Theme.of(context).colorScheme.primary.withOpacity(0.5),
516-
backgroundColor: Theme.of(context).disabledColor.withOpacity(0.3),
515+
bufferedColor: Theme.of(context).colorScheme.primary.withValues(alpha: 0.5),
516+
backgroundColor: Theme.of(context).disabledColor.withValues(alpha: 0.3),
517517
),
518518
);
519519
}

lib/main.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ Future<void> _setUITheme() async {
3737
bool isDark = sharedPreferences.getBool(ThemeNotifier.themeKey) ??
3838
(ThemeMode.system == ThemeMode.dark);
3939
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
40-
systemNavigationBarColor: Colors.black.withOpacity(0.001),
41-
statusBarColor: Colors.black.withOpacity(0.001),
40+
systemNavigationBarColor: Colors.black.withValues(alpha: 0.001),
41+
statusBarColor: Colors.black.withValues(alpha: 0.001),
4242
statusBarIconBrightness: isDark ? Brightness.light : Brightness.dark,
4343
));
4444
}

lib/utils/themes.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ final ThemeData lightTheme = ThemeData.light(useMaterial3: true).copyWith(
99
scaffoldBackgroundColor: AppColors.backgroundLight,
1010
dialogBackgroundColor: AppColors.backgroundLight,
1111
focusColor: AppColors.accent,
12-
splashColor: AppColors.accent.withOpacity(0.3),
12+
splashColor: AppColors.accent.withValues(alpha: 0.3),
1313
cardColor: AppColors.cardLight,
1414
shadowColor: Colors.black54,
1515
chipTheme: ChipThemeData(
@@ -93,12 +93,12 @@ final ThemeData lightTheme = ThemeData.light(useMaterial3: true).copyWith(
9393
),
9494
textSelectionTheme: TextSelectionThemeData(
9595
cursorColor: AppColors.accent,
96-
selectionColor: AppColors.accent.withOpacity(0.3),
96+
selectionColor: AppColors.accent.withValues(alpha: 0.3),
9797
selectionHandleColor: AppColors.accent,
9898
),
9999
bottomSheetTheme: BottomSheetThemeData(
100-
surfaceTintColor: Colors.black.withOpacity(0),
101-
backgroundColor: Colors.black.withOpacity(0),
100+
surfaceTintColor: Colors.black.withValues(alpha: 0),
101+
backgroundColor: Colors.black.withValues(alpha: 0),
102102
),
103103
switchTheme: SwitchThemeData(
104104
thumbColor: WidgetStateProperty.all(AppColors.backgroundLight),
@@ -180,7 +180,7 @@ final ThemeData darkTheme = ThemeData.dark(useMaterial3: true).copyWith(
180180
scaffoldBackgroundColor: AppColors.backgroundDark,
181181
dialogBackgroundColor: AppColors.backgroundDark,
182182
focusColor: AppColors.accent,
183-
splashColor: AppColors.accent.withOpacity(0.3),
183+
splashColor: AppColors.accent.withValues(alpha: 0.3),
184184
cardColor: AppColors.cardDark,
185185
shadowColor: Colors.black54,
186186
chipTheme: ChipThemeData(
@@ -268,8 +268,8 @@ final ThemeData darkTheme = ThemeData.dark(useMaterial3: true).copyWith(
268268
selectionHandleColor: AppColors.accent,
269269
),
270270
bottomSheetTheme: BottomSheetThemeData(
271-
surfaceTintColor: Colors.black.withOpacity(0),
272-
backgroundColor: Colors.black.withOpacity(0),
271+
surfaceTintColor: Colors.black.withValues(alpha: 0),
272+
backgroundColor: Colors.black.withValues(alpha: 0),
273273
),
274274
switchTheme: SwitchThemeData(
275275
thumbColor: WidgetStateProperty.all(const Color(0x80FFFFFF)),

lib/views/album/album_page.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ class _AlbumPageState extends State<AlbumPage> {
197197
}).then((value) => _refreshController.requestRefresh());
198198
}
199199

200-
void _onWillPop(bool pop) {
200+
void _onWillPop(bool pop,Object? result) {
201201
if (pop) return;
202202
if (_selectedList.isNotEmpty) {
203203
setState(() {
@@ -212,7 +212,7 @@ class _AlbumPageState extends State<AlbumPage> {
212212
Widget build(BuildContext context) {
213213
return PopScope(
214214
canPop: false,
215-
onPopInvoked: _onWillPop,
215+
onPopInvokedWithResult: _onWillPop,
216216
child: Scaffold(
217217
body: SafeArea(
218218
child: SmartRefresher(
@@ -460,7 +460,7 @@ class _AlbumPageState extends State<AlbumPage> {
460460
return FloatingActionButton(
461461
tooltip: uploading ? appStrings.uploadList_title : appStrings.categorySelection_root,
462462
shape: uploading ? CircleBorder() : null,
463-
backgroundColor: Theme.of(context).disabledColor.withOpacity(0.7),
463+
backgroundColor: Theme.of(context).disabledColor.withValues(alpha: 0.7),
464464
onPressed: () {
465465
if (uploading) {
466466
Navigator.of(context).pushNamed(UploadStatusPage.routeName);

lib/views/image/image_favorites_page.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class _ImageFavoritesPageState extends State<ImageFavoritesPage> {
6060

6161
bool get _hasNonFavorites => _selectedList.where((image) => !image.favorite).isNotEmpty;
6262

63-
void _onWillPop(bool pop) async {
63+
void _onWillPop(bool pop,Object? result) async {
6464
if (pop) return;
6565
if (_selectedList.isNotEmpty) {
6666
setState(() {
@@ -145,7 +145,7 @@ class _ImageFavoritesPageState extends State<ImageFavoritesPage> {
145145
Widget build(BuildContext context) {
146146
return PopScope(
147147
canPop: false,
148-
onPopInvoked: _onWillPop,
148+
onPopInvokedWithResult: _onWillPop,
149149
child: Scaffold(
150150
body: SafeArea(
151151
child: SmartRefresher(

0 commit comments

Comments
 (0)