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( elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
primary: accentColor, primary: accentColor,

View file

@ -3,7 +3,6 @@ import 'package:flutter/scheduler.dart';
class Durations { class Durations {
// common animations // common animations
static const iconAnimation = Duration(milliseconds: 300); static const iconAnimation = Duration(milliseconds: 300);
static const opToastAnimation = Duration(milliseconds: 600);
static const sweeperOpacityAnimation = Duration(milliseconds: 150); static const sweeperOpacityAnimation = Duration(milliseconds: 150);
static const sweepingAnimation = Duration(milliseconds: 650); static const sweepingAnimation = Duration(milliseconds: 650);
static const popupMenuAnimation = Duration(milliseconds: 300); // ref _PopupMenuRoute._kMenuDuration static const popupMenuAnimation = Duration(milliseconds: 300); // ref _PopupMenuRoute._kMenuDuration
@ -43,7 +42,7 @@ class Durations {
static const xmpStructArrayCardTransition = Duration(milliseconds: 300); static const xmpStructArrayCardTransition = Duration(milliseconds: 300);
// delays & refresh intervals // delays & refresh intervals
static const opToastDisplay = Duration(seconds: 2); static const opToastDisplay = Duration(seconds: 3);
static const collectionScrollMonitoringTimerDelay = Duration(milliseconds: 100); static const collectionScrollMonitoringTimerDelay = Duration(milliseconds: 100);
static const collectionScalingCompleteNotificationDelay = Duration(milliseconds: 300); static const collectionScalingCompleteNotificationDelay = Duration(milliseconds: 300);
static const highlightScrollInitDelay = Duration(milliseconds: 800); 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', licenseUrl: 'https://github.com/Skylled/expansion_tile_card/blob/master/LICENSE',
sourceUrl: 'https://github.com/Skylled/expansion_tile_card', 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( Dependency(
name: 'Flutter Highlight', name: 'Flutter Highlight',
license: 'MIT', license: 'MIT',

View file

@ -109,14 +109,6 @@ class EntrySetActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAware
itemCount: todoCount, itemCount: todoCount,
onDone: (processed) async { onDone: (processed) async {
final movedOps = processed.where((e) => e.success).toSet(); 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( await source.updateAfterMove(
todoEntries: todoEntries, todoEntries: todoEntries,
favouriteEntries: favouriteEntries, favouriteEntries: favouriteEntries,
@ -126,6 +118,15 @@ class EntrySetActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAware
); );
collection.browse(); collection.browse();
source.resumeMonitoring(); 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, itemCount: selectionCount,
onDone: (processed) { onDone: (processed) {
final deletedUris = processed.where((event) => event.success).map((event) => event.uri).toSet(); final deletedUris = processed.where((event) => event.success).map((event) => event.uri).toSet();
source.removeEntries(deletedUris);
collection.browse();
source.resumeMonitoring();
final deletedCount = deletedUris.length; final deletedCount = deletedUris.length;
if (deletedCount < selectionCount) { if (deletedCount < selectionCount) {
final count = selectionCount - deletedCount; final count = selectionCount - deletedCount;
showFeedback(context, context.l10n.collectionDeleteFailureFeedback(count)); 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:aves/theme/durations.dart';
import 'package:flushbar/flushbar.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:percent_indicator/circular_percent_indicator.dart'; import 'package:percent_indicator/circular_percent_indicator.dart';
mixin FeedbackMixin { mixin FeedbackMixin {
Flushbar _flushbar; void dismissFeedback(BuildContext context) => ScaffoldMessenger.of(context).hideCurrentSnackBar();
Future<void> dismissFeedback() => _flushbar?.dismiss();
void showFeedback(BuildContext context, String message) { void showFeedback(BuildContext context, String message) {
_flushbar = Flushbar( ScaffoldMessenger.of(context).showSnackBar(SnackBar(
message: message, content: Text(message),
margin: EdgeInsets.all(8), duration: Durations.opToastDisplay,
borderRadius: 8, ));
borderColor: Colors.white30,
borderWidth: 0.5,
duration: Durations.opToastDisplay * timeDilation,
flushbarPosition: FlushbarPosition.TOP,
animationDuration: Durations.opToastAnimation,
)..show(context);
} }
// report overlay for multiple operations // report overlay for multiple operations

View file

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

View file

@ -142,13 +142,14 @@ class AlbumChipActionDelegate extends ChipActionDelegate with FeedbackMixin, Per
itemCount: selectionCount, itemCount: selectionCount,
onDone: (processed) { onDone: (processed) {
final deletedUris = processed.where((event) => event.success).map((event) => event.uri).toSet(); final deletedUris = processed.where((event) => event.success).map((event) => event.uri).toSet();
source.removeEntries(deletedUris);
source.resumeMonitoring();
final deletedCount = deletedUris.length; final deletedCount = deletedUris.length;
if (deletedCount < selectionCount) { if (deletedCount < selectionCount) {
final count = selectionCount - deletedCount; final count = selectionCount - deletedCount;
showFeedback(context, context.l10n.collectionDeleteFailureFeedback(count)); showFeedback(context, context.l10n.collectionDeleteFailureFeedback(count));
} }
source.removeEntries(deletedUris);
source.resumeMonitoring();
}, },
); );
} }
@ -180,13 +181,6 @@ class AlbumChipActionDelegate extends ChipActionDelegate with FeedbackMixin, Per
itemCount: todoCount, itemCount: todoCount,
onDone: (processed) async { onDone: (processed) async {
final movedOps = processed.where((e) => e.success).toSet(); 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); final pinned = settings.pinnedFilters.contains(filter);
await source.updateAfterMove( await source.updateAfterMove(
todoEntries: todoEntries, todoEntries: todoEntries,
@ -201,6 +195,14 @@ class AlbumChipActionDelegate extends ChipActionDelegate with FeedbackMixin, Per
settings.pinnedFilters = settings.pinnedFilters..add(newFilter); settings.pinnedFilters = settings.pinnedFilters..add(newFilter);
} }
source.resumeMonitoring(); 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; _currentVerticalPage.value = page;
if (page == transitionPage) { if (page == transitionPage) {
await _actionDelegate.dismissFeedback(); _actionDelegate.dismissFeedback(context);
_popVisual(); _popVisual();
} else if (page == infoPage) { } else if (page == infoPage) {
// prevent hero when viewer is offscreen // prevent hero when viewer is offscreen

View file

@ -181,10 +181,10 @@ packages:
description: description:
path: "." path: "."
ref: HEAD ref: HEAD
resolved-ref: "51fe2b12588356fade82ce65daef5482beed54e7" resolved-ref: b80a0b322622f28bd783cccef3663aa7aa806e01
url: "git://github.com/deckerst/expansion_tile_card.git" url: "git://github.com/deckerst/expansion_tile_card.git"
source: git source: git
version: "1.0.3" version: "2.0.0"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
@ -269,13 +269,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.0" version: "2.0.0"
flushbar:
dependency: "direct main"
description:
name: flushbar
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.4"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
@ -1106,4 +1099,4 @@ packages:
version: "3.1.0" version: "3.1.0"
sdks: sdks:
dart: ">=2.12.0 <3.0.0" 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: environment:
sdk: '>=2.10.0 <3.0.0' 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 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: # 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 # `charts_flutter` - https://github.com/google/charts/issues/579
# `country_code` - unmaintained? # `country_code` - unmaintained?
# `decorated_icon` - https://github.com/benPesso/flutter_decorated_icon/issues/2 # `decorated_icon` - https://github.com/benPesso/flutter_decorated_icon/issues/2
# `flushbar` - discontinued
# `flutter_ijkplayer` - unmaintained? # `flutter_ijkplayer` - unmaintained?
# `flutter_map` - https://github.com/fleaflet/flutter_map/issues/829 # `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 # `latlong` - archived - migrate to maps_toolkit? cf https://github.com/fleaflet/flutter_map/pull/750
@ -47,7 +44,6 @@ dependencies:
firebase_core: firebase_core:
firebase_analytics: firebase_analytics:
firebase_crashlytics: firebase_crashlytics:
flushbar:
flutter_highlight: flutter_highlight:
flutter_ijkplayer: flutter_ijkplayer:
# path: ../flutter_ijkplayer # path: ../flutter_ijkplayer