removed flushbar, upgraded expansion_tile_card

This commit is contained in:
Thibault Deckers 2021-03-11 09:47:17 +09:00
parent b35ddcb78e
commit cef6c8b479
10 changed files with 44 additions and 59 deletions

View file

@ -83,6 +83,13 @@ class _AvesAppState extends State<AvesApp> {
),
),
),
snackBarTheme: SnackBarThemeData(
backgroundColor: Colors.grey[800],
contentTextStyle: TextStyle(
color: Colors.white,
),
behavior: SnackBarBehavior.floating,
),
elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
primary: accentColor,

View file

@ -3,7 +3,6 @@ import 'package:flutter/scheduler.dart';
class Durations {
// common animations
static const iconAnimation = Duration(milliseconds: 300);
static const opToastAnimation = Duration(milliseconds: 600);
static const sweeperOpacityAnimation = Duration(milliseconds: 150);
static const sweepingAnimation = Duration(milliseconds: 650);
static const popupMenuAnimation = Duration(milliseconds: 300); // ref _PopupMenuRoute._kMenuDuration
@ -43,7 +42,7 @@ class Durations {
static const xmpStructArrayCardTransition = Duration(milliseconds: 300);
// delays & refresh intervals
static const opToastDisplay = Duration(seconds: 2);
static const opToastDisplay = Duration(seconds: 3);
static const collectionScrollMonitoringTimerDelay = Duration(milliseconds: 100);
static const collectionScalingCompleteNotificationDelay = Duration(milliseconds: 300);
static const highlightScrollInitDelay = Duration(milliseconds: 800);

View file

@ -234,12 +234,6 @@ class Constants {
licenseUrl: 'https://github.com/Skylled/expansion_tile_card/blob/master/LICENSE',
sourceUrl: 'https://github.com/Skylled/expansion_tile_card',
),
Dependency(
name: 'Flushbar',
license: 'Apache 2.0',
licenseUrl: 'https://github.com/AndreHaueisen/flushbar/blob/master/LICENSE',
sourceUrl: 'https://github.com/AndreHaueisen/flushbar',
),
Dependency(
name: 'Flutter Highlight',
license: 'MIT',

View file

@ -109,14 +109,6 @@ class EntrySetActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAware
itemCount: todoCount,
onDone: (processed) async {
final movedOps = processed.where((e) => e.success).toSet();
final movedCount = movedOps.length;
if (movedCount < todoCount) {
final count = todoCount - movedCount;
showFeedback(context, copy ? context.l10n.collectionCopyFailureFeedback(count) : context.l10n.collectionMoveFailureFeedback(count));
} else {
final count = movedCount;
showFeedback(context, copy ? context.l10n.collectionCopySuccessFeedback(count) : context.l10n.collectionMoveSuccessFeedback(count));
}
await source.updateAfterMove(
todoEntries: todoEntries,
favouriteEntries: favouriteEntries,
@ -126,6 +118,15 @@ class EntrySetActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAware
);
collection.browse();
source.resumeMonitoring();
final movedCount = movedOps.length;
if (movedCount < todoCount) {
final count = todoCount - movedCount;
showFeedback(context, copy ? context.l10n.collectionCopyFailureFeedback(count) : context.l10n.collectionMoveFailureFeedback(count));
} else {
final count = movedCount;
showFeedback(context, copy ? context.l10n.collectionCopySuccessFeedback(count) : context.l10n.collectionMoveSuccessFeedback(count));
}
},
);
}
@ -164,14 +165,15 @@ class EntrySetActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAware
itemCount: selectionCount,
onDone: (processed) {
final deletedUris = processed.where((event) => event.success).map((event) => event.uri).toSet();
source.removeEntries(deletedUris);
collection.browse();
source.resumeMonitoring();
final deletedCount = deletedUris.length;
if (deletedCount < selectionCount) {
final count = selectionCount - deletedCount;
showFeedback(context, context.l10n.collectionDeleteFailureFeedback(count));
}
source.removeEntries(deletedUris);
collection.browse();
source.resumeMonitoring();
},
);
}

View file

@ -1,26 +1,16 @@
import 'package:aves/theme/durations.dart';
import 'package:flushbar/flushbar.dart';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:intl/intl.dart';
import 'package:percent_indicator/circular_percent_indicator.dart';
mixin FeedbackMixin {
Flushbar _flushbar;
Future<void> dismissFeedback() => _flushbar?.dismiss();
void dismissFeedback(BuildContext context) => ScaffoldMessenger.of(context).hideCurrentSnackBar();
void showFeedback(BuildContext context, String message) {
_flushbar = Flushbar(
message: message,
margin: EdgeInsets.all(8),
borderRadius: 8,
borderColor: Colors.white30,
borderWidth: 0.5,
duration: Durations.opToastDisplay * timeDilation,
flushbarPosition: FlushbarPosition.TOP,
animationDuration: Durations.opToastAnimation,
)..show(context);
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(message),
duration: Durations.opToastDisplay,
));
}
// report overlay for multiple operations

