chore: format files and update analysis file
This commit is contained in:
@@ -3,6 +3,11 @@
|
||||
# use "flutter analyze ." or "dart analyze ." for running lint checks
|
||||
|
||||
include: package:flutter_lints/flutter.yaml
|
||||
|
||||
formatter:
|
||||
trailing_commas: preserve
|
||||
page_width: 80
|
||||
|
||||
linter:
|
||||
rules:
|
||||
# Ref https://github.com/flutter/packages/blob/master/packages/flutter_lints/lib/flutter.yaml
|
||||
|
||||
@@ -38,7 +38,7 @@ enum CollectionActionType {
|
||||
shareCollection,
|
||||
addToHiddenAlbum,
|
||||
moveToHiddenCollection,
|
||||
autoAddPeople;
|
||||
autoAddPeople,
|
||||
}
|
||||
|
||||
extension CollectionActionTypeExtension on CollectionActionType {
|
||||
@@ -147,19 +147,20 @@ class _CollectionActionSheetState extends State<CollectionActionSheet> {
|
||||
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<CreateNewAlbumEvent>().listen((event) {
|
||||
setState(() {
|
||||
_recentlyCreatedCollections.insert(0, event.collection);
|
||||
_selectedCollections.add(event.collection);
|
||||
});
|
||||
});
|
||||
_createNewAlbumSubscription = Bus.instance.on<CreateNewAlbumEvent>().listen(
|
||||
(event) {
|
||||
setState(() {
|
||||
_recentlyCreatedCollections.insert(0, event.collection);
|
||||
_selectedCollections.add(event.collection);
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -173,12 +174,14 @@ class _CollectionActionSheetState extends State<CollectionActionSheet> {
|
||||
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,
|
||||
@@ -275,12 +278,12 @@ class _CollectionActionSheetState extends State<CollectionActionSheet> {
|
||||
isDisabled: _selectedCollections.isEmpty,
|
||||
onTap: () async {
|
||||
if (widget.selectedPeople != null) {
|
||||
final ProgressDialog? dialog = createProgressDialog(
|
||||
final ProgressDialog dialog = createProgressDialog(
|
||||
context,
|
||||
S.of(context).uploadingFilesToAlbum,
|
||||
isDismissible: true,
|
||||
);
|
||||
await dialog?.show();
|
||||
await dialog.show();
|
||||
for (final collection in _selectedCollections) {
|
||||
try {
|
||||
await smartAlbumsService.addPeopleToSmartAlbum(
|
||||
@@ -296,11 +299,12 @@ class _CollectionActionSheetState extends State<CollectionActionSheet> {
|
||||
}
|
||||
}
|
||||
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,
|
||||
@@ -342,12 +346,12 @@ class _CollectionActionSheetState extends State<CollectionActionSheet> {
|
||||
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,
|
||||
@@ -402,8 +406,8 @@ class _CollectionActionSheetState extends State<CollectionActionSheet> {
|
||||
});
|
||||
return recentlyCreated + hidden;
|
||||
} else {
|
||||
final List<Collection> collections =
|
||||
CollectionsService.instance.getCollectionsForUI(
|
||||
final List<Collection>
|
||||
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,
|
||||
|
||||
@@ -36,10 +36,8 @@ class CircularIconButton extends StatelessWidget {
|
||||
width: size,
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected
|
||||
? Theme.of(context)
|
||||
.colorScheme
|
||||
.imageEditorPrimaryColor
|
||||
.withOpacity(0.24)
|
||||
? Theme.of(context).colorScheme.imageEditorPrimaryColor
|
||||
.withValues(alpha: 0.24)
|
||||
: Theme.of(context).colorScheme.editorBackgroundColor,
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
|
||||
@@ -80,14 +80,16 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
|
||||
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,
|
||||
@@ -116,8 +118,9 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
|
||||
|
||||
// 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;
|
||||
@@ -178,7 +181,7 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
|
||||
final textTheme = getEnteTextTheme(context);
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
onPopInvoked: (didPop) {
|
||||
onPopInvokedWithResult: (didPop, _) {
|
||||
if (didPop) return;
|
||||
editorKey.currentState?.disablePopScope = true;
|
||||
_showExitConfirmationDialog(context);
|
||||
@@ -209,10 +212,12 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
|
||||
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,
|
||||
@@ -230,8 +235,9 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
|
||||
),
|
||||
cropRotateEditor: CropRotateEditorTheme(
|
||||
background: colorScheme.backgroundBase,
|
||||
cropCornerColor:
|
||||
Theme.of(context).colorScheme.imageEditorPrimaryColor,
|
||||
cropCornerColor: Theme.of(
|
||||
context,
|
||||
).colorScheme.imageEditorPrimaryColor,
|
||||
),
|
||||
tuneEditor: TuneEditorTheme(
|
||||
background: colorScheme.backgroundBase,
|
||||
@@ -267,38 +273,39 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
|
||||
),
|
||||
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(() {});
|
||||
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,
|
||||
);
|
||||
},
|
||||
editorImage: editorImage,
|
||||
filterKey: filterKey,
|
||||
);
|
||||
},
|
||||
appBar: (editor, rebuildStream) {
|
||||
return ReactiveCustomAppbar(
|
||||
builder: (context) {
|
||||
@@ -354,8 +361,10 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
|
||||
child: StreamBuilder(
|
||||
stream: rebuildStream,
|
||||
builder: (context, snapshot) {
|
||||
final isHovered = editorKey.currentState!
|
||||
.layerInteractionManager.hoverRemoveBtn;
|
||||
final isHovered = editorKey
|
||||
.currentState!
|
||||
.layerInteractionManager
|
||||
.hoverRemoveBtn;
|
||||
|
||||
return AnimatedContainer(
|
||||
key: key,
|
||||
@@ -365,7 +374,9 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
|
||||
margin: const EdgeInsets.only(bottom: 24),
|
||||
decoration: BoxDecoration(
|
||||
color: isHovered
|
||||
? colorScheme.warning400.withOpacity(0.8)
|
||||
? colorScheme.warning400.withValues(
|
||||
alpha: 0.8,
|
||||
)
|
||||
: Colors.white,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
@@ -376,8 +387,9 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
|
||||
colorFilter: ColorFilter.mode(
|
||||
isHovered
|
||||
? Colors.white
|
||||
: colorScheme.warning400
|
||||
.withOpacity(0.8),
|
||||
: colorScheme.warning400.withValues(
|
||||
alpha: 0.8,
|
||||
),
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
),
|
||||
@@ -526,13 +538,13 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
|
||||
},
|
||||
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),
|
||||
|
||||
@@ -122,16 +122,16 @@ class _ImageEditorTextBarState extends State<ImageEditorTextBar>
|
||||
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,10 +155,9 @@ 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;
|
||||
@@ -208,8 +207,9 @@ 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,8 +218,9 @@ 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,
|
||||
@@ -228,26 +229,29 @@ 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.withOpacity(0.11),
|
||||
'selectedInnerBackgroundColor': Colors.black.withValues(alpha: 0.11),
|
||||
'innerBackgroundColor': isLightMode
|
||||
? Colors.black.withOpacity(0.11)
|
||||
: Colors.white.withOpacity(0.11),
|
||||
? Colors.black.withValues(alpha: 0.11)
|
||||
: Colors.white.withValues(alpha: 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.withOpacity(0.6),
|
||||
'innerBackgroundColor': Colors.white.withValues(alpha: 0.6),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -327,11 +331,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",
|
||||
),
|
||||
];
|
||||
|
||||
|
||||
@@ -87,18 +87,20 @@ class _ImageEditorTuneBarState extends State<ImageEditorTuneBar>
|
||||
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),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -163,8 +165,9 @@ 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",
|
||||
),
|
||||
@@ -223,15 +226,16 @@ class _CircularProgressWithValueState extends State<CircularProgressWithValue>
|
||||
animationBehavior: AnimationBehavior.preserve,
|
||||
);
|
||||
|
||||
_progressAnimation = Tween<double>(
|
||||
begin: 0.0,
|
||||
end: widget.value,
|
||||
).animate(
|
||||
CurvedAnimation(
|
||||
parent: _animationController,
|
||||
curve: Curves.easeInOut,
|
||||
),
|
||||
);
|
||||
_progressAnimation =
|
||||
Tween<double>(
|
||||
begin: 0.0,
|
||||
end: widget.value,
|
||||
).animate(
|
||||
CurvedAnimation(
|
||||
parent: _animationController,
|
||||
curve: Curves.easeInOut,
|
||||
),
|
||||
);
|
||||
|
||||
_animationController.forward();
|
||||
}
|
||||
@@ -245,15 +249,16 @@ class _CircularProgressWithValueState extends State<CircularProgressWithValue>
|
||||
}
|
||||
if (oldWidget.value != widget.value) {
|
||||
_previousValue = oldWidget.value;
|
||||
_progressAnimation = Tween<double>(
|
||||
begin: _previousValue,
|
||||
end: widget.value,
|
||||
).animate(
|
||||
CurvedAnimation(
|
||||
parent: _animationController,
|
||||
curve: Curves.easeInOut,
|
||||
),
|
||||
);
|
||||
_progressAnimation =
|
||||
Tween<double>(
|
||||
begin: _previousValue,
|
||||
end: widget.value,
|
||||
).animate(
|
||||
CurvedAnimation(
|
||||
parent: _animationController,
|
||||
curve: Curves.easeInOut,
|
||||
),
|
||||
);
|
||||
_animationController.forward(from: 0.0);
|
||||
}
|
||||
}
|
||||
@@ -300,8 +305,11 @@ class _CircularProgressWithValueState extends State<CircularProgressWithValue>
|
||||
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;
|
||||
@@ -320,11 +328,11 @@ class _CircularProgressWithValueState extends State<CircularProgressWithValue>
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: showValue || widget.isSelected
|
||||
? progressColor.withOpacity(0.2)
|
||||
? progressColor.withValues(alpha: 0.2)
|
||||
: Theme.of(context).colorScheme.editorBackgroundColor,
|
||||
border: Border.all(
|
||||
color: widget.isSelected
|
||||
? progressColor.withOpacity(0.4)
|
||||
? progressColor.withValues(alpha: 0.4)
|
||||
: Theme.of(context).colorScheme.editorBackgroundColor,
|
||||
width: 2,
|
||||
),
|
||||
@@ -333,11 +341,15 @@ class _CircularProgressWithValueState extends State<CircularProgressWithValue>
|
||||
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,
|
||||
@@ -365,21 +377,21 @@ class _CircularProgressWithValueState extends State<CircularProgressWithValue>
|
||||
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,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -426,10 +438,12 @@ 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,
|
||||
),
|
||||
|
||||
@@ -66,7 +66,8 @@ class _SmartAlbumsStatusWidgetState extends State<SmartAlbumsStatusWidget>
|
||||
firstCurve: Curves.easeInOutExpo,
|
||||
secondCurve: Curves.easeInOutExpo,
|
||||
sizeCurve: Curves.easeInOutExpo,
|
||||
crossFadeState: !(_syncingCollection == null ||
|
||||
crossFadeState:
|
||||
!(_syncingCollection == null ||
|
||||
_syncingCollection!.$1 != widget.collection?.id)
|
||||
? CrossFadeState.showSecond
|
||||
: CrossFadeState.showFirst,
|
||||
@@ -76,11 +77,13 @@ class _SmartAlbumsStatusWidgetState extends State<SmartAlbumsStatusWidget>
|
||||
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.withOpacity(0.65),
|
||||
color: Colors.black.withValues(alpha: 0.65),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
||||
@@ -84,8 +84,10 @@ class _CustomScrollBarState extends State<CustomScrollBar> {
|
||||
}
|
||||
|
||||
if (_showScrollbarDivisions) {
|
||||
getIntrinsicSizeOfWidget(const ScrollBarDivider(title: "Temp"), context)
|
||||
.then((size) {
|
||||
getIntrinsicSizeOfWidget(
|
||||
const ScrollBarDivider(title: "Temp"),
|
||||
context,
|
||||
).then((size) {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
heightOfScrollbarDivider = size.height;
|
||||
@@ -114,7 +116,8 @@ class _CustomScrollBarState extends State<CustomScrollBar> {
|
||||
|
||||
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) {
|
||||
@@ -142,19 +145,20 @@ class _CustomScrollBarState extends State<CustomScrollBar> {
|
||||
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),
|
||||
@@ -279,7 +283,7 @@ class ScrollBarDivider extends StatelessWidget {
|
||||
// is affected.
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.1),
|
||||
color: Colors.black.withValues(alpha: 0.1),
|
||||
blurRadius: 3,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
|
||||
@@ -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 [MaterialState] by
|
||||
/// drawn when triggered by a hover event, or based on any [WidgetState] by
|
||||
/// using [ScrollbarThemeData.trackVisibility].
|
||||
///
|
||||
/// The [thickness] of the track and scrollbar thumb can be changed dynamically
|
||||
/// in response to [MaterialState]s using [ScrollbarThemeData.thickness].
|
||||
/// in response to [WidgetState]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<WidgetState> get _states => <WidgetState>{
|
||||
if (_dragIsActive) WidgetState.dragged,
|
||||
if (_hoverIsActive) WidgetState.hovered,
|
||||
};
|
||||
if (_dragIsActive) WidgetState.dragged,
|
||||
if (_hoverIsActive) WidgetState.hovered,
|
||||
};
|
||||
|
||||
WidgetStateProperty<Color> 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.withOpacity(0.6);
|
||||
hoverColor = onSurface.withOpacity(0.5);
|
||||
dragColor = onSurface.withValues(alpha: 0.6);
|
||||
hoverColor = onSurface.withValues(alpha: 0.5);
|
||||
idleColor = _useAndroidScrollbar
|
||||
? Theme.of(context).highlightColor.withOpacity(1.0)
|
||||
: onSurface.withOpacity(0.1);
|
||||
? Theme.of(context).highlightColor.withValues(alpha: 1.0)
|
||||
: onSurface.withValues(alpha: 0.1);
|
||||
case Brightness.dark:
|
||||
dragColor = onSurface.withOpacity(0.75);
|
||||
hoverColor = onSurface.withOpacity(0.65);
|
||||
dragColor = onSurface.withValues(alpha: 0.75);
|
||||
hoverColor = onSurface.withValues(alpha: 0.65);
|
||||
idleColor = _useAndroidScrollbar
|
||||
? Theme.of(context).highlightColor.withOpacity(1.0)
|
||||
: onSurface.withOpacity(0.3);
|
||||
? Theme.of(context).highlightColor.withValues(alpha: 1.0)
|
||||
: onSurface.withValues(alpha: 0.3);
|
||||
}
|
||||
|
||||
return WidgetStateProperty.resolveWith((Set<WidgetState> 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.withOpacity(0.03),
|
||||
Brightness.dark => onSurface.withOpacity(0.05),
|
||||
Brightness.light => onSurface.withValues(alpha: 0.03),
|
||||
Brightness.dark => onSurface.withValues(alpha: 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.withOpacity(0.1),
|
||||
Brightness.dark => onSurface.withOpacity(0.25),
|
||||
Brightness.light => onSurface.withValues(alpha: 0.1),
|
||||
Brightness.dark => onSurface.withValues(alpha: 0.25),
|
||||
};
|
||||
}
|
||||
return const Color(0x00000000);
|
||||
@@ -383,10 +383,12 @@ 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
|
||||
|
||||
@@ -3028,5 +3028,5 @@ packages:
|
||||
source: hosted
|
||||
version: "3.1.3"
|
||||
sdks:
|
||||
dart: ">=3.7.2 <4.0.0"
|
||||
dart: ">=3.8.0 <4.0.0"
|
||||
flutter: ">=3.29.0"
|
||||
|
||||
@@ -16,7 +16,7 @@ version: 1.2.1+1205
|
||||
publish_to: none
|
||||
|
||||
environment:
|
||||
sdk: ">=3.3.0 <4.0.0"
|
||||
sdk: ">=3.8.0 <4.0.0"
|
||||
|
||||
dependencies:
|
||||
adaptive_theme: ^3.1.0
|
||||
|
||||
Reference in New Issue
Block a user