minor fixes

This commit is contained in:
Thibault Deckers 2023-12-19 15:35:40 +01:00
parent cd624979fb
commit 4dcfc7568f
8 changed files with 23 additions and 9 deletions

View file

@ -58,6 +58,7 @@ class Themes {
typography: _typography, typography: _typography,
// COMPONENT THEMES // COMPONENT THEMES
checkboxTheme: _checkboxTheme(colors), checkboxTheme: _checkboxTheme(colors),
floatingActionButtonTheme: _floatingActionButtonTheme(colors),
radioTheme: _radioTheme(colors), radioTheme: _radioTheme(colors),
sliderTheme: _sliderTheme(colors), sliderTheme: _sliderTheme(colors),
tooltipTheme: _tooltipTheme, tooltipTheme: _tooltipTheme,
@ -86,6 +87,13 @@ class Themes {
); );
} }
static FloatingActionButtonThemeData _floatingActionButtonTheme(ColorScheme colors) {
return FloatingActionButtonThemeData(
foregroundColor: colors.onPrimary,
backgroundColor: colors.primary,
);
}
// adapted from M3 defaults // adapted from M3 defaults
static RadioThemeData _radioTheme(ColorScheme colors) => RadioThemeData( static RadioThemeData _radioTheme(ColorScheme colors) => RadioThemeData(
fillColor: MaterialStateProperty.resolveWith<Color>((states) { fillColor: MaterialStateProperty.resolveWith<Color>((states) {

View file

@ -30,7 +30,7 @@ class AboutTranslators extends StatelessWidget {
static Widget buildBody(BuildContext context) { static Widget buildBody(BuildContext context) {
return _RandomTextSpanHighlighter( return _RandomTextSpanHighlighter(
spans: Contributors.translators.map((v) => v.name).toList(), spans: Contributors.translators.map((v) => v.name).toList(),
color: Theme.of(context).colorScheme.onPrimary, color: Theme.of(context).colorScheme.onBackground,
); );
} }
} }

View file

@ -11,11 +11,13 @@ class FilterBar extends StatefulWidget {
static const double preferredHeight = AvesFilterChip.minChipHeight + verticalPadding; static const double preferredHeight = AvesFilterChip.minChipHeight + verticalPadding;
final List<CollectionFilter> filters; final List<CollectionFilter> filters;
final bool interactive;
final FilterCallback? onTap, onRemove; final FilterCallback? onTap, onRemove;
FilterBar({ FilterBar({
super.key, super.key,
required Set<CollectionFilter> filters, required Set<CollectionFilter> filters,
this.interactive = true,
this.onTap, this.onTap,
this.onRemove, this.onRemove,
}) : filters = List<CollectionFilter>.from(filters)..sort(); }) : filters = List<CollectionFilter>.from(filters)..sort();
@ -111,6 +113,7 @@ class _FilterBarState extends State<FilterBar> {
return _Chip( return _Chip(
filter: filter, filter: filter,
single: filters.length == 1, single: filters.length == 1,
interactive: widget.interactive,
onTap: onTap, onTap: onTap,
onRemove: onRemove, onRemove: onRemove,
); );
@ -119,12 +122,13 @@ class _FilterBarState extends State<FilterBar> {
class _Chip extends StatelessWidget { class _Chip extends StatelessWidget {
final CollectionFilter filter; final CollectionFilter filter;
final bool single; final bool single, interactive;
final FilterCallback? onTap, onRemove; final FilterCallback? onTap, onRemove;
const _Chip({ const _Chip({
required this.filter, required this.filter,
required this.single, required this.single,
required this.interactive,
required this.onTap, required this.onTap,
required this.onRemove, required this.onRemove,
}); });
@ -148,6 +152,7 @@ class _Chip extends StatelessWidget {
heroType: HeroType.always, heroType: HeroType.always,
onTap: onTap, onTap: onTap,
onRemove: onRemove, onRemove: onRemove,
onLongPress: interactive ? AvesFilterChip.showDefaultLongPressMenu : null,
), ),
), ),
); );

View file

@ -50,7 +50,7 @@ class MosaicScaleOverlay extends StatelessWidget {
child: Stack( child: Stack(
alignment: Alignment.center, alignment: Alignment.center,
children: [ children: [
_buildBar(extentMax, colorScheme.onPrimary.withOpacity(.1)), _buildBar(extentMax, colorScheme.onBackground.withOpacity(.2)),
_buildBar(scaledSize.width, colorScheme.primary), _buildBar(scaledSize.width, colorScheme.primary),
], ],
), ),

View file

@ -20,9 +20,6 @@ class AvesFab extends StatelessWidget {
child: FloatingActionButton( child: FloatingActionButton(
tooltip: tooltip, tooltip: tooltip,
onPressed: onPressed, onPressed: onPressed,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(16)),
),
child: const Icon(AIcons.apply), child: const Icon(AIcons.apply),
), ),
); );

View file

@ -22,7 +22,7 @@ class AvesOutlinedButton extends StatelessWidget {
); );
}), }),
foregroundColor: MaterialStateProperty.resolveWith<Color>((states) { foregroundColor: MaterialStateProperty.resolveWith<Color>((states) {
return states.contains(MaterialState.disabled) ? theme.disabledColor : theme.colorScheme.onPrimary; return states.contains(MaterialState.disabled) ? theme.disabledColor : theme.colorScheme.onBackground;
}), }),
); );
return icon != null return icon != null

View file

@ -61,7 +61,11 @@ class SettingsCollectionTile extends StatelessWidget {
], ],
), ),
), ),
if (filters.isNotEmpty) FilterBar(filters: filters), if (filters.isNotEmpty)
FilterBar(
filters: filters,
interactive: false,
),
], ],
), ),
), ),

View file

@ -275,7 +275,7 @@ class _QuickActionEditorBodyState<T extends Object> extends State<QuickActionEdi
effect: WormEffect( effect: WormEffect(
dotWidth: 8, dotWidth: 8,
dotHeight: 8, dotHeight: 8,
dotColor: colorScheme.onPrimary.withOpacity(.3), dotColor: colorScheme.onBackground.withOpacity(.2),
activeDotColor: colorScheme.primary, activeDotColor: colorScheme.primary,
), ),
), ),