View file

@ -36,8 +36,10 @@ class AvesExpansionTile extends StatelessWidget {
),
expandable: enabled,
initiallyExpanded: initiallyExpanded,
finalPadding: EdgeInsets.symmetric(vertical: 6.0),
baseColor: Colors.grey[900],
expandedColor: Colors.grey[850],
shadowColor: Theme.of(context).shadowColor,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [

View file

@ -142,13 +142,14 @@ class AlbumChipActionDelegate extends ChipActionDelegate with FeedbackMixin, Per
itemCount: selectionCount,
onDone: (processed) {
final deletedUris = processed.where((event) => event.success).map((event) => event.uri).toSet();
source.removeEntries(deletedUris);
source.resumeMonitoring();
final deletedCount = deletedUris.length;
if (deletedCount < selectionCount) {
final count = selectionCount - deletedCount;
showFeedback(context, context.l10n.collectionDeleteFailureFeedback(count));
}
source.removeEntries(deletedUris);
source.resumeMonitoring();
},
);
}
@ -180,13 +181,6 @@ class AlbumChipActionDelegate extends ChipActionDelegate with FeedbackMixin, Per
itemCount: todoCount,
onDone: (processed) async {
final movedOps = processed.where((e) => e.success).toSet();
final movedCount = movedOps.length;
if (movedCount < todoCount) {
final count = todoCount - movedCount;
showFeedback(context, context.l10n.collectionMoveFailureFeedback(count));
} else {
showFeedback(context, context.l10n.genericSuccessFeedback);
}
final pinned = settings.pinnedFilters.contains(filter);
await source.updateAfterMove(
todoEntries: todoEntries,
@ -201,6 +195,14 @@ class AlbumChipActionDelegate extends ChipActionDelegate with FeedbackMixin, Per
settings.pinnedFilters = settings.pinnedFilters..add(newFilter);
}
source.resumeMonitoring();
final movedCount = movedOps.length;
if (movedCount < todoCount) {
final count = todoCount - movedCount;
showFeedback(context, context.l10n.collectionMoveFailureFeedback(count));
} else {
showFeedback(context, context.l10n.genericSuccessFeedback);
}
},
);
}

View file

@ -360,10 +360,10 @@ class _EntryViewerStackState extends State<EntryViewerStack> with SingleTickerPr
);
}
Future<void> _onVerticalPageChanged(int page) async {
void _onVerticalPageChanged(int page) {
_currentVerticalPage.value = page;
if (page == transitionPage) {
await _actionDelegate.dismissFeedback();
_actionDelegate.dismissFeedback(context);
_popVisual();
} else if (page == infoPage) {
// prevent hero when viewer is offscreen

View file

@ -181,10 +181,10 @@ packages:
description:
path: "."
ref: HEAD
resolved-ref: "51fe2b12588356fade82ce65daef5482beed54e7"
resolved-ref: b80a0b322622f28bd783cccef3663aa7aa806e01
url: "git://github.com/deckerst/expansion_tile_card.git"
source: git
version: "1.0.3"
version: "2.0.0"
fake_async:
dependency: transitive
description:
@ -269,13 +269,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
flushbar:
dependency: "direct main"
description:
name: flushbar
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.4"
flutter:
dependency: "direct main"
description: flutter
@ -1106,4 +1099,4 @@ packages:
version: "3.1.0"
sdks:
dart: ">=2.12.0 <3.0.0"
flutter: ">=1.24.0-10"
flutter: ">=1.26.0-0"

View file

@ -7,8 +7,6 @@ publish_to: none
environment:
sdk: '>=2.10.0 <3.0.0'
# TODO TLAD merge null safe `expansion_tile_card` to fork
# TODO TLAD migrate from `flushbar` to basic SnackBar or `another_flushbar`
# TODO TLAD remove explicit `overlay_support` version when 1.2.0 is stable (1.0.5 uses deprecated `ancestorWidgetOfExactType`)
# TODO TLAD switch to Flutter dev/beta when possible, currently on master because of the following mess:
@ -21,7 +19,6 @@ environment:
# `charts_flutter` - https://github.com/google/charts/issues/579
# `country_code` - unmaintained?
# `decorated_icon` - https://github.com/benPesso/flutter_decorated_icon/issues/2
# `flushbar` - discontinued
# `flutter_ijkplayer` - unmaintained?
# `flutter_map` - https://github.com/fleaflet/flutter_map/issues/829
# `latlong` - archived - migrate to maps_toolkit? cf https://github.com/fleaflet/flutter_map/pull/750
@ -47,7 +44,6 @@ dependencies:
firebase_core:
firebase_analytics:
firebase_crashlytics:
flushbar:
flutter_highlight:
flutter_ijkplayer:
# path: ../flutter_ijkplayer