viewer: fixed error background on light theme
This commit is contained in:
parent
efa6e61ff0
commit
786335ede3
20 changed files with 51 additions and 27 deletions
|
@ -1,6 +1,7 @@
|
|||
import 'package:aves/image_providers/app_icon_image_provider.dart';
|
||||
import 'package:aves/model/covers.dart';
|
||||
import 'package:aves/model/settings/settings.dart';
|
||||
import 'package:aves/widgets/common/extensions/theme.dart';
|
||||
import 'package:aves_model/aves_model.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -32,7 +33,7 @@ class AvesColorsProvider extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
return ProxyProvider<Settings, AvesColorsData>(
|
||||
update: (context, settings, __) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final isDark = Theme.of(context).isDark;
|
||||
var mode = settings.themeColorMode;
|
||||
if (!allowMonochrome && mode == AvesThemeColorMode.monochrome) {
|
||||
mode = AvesThemeColorMode.polychrome;
|
||||
|
|
|
@ -11,6 +11,7 @@ import 'package:aves/widgets/common/action_mixins/overlay_snack_bar.dart';
|
|||
import 'package:aves/widgets/common/basic/circle.dart';
|
||||
import 'package:aves/widgets/common/basic/text/change_highlight.dart';
|
||||
import 'package:aves/widgets/common/extensions/build_context.dart';
|
||||
import 'package:aves/widgets/common/extensions/theme.dart';
|
||||
import 'package:aves/widgets/viewer/entry_viewer_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
@ -202,7 +203,8 @@ class _ReportOverlayState<T> extends State<ReportOverlay<T>> with SingleTickerPr
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final theme = Theme.of(context);
|
||||
final colorScheme = theme.colorScheme;
|
||||
final progressColor = colorScheme.primary;
|
||||
final animate = context.select<Settings, bool>((v) => v.accessibilityAnimations.animate);
|
||||
return PopScope(
|
||||
|
@ -223,7 +225,7 @@ class _ReportOverlayState<T> extends State<ReportOverlay<T>> with SingleTickerPr
|
|||
width: diameter + 2,
|
||||
height: diameter + 2,
|
||||
decoration: BoxDecoration(
|
||||
color: colorScheme.brightness == Brightness.dark ? const Color(0xBB000000) : const Color(0xEEFFFFFF),
|
||||
color: theme.isDark ? const Color(0xBB000000) : const Color(0xEEFFFFFF),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import 'package:aves/widgets/common/extensions/theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// adapted from Flutter `SnackBar` in `/material/snack_bar.dart`
|
||||
|
@ -115,7 +116,7 @@ class _OverlaySnackBarState extends State<OverlaySnackBar> {
|
|||
final ThemeData theme = Theme.of(context);
|
||||
final ColorScheme colorScheme = theme.colorScheme;
|
||||
final SnackBarThemeData snackBarTheme = theme.snackBarTheme;
|
||||
final bool isThemeDark = theme.brightness == Brightness.dark;
|
||||
final bool isThemeDark = theme.isDark;
|
||||
final Color buttonColor = isThemeDark ? colorScheme.primary : colorScheme.secondary;
|
||||
final SnackBarThemeData defaults = _SnackbarDefaultsM3(context);
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import 'package:aves/model/source/events.dart';
|
|||
import 'package:aves/theme/durations.dart';
|
||||
import 'package:aves/view/view.dart';
|
||||
import 'package:aves/widgets/common/extensions/build_context.dart';
|
||||
import 'package:aves/widgets/common/extensions/theme.dart';
|
||||
import 'package:aves_model/aves_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
@ -77,7 +78,7 @@ class SourceStateSubtitle extends StatelessWidget {
|
|||
const WidgetSpan(child: SizedBox(width: 8)),
|
||||
TextSpan(
|
||||
text: '${progress.done}/${progress.total}',
|
||||
style: TextStyle(color: theme.brightness == Brightness.dark ? Colors.white30 : Colors.black26),
|
||||
style: TextStyle(color: theme.isDark ? Colors.white30 : Colors.black26),
|
||||
),
|
||||
]
|
||||
],
|
||||
|
|
5
lib/widgets/common/extensions/theme.dart
Normal file
5
lib/widgets/common/extensions/theme.dart
Normal file
|
@ -0,0 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
extension ExtraThemeData on ThemeData {
|
||||
bool get isDark => brightness == Brightness.dark;
|
||||
}
|
|
@ -1,7 +1,8 @@
|
|||
import 'package:aves/widgets/common/extensions/theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AvesBorder {
|
||||
static Color _borderColor(BuildContext context) => Theme.of(context).brightness == Brightness.dark ? Colors.white30 : Colors.black26;
|
||||
static Color _borderColor(BuildContext context) => Theme.of(context).isDark ? Colors.white30 : Colors.black26;
|
||||
|
||||
// 1 device pixel for straight lines is fine
|
||||
static double straightBorderWidth(BuildContext context) => 1 / View.of(context).devicePixelRatio;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:aves/theme/durations.dart';
|
||||
import 'package:aves/widgets/common/extensions/build_context.dart';
|
||||
import 'package:aves/widgets/common/extensions/theme.dart';
|
||||
import 'package:aves/widgets/common/providers/media_query_data_provider.dart';
|
||||
import 'package:aves_model/aves_model.dart';
|
||||
import 'package:aves_utils/aves_utils.dart';
|
||||
|
@ -99,7 +100,7 @@ class _OverlayBackgroundState extends State<_OverlayBackground> {
|
|||
}
|
||||
|
||||
BoxDecoration _buildBackgroundDecoration(BuildContext context) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final isDark = Theme.of(context).isDark;
|
||||
final gradientCenter = widget.gradientCenter;
|
||||
return _initialized
|
||||
? BoxDecoration(
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:aves/theme/durations.dart';
|
||||
import 'package:aves/widgets/common/extensions/theme.dart';
|
||||
import 'package:aves/widgets/common/grid/sections/mosaic/scale_grid.dart';
|
||||
import 'package:aves/widgets/common/providers/media_query_data_provider.dart';
|
||||
import 'package:aves_utils/aves_utils.dart';
|
||||
|
@ -104,7 +105,7 @@ class _OverlayBackgroundState extends State<_OverlayBackground> {
|
|||
}
|
||||
|
||||
BoxDecoration _buildBackgroundDecoration(BuildContext context) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final isDark = Theme.of(context).isDark;
|
||||
return _initialized
|
||||
? BoxDecoration(
|
||||
color: isDark ? Colors.black87 : const Color(0xDDFFFFFF),
|
||||
|
|
|
@ -6,6 +6,7 @@ import 'package:aves/model/entry/extensions/props.dart';
|
|||
import 'package:aves/model/vaults/vaults.dart';
|
||||
import 'package:aves/theme/icons.dart';
|
||||
import 'package:aves/widgets/common/extensions/build_context.dart';
|
||||
import 'package:aves/widgets/common/extensions/theme.dart';
|
||||
import 'package:aves/widgets/common/grid/theme.dart';
|
||||
import 'package:aves_model/aves_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -295,7 +296,7 @@ class OverlayIcon extends StatelessWidget {
|
|||
margin: margin,
|
||||
padding: text != null ? EdgeInsetsDirectional.only(end: size / 4) : null,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).brightness == Brightness.dark ? const Color(0xAA000000) : const Color(0xCCFFFFFF),
|
||||
color: Theme.of(context).isDark ? const Color(0xAA000000) : const Color(0xCCFFFFFF),
|
||||
borderRadius: BorderRadius.all(Radius.circular(size)),
|
||||
),
|
||||
child: text == null
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:aves/model/settings/settings.dart';
|
||||
import 'package:aves/theme/themes.dart';
|
||||
import 'package:aves/widgets/common/extensions/theme.dart';
|
||||
import 'package:aves/widgets/common/fx/blurred.dart';
|
||||
import 'package:aves/widgets/common/fx/borders.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -174,7 +175,7 @@ class OverlayTextButton extends StatelessWidget {
|
|||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateProperty.all<Color>(Themes.overlayBackgroundColor(brightness: theme.brightness, blurred: blurred)),
|
||||
foregroundColor: MaterialStateProperty.all<Color>(theme.colorScheme.onSurface),
|
||||
overlayColor: theme.brightness == Brightness.dark ? MaterialStateProperty.all<Color>(Colors.white.withOpacity(0.12)) : null,
|
||||
overlayColor: theme.isDark ? MaterialStateProperty.all<Color>(Colors.white.withOpacity(0.12)) : null,
|
||||
minimumSize: _minSize,
|
||||
side: MaterialStateProperty.all<BorderSide>(AvesBorder.curvedSide(context)),
|
||||
shape: MaterialStateProperty.all<OutlinedBorder>(const RoundedRectangleBorder(
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
import 'package:aves/model/settings/settings.dart';
|
||||
import 'package:aves/theme/colors.dart';
|
||||
import 'package:aves/widgets/common/basic/text/outlined.dart';
|
||||
import 'package:aves/widgets/common/extensions/theme.dart';
|
||||
import 'package:aves/widgets/common/fx/highlight_decoration.dart';
|
||||
import 'package:aves_model/aves_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -27,7 +28,7 @@ class HighlightTitle extends StatelessWidget {
|
|||
|
||||
static List<Shadow> shadows(BuildContext context) => [
|
||||
Shadow(
|
||||
color: Theme.of(context).brightness == Brightness.dark ? Colors.black : Colors.white,
|
||||
color: Theme.of(context).isDark ? Colors.black : Colors.white,
|
||||
offset: const Offset(0, 1),
|
||||
blurRadius: 2,
|
||||
)
|
||||
|
|
|
@ -3,6 +3,7 @@ import 'dart:math';
|
|||
import 'package:aves/model/entry/entry.dart';
|
||||
import 'package:aves/theme/icons.dart';
|
||||
import 'package:aves/widgets/common/extensions/build_context.dart';
|
||||
import 'package:aves/widgets/common/extensions/theme.dart';
|
||||
import 'package:aves/widgets/common/fx/borders.dart';
|
||||
import 'package:aves/widgets/common/thumbnail/image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -50,7 +51,7 @@ class ItemPicker extends StatelessWidget {
|
|||
bottom: -1,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).brightness == Brightness.dark ? const Color(0xAA000000) : const Color(0xCCFFFFFF),
|
||||
color: Theme.of(context).isDark ? const Color(0xAA000000) : const Color(0xCCFFFFFF),
|
||||
border: AvesBorder.border(context),
|
||||
borderRadius: actionBoxBorderRadius,
|
||||
),
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:aves/theme/durations.dart';
|
||||
import 'package:aves/theme/styles.dart';
|
||||
import 'package:aves/widgets/common/extensions/theme.dart';
|
||||
import 'package:aves/widgets/common/identity/aves_filter_chip.dart';
|
||||
import 'package:decorated_icon/decorated_icon.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -16,7 +17,8 @@ class SettingsTileLeading extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final theme = Theme.of(context);
|
||||
final colorScheme = theme.colorScheme;
|
||||
return AnimatedContainer(
|
||||
padding: const EdgeInsets.all(6),
|
||||
decoration: BoxDecoration(
|
||||
|
@ -32,7 +34,7 @@ class SettingsTileLeading extends StatelessWidget {
|
|||
icon,
|
||||
size: 18,
|
||||
color: DefaultTextStyle.of(context).style.color,
|
||||
shadows: colorScheme.brightness == Brightness.dark ? AStyles.embossShadows : null,
|
||||
shadows: theme.isDark ? AStyles.embossShadows : null,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:aves/theme/styles.dart';
|
||||
import 'package:aves/widgets/common/basic/text/outlined.dart';
|
||||
import 'package:aves/widgets/common/extensions/theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
|
@ -20,7 +21,7 @@ class LinearPercentIndicatorText extends StatelessWidget {
|
|||
TextSpan(
|
||||
text: percentFormat.format(percent),
|
||||
style: TextStyle(
|
||||
shadows: theme.brightness == Brightness.dark ? AStyles.embossShadows : null,
|
||||
shadows: theme.isDark ? AStyles.embossShadows : null,
|
||||
),
|
||||
)
|
||||
],
|
||||
|
|
|
@ -11,6 +11,7 @@ import 'package:aves/model/settings/settings.dart';
|
|||
import 'package:aves/model/source/collection_lens.dart';
|
||||
import 'package:aves/theme/durations.dart';
|
||||
import 'package:aves/widgets/common/behaviour/springy_scroll_physics.dart';
|
||||
import 'package:aves/widgets/common/extensions/theme.dart';
|
||||
import 'package:aves/widgets/viewer/action/entry_action_delegate.dart';
|
||||
import 'package:aves/widgets/viewer/controls/controller.dart';
|
||||
import 'package:aves/widgets/viewer/controls/intents.dart';
|
||||
|
@ -171,7 +172,7 @@ class _ViewerVerticalPageViewState extends State<ViewerVerticalPageView> {
|
|||
return ValueListenableBuilder<double>(
|
||||
valueListenable: widget.overlayOpacity,
|
||||
builder: (context, overlayOpacity, child) {
|
||||
final background = Theme.of(context).brightness == Brightness.dark ? Colors.black : Color.lerp(Colors.black, Colors.white, overlayOpacity)!;
|
||||
final background = Theme.of(context).isDark ? Colors.black : Color.lerp(Colors.black, Colors.white, overlayOpacity)!;
|
||||
return Container(
|
||||
color: background.withOpacity(backgroundOpacity),
|
||||
child: child,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:aves/model/entry/entry.dart';
|
||||
import 'package:aves/model/source/collection_lens.dart';
|
||||
import 'package:aves/widgets/common/basic/scaffold.dart';
|
||||
import 'package:aves/widgets/common/extensions/theme.dart';
|
||||
import 'package:aves/widgets/viewer/controls/controller.dart';
|
||||
import 'package:aves/widgets/viewer/entry_viewer_stack.dart';
|
||||
import 'package:aves/widgets/viewer/overlay/bottom.dart';
|
||||
|
@ -26,6 +27,8 @@ class EntryViewerPage extends StatefulWidget {
|
|||
static EdgeInsets snackBarMargin(BuildContext context) {
|
||||
return EdgeInsets.only(bottom: ViewerBottomOverlay.actionSafeHeight(context));
|
||||
}
|
||||
|
||||
static Color getBackground(BuildContext context) => Theme.of(context).isDark ? Colors.black : Colors.white;
|
||||
}
|
||||
|
||||
class _EntryViewerPageState extends State<EntryViewerPage> {
|
||||
|
@ -56,11 +59,7 @@ class _EntryViewerPageState extends State<EntryViewerPage> {
|
|||
viewerController: _viewerController,
|
||||
),
|
||||
),
|
||||
backgroundColor: Navigator.canPop(context)
|
||||
? Colors.transparent
|
||||
: Theme.of(context).brightness == Brightness.dark
|
||||
? Colors.black
|
||||
: Colors.white,
|
||||
backgroundColor: Navigator.canPop(context) ? Colors.transparent : EntryViewerPage.getBackground(context),
|
||||
resizeToAvoidBottomInset: false,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import 'package:aves/model/settings/settings.dart';
|
|||
import 'package:aves/services/common/services.dart';
|
||||
import 'package:aves/theme/durations.dart';
|
||||
import 'package:aves/theme/styles.dart';
|
||||
import 'package:aves/widgets/common/extensions/theme.dart';
|
||||
import 'package:aves/widgets/viewer/multipage/controller.dart';
|
||||
import 'package:aves/widgets/viewer/overlay/details/date.dart';
|
||||
import 'package:aves/widgets/viewer/overlay/details/description.dart';
|
||||
|
@ -136,7 +137,7 @@ class ViewerDetailOverlayContent extends StatelessWidget {
|
|||
static const double iconPadding = 8.0;
|
||||
static const double iconSize = 16.0;
|
||||
|
||||
static List<Shadow>? shadows(BuildContext context) => Theme.of(context).brightness == Brightness.dark ? AStyles.embossShadows : null;
|
||||
static List<Shadow>? shadows(BuildContext context) => Theme.of(context).isDark ? AStyles.embossShadows : null;
|
||||
|
||||
const ViewerDetailOverlayContent({
|
||||
super.key,
|
||||
|
|
|
@ -5,6 +5,7 @@ import 'package:aves/theme/format.dart';
|
|||
import 'package:aves/theme/icons.dart';
|
||||
import 'package:aves/theme/styles.dart';
|
||||
import 'package:aves/theme/themes.dart';
|
||||
import 'package:aves/widgets/common/extensions/theme.dart';
|
||||
import 'package:aves/widgets/common/fx/blurred.dart';
|
||||
import 'package:aves/widgets/common/fx/borders.dart';
|
||||
import 'package:aves_video/aves_video.dart';
|
||||
|
@ -39,9 +40,9 @@ class _VideoProgressBarState extends State<VideoProgressBar> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final blurred = settings.enableBlurEffect;
|
||||
final brightness = Theme.of(context).brightness;
|
||||
final theme = Theme.of(context);
|
||||
final textStyle = TextStyle(
|
||||
shadows: brightness == Brightness.dark ? AStyles.embossShadows : null,
|
||||
shadows: theme.isDark ? AStyles.embossShadows : null,
|
||||
);
|
||||
const strutStyle = StrutStyle(
|
||||
forceStrutHeight: true,
|
||||
|
@ -71,7 +72,7 @@ class _VideoProgressBarState extends State<VideoProgressBar> {
|
|||
alignment: Alignment.center,
|
||||
padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: Themes.overlayBackgroundColor(brightness: brightness, blurred: blurred),
|
||||
color: Themes.overlayBackgroundColor(brightness: theme.brightness, blurred: blurred),
|
||||
border: AvesBorder.border(context),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(radius)),
|
||||
),
|
||||
|
|
|
@ -4,6 +4,7 @@ import 'package:aves/model/entry/entry.dart';
|
|||
import 'package:aves/theme/icons.dart';
|
||||
import 'package:aves/widgets/common/extensions/build_context.dart';
|
||||
import 'package:aves/widgets/common/identity/empty.dart';
|
||||
import 'package:aves/widgets/viewer/entry_viewer_page.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
@ -40,7 +41,7 @@ class _ErrorViewState extends State<ErrorView> {
|
|||
// use container to expand constraints, so that the user can tap anywhere
|
||||
child: Container(
|
||||
// opaque to cover potential lower quality layer below
|
||||
color: Colors.black,
|
||||
color: EntryViewerPage.getBackground(context),
|
||||
child: FutureBuilder<bool>(
|
||||
future: _exists,
|
||||
builder: (context, snapshot) {
|
||||
|
|
|
@ -7,6 +7,7 @@ import 'package:aves/theme/durations.dart';
|
|||
import 'package:aves/widgets/aves_app.dart';
|
||||
import 'package:aves/widgets/common/basic/insets.dart';
|
||||
import 'package:aves/widgets/common/basic/scaffold.dart';
|
||||
import 'package:aves/widgets/common/extensions/theme.dart';
|
||||
import 'package:aves/widgets/viewer/action/video_action_delegate.dart';
|
||||
import 'package:aves/widgets/viewer/controls/controller.dart';
|
||||
import 'package:aves/widgets/viewer/controls/notifications.dart';
|
||||
|
@ -50,7 +51,7 @@ class WallpaperPage extends StatelessWidget {
|
|||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
backgroundColor: Theme.of(context).brightness == Brightness.dark ? Colors.black : Colors.white,
|
||||
backgroundColor: Theme.of(context).isDark ? Colors.black : Colors.white,
|
||||
resizeToAvoidBottomInset: false,
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue