diff --git a/mobile/apps/photos/lib/ui/collections/collection_action_sheet.dart b/mobile/apps/photos/lib/ui/collections/collection_action_sheet.dart index 7620fb35a3..55a5f46af0 100644 --- a/mobile/apps/photos/lib/ui/collections/collection_action_sheet.dart +++ b/mobile/apps/photos/lib/ui/collections/collection_action_sheet.dart @@ -38,7 +38,7 @@ enum CollectionActionType { shareCollection, addToHiddenAlbum, moveToHiddenCollection, - autoAddPeople, + autoAddPeople; } extension CollectionActionTypeExtension on CollectionActionType { @@ -147,20 +147,19 @@ class _CollectionActionSheetState extends State { void initState() { super.initState(); _showOnlyHiddenCollections = widget.actionType.isHiddenAction; - _enableSelection = - (widget.actionType == CollectionActionType.autoAddPeople && + _enableSelection = (widget.actionType == + CollectionActionType.autoAddPeople && widget.selectedPeople != null) || ((widget.actionType == CollectionActionType.addFiles || widget.actionType == CollectionActionType.addToHiddenAlbum) && (widget.sharedFiles == null || widget.sharedFiles!.isEmpty)); - _createNewAlbumSubscription = Bus.instance.on().listen( - (event) { - setState(() { - _recentlyCreatedCollections.insert(0, event.collection); - _selectedCollections.add(event.collection); - }); - }, - ); + _createNewAlbumSubscription = + Bus.instance.on().listen((event) { + setState(() { + _recentlyCreatedCollections.insert(0, event.collection); + _selectedCollections.add(event.collection); + }); + }); } @override @@ -174,14 +173,12 @@ class _CollectionActionSheetState extends State { final filesCount = widget.sharedFiles != null ? widget.sharedFiles!.length : widget.selectedPeople != null - ? widget.selectedPeople!.length - : widget.selectedFiles?.files.length ?? 0; + ? widget.selectedPeople!.length + : widget.selectedFiles?.files.length ?? 0; final bottomInset = MediaQuery.viewInsetsOf(context).bottom; final isKeyboardUp = bottomInset > 100; - final double bottomPadding = max( - 0, - bottomInset - (_enableSelection ? okButtonSize : 0), - ); + final double bottomPadding = + max(0, bottomInset - (_enableSelection ? okButtonSize : 0)); return Padding( padding: EdgeInsets.only( bottom: isKeyboardUp ? bottomPadding : 0, @@ -279,12 +276,12 @@ class _CollectionActionSheetState extends State { isDisabled: _selectedCollections.isEmpty, onTap: () async { if (widget.selectedPeople != null) { - final ProgressDialog dialog = createProgressDialog( + final ProgressDialog? dialog = createProgressDialog( context, AppLocalizations.of(context).uploadingFilesToAlbum, isDismissible: true, ); - await dialog.show(); + await dialog?.show(); for (final collection in _selectedCollections) { try { await smartAlbumsService.addPeopleToSmartAlbum( @@ -300,12 +297,11 @@ class _CollectionActionSheetState extends State { } } unawaited(smartAlbumsService.syncSmartAlbums()); - await dialog.hide(); + await dialog?.hide(); return; } - final CollectionActions collectionActions = CollectionActions( - CollectionsService.instance, - ); + final CollectionActions collectionActions = + CollectionActions(CollectionsService.instance); final result = await collectionActions.addToMultipleCollections( context, _selectedCollections, @@ -348,12 +344,12 @@ class _CollectionActionSheetState extends State { widget.showOptionToCreateNewAlbum && _searchQuery.isEmpty; final searchResults = _searchQuery.isNotEmpty ? collections - .where( - (element) => element.displayName - .toLowerCase() - .contains(_searchQuery), - ) - .toList() + .where( + (element) => element.displayName + .toLowerCase() + .contains(_searchQuery), + ) + .toList() : collections; return Scrollbar( thumbVisibility: true, @@ -408,8 +404,8 @@ class _CollectionActionSheetState extends State { }); return recentlyCreated + hidden; } else { - final List - collections = CollectionsService.instance.getCollectionsForUI( + final List collections = + CollectionsService.instance.getCollectionsForUI( // in collections where user is a collaborator, only addTo and remove // action can to be performed includeCollab: widget.actionType == CollectionActionType.addFiles, @@ -460,4 +456,4 @@ class _CollectionActionSheetState extends State { ); } } -} +} \ No newline at end of file diff --git a/mobile/apps/photos/lib/ui/tools/editor/image_editor/circular_icon_button.dart b/mobile/apps/photos/lib/ui/tools/editor/image_editor/circular_icon_button.dart index c21f3256b8..3ad9ad2c63 100644 --- a/mobile/apps/photos/lib/ui/tools/editor/image_editor/circular_icon_button.dart +++ b/mobile/apps/photos/lib/ui/tools/editor/image_editor/circular_icon_button.dart @@ -71,4 +71,4 @@ class CircularIconButton extends StatelessWidget { ), ); } -} +} \ No newline at end of file diff --git a/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_page.dart b/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_page.dart index 6602230ab4..cf1a566bd3 100644 --- a/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_page.dart +++ b/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_page.dart @@ -81,16 +81,14 @@ class _ImageEditorPageState extends State { try { final fileName = path.basenameWithoutExtension(widget.originalFile.title!) + - "_edited_" + - DateTime.now().microsecondsSinceEpoch.toString() + - ".JPEG"; + "_edited_" + + DateTime.now().microsecondsSinceEpoch.toString() + + ".JPEG"; //Disabling notifications for assets changing to insert the file into //files db before triggering a sync. await PhotoManager.stopChangeNotify(); - final AssetEntity newAsset = await (PhotoManager.editor.saveImage( - result, - filename: fileName, - )); + final AssetEntity newAsset = + await (PhotoManager.editor.saveImage(result, filename: fileName)); final newFile = await ente.EnteFile.fromAsset( widget.originalFile.deviceFolder ?? '', newAsset, @@ -119,9 +117,8 @@ class _ImageEditorPageState extends State { // the index could be -1 if the files fetched doesn't contain the newly // edited files - int selectionIndex = files.indexWhere( - (file) => file.generatedID == newFile.generatedID, - ); + int selectionIndex = + files.indexWhere((file) => file.generatedID == newFile.generatedID); if (selectionIndex == -1) { files.add(newFile); selectionIndex = files.length - 1; @@ -182,7 +179,7 @@ class _ImageEditorPageState extends State { final textTheme = getEnteTextTheme(context); return PopScope( canPop: false, - onPopInvokedWithResult: (didPop, _) { + onPopInvoked: (didPop) { if (didPop) return; editorKey.currentState?.disablePopScope = true; _showExitConfirmationDialog(context); @@ -213,12 +210,10 @@ class _ImageEditorPageState extends State { uiOverlayStyle: SystemUiOverlayStyle( systemNavigationBarContrastEnforced: true, systemNavigationBarColor: Colors.transparent, - statusBarBrightness: isLightMode - ? Brightness.dark - : Brightness.light, - statusBarIconBrightness: isLightMode - ? Brightness.dark - : Brightness.light, + statusBarBrightness: + isLightMode ? Brightness.dark : Brightness.light, + statusBarIconBrightness: + isLightMode ? Brightness.dark : Brightness.light, ), appBarBackgroundColor: colorScheme.backgroundBase, background: colorScheme.backgroundBase, @@ -236,9 +231,8 @@ class _ImageEditorPageState extends State { ), cropRotateEditor: CropRotateEditorTheme( background: colorScheme.backgroundBase, - cropCornerColor: Theme.of( - context, - ).colorScheme.imageEditorPrimaryColor, + cropCornerColor: + Theme.of(context).colorScheme.imageEditorPrimaryColor, ), tuneEditor: TuneEditorTheme( background: colorScheme.backgroundBase, @@ -274,39 +268,38 @@ class _ImageEditorPageState extends State { ), customWidgets: ImageEditorCustomWidgets( filterEditor: CustomWidgetsFilterEditor( - slider: - ( - editorState, - rebuildStream, - value, - onChanged, - onChangeEnd, - ) => ReactiveCustomWidget( - builder: (context) { - return const SizedBox.shrink(); - }, - stream: rebuildStream, - ), - filterButton: - ( - filter, - isSelected, - scaleFactor, - onSelectFilter, - editorImage, - filterKey, - ) { - return ImageEditorFilterBar( - filterModel: filter, - isSelected: isSelected, - onSelectFilter: () { - onSelectFilter.call(); - editorKey.currentState?.setState(() {}); - }, - editorImage: editorImage, - filterKey: filterKey, - ); + slider: ( + editorState, + rebuildStream, + value, + onChanged, + onChangeEnd, + ) => + ReactiveCustomWidget( + builder: (context) { + return const SizedBox.shrink(); + }, + stream: rebuildStream, + ), + filterButton: ( + filter, + isSelected, + scaleFactor, + onSelectFilter, + editorImage, + filterKey, + ) { + return ImageEditorFilterBar( + filterModel: filter, + isSelected: isSelected, + onSelectFilter: () { + onSelectFilter.call(); + editorKey.currentState?.setState(() {}); }, + editorImage: editorImage, + filterKey: filterKey, + ); + }, appBar: (editor, rebuildStream) { return ReactiveCustomAppbar( builder: (context) { @@ -362,10 +355,8 @@ class _ImageEditorPageState extends State { child: StreamBuilder( stream: rebuildStream, builder: (context, snapshot) { - final isHovered = editorKey - .currentState! - .layerInteractionManager - .hoverRemoveBtn; + final isHovered = editorKey.currentState! + .layerInteractionManager.hoverRemoveBtn; return AnimatedContainer( key: key, @@ -375,9 +366,7 @@ class _ImageEditorPageState extends State { margin: const EdgeInsets.only(bottom: 24), decoration: BoxDecoration( color: isHovered - ? colorScheme.warning400.withValues( - alpha: 0.8, - ) + ? colorScheme.warning400.withOpacity(0.8) : Colors.white, shape: BoxShape.circle, ), @@ -388,9 +377,8 @@ class _ImageEditorPageState extends State { colorFilter: ColorFilter.mode( isHovered ? Colors.white - : colorScheme.warning400.withValues( - alpha: 0.8, - ), + : colorScheme.warning400 + .withOpacity(0.8), BlendMode.srcIn, ), ), @@ -539,13 +527,13 @@ class _ImageEditorPageState extends State { }, bottomBar: (cropRotateEditor, rebuildStream) => ReactiveCustomWidget( - stream: rebuildStream, - builder: (_) => ImageEditorCropRotateBar( - configs: cropRotateEditor.configs, - callbacks: cropRotateEditor.callbacks, - editor: cropRotateEditor, - ), - ), + stream: rebuildStream, + builder: (_) => ImageEditorCropRotateBar( + configs: cropRotateEditor.configs, + callbacks: cropRotateEditor.callbacks, + editor: cropRotateEditor, + ), + ), ), ), mainEditorConfigs: const MainEditorConfigs(enableZoom: true), @@ -587,4 +575,4 @@ class _ImageEditorPageState extends State { ), ); } -} +} \ No newline at end of file diff --git a/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_text_bar.dart b/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_text_bar.dart index bd24f7087c..c4c32440b2 100644 --- a/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_text_bar.dart +++ b/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_text_bar.dart @@ -122,16 +122,16 @@ class _ImageEditorTextBarState extends State switchOutCurve: Curves.easeInOut, child: switch (selectedActionIndex) { 0 => ImageEditorColorPicker( - value: colorSliderValue, - onChanged: (value) { - setState(() { - colorSliderValue = value; - }); - final hue = value * 360; - final color = HSVColor.fromAHSV(1.0, hue, 1.0, 1.0).toColor(); - widget.editor.primaryColor = color; - }, - ), + value: colorSliderValue, + onChanged: (value) { + setState(() { + colorSliderValue = value; + }); + final hue = value * 360; + final color = HSVColor.fromAHSV(1.0, hue, 1.0, 1.0).toColor(); + widget.editor.primaryColor = color; + }, + ), 1 => _FontPickerWidget(editor: widget.editor), 2 => _BackgroundPickerWidget(editor: widget.editor), 3 => _AlignPickerWidget(editor: widget.editor), @@ -155,9 +155,10 @@ class _FontPickerWidget extends StatelessWidget { return Row( mainAxisAlignment: MainAxisAlignment.center, - children: editor.textEditorConfigs.customTextStyles!.asMap().entries.map(( - entry, - ) { + children: editor.textEditorConfigs.customTextStyles! + .asMap() + .entries + .map((entry) { final item = entry.value; final selected = editor.selectedTextStyle; final bool isSelected = selected.hashCode == item.hashCode; @@ -207,9 +208,8 @@ class _BackgroundPickerWidget extends StatelessWidget { final backgroundStyles = { LayerBackgroundMode.background: { 'text': 'Aa', - 'selectedBackgroundColor': isLightMode - ? colorScheme.fillFaint - : Colors.white, + 'selectedBackgroundColor': + isLightMode ? colorScheme.fillFaint : Colors.white, 'backgroundColor': Theme.of(context).colorScheme.editorBackgroundColor, 'border': null, 'textColor': Colors.white, @@ -218,9 +218,8 @@ class _BackgroundPickerWidget extends StatelessWidget { }, LayerBackgroundMode.backgroundAndColor: { 'text': 'Aa', - 'selectedBackgroundColor': isLightMode - ? colorScheme.fillFaint - : Colors.white, + 'selectedBackgroundColor': + isLightMode ? colorScheme.fillFaint : Colors.white, 'backgroundColor': Theme.of(context).colorScheme.editorBackgroundColor, 'border': null, 'textColor': Colors.black, @@ -229,29 +228,26 @@ class _BackgroundPickerWidget extends StatelessWidget { }, LayerBackgroundMode.backgroundAndColorWithOpacity: { 'text': 'Aa', - 'selectedBackgroundColor': isLightMode - ? colorScheme.fillFaint - : Colors.white, + 'selectedBackgroundColor': + isLightMode ? colorScheme.fillFaint : Colors.white, 'backgroundColor': Theme.of(context).colorScheme.editorBackgroundColor, 'border': null, 'textColor': Colors.black, - 'selectedInnerBackgroundColor': Colors.black.withValues(alpha: 0.11), + 'selectedInnerBackgroundColor': Colors.black.withOpacity(0.11), 'innerBackgroundColor': isLightMode - ? Colors.black.withValues(alpha: 0.11) - : Colors.white.withValues(alpha: 0.11), + ? Colors.black.withOpacity(0.11) + : Colors.white.withOpacity(0.11), }, LayerBackgroundMode.onlyColor: { 'text': 'Aa', - 'selectedBackgroundColor': isLightMode - ? colorScheme.fillFaint - : Colors.black, + 'selectedBackgroundColor': + isLightMode ? colorScheme.fillFaint : Colors.black, 'backgroundColor': Theme.of(context).colorScheme.editorBackgroundColor, - 'border': isLightMode - ? null - : Border.all(color: Colors.white, width: 2), + 'border': + isLightMode ? null : Border.all(color: Colors.white, width: 2), 'textColor': Colors.black, 'selectedInnerBackgroundColor': Colors.white, - 'innerBackgroundColor': Colors.white.withValues(alpha: 0.6), + 'innerBackgroundColor': Colors.white.withOpacity(0.6), }, }; @@ -331,11 +327,11 @@ class _AlignPickerWidget extends StatelessWidget { (TextAlign.left, "assets/image-editor/image-editor-text-align-left.svg"), ( TextAlign.center, - "assets/image-editor/image-editor-text-align-center.svg", + "assets/image-editor/image-editor-text-align-center.svg" ), ( TextAlign.right, - "assets/image-editor/image-editor-text-align-right.svg", + "assets/image-editor/image-editor-text-align-right.svg" ), ]; @@ -383,4 +379,4 @@ class _AlignPickerWidget extends StatelessWidget { }).toList(), ); } -} +} \ No newline at end of file diff --git a/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_tune_bar.dart b/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_tune_bar.dart index 784fe862bc..147d2ff08f 100644 --- a/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_tune_bar.dart +++ b/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_tune_bar.dart @@ -87,20 +87,18 @@ class _ImageEditorTuneBarState extends State mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisSize: MainAxisSize.min, children: List.generate( - tuneEditor.tuneAdjustmentMatrix.length, - (index) { - final item = tuneEditor.tuneAdjustmentList[index]; - return TuneItem( - icon: item.icon, - label: item.label, - isSelected: tuneEditor.selectedIndex == index, - value: tuneEditor.tuneAdjustmentMatrix[index].value, - max: item.max, - min: item.min, - onTap: () => _handleTuneItemTap(index), - ); - }, - ), + tuneEditor.tuneAdjustmentMatrix.length, (index) { + final item = tuneEditor.tuneAdjustmentList[index]; + return TuneItem( + icon: item.icon, + label: item.label, + isSelected: tuneEditor.selectedIndex == index, + value: tuneEditor.tuneAdjustmentMatrix[index].value, + max: item.max, + min: item.min, + onTap: () => _handleTuneItemTap(index), + ); + }), ), ), ), @@ -165,9 +163,8 @@ class TuneItem extends StatelessWidget { size: 60, icon: icon, isSelected: isSelected, - progressColor: Theme.of( - context, - ).colorScheme.imageEditorPrimaryColor, + progressColor: + Theme.of(context).colorScheme.imageEditorPrimaryColor, svgPath: "assets/image-editor/image-editor-${label.toLowerCase()}.svg", ), @@ -226,16 +223,15 @@ class _CircularProgressWithValueState extends State animationBehavior: AnimationBehavior.preserve, ); - _progressAnimation = - Tween( - begin: 0.0, - end: widget.value, - ).animate( - CurvedAnimation( - parent: _animationController, - curve: Curves.easeInOut, - ), - ); + _progressAnimation = Tween( + begin: 0.0, + end: widget.value, + ).animate( + CurvedAnimation( + parent: _animationController, + curve: Curves.easeInOut, + ), + ); _animationController.forward(); } @@ -249,16 +245,15 @@ class _CircularProgressWithValueState extends State } if (oldWidget.value != widget.value) { _previousValue = oldWidget.value; - _progressAnimation = - Tween( - begin: _previousValue, - end: widget.value, - ).animate( - CurvedAnimation( - parent: _animationController, - curve: Curves.easeInOut, - ), - ); + _progressAnimation = Tween( + begin: _previousValue, + end: widget.value, + ).animate( + CurvedAnimation( + parent: _animationController, + curve: Curves.easeInOut, + ), + ); _animationController.forward(from: 0.0); } } @@ -305,11 +300,8 @@ class _CircularProgressWithValueState extends State Widget build(BuildContext context) { final colorTheme = getEnteColorScheme(context); final textTheme = getEnteTextTheme(context); - final displayValue = _normalizeValueForDisplay( - widget.value, - widget.min, - widget.max, - ); + final displayValue = + _normalizeValueForDisplay(widget.value, widget.min, widget.max); final displayText = displayValue.toString(); final prefix = displayValue > 0 ? "+" : ""; final progressColor = widget.progressColor; @@ -328,11 +320,11 @@ class _CircularProgressWithValueState extends State decoration: BoxDecoration( shape: BoxShape.circle, color: showValue || widget.isSelected - ? progressColor.withValues(alpha: 0.2) + ? progressColor.withOpacity(0.2) : Theme.of(context).colorScheme.editorBackgroundColor, border: Border.all( color: widget.isSelected - ? progressColor.withValues(alpha: 0.4) + ? progressColor.withOpacity(0.4) : Theme.of(context).colorScheme.editorBackgroundColor, width: 2, ), @@ -341,15 +333,11 @@ class _CircularProgressWithValueState extends State AnimatedBuilder( animation: _progressAnimation, builder: (context, child) { - final animatedValue = displayValue == 0 - ? 0.0 - : _progressAnimation.value; + final animatedValue = + displayValue == 0 ? 0.0 : _progressAnimation.value; - final isClockwise = _isClockwise( - animatedValue, - widget.min, - widget.max, - ); + final isClockwise = + _isClockwise(animatedValue, widget.min, widget.max); final progressValue = _normalizeValueForProgress( animatedValue, widget.min, @@ -377,21 +365,21 @@ class _CircularProgressWithValueState extends State style: textTheme.smallBold, ) : widget.svgPath != null - ? SvgPicture.asset( - widget.svgPath!, - width: 22, - height: 22, - fit: BoxFit.scaleDown, - colorFilter: ColorFilter.mode( - colorTheme.tabIcon, - BlendMode.srcIn, - ), - ) - : Icon( - widget.icon, - color: colorTheme.tabIcon, - size: 20, - ), + ? SvgPicture.asset( + widget.svgPath!, + width: 22, + height: 22, + fit: BoxFit.scaleDown, + colorFilter: ColorFilter.mode( + colorTheme.tabIcon, + BlendMode.srcIn, + ), + ) + : Icon( + widget.icon, + color: colorTheme.tabIcon, + size: 20, + ), ), ], ), @@ -438,12 +426,10 @@ class _TuneAdjustWidget extends StatelessWidget { data: SliderTheme.of(context).copyWith( thumbShape: const _ColorPickerThumbShape(), overlayShape: const RoundSliderOverlayShape(overlayRadius: 0), - activeTrackColor: Theme.of( - context, - ).colorScheme.imageEditorPrimaryColor, - inactiveTrackColor: Theme.of( - context, - ).colorScheme.editorBackgroundColor, + activeTrackColor: + Theme.of(context).colorScheme.imageEditorPrimaryColor, + inactiveTrackColor: + Theme.of(context).colorScheme.editorBackgroundColor, trackShape: const _CenterBasedTrackShape(), trackHeight: 24, ), @@ -681,4 +667,4 @@ class CircularProgressPainter extends CustomPainter { @override bool shouldRepaint(covariant CustomPainter oldDelegate) => true; -} +} \ No newline at end of file diff --git a/mobile/apps/photos/lib/ui/viewer/actions/smart_albums_status_widget.dart b/mobile/apps/photos/lib/ui/viewer/actions/smart_albums_status_widget.dart index dfb7a3b9cd..cabaaf5220 100644 --- a/mobile/apps/photos/lib/ui/viewer/actions/smart_albums_status_widget.dart +++ b/mobile/apps/photos/lib/ui/viewer/actions/smart_albums_status_widget.dart @@ -66,8 +66,7 @@ class _SmartAlbumsStatusWidgetState extends State firstCurve: Curves.easeInOutExpo, secondCurve: Curves.easeInOutExpo, sizeCurve: Curves.easeInOutExpo, - crossFadeState: - !(_syncingCollection == null || + crossFadeState: !(_syncingCollection == null || _syncingCollection!.$1 != widget.collection?.id) ? CrossFadeState.showSecond : CrossFadeState.showFirst, @@ -77,13 +76,11 @@ class _SmartAlbumsStatusWidgetState extends State crossAxisAlignment: CrossAxisAlignment.end, children: [ Container( - padding: const EdgeInsets.symmetric( - horizontal: 16, - vertical: 12, - ).copyWith(left: 14), + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12) + .copyWith(left: 14), decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), - color: Colors.black.withValues(alpha: 0.65), + color: Colors.black.withOpacity(0.65), ), child: Row( mainAxisSize: MainAxisSize.min, @@ -113,4 +110,4 @@ class _SmartAlbumsStatusWidgetState extends State firstChild: const SizedBox.shrink(), ); } -} +} \ No newline at end of file diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/scrollbar/custom_scroll_bar.dart b/mobile/apps/photos/lib/ui/viewer/gallery/scrollbar/custom_scroll_bar.dart index 74d5b1d7af..87de2cc64a 100644 --- a/mobile/apps/photos/lib/ui/viewer/gallery/scrollbar/custom_scroll_bar.dart +++ b/mobile/apps/photos/lib/ui/viewer/gallery/scrollbar/custom_scroll_bar.dart @@ -84,10 +84,8 @@ class _CustomScrollBarState extends State { } if (_showScrollbarDivisions) { - getIntrinsicSizeOfWidget( - const ScrollBarDivider(title: "Temp"), - context, - ).then((size) { + getIntrinsicSizeOfWidget(const ScrollBarDivider(title: "Temp"), context) + .then((size) { if (mounted) { setState(() { heightOfScrollbarDivider = size.height; @@ -116,8 +114,7 @@ class _CustomScrollBarState extends State { for (final scrollbarDivision in widget.galleryGroups.scrollbarDivisions) { final scrollOffsetOfGroup = widget - .galleryGroups - .groupIdToScrollOffsetMap[scrollbarDivision.groupID]!; + .galleryGroups.groupIdToScrollOffsetMap[scrollbarDivision.groupID]!; final groupScrollOffsetToUse = scrollOffsetOfGroup - heightOfScrollTrack!; if (groupScrollOffsetToUse < 0) { @@ -145,20 +142,19 @@ class _CustomScrollBarState extends State { final value = (_kScrollbarMinLength - heightOfScrollbarDivider!) / 2; if (fractionOfGroupScrollOffsetWrtMaxExtent < 0.5) { - positionCorrection = - value * fractionOfGroupScrollOffsetWrtMaxExtent - + positionCorrection = value * fractionOfGroupScrollOffsetWrtMaxExtent - (heightOfScrollbarDivider! * fractionOfGroupScrollOffsetWrtMaxExtent); } else { positionCorrection = -value * fractionOfGroupScrollOffsetWrtMaxExtent - - (heightOfScrollbarDivider! * - fractionOfGroupScrollOffsetWrtMaxExtent); + (heightOfScrollbarDivider! * + fractionOfGroupScrollOffsetWrtMaxExtent); } final adaptedPosition = heightOfScrollTrack! * fractionOfGroupScrollOffsetWrtMaxExtent + - positionCorrection; + positionCorrection; result.add( (position: adaptedPosition, title: scrollbarDivision.title), @@ -283,7 +279,7 @@ class ScrollBarDivider extends StatelessWidget { // is affected. boxShadow: [ BoxShadow( - color: Colors.black.withValues(alpha: 0.1), + color: Colors.black.withOpacity(0.1), blurRadius: 3, offset: const Offset(0, 2), ), @@ -302,4 +298,4 @@ class ScrollBarDivider extends StatelessWidget { ), ); } -} +} \ No newline at end of file diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/scrollbar/scroll_bar_with_use_notifier.dart b/mobile/apps/photos/lib/ui/viewer/gallery/scrollbar/scroll_bar_with_use_notifier.dart index d2479bf1da..7b83d16f1e 100644 --- a/mobile/apps/photos/lib/ui/viewer/gallery/scrollbar/scroll_bar_with_use_notifier.dart +++ b/mobile/apps/photos/lib/ui/viewer/gallery/scrollbar/scroll_bar_with_use_notifier.dart @@ -53,11 +53,11 @@ const Duration _kScrollbarTimeToFade = Duration(milliseconds: 600); /// {@end-tool} /// /// A scrollbar track can be added using [trackVisibility]. This can also be -/// drawn when triggered by a hover event, or based on any [WidgetState] by +/// drawn when triggered by a hover event, or based on any [MaterialState] by /// using [ScrollbarThemeData.trackVisibility]. /// /// The [thickness] of the track and scrollbar thumb can be changed dynamically -/// in response to [WidgetState]s using [ScrollbarThemeData.thickness]. +/// in response to [MaterialState]s using [ScrollbarThemeData.thickness]. /// /// See also: /// @@ -207,12 +207,12 @@ class _MaterialScrollbar extends RawScrollbar { super.interactive, super.scrollbarOrientation, }) : super( - fadeDuration: _kScrollbarFadeDuration, - timeToFade: _kScrollbarTimeToFade, - pressDuration: Duration.zero, - notificationPredicate: - notificationPredicate ?? defaultScrollNotificationPredicate, - ); + fadeDuration: _kScrollbarFadeDuration, + timeToFade: _kScrollbarTimeToFade, + pressDuration: Duration.zero, + notificationPredicate: + notificationPredicate ?? defaultScrollNotificationPredicate, + ); @override _MaterialScrollbarState createState() => _MaterialScrollbarState(); @@ -247,9 +247,9 @@ class _MaterialScrollbarState extends RawScrollbarState<_MaterialScrollbar> { }); Set get _states => { - if (_dragIsActive) WidgetState.dragged, - if (_hoverIsActive) WidgetState.hovered, - }; + if (_dragIsActive) WidgetState.dragged, + if (_hoverIsActive) WidgetState.hovered, + }; WidgetStateProperty get _thumbColor { if (widget.showThumb == false) { @@ -262,17 +262,17 @@ class _MaterialScrollbarState extends RawScrollbarState<_MaterialScrollbar> { late Color idleColor; switch (brightness) { case Brightness.light: - dragColor = onSurface.withValues(alpha: 0.6); - hoverColor = onSurface.withValues(alpha: 0.5); + dragColor = onSurface.withOpacity(0.6); + hoverColor = onSurface.withOpacity(0.5); idleColor = _useAndroidScrollbar - ? Theme.of(context).highlightColor.withValues(alpha: 1.0) - : onSurface.withValues(alpha: 0.1); + ? Theme.of(context).highlightColor.withOpacity(1.0) + : onSurface.withOpacity(0.1); case Brightness.dark: - dragColor = onSurface.withValues(alpha: 0.75); - hoverColor = onSurface.withValues(alpha: 0.65); + dragColor = onSurface.withOpacity(0.75); + hoverColor = onSurface.withOpacity(0.65); idleColor = _useAndroidScrollbar - ? Theme.of(context).highlightColor.withValues(alpha: 1.0) - : onSurface.withValues(alpha: 0.3); + ? Theme.of(context).highlightColor.withOpacity(1.0) + : onSurface.withOpacity(0.3); } return WidgetStateProperty.resolveWith((Set states) { @@ -304,8 +304,8 @@ class _MaterialScrollbarState extends RawScrollbarState<_MaterialScrollbar> { if (showScrollbar && _trackVisibility.resolve(states)) { return _scrollbarTheme.trackColor?.resolve(states) ?? switch (brightness) { - Brightness.light => onSurface.withValues(alpha: 0.03), - Brightness.dark => onSurface.withValues(alpha: 0.05), + Brightness.light => onSurface.withOpacity(0.03), + Brightness.dark => onSurface.withOpacity(0.05), }; } return const Color(0x00000000); @@ -322,8 +322,8 @@ class _MaterialScrollbarState extends RawScrollbarState<_MaterialScrollbar> { if (showScrollbar && _trackVisibility.resolve(states)) { return _scrollbarTheme.trackBorderColor?.resolve(states) ?? switch (brightness) { - Brightness.light => onSurface.withValues(alpha: 0.1), - Brightness.dark => onSurface.withValues(alpha: 0.25), + Brightness.light => onSurface.withOpacity(0.1), + Brightness.dark => onSurface.withOpacity(0.25), }; } return const Color(0x00000000); @@ -383,12 +383,10 @@ class _MaterialScrollbarState extends RawScrollbarState<_MaterialScrollbar> { ..trackBorderColor = _trackBorderColor.resolve(_states) ..textDirection = Directionality.of(context) ..thickness = _thickness.resolve(_states) - ..radius = - widget.radius ?? + ..radius = widget.radius ?? _scrollbarTheme.radius ?? (_useAndroidScrollbar ? null : _kScrollbarRadius) - ..crossAxisMargin = - _scrollbarTheme.crossAxisMargin ?? + ..crossAxisMargin = _scrollbarTheme.crossAxisMargin ?? (_useAndroidScrollbar ? 0.0 : _kScrollbarMargin) ..mainAxisMargin = _scrollbarTheme.mainAxisMargin ?? 0.0 ..minLength = widget.minScrollbarLength @@ -448,4 +446,4 @@ class _MaterialScrollbarState extends RawScrollbarState<_MaterialScrollbar> { _hoverAnimationController.dispose(); super.dispose(); } -} +} \ No newline at end of file