const galore

This commit is contained in:
Thibault Deckers 2021-06-08 11:05:23 +09:00
parent 236626984c
commit 0dbb46d9bb
133 changed files with 567 additions and 564 deletions

View file

@ -29,6 +29,6 @@ linter:
unnecessary_lambdas: true
# misc
prefer_const_constructors: false # too noisy
prefer_const_constructors: true # should specify `const` as Dart does not build constants when using const constructors without it
prefer_const_constructors_in_immutables: true
prefer_const_declarations: true

View file

@ -159,14 +159,14 @@ class CollectionLens with ChangeNotifier, CollectionActivityMixin {
break;
case EntryGroupFactor.none:
sections = Map.fromEntries([
MapEntry(SectionKey(), _filteredSortedEntries),
MapEntry(const SectionKey(), _filteredSortedEntries),
]);
break;
}
break;
case EntrySortFactor.size:
sections = Map.fromEntries([
MapEntry(SectionKey(), _filteredSortedEntries),
MapEntry(const SectionKey(), _filteredSortedEntries),
]);
break;
case EntrySortFactor.name:

View file

@ -12,10 +12,10 @@ class Themes {
scaffoldBackgroundColor: Colors.grey.shade900,
dialogBackgroundColor: Colors.grey[850],
toggleableActiveColor: _accentColor,
tooltipTheme: TooltipThemeData(
tooltipTheme: const TooltipThemeData(
verticalOffset: 32,
),
appBarTheme: AppBarTheme(
appBarTheme: const AppBarTheme(
textTheme: TextTheme(
headline6: TextStyle(
fontSize: 20,
@ -24,7 +24,7 @@ class Themes {
),
),
),
colorScheme: ColorScheme.dark(
colorScheme: const ColorScheme.dark(
primary: _accentColor,
secondary: _accentColor,
onPrimary: Colors.white,
@ -32,7 +32,7 @@ class Themes {
),
snackBarTheme: SnackBarThemeData(
backgroundColor: Colors.grey.shade800,
contentTextStyle: TextStyle(
contentTextStyle: const TextStyle(
color: Colors.white,
),
behavior: SnackBarBehavior.floating,

View file

@ -15,10 +15,12 @@ class Constants {
fontFeatures: [FontFeature.enable('smcp')],
);
static const embossShadow = Shadow(
static const embossShadows = [
Shadow(
color: Colors.black,
offset: Offset(0.5, 1.0),
);
)
];
static const overlayUnknown = ''; // em dash

View file

@ -23,7 +23,7 @@ extension ExtraDateTime on DateTime {
bool get isToday => isAtSameDayAs(DateTime.now());
bool get isYesterday => isAtSameDayAs(DateTime.now().subtract(Duration(days: 1)));
bool get isYesterday => isAtSameDayAs(DateTime.now().subtract(const Duration(days: 1)));
bool get isThisMonth => isAtSameMonthAs(DateTime.now());

View file

@ -18,15 +18,15 @@ class AboutPage extends StatelessWidget {
child: CustomScrollView(
slivers: [
SliverPadding(
padding: EdgeInsets.only(top: 16),
padding: const EdgeInsets.only(top: 16),
sliver: SliverList(
delegate: SliverChildListDelegate(
[
AppReference(),
Divider(),
const Divider(),
AboutUpdate(),
AboutCredits(),
Divider(),
const Divider(),
],
),
),

View file

@ -28,14 +28,14 @@ class _AppReferenceState extends State<AppReference> {
children: [
_buildAvesLine(),
_buildFlutterLine(),
SizedBox(height: 16),
const SizedBox(height: 16),
],
),
);
}
Widget _buildAvesLine() {
final style = TextStyle(
const style = TextStyle(
fontSize: 20,
fontWeight: FontWeight.normal,
letterSpacing: 1.0,
@ -66,7 +66,7 @@ class _AppReferenceState extends State<AppReference> {
children: [
WidgetSpan(
child: Padding(
padding: EdgeInsetsDirectional.only(end: 4),
padding: const EdgeInsetsDirectional.only(end: 4),
child: FlutterLogo(
size: style.fontSize! * 1.25,
),

View file

@ -9,12 +9,12 @@ class AboutCredits extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ConstrainedBox(
constraints: BoxConstraints(minHeight: 48),
constraints: const BoxConstraints(minHeight: 48),
child: Align(
alignment: AlignmentDirectional.centerStart,
child: Text(context.l10n.aboutCredits, style: Constants.titleTextStyle),
@ -24,7 +24,7 @@ class AboutCredits extends StatelessWidget {
TextSpan(
children: [
TextSpan(text: context.l10n.aboutCreditsWorldAtlas1),
WidgetSpan(
const WidgetSpan(
child: LinkChip(
text: 'World Atlas',
url: 'https://github.com/topojson/world-atlas',
@ -36,7 +36,7 @@ class AboutCredits extends StatelessWidget {
],
),
),
SizedBox(height: 16),
const SizedBox(height: 16),
],
),
);

View file

@ -36,12 +36,12 @@ class _LicensesState extends State<Licenses> {
@override
Widget build(BuildContext context) {
return SliverPadding(
padding: EdgeInsets.symmetric(horizontal: 8),
padding: const EdgeInsets.symmetric(horizontal: 8),
sliver: SliverList(
delegate: SliverChildListDelegate(
[
_buildHeader(),
SizedBox(height: 16),
const SizedBox(height: 16),
AvesExpansionTile(
title: context.l10n.aboutLicensesAndroidLibraries,
color: BrandColors.android,
@ -76,7 +76,7 @@ class _LicensesState extends State<Licenses> {
// as of Flutter v1.22.4, `cardColor` is used as a background color by `LicensePage`
cardColor: Theme.of(context).scaffoldBackgroundColor,
),
child: LicensePage(),
child: const LicensePage(),
),
),
),
@ -91,18 +91,18 @@ class _LicensesState extends State<Licenses> {
Widget _buildHeader() {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 8),
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ConstrainedBox(
constraints: BoxConstraints(minHeight: 48),
constraints: const BoxConstraints(minHeight: 48),
child: Align(
alignment: AlignmentDirectional.centerStart,
child: Text(context.l10n.aboutLicenses, style: Constants.titleTextStyle),
),
),
SizedBox(height: 8),
const SizedBox(height: 8),
Text(context.l10n.aboutLicensesBanner),
],
),
@ -122,17 +122,17 @@ class LicenseRow extends StatelessWidget {
final subColor = bodyTextStyle.color!.withOpacity(.6);
return Padding(
padding: EdgeInsets.symmetric(vertical: 8),
padding: const EdgeInsets.symmetric(vertical: 8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LinkChip(
text: package.name,
url: package.sourceUrl,
textStyle: TextStyle(fontWeight: FontWeight.bold),
textStyle: const TextStyle(fontWeight: FontWeight.bold),
),
Padding(
padding: EdgeInsetsDirectional.only(start: 16),
padding: const EdgeInsetsDirectional.only(start: 16),
child: LinkChip(
text: package.license,
url: package.licenseUrl,

View file

@ -1,9 +1,11 @@
import 'package:flutter/material.dart';
class AboutNewsBadge extends StatelessWidget {
const AboutNewsBadge();
@override
Widget build(BuildContext context) {
return Icon(
return const Icon(
Icons.circle,
size: 12,
color: Colors.red,

View file

@ -25,22 +25,22 @@ class _AboutUpdateState extends State<AboutUpdate> {
future: _updateChecker,
builder: (context, snapshot) {
final newVersionAvailable = snapshot.data == true;
if (!newVersionAvailable) return SizedBox();
if (!newVersionAvailable) return const SizedBox();
return Column(
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ConstrainedBox(
constraints: BoxConstraints(minHeight: 48),
constraints: const BoxConstraints(minHeight: 48),
child: Align(
alignment: AlignmentDirectional.centerStart,
child: Text.rich(
TextSpan(
children: [
WidgetSpan(
const WidgetSpan(
child: Padding(
padding: EdgeInsetsDirectional.only(end: 8),
child: AboutNewsBadge(),
@ -61,7 +61,7 @@ class _AboutUpdateState extends State<AboutUpdate> {
child: LinkChip(
text: context.l10n.aboutUpdateGithub,
url: 'https://github.com/deckerst/aves/releases',
textStyle: TextStyle(fontWeight: FontWeight.bold),
textStyle: const TextStyle(fontWeight: FontWeight.bold),
),
alignment: PlaceholderAlignment.middle,
),
@ -70,7 +70,7 @@ class _AboutUpdateState extends State<AboutUpdate> {
child: LinkChip(
text: context.l10n.aboutUpdateGooglePlay,
url: 'https://play.google.com/store/apps/details?id=deckers.thibault.aves',
textStyle: TextStyle(fontWeight: FontWeight.bold),
textStyle: const TextStyle(fontWeight: FontWeight.bold),
),
alignment: PlaceholderAlignment.middle,
),
@ -78,11 +78,11 @@ class _AboutUpdateState extends State<AboutUpdate> {
],
),
),
SizedBox(height: 16),
const SizedBox(height: 16),
],
),
),
Divider(),
const Divider(),
],
);
},

View file

@ -41,11 +41,11 @@ class _AvesAppState extends State<AvesApp> {
// observers are not registered when using the same list object with different items
// the list itself needs to be reassigned
List<NavigatorObserver> _navigatorObservers = [];
final EventChannel _contentChangeChannel = EventChannel('deckers.thibault/aves/contentchange');
final EventChannel _newIntentChannel = EventChannel('deckers.thibault/aves/intent');
final EventChannel _contentChangeChannel = const EventChannel('deckers.thibault/aves/contentchange');
final EventChannel _newIntentChannel = const EventChannel('deckers.thibault/aves/intent');
final GlobalKey<NavigatorState> _navigatorKey = GlobalKey(debugLabel: 'app-navigator');
Widget getFirstPage({Map? intentData}) => settings.hasAcceptedTerms ? HomePage(intentData: intentData) : WelcomePage();
Widget getFirstPage({Map? intentData}) => settings.hasAcceptedTerms ? HomePage(intentData: intentData) : const WelcomePage();
@override
void initState() {
@ -75,7 +75,7 @@ class _AvesAppState extends State<AvesApp> {
final home = initialized
? getFirstPage()
: Scaffold(
body: snapshot.hasError ? _buildError(snapshot.error!) : SizedBox(),
body: snapshot.hasError ? _buildError(snapshot.error!) : const SizedBox(),
);
return Selector<Settings, Locale?>(
selector: (context, s) => s.locale,
@ -108,12 +108,12 @@ class _AvesAppState extends State<AvesApp> {
Widget _buildError(Object error) {
return Container(
alignment: Alignment.center,
padding: EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Icon(AIcons.error),
SizedBox(height: 16),
const Icon(AIcons.error),
const SizedBox(height: 16),
Text(error.toString()),
],
),
@ -151,7 +151,7 @@ class _AvesAppState extends State<AvesApp> {
FirebaseCrashlytics.instance.log('New intent');
_navigatorKey.currentState!.pushReplacement(DirectMaterialPageRoute(
settings: RouteSettings(name: HomePage.routeName),
settings: const RouteSettings(name: HomePage.routeName),
builder: (_) => getFirstPage(intentData: intentData),
));
}

View file

@ -137,7 +137,7 @@ class _CollectionAppBarState extends State<CollectionAppBar> with SingleTickerPr
tooltip = MaterialLocalizations.of(context).backButtonTooltip;
}
return IconButton(
key: Key('appbar-leading-button'),
key: const Key('appbar-leading-button'),
icon: AnimatedIcon(
icon: AnimatedIcons.menu_arrow,
progress: _browseToSelectAnimation,
@ -197,19 +197,19 @@ class _CollectionAppBarState extends State<CollectionAppBar> with SingleTickerPr
builder: (context, snapshot) {
final canAddShortcuts = snapshot.data ?? false;
return PopupMenuButton<CollectionAction>(
key: Key('appbar-menu-button'),
key: const Key('appbar-menu-button'),
itemBuilder: (context) {
final isNotEmpty = !collection.isEmpty;
final hasSelection = collection.selection.isNotEmpty;
return [
PopupMenuItem(
key: Key('menu-sort'),
key: const Key('menu-sort'),
value: CollectionAction.sort,
child: MenuRow(text: context.l10n.menuActionSort, icon: AIcons.sort),
),
if (collection.sortFactor == EntrySortFactor.date)
PopupMenuItem(
key: Key('menu-group'),
key: const Key('menu-group'),
value: CollectionAction.group,
child: MenuRow(text: context.l10n.menuActionGroup, icon: AIcons.group),
),
@ -231,7 +231,7 @@ class _CollectionAppBarState extends State<CollectionAppBar> with SingleTickerPr
),
],
if (collection.isSelecting) ...[
PopupMenuDivider(),
const PopupMenuDivider(),
PopupMenuItem(
value: CollectionAction.copy,
enabled: hasSelection,
@ -247,7 +247,7 @@ class _CollectionAppBarState extends State<CollectionAppBar> with SingleTickerPr
enabled: hasSelection,
child: MenuRow(text: context.l10n.collectionActionRefreshMetadata),
),
PopupMenuDivider(),
const PopupMenuDivider(),
PopupMenuItem(
value: CollectionAction.selectAll,
enabled: collection.selection.length < collection.entryCount,
@ -390,7 +390,7 @@ class _CollectionAppBarState extends State<CollectionAppBar> with SingleTickerPr
Navigator.push(
context,
MaterialPageRoute(
settings: RouteSettings(name: StatsPage.routeName),
settings: const RouteSettings(name: StatsPage.routeName),
builder: (context) => StatsPage(
source: source,
parentCollection: collection,

View file

@ -318,7 +318,7 @@ class _CollectionScrollViewState extends State<_CollectionScrollView> {
primary: true,
// workaround to prevent scrolling the app bar away
// when there is no content and we use `SliverFillRemaining`
physics: collection.isEmpty ? NeverScrollableScrollPhysics() : SloppyScrollPhysics(parent: AlwaysScrollableScrollPhysics()),
physics: collection.isEmpty ? const NeverScrollableScrollPhysics() : const SloppyScrollPhysics(parent: AlwaysScrollableScrollPhysics()),
cacheExtent: context.select<TileExtentController, double>((controller) => controller.effectiveExtentMax),
slivers: [
appBar,
@ -327,7 +327,7 @@ class _CollectionScrollViewState extends State<_CollectionScrollView> {
hasScrollBody: false,
child: _buildEmptyCollectionPlaceholder(collection),
)
: SectionedListSliver<AvesEntry>(),
: const SectionedListSliver<AvesEntry>(),
BottomPaddingSliver(),
],
);
@ -338,7 +338,7 @@ class _CollectionScrollViewState extends State<_CollectionScrollView> {
valueListenable: collection.source.stateNotifier,
builder: (context, sourceState, child) {
if (sourceState == SourceState.loading) {
return SizedBox.shrink();
return const SizedBox.shrink();
}
if (collection.filters.any((filter) => filter is FavouriteFilter)) {
return EmptyContent(

View file

@ -46,7 +46,7 @@ class _CollectionPageState extends State<CollectionPage> {
bottom: false,
child: ChangeNotifierProvider<CollectionLens>.value(
value: collection,
child: CollectionGrid(
child: const CollectionGrid(
key: Key('collection-grid'),
),
),

View file

@ -81,7 +81,7 @@ class EntrySetActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAware
final destinationAlbum = await Navigator.push(
context,
MaterialPageRoute<String>(
settings: RouteSettings(name: AlbumPickPage.routeName),
settings: const RouteSettings(name: AlbumPickPage.routeName),
builder: (context) => AlbumPickPage(source: source, moveType: moveType),
),
);

View file

@ -20,7 +20,7 @@ class FilterBar extends StatefulWidget implements PreferredSizeWidget {
super(key: key);
@override
final Size preferredSize = Size.fromHeight(preferredHeight);
final Size preferredSize = const Size.fromHeight(preferredHeight);
@override
_FilterBarState createState() => _FilterBarState();
@ -92,10 +92,10 @@ class _FilterBarState extends State<FilterBar> {
key: _animatedListKey,
initialItemCount: widget.filters.length,
scrollDirection: Axis.horizontal,
physics: BouncingScrollPhysics(),
padding: EdgeInsets.only(left: 8),
physics: const BouncingScrollPhysics(),
padding: const EdgeInsets.only(left: 8),
itemBuilder: (context, index, animation) {
if (index >= widget.filters.length) return SizedBox();
if (index >= widget.filters.length) return const SizedBox();
return _buildChip(widget.filters.toList()[index]);
},
),
@ -105,7 +105,7 @@ class _FilterBarState extends State<FilterBar> {
Padding _buildChip(CollectionFilter filter) {
return Padding(
padding: EdgeInsets.only(right: 8),
padding: const EdgeInsets.only(right: 8),
child: Center(
child: AvesFilterChip(
key: ValueKey(filter),

View file

@ -38,7 +38,7 @@ class AlbumSectionHeader extends StatelessWidget {
leading: albumIcon,
title: albumName ?? context.l10n.sectionUnknown,
trailing: directory != null && androidFileUtils.isOnRemovableStorage(directory!)
? Icon(
? const Icon(
AIcons.removableStorage,
size: 16,
color: Color(0xFF757575),

View file

@ -29,7 +29,7 @@ class CollectionSectionHeader extends StatelessWidget {
height: height,
child: header,
)
: SizedBox.shrink();
: const SizedBox.shrink();
}
Widget? _buildHeader(BuildContext context) {

View file

@ -66,7 +66,7 @@ class InteractiveThumbnail extends StatelessWidget {
Navigator.push(
context,
TransparentMaterialPageRoute(
settings: RouteSettings(name: EntryViewerPage.routeName),
settings: const RouteSettings(name: EntryViewerPage.routeName),
pageBuilder: (c, a, sa) {
final viewerCollection = CollectionLens(
source: collection.source,

View file

@ -60,10 +60,10 @@ class DecoratedThumbnail extends StatelessWidget {
return Container(
decoration: BoxDecoration(
border: Border.all(
border: Border.fromBorderSide(BorderSide(
color: borderColor,
width: borderWidth,
),
)),
),
width: tileExtent,
height: tileExtent,

View file

@ -43,7 +43,7 @@ class _ErrorThumbnailState extends State<ErrorThumbnail> {
builder: (context, snapshot) {
Widget child;
if (snapshot.connectionState != ConnectionState.done) {
child = SizedBox();
child = const SizedBox();
} else {
final exists = snapshot.data!;
child = Tooltip(

View file

@ -23,21 +23,21 @@ class ThumbnailEntryOverlay extends StatelessWidget {
@override
Widget build(BuildContext context) {
final children = [
if (entry.hasGps && context.select<ThumbnailThemeData, bool>((t) => t.showLocation)) GpsIcon(),
if (entry.hasGps && context.select<ThumbnailThemeData, bool>((t) => t.showLocation)) const GpsIcon(),
if (entry.isVideo)
VideoIcon(
entry: entry,
)
else if (entry.isAnimated)
AnimatedImageIcon()
const AnimatedImageIcon()
else ...[
if (entry.isRaw && context.select<ThumbnailThemeData, bool>((t) => t.showRaw)) RawIcon(),
if (entry.isRaw && context.select<ThumbnailThemeData, bool>((t) => t.showRaw)) const RawIcon(),
if (entry.isMultiPage) MultiPageIcon(entry: entry),
if (entry.isGeotiff) GeotiffIcon(),
if (entry.is360) SphericalImageIcon(),
if (entry.isGeotiff) const GeotiffIcon(),
if (entry.is360) const SphericalImageIcon(),
]
];
if (children.isEmpty) return SizedBox.shrink();
if (children.isEmpty) return const SizedBox.shrink();
if (children.length == 1) return children.first;
return Column(
mainAxisSize: MainAxisSize.min,
@ -74,7 +74,7 @@ class ThumbnailSelectionOverlay extends StatelessWidget {
icon: selected ? AIcons.selected : AIcons.unselected,
size: context.select<ThumbnailThemeData, double>((t) => t.iconSize),
)
: SizedBox.shrink();
: const SizedBox.shrink();
child = AnimatedSwitcher(
duration: duration,
switchInCurve: Curves.easeOutBack,
@ -94,7 +94,7 @@ class ThumbnailSelectionOverlay extends StatelessWidget {
return child;
},
)
: SizedBox.shrink();
: const SizedBox.shrink();
return AnimatedSwitcher(
duration: duration,
child: child,
@ -130,10 +130,10 @@ class _ThumbnailHighlightOverlayState extends State<ThumbnailHighlightOverlay> {
return Sweeper(
builder: (context) => Container(
decoration: BoxDecoration(
border: Border.all(
border: Border.fromBorderSide(BorderSide(
color: Theme.of(context).accentColor,
width: context.select<ThumbnailThemeData, double>((t) => t.highlightBorderWidth),
),
)),
),
),
toggledNotifier: _highlightedNotifier,

View file

@ -103,7 +103,7 @@ class _ReportOverlayState<T> extends State<ReportOverlay<T>> with SingleTickerPr
return FadeTransition(
opacity: _animation,
child: Container(
decoration: BoxDecoration(
decoration: const BoxDecoration(
gradient: RadialGradient(
colors: [
Colors.black,

View file

@ -34,7 +34,7 @@ class SourceStateAwareAppBarTitle extends StatelessWidget {
),
),
child: sourceState == SourceState.ready
? SizedBox.shrink()
? const SizedBox.shrink()
: SourceStateSubtitle(
source: source,
),
@ -70,7 +70,7 @@ class SourceStateSubtitle extends StatelessWidget {
}
final subtitleStyle = Theme.of(context).textTheme.caption;
return subtitle == null
? SizedBox.shrink()
? const SizedBox.shrink()
: Row(
mainAxisSize: MainAxisSize.min,
children: [
@ -78,10 +78,10 @@ class SourceStateSubtitle extends StatelessWidget {
StreamBuilder<ProgressEvent>(
stream: source.progressStream,
builder: (context, snapshot) {
if (snapshot.hasError || !snapshot.hasData) return SizedBox.shrink();
if (snapshot.hasError || !snapshot.hasData) return const SizedBox.shrink();
final progress = snapshot.data!;
return Padding(
padding: EdgeInsetsDirectional.only(start: 8),
padding: const EdgeInsetsDirectional.only(start: 8),
child: Text(
'${progress.done}/${progress.total}',
style: subtitleStyle!.copyWith(color: Colors.white30),

View file

@ -17,7 +17,7 @@ class InteractiveAppBarTitle extends StatelessWidget {
// so that we can also detect taps around the title `Text`
child: Container(
alignment: AlignmentDirectional.centerStart,
padding: EdgeInsets.symmetric(horizontal: NavigationToolbar.kMiddleSpacing),
padding: const EdgeInsets.symmetric(horizontal: NavigationToolbar.kMiddleSpacing),
color: Colors.transparent,
height: kToolbarHeight,
child: child,

View file

@ -89,7 +89,7 @@ class DraggableScrollbar extends StatefulWidget {
backgroundColor: backgroundColor,
child: labelText,
),
SizedBox(width: 24),
const SizedBox(width: 24),
scrollThumb,
],
);
@ -117,11 +117,11 @@ class ScrollLabel extends StatelessWidget {
return FadeTransition(
opacity: animation,
child: Container(
margin: EdgeInsets.only(right: 12.0),
margin: const EdgeInsets.only(right: 12.0),
child: Material(
elevation: 4.0,
color: backgroundColor,
borderRadius: BorderRadius.circular(16),
borderRadius: const BorderRadius.all(Radius.circular(16)),
child: child,
),
),
@ -386,8 +386,8 @@ class SlideFadeTransition extends StatelessWidget {
builder: (context, child) => animation.value == 0.0 ? Container() : child!,
child: SlideTransition(
position: Tween(
begin: Offset(0.3, 0.0),
end: Offset(0.0, 0.0),
begin: const Offset(0.3, 0.0),
end: const Offset(0.0, 0.0),
).animate(animation),
child: FadeTransition(
opacity: animation,

View file

@ -17,7 +17,7 @@ class BottomGestureAreaProtector extends StatelessWidget {
right: 0,
bottom: 0,
height: systemGestureBottom,
child: AbsorbPointer(),
child: const AbsorbPointer(),
);
},
);

View file

@ -9,7 +9,7 @@ class LinkChip extends StatelessWidget {
final Color? color;
final TextStyle? textStyle;
static final borderRadius = BorderRadius.circular(8);
static const borderRadius = BorderRadius.all(Radius.circular(8));
const LinkChip({
Key? key,
@ -23,7 +23,7 @@ class LinkChip extends StatelessWidget {
@override
Widget build(BuildContext context) {
return DefaultTextStyle.merge(
style: (textStyle ?? TextStyle()).copyWith(color: color),
style: (textStyle ?? const TextStyle()).copyWith(color: color),
child: InkWell(
borderRadius: borderRadius,
onTap: () async {
@ -32,13 +32,13 @@ class LinkChip extends StatelessWidget {
}
},
child: Padding(
padding: EdgeInsets.all(8.0),
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
if (leading != null) ...[
leading!,
SizedBox(width: 8),
const SizedBox(width: 8),
],
Flexible(
child: Text(
@ -48,7 +48,7 @@ class LinkChip extends StatelessWidget {
maxLines: 1,
),
),
SizedBox(width: 8),
const SizedBox(width: 8),
Builder(
builder: (context) => Icon(
AIcons.openOutside,

View file

@ -24,11 +24,11 @@ class MenuRow extends StatelessWidget {
opacity: checked! ? 1 : 0,
child: Icon(AIcons.checked, size: iconSize),
),
SizedBox(width: 8),
const SizedBox(width: 8),
],
if (icon != null) ...[
Icon(icon, size: iconSize),
SizedBox(width: 8),
const SizedBox(width: 8),
],
Expanded(child: Text(text)),
],

View file

@ -26,7 +26,7 @@ class _MultiCrossFaderState extends State<MultiCrossFader> {
void initState() {
super.initState();
_first = widget.child;
_second = SizedBox();
_second = const SizedBox();
}
@override

View file

@ -30,7 +30,7 @@ class _QueryBarState extends State<QueryBar> {
@override
Widget build(BuildContext context) {
final clearButton = IconButton(
icon: Icon(AIcons.clear),
icon: const Icon(AIcons.clear),
onPressed: () {
_controller.clear();
filterNotifier.value = '';
@ -45,7 +45,7 @@ class _QueryBarState extends State<QueryBar> {
child: TextField(
controller: _controller,
decoration: InputDecoration(
icon: Padding(
icon: const Padding(
padding: EdgeInsetsDirectional.only(start: 16),
child: Icon(AIcons.search),
),
@ -57,7 +57,7 @@ class _QueryBarState extends State<QueryBar> {
),
),
ConstrainedBox(
constraints: BoxConstraints(minWidth: 16),
constraints: const BoxConstraints(minWidth: 16),
child: ValueListenableBuilder<TextEditingValue>(
valueListenable: _controller,
builder: (context, value, child) => AnimatedSwitcher(
@ -70,7 +70,7 @@ class _QueryBarState extends State<QueryBar> {
child: child,
),
),
child: value.text.isNotEmpty ? clearButton : SizedBox.shrink(),
child: value.text.isNotEmpty ? clearButton : const SizedBox.shrink(),
),
),
)

View file

@ -40,7 +40,7 @@ class BlurredRRect extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ClipRRect(
borderRadius: BorderRadius.circular(borderRadius),
borderRadius: BorderRadius.all(Radius.circular(borderRadius)),
child: BackdropFilter(
filter: _filter,
child: child,

View file

@ -17,7 +17,7 @@ class DraggableThumbLabel<T> extends StatelessWidget {
Widget build(BuildContext context) {
final sll = context.read<SectionedListLayout<T>>();
final sectionLayout = sll.getSectionAt(offsetY);
if (sectionLayout == null) return SizedBox();
if (sectionLayout == null) return const SizedBox();
final section = sll.sections[sectionLayout.sectionKey]!;
final dy = offsetY - (sectionLayout.minOffset + sectionLayout.headerExtent);
@ -25,12 +25,12 @@ class DraggableThumbLabel<T> extends StatelessWidget {
final item = section[itemIndex];
final lines = lineBuilder(context, item);
if (lines.isEmpty) return SizedBox();
if (lines.isEmpty) return const SizedBox();
return ConstrainedBox(
constraints: BoxConstraints(maxWidth: 140),
constraints: const BoxConstraints(maxWidth: 140),
child: Padding(
padding: EdgeInsets.symmetric(vertical: 4, horizontal: 8),
padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 8),
child: lines.length > 1
? Column(
mainAxisSize: MainAxisSize.min,
@ -44,7 +44,7 @@ class DraggableThumbLabel<T> extends StatelessWidget {
Widget _buildText(String text) => Text(
text,
style: TextStyle(
style: const TextStyle(
color: Colors.black,
),
softWrap: false,

View file

@ -35,7 +35,7 @@ class SectionHeader extends StatelessWidget {
return Container(
alignment: AlignmentDirectional.centerStart,
padding: padding,
constraints: BoxConstraints(minHeight: leadingDimension),
constraints: const BoxConstraints(minHeight: leadingDimension),
child: GestureDetector(
onTap: selectable ? () => _toggleSectionSelection(context) : null,
child: Text.rich(
@ -158,12 +158,12 @@ class _SectionSelectableLeading extends StatelessWidget {
),
child: IconButton(
iconSize: 26,
padding: EdgeInsets.only(top: 1),
padding: const EdgeInsets.only(top: 1),
alignment: AlignmentDirectional.topStart,
icon: Icon(selected ? AIcons.selected : AIcons.unselected),
onPressed: onPressed,
tooltip: selected ? context.l10n.collectionDeselectSectionTooltip : context.l10n.collectionSelectSectionTooltip,
constraints: BoxConstraints(
constraints: const BoxConstraints(
minHeight: leadingDimension,
minWidth: leadingDimension,
),
@ -208,5 +208,5 @@ class _SectionSelectableLeading extends StatelessWidget {
);
}
Widget _buildBrowsing(BuildContext context) => browsingBuilder?.call(context) ?? SizedBox(height: leadingDimension);
Widget _buildBrowsing(BuildContext context) => browsingBuilder?.call(context) ?? const SizedBox(height: leadingDimension);
}

View file

@ -106,7 +106,7 @@ abstract class SectionedListLayoutProvider<T> extends StatelessWidget {
bool animate,
) {
if (sectionChildIndex == 0) {
final header = headerExtent > 0 ? buildHeader(context, sectionKey, headerExtent) : SizedBox.shrink();
final header = headerExtent > 0 ? buildHeader(context, sectionKey, headerExtent) : const SizedBox.shrink();
return animate ? _buildAnimation(sectionGridIndex, header) : header;
}
sectionChildIndex--;

View file

@ -26,7 +26,7 @@ class SectionedListSliver<T> extends StatelessWidget {
(context, index) {
if (index >= childCount) return null;
final sectionLayout = sectionLayouts.firstWhereOrNull((section) => section.hasChild(index));
return sectionLayout?.builder(context, index) ?? SizedBox.shrink();
return sectionLayout?.builder(context, index) ?? const SizedBox.shrink();
},
childCount: childCount,
addAutomaticKeepAlives: false,

View file

@ -35,7 +35,7 @@ class AvesExpansionTile extends StatelessWidget {
titleChild = Row(
children: [
leading!,
SizedBox(width: 8),
const SizedBox(width: 8),
Expanded(child: titleChild),
],
);
@ -52,15 +52,15 @@ class AvesExpansionTile extends StatelessWidget {
title: titleChild,
expandable: enabled,
initiallyExpanded: initiallyExpanded,
finalPadding: EdgeInsets.symmetric(vertical: 6.0),
finalPadding: const EdgeInsets.symmetric(vertical: 6.0),
baseColor: Colors.grey.shade900,
expandedColor: Colors.grey[850],
shadowColor: Theme.of(context).shadowColor,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Divider(thickness: 1, height: 1),
SizedBox(height: 4),
const Divider(thickness: 1, height: 1),
const SizedBox(height: 4),
if (enabled) ...children,
],
),

View file

@ -65,7 +65,7 @@ class AvesFilterChip extends StatefulWidget {
FocusManager.instance.primaryFocus?.unfocus();
final overlay = Overlay.of(context)!.context.findRenderObject() as RenderBox;
final touchArea = Size(40, 40);
const touchArea = Size(40, 40);
final selectedAction = await showMenu<ChipAction>(
context: context,
position: RelativeRect.fromRect(tapPosition & touchArea, Offset.zero & overlay.size),
@ -186,7 +186,7 @@ class _AvesFilterChipState extends State<AvesFilterChip> {
color: Colors.black54,
child: DefaultTextStyle(
style: Theme.of(context).textTheme.bodyText2!.copyWith(
shadows: [Constants.embossShadow],
shadows: Constants.embossShadows,
),
child: content,
),
@ -194,9 +194,9 @@ class _AvesFilterChipState extends State<AvesFilterChip> {
);
}
final borderRadius = widget.borderRadius ?? BorderRadius.circular(AvesFilterChip.defaultRadius);
final borderRadius = widget.borderRadius ?? const BorderRadius.all(Radius.circular(AvesFilterChip.defaultRadius));
Widget chip = Container(
constraints: BoxConstraints(
constraints: const BoxConstraints(
minWidth: AvesFilterChip.minChipWidth,
maxWidth: AvesFilterChip.maxChipWidth,
minHeight: AvesFilterChip.minChipHeight,
@ -237,15 +237,15 @@ class _AvesFilterChipState extends State<AvesFilterChip> {
}
return DecoratedBox(
decoration: BoxDecoration(
border: Border.all(
border: Border.fromBorderSide(BorderSide(
color: _outlineColor,
width: AvesFilterChip.outlineWidth,
),
)),
borderRadius: borderRadius,
),
position: DecorationPosition.foreground,
child: Padding(
padding: EdgeInsets.symmetric(vertical: 8),
padding: const EdgeInsets.symmetric(vertical: 8),
child: content,
),
);
@ -263,7 +263,7 @@ class _AvesFilterChipState extends State<AvesFilterChip> {
tag: filter,
transitionOnUserGestures: true,
child: DefaultTextStyle(
style: TextStyle(),
style: const TextStyle(),
child: chip,
),
);

View file

@ -150,11 +150,11 @@ class OverlayIcon extends StatelessWidget {
);
return Container(
margin: EdgeInsets.all(1),
margin: const EdgeInsets.all(1),
padding: text != null ? EdgeInsets.only(right: size / 4) : null,
decoration: BoxDecoration(
color: Color(0xBB000000),
borderRadius: BorderRadius.circular(size),
color: const Color(0xBB000000),
borderRadius: BorderRadius.all(Radius.circular(size)),
),
child: text == null
? iconBox
@ -163,7 +163,7 @@ class OverlayIcon extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
iconBox,
SizedBox(width: 2),
const SizedBox(width: 2),
Text(text!),
],
),
@ -187,7 +187,7 @@ class IconUtils {
data: context.read<MediaQueryData>().copyWith(textScaleFactor: 1.0),
child: DecoratedIcon(
icon,
shadows: [Constants.embossShadow],
shadows: Constants.embossShadows,
size: size,
),
)

View file

@ -25,11 +25,11 @@ class EmptyContent extends StatelessWidget {
size: 64,
color: color,
),
SizedBox(height: 16)
const SizedBox(height: 16)
],
Text(
text,
style: TextStyle(
style: const TextStyle(
color: color,
fontSize: 22,
),

View file

@ -25,7 +25,7 @@ class HighlightTitle extends StatelessWidget {
@override
Widget build(BuildContext context) {
final style = TextStyle(
shadows: [
shadows: const [
Shadow(
color: Colors.black,
offset: Offset(1, 1),
@ -34,7 +34,7 @@ class HighlightTitle extends StatelessWidget {
],
fontSize: fontSize,
letterSpacing: 1.0,
fontFeatures: [FontFeature.enable('smcp')],
fontFeatures: const [FontFeature.enable('smcp')],
);
return Align(
@ -45,7 +45,7 @@ class HighlightTitle extends StatelessWidget {
color: enabled ? color ?? stringToColor(title) : disabledColor,
)
: null,
margin: EdgeInsets.symmetric(vertical: 4.0),
margin: const EdgeInsets.symmetric(vertical: 4.0),
child: selectable
? SelectableText(
title,

View file

@ -10,20 +10,20 @@ ScrollThumbBuilder avesScrollThumbBuilder({
required Color backgroundColor,
}) {
final scrollThumb = Container(
decoration: BoxDecoration(
decoration: const BoxDecoration(
color: Colors.black26,
borderRadius: BorderRadius.circular(12),
borderRadius: BorderRadius.all(Radius.circular(12)),
),
height: height,
margin: EdgeInsets.only(right: .5),
padding: EdgeInsets.all(2),
margin: const EdgeInsets.only(right: .5),
padding: const EdgeInsets.all(2),
child: ClipPath(
clipper: ArrowClipper(),
child: Container(
width: 20.0,
decoration: BoxDecoration(
color: backgroundColor,
borderRadius: BorderRadius.circular(12),
borderRadius: const BorderRadius.all(Radius.circular(12)),
),
),
),

View file

@ -28,7 +28,7 @@ class MagnifierController {
_currentState = initial;
_setState(initial);
final _initialScaleState = ScaleStateChange(state: ScaleState.initial, source: ChangeSource.internal);
const _initialScaleState = ScaleStateChange(state: ScaleState.initial, source: ChangeSource.internal);
previousScaleState = _initialScaleState;
_currentScaleState = _initialScaleState;
_setScaleState(_initialScaleState);

View file

@ -302,7 +302,7 @@ class _CenterWithOriginalSizeDelegate extends SingleChildLayoutDelegate {
@override
BoxConstraints getConstraintsForChild(BoxConstraints constraints) {
return applyScale ? BoxConstraints.tight(subjectSize) : BoxConstraints();
return applyScale ? BoxConstraints.tight(subjectSize) : const BoxConstraints();
}
@override

View file

@ -14,7 +14,7 @@ mixin CornerHitDetector on MagnifierControllerDelegate {
final childWidth = scaleBoundaries.childSize.width * scale!;
final viewportWidth = scaleBoundaries.viewportSize.width;
if (viewportWidth + precisionErrorTolerance >= childWidth) {
return _CornerHit(true, true);
return const _CornerHit(true, true);
}
final x = -position.dx;
final cornersX = this.cornersX();
@ -25,7 +25,7 @@ mixin CornerHitDetector on MagnifierControllerDelegate {
final childHeight = scaleBoundaries.childSize.height * scale!;
final viewportHeight = scaleBoundaries.viewportSize.height;
if (viewportHeight + precisionErrorTolerance >= childHeight) {
return _CornerHit(true, true);
return const _CornerHit(true, true);
}
final y = -position.dy;
final cornersY = this.cornersY();

View file

@ -206,7 +206,7 @@ class _ScaleOverlayState extends State<ScaleOverlay> {
],
),
)
: BoxDecoration(
: const BoxDecoration(
// provide dummy gradient to lerp to the other one during animation
gradient: RadialGradient(
colors: [
@ -237,7 +237,7 @@ class _ScaleOverlayState extends State<ScaleOverlay> {
left: clampedCenter.dx - extent / 2,
top: clampedCenter.dy - extent / 2,
child: DefaultTextStyle(
style: TextStyle(),
style: const TextStyle(),
child: child,
),
),

View file

@ -30,15 +30,15 @@ class _DebugAndroidAppSectionState extends State<DebugAndroidAppSection> with Au
title: 'Android Apps',
children: [
Padding(
padding: EdgeInsets.only(left: 8, right: 8, bottom: 8),
padding: const EdgeInsets.only(left: 8, right: 8, bottom: 8),
child: FutureBuilder<Set<Package>>(
future: _loader,
builder: (context, snapshot) {
if (snapshot.hasError) return Text(snapshot.error.toString());
if (snapshot.connectionState != ConnectionState.done) return SizedBox.shrink();
if (snapshot.connectionState != ConnectionState.done) return const SizedBox.shrink();
final packages = snapshot.data!.toList()..sort((a, b) => compareAsciiUpperCase(a.packageName, b.packageName));
final enabledTheme = IconTheme.of(context);
final disabledTheme = enabledTheme.merge(IconThemeData(opacity: .2));
final disabledTheme = enabledTheme.merge(const IconThemeData(opacity: .2));
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: packages.map((package) {
@ -64,7 +64,7 @@ class _DebugAndroidAppSectionState extends State<DebugAndroidAppSection> with Au
alignment: PlaceholderAlignment.middle,
child: IconTheme(
data: package.categoryLauncher ? enabledTheme : disabledTheme,
child: Icon(
child: const Icon(
Icons.launch_outlined,
size: iconSize,
),
@ -74,7 +74,7 @@ class _DebugAndroidAppSectionState extends State<DebugAndroidAppSection> with Au
alignment: PlaceholderAlignment.middle,
child: IconTheme(
data: package.isSystem ? enabledTheme : disabledTheme,
child: Icon(
child: const Icon(
Icons.android,
size: iconSize,
),

View file

@ -27,12 +27,12 @@ class _DebugAndroidDirSectionState extends State<DebugAndroidDirSection> with Au
title: 'Android Dirs',
children: [
Padding(
padding: EdgeInsets.only(left: 8, right: 8, bottom: 8),
padding: const EdgeInsets.only(left: 8, right: 8, bottom: 8),
child: FutureBuilder<Map>(
future: _loader,
builder: (context, snapshot) {
if (snapshot.hasError) return Text(snapshot.error.toString());
if (snapshot.connectionState != ConnectionState.done) return SizedBox.shrink();
if (snapshot.connectionState != ConnectionState.done) return const SizedBox.shrink();
final data = SplayTreeMap.of(snapshot.data!.map((k, v) => MapEntry(k.toString(), v?.toString() ?? 'null')));
return InfoRowGroup(data);
},

View file

@ -27,12 +27,12 @@ class _DebugAndroidEnvironmentSectionState extends State<DebugAndroidEnvironment
title: 'Android Environment',
children: [
Padding(
padding: EdgeInsets.only(left: 8, right: 8, bottom: 8),
padding: const EdgeInsets.only(left: 8, right: 8, bottom: 8),
child: FutureBuilder<Map>(
future: _loader,
builder: (context, snapshot) {
if (snapshot.hasError) return Text(snapshot.error.toString());
if (snapshot.connectionState != ConnectionState.done) return SizedBox.shrink();
if (snapshot.connectionState != ConnectionState.done) return const SizedBox.shrink();
final data = SplayTreeMap.of(snapshot.data!.map((k, v) => MapEntry(k.toString(), v?.toString() ?? 'null')));
return InfoRowGroup(data);
},

View file

@ -35,11 +35,11 @@ class _AppDebugPageState extends State<AppDebugPage> {
return MediaQueryDataProvider(
child: Scaffold(
appBar: AppBar(
title: Text('Debug'),
title: const Text('Debug'),
),
body: SafeArea(
child: ListView(
padding: EdgeInsets.all(8),
padding: const EdgeInsets.all(8),
children: [
_buildGeneralTabView(),
DebugAndroidAppSection(),
@ -65,7 +65,7 @@ class _AppDebugPageState extends State<AppDebugPage> {
return AvesExpansionTile(
title: 'General',
children: [
Padding(
const Padding(
padding: EdgeInsets.all(8),
child: Text('Time dilation'),
),
@ -91,11 +91,11 @@ class _AppDebugPageState extends State<AppDebugPage> {
}
setState(() {});
},
title: Text('Show tasks overlay'),
title: const Text('Show tasks overlay'),
),
Divider(),
const Divider(),
Padding(
padding: EdgeInsets.only(left: 8, right: 8, bottom: 8),
padding: const EdgeInsets.only(left: 8, right: 8, bottom: 8),
child: InfoRowGroup(
{
'All entries': '${source.allEntries.length}',

View file

@ -18,7 +18,7 @@ class _DebugCacheSectionState extends State<DebugCacheSection> with AutomaticKee
title: 'Cache',
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 8),
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Column(
children: [
Row(
@ -26,14 +26,14 @@ class _DebugCacheSectionState extends State<DebugCacheSection> with AutomaticKee
Expanded(
child: Text('Image cache:\n\t${imageCache!.currentSize}/${imageCache!.maximumSize} items\n\t${formatFilesize(imageCache!.currentSizeBytes)}/${formatFilesize(imageCache!.maximumSizeBytes)}'),
),
SizedBox(width: 8),
const SizedBox(width: 8),
ElevatedButton(
onPressed: () {
imageCache!.clear();
setState(() {});
},
child: Text('Clear'),
child: const Text('Clear'),
),
],
),
@ -42,26 +42,26 @@ class _DebugCacheSectionState extends State<DebugCacheSection> with AutomaticKee
Expanded(
child: Text('SVG cache: ${PictureProvider.cache.count} items'),
),
SizedBox(width: 8),
const SizedBox(width: 8),
ElevatedButton(
onPressed: () {
PictureProvider.cache.clear();
setState(() {});
},
child: Text('Clear'),
child: const Text('Clear'),
),
],
),
Row(
children: [
Expanded(
const Expanded(
child: Text('Glide disk cache: ?'),
),
SizedBox(width: 8),
const SizedBox(width: 8),
ElevatedButton(
onPressed: imageFileService.clearSizedThumbnailDiskCache,
child: Text('Clear'),
child: const Text('Clear'),
),
],
),

View file

@ -35,7 +35,7 @@ class _DebugAppDatabaseSectionState extends State<DebugAppDatabaseSection> with
title: 'Database',
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 8),
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Column(
children: [
FutureBuilder<int>(
@ -43,17 +43,17 @@ class _DebugAppDatabaseSectionState extends State<DebugAppDatabaseSection> with
builder: (context, snapshot) {
if (snapshot.hasError) return Text(snapshot.error.toString());
if (snapshot.connectionState != ConnectionState.done) return SizedBox.shrink();
if (snapshot.connectionState != ConnectionState.done) return const SizedBox.shrink();
return Row(
children: [
Expanded(
child: Text('DB file size: ${formatFilesize(snapshot.data!)}'),
),
SizedBox(width: 8),
const SizedBox(width: 8),
ElevatedButton(
onPressed: () => metadataDb.reset().then((_) => _startDbReport()),
child: Text('Reset'),
child: const Text('Reset'),
),
],
);
@ -64,17 +64,17 @@ class _DebugAppDatabaseSectionState extends State<DebugAppDatabaseSection> with
builder: (context, snapshot) {
if (snapshot.hasError) return Text(snapshot.error.toString());
if (snapshot.connectionState != ConnectionState.done) return SizedBox.shrink();
if (snapshot.connectionState != ConnectionState.done) return const SizedBox.shrink();
return Row(
children: [
Expanded(
child: Text('entry rows: ${snapshot.data!.length}'),
),
SizedBox(width: 8),
const SizedBox(width: 8),
ElevatedButton(
onPressed: () => metadataDb.clearEntries().then((_) => _startDbReport()),
child: Text('Clear'),
child: const Text('Clear'),
),
],
);
@ -85,17 +85,17 @@ class _DebugAppDatabaseSectionState extends State<DebugAppDatabaseSection> with
builder: (context, snapshot) {
if (snapshot.hasError) return Text(snapshot.error.toString());
if (snapshot.connectionState != ConnectionState.done) return SizedBox.shrink();
if (snapshot.connectionState != ConnectionState.done) return const SizedBox.shrink();
return Row(
children: [
Expanded(
child: Text('date rows: ${snapshot.data!.length}'),
),
SizedBox(width: 8),
const SizedBox(width: 8),
ElevatedButton(
onPressed: () => metadataDb.clearDates().then((_) => _startDbReport()),
child: Text('Clear'),
child: const Text('Clear'),
),
],
);
@ -106,17 +106,17 @@ class _DebugAppDatabaseSectionState extends State<DebugAppDatabaseSection> with
builder: (context, snapshot) {
if (snapshot.hasError) return Text(snapshot.error.toString());
if (snapshot.connectionState != ConnectionState.done) return SizedBox.shrink();
if (snapshot.connectionState != ConnectionState.done) return const SizedBox.shrink();
return Row(
children: [
Expanded(
child: Text('metadata rows: ${snapshot.data!.length}'),
),
SizedBox(width: 8),
const SizedBox(width: 8),
ElevatedButton(
onPressed: () => metadataDb.clearMetadataEntries().then((_) => _startDbReport()),
child: Text('Clear'),
child: const Text('Clear'),
),
],
);
@ -127,17 +127,17 @@ class _DebugAppDatabaseSectionState extends State<DebugAppDatabaseSection> with
builder: (context, snapshot) {
if (snapshot.hasError) return Text(snapshot.error.toString());
if (snapshot.connectionState != ConnectionState.done) return SizedBox.shrink();
if (snapshot.connectionState != ConnectionState.done) return const SizedBox.shrink();
return Row(
children: [
Expanded(
child: Text('address rows: ${snapshot.data!.length}'),
),
SizedBox(width: 8),
const SizedBox(width: 8),
ElevatedButton(
onPressed: () => metadataDb.clearAddresses().then((_) => _startDbReport()),
child: Text('Clear'),
child: const Text('Clear'),
),
],
);
@ -148,17 +148,17 @@ class _DebugAppDatabaseSectionState extends State<DebugAppDatabaseSection> with
builder: (context, snapshot) {
if (snapshot.hasError) return Text(snapshot.error.toString());
if (snapshot.connectionState != ConnectionState.done) return SizedBox.shrink();
if (snapshot.connectionState != ConnectionState.done) return const SizedBox.shrink();
return Row(
children: [
Expanded(
child: Text('favourite rows: ${snapshot.data!.length} (${favourites.count} in memory)'),
),
SizedBox(width: 8),
const SizedBox(width: 8),
ElevatedButton(
onPressed: () => favourites.clear().then((_) => _startDbReport()),
child: Text('Clear'),
child: const Text('Clear'),
),
],
);
@ -169,17 +169,17 @@ class _DebugAppDatabaseSectionState extends State<DebugAppDatabaseSection> with
builder: (context, snapshot) {
if (snapshot.hasError) return Text(snapshot.error.toString());
if (snapshot.connectionState != ConnectionState.done) return SizedBox.shrink();
if (snapshot.connectionState != ConnectionState.done) return const SizedBox.shrink();
return Row(
children: [
Expanded(
child: Text('cover rows: ${snapshot.data!.length} (${covers.count} in memory)'),
),
SizedBox(width: 8),
const SizedBox(width: 8),
ElevatedButton(
onPressed: () => covers.clear().then((_) => _startDbReport()),
child: Text('Clear'),
child: const Text('Clear'),
),
],
);

View file

@ -12,26 +12,26 @@ class DebugFirebaseSection extends StatelessWidget {
title: 'Firebase',
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 8),
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Row(
children: [
ElevatedButton(
onPressed: FirebaseCrashlytics.instance.crash,
child: Text('Crash'),
child: const Text('Crash'),
),
SizedBox(width: 8),
const SizedBox(width: 8),
ElevatedButton(
onPressed: () => FirebaseAnalytics().logEvent(
name: 'debug_test',
parameters: {'time': DateTime.now().toIso8601String()},
),
child: Text('Send event'),
child: const Text('Send event'),
),
],
),
),
Padding(
padding: EdgeInsets.only(left: 8, right: 8, bottom: 8),
padding: const EdgeInsets.only(left: 8, right: 8, bottom: 8),
child: InfoRowGroup({
'Firebase data collection enabled': '${Firebase.app().isAutomaticDataCollectionEnabled}',
'Crashlytics collection enabled': '${FirebaseCrashlytics.instance.isCrashlyticsCollectionEnabled}',

View file

@ -6,17 +6,17 @@ class DebugTaskQueueOverlay extends StatelessWidget {
Widget build(BuildContext context) {
return IgnorePointer(
child: DefaultTextStyle(
style: TextStyle(),
style: const TextStyle(),
child: Align(
alignment: AlignmentDirectional.bottomStart,
child: SafeArea(
child: Container(
color: Colors.indigo.shade900.withAlpha(0xCC),
padding: EdgeInsets.all(8),
padding: const EdgeInsets.all(8),
child: StreamBuilder<QueueState>(
stream: servicePolicy.queueStream,
builder: (context, snapshot) {
if (snapshot.hasError) return SizedBox.shrink();
if (snapshot.hasError) return const SizedBox.shrink();
final queuedEntries = <MapEntry<dynamic, int>>[];
if (snapshot.hasData) {
final state = snapshot.data!;

View file

@ -18,19 +18,19 @@ class DebugSettingsSection extends StatelessWidget {
title: 'Settings',
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 8),
padding: const EdgeInsets.symmetric(horizontal: 8),
child: ElevatedButton(
onPressed: () => settings.reset(),
child: Text('Reset'),
child: const Text('Reset'),
),
),
SwitchListTile(
value: settings.hasAcceptedTerms,
onChanged: (v) => settings.hasAcceptedTerms = v,
title: Text('hasAcceptedTerms'),
title: const Text('hasAcceptedTerms'),
),
Padding(
padding: EdgeInsets.only(left: 8, right: 8, bottom: 8),
padding: const EdgeInsets.only(left: 8, right: 8, bottom: 8),
child: InfoRowGroup({
'tileExtent - Collection': '${settings.getTileExtent(CollectionPage.routeName)}',
'tileExtent - Albums': '${settings.getTileExtent(AlbumListPage.routeName)}',

View file

@ -33,11 +33,11 @@ class _DebugStorageSectionState extends State<DebugStorageSection> with Automati
final freeSpace = _freeSpaceByVolume[v.path];
return [
Padding(
padding: EdgeInsets.all(8),
padding: const EdgeInsets.all(8),
child: Text(v.path),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 8),
padding: const EdgeInsets.symmetric(horizontal: 8),
child: InfoRowGroup({
'description': '${v.getDescription(context)}',
'isPrimary': '${v.isPrimary}',
@ -46,7 +46,7 @@ class _DebugStorageSectionState extends State<DebugStorageSection> with Automati
if (freeSpace != null) 'freeSpace': formatFilesize(freeSpace),
}),
),
Divider(),
const Divider(),
];
})
],

View file

@ -67,11 +67,11 @@ class _AddShortcutDialogState extends State<AddShortcutDialog> {
if (_coverEntry != null)
Container(
alignment: Alignment.center,
padding: EdgeInsets.only(top: 16),
padding: const EdgeInsets.only(top: 16),
child: _buildCover(_coverEntry!, extent),
),
Padding(
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 24),
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 24),
child: TextField(
controller: _nameController,
decoration: InputDecoration(
@ -109,7 +109,7 @@ class _AddShortcutDialogState extends State<AddShortcutDialog> {
return GestureDetector(
onTap: _pickEntry,
child: ClipRRect(
borderRadius: BorderRadius.circular(32),
borderRadius: const BorderRadius.all(Radius.circular(32)),
child: SizedBox(
width: extent,
height: extent,
@ -131,7 +131,7 @@ class _AddShortcutDialogState extends State<AddShortcutDialog> {
final entry = await Navigator.push(
context,
MaterialPageRoute(
settings: RouteSettings(name: ItemPickDialog.routeName),
settings: const RouteSettings(name: ItemPickDialog.routeName),
builder: (context) => ItemPickDialog(
CollectionLens(
source: collection.source,

View file

@ -20,7 +20,7 @@ class AvesDialog extends AlertDialog {
title: title != null
? Padding(
// padding to avoid transparent border overlapping
padding: EdgeInsets.symmetric(horizontal: borderWidth),
padding: const EdgeInsets.symmetric(horizontal: borderWidth),
child: DialogTitle(title: title),
)
: null,
@ -32,7 +32,7 @@ class AvesDialog extends AlertDialog {
content: scrollableContent != null
? Container(
// padding to avoid transparent border overlapping
padding: EdgeInsets.symmetric(horizontal: borderWidth),
padding: const EdgeInsets.symmetric(horizontal: borderWidth),
// workaround because the dialog tries
// to size itself to the content intrinsic size,
// but the `ListView` viewport does not have one
@ -51,12 +51,12 @@ class AvesDialog extends AlertDialog {
),
)
: content,
contentPadding: scrollableContent != null ? EdgeInsets.zero : EdgeInsets.fromLTRB(24, 20, 24, 0),
contentPadding: scrollableContent != null ? EdgeInsets.zero : const EdgeInsets.fromLTRB(24, 20, 24, 0),
actions: actions,
actionsPadding: EdgeInsets.symmetric(horizontal: 8),
actionsPadding: const EdgeInsets.symmetric(horizontal: 8),
shape: RoundedRectangleBorder(
side: Divider.createBorderSide(context, width: borderWidth),
borderRadius: BorderRadius.circular(24),
borderRadius: const BorderRadius.all(Radius.circular(24)),
),
);
}
@ -78,7 +78,7 @@ class DialogTitle extends StatelessWidget {
),
child: Text(
title,
style: TextStyle(
style: const TextStyle(
fontWeight: FontWeight.normal,
fontFeatures: [FontFeature.enable('smcp')],
),

View file

@ -74,11 +74,11 @@ class _CoverSelectionDialogState extends State<CoverSelectionDialog> {
title: isCustom
? Row(children: [
title,
Spacer(),
const Spacer(),
IconButton(
onPressed: _isCustom ? _pickEntry : null,
tooltip: 'Change',
icon: Icon(AIcons.setCover),
icon: const Icon(AIcons.setCover),
),
])
: title,
@ -87,7 +87,7 @@ class _CoverSelectionDialogState extends State<CoverSelectionDialog> {
),
Container(
alignment: Alignment.center,
padding: EdgeInsets.only(bottom: 16),
padding: const EdgeInsets.only(bottom: 16),
child: DecoratedFilterChip(
filter: filter,
extent: extent,
@ -116,7 +116,7 @@ class _CoverSelectionDialogState extends State<CoverSelectionDialog> {
final entry = await Navigator.push(
context,
MaterialPageRoute(
settings: RouteSettings(name: ItemPickDialog.routeName),
settings: const RouteSettings(name: ItemPickDialog.routeName),
builder: (context) => ItemPickDialog(
CollectionLens(
source: context.read<CollectionSource>(),

View file

@ -50,12 +50,12 @@ class _CreateAlbumDialogState extends State<CreateAlbumDialog> {
final otherVolumes = (byPrimary[false] ?? [])..sort(compare);
volumeTiles.addAll([
Padding(
padding: AvesDialog.contentHorizontalPadding + EdgeInsets.only(top: 20),
padding: AvesDialog.contentHorizontalPadding + const EdgeInsets.only(top: 20),
child: Text(context.l10n.newAlbumDialogStorageLabel),
),
...primaryVolumes.map((volume) => _buildVolumeTile(context, volume)),
...otherVolumes.map((volume) => _buildVolumeTile(context, volume)),
SizedBox(height: 8),
const SizedBox(height: 8),
]);
}
@ -66,7 +66,7 @@ class _CreateAlbumDialogState extends State<CreateAlbumDialog> {
scrollableContent: [
...volumeTiles,
Padding(
padding: AvesDialog.contentHorizontalPadding + EdgeInsets.only(bottom: 8),
padding: AvesDialog.contentHorizontalPadding + const EdgeInsets.only(bottom: 8),
child: ValueListenableBuilder<bool>(
valueListenable: _existsNotifier,
builder: (context, exists, child) {

View file

@ -38,7 +38,7 @@ class _ItemPickDialogState extends State<ItemPickDialog> {
bottom: false,
child: ChangeNotifierProvider<CollectionLens>.value(
value: collection,
child: CollectionGrid(
child: const CollectionGrid(
settingsRouteKey: CollectionPage.routeName,
),
),

View file

@ -23,7 +23,7 @@ class AlbumTile extends StatelessWidget {
),
title: displayName,
trailing: androidFileUtils.isOnRemovableStorage(album)
? Icon(
? const Icon(
AIcons.removableStorage,
size: 16,
color: Colors.grey,

View file

@ -54,12 +54,12 @@ class _AppDrawerState extends State<AppDrawer> {
if (showVideos) videoTile,
if (showFavourites) favouriteTile,
_buildSpecialAlbumSection(),
Divider(),
const Divider(),
albumListTile,
countryListTile,
tagListTile,
if (!kReleaseMode) ...[
Divider(),
const Divider(),
debugTile,
],
];
@ -101,7 +101,7 @@ class _AppDrawerState extends State<AppDrawer> {
}
return Container(
padding: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8),
padding: const EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8),
color: Theme.of(context).accentColor,
child: SafeArea(
bottom: false,
@ -114,10 +114,10 @@ class _AppDrawerState extends State<AppDrawer> {
spacing: 16,
crossAxisAlignment: WrapCrossAlignment.center,
children: [
AvesLogo(size: 64),
const AvesLogo(size: 64),
Text(
context.l10n.appName,
style: TextStyle(
style: const TextStyle(
fontSize: 44,
fontWeight: FontWeight.w300,
letterSpacing: 1.0,
@ -127,7 +127,7 @@ class _AppDrawerState extends State<AppDrawer> {
],
),
),
SizedBox(height: 8),
const SizedBox(height: 8),
OutlinedButtonTheme(
data: OutlinedButtonThemeData(
style: ButtonStyle(
@ -140,9 +140,9 @@ class _AppDrawerState extends State<AppDrawer> {
runSpacing: 8,
children: [
OutlinedButton.icon(
key: Key('drawer-about-button'),
key: const Key('drawer-about-button'),
onPressed: () => goTo(AboutPage.routeName, (_) => AboutPage()),
icon: Icon(AIcons.info),
icon: const Icon(AIcons.info),
label: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -156,11 +156,11 @@ class _AppDrawerState extends State<AppDrawer> {
duration: Durations.newsBadgeAnimation,
opacity: newVersion ? 1 : 0,
child: Padding(
padding: EdgeInsetsDirectional.only(start: 2),
padding: const EdgeInsetsDirectional.only(start: 2),
child: DecoratedBox(
decoration: BoxDecoration(
border: Border.all(color: Colors.white70),
borderRadius: BorderRadius.circular(badgeSize),
border: const Border.fromBorderSide(BorderSide(color: Colors.white70)),
borderRadius: BorderRadius.all(Radius.circular(badgeSize)),
),
child: Icon(
Icons.circle,
@ -176,9 +176,9 @@ class _AppDrawerState extends State<AppDrawer> {
),
),
OutlinedButton.icon(
key: Key('drawer-settings-button'),
key: const Key('drawer-settings-button'),
onPressed: () => goTo(SettingsPage.routeName, (_) => SettingsPage()),
icon: Icon(AIcons.settings),
icon: const Icon(AIcons.settings),
label: Text(context.l10n.settingsPageTitle),
),
],
@ -200,10 +200,10 @@ class _AppDrawerState extends State<AppDrawer> {
}).toList()
..sort(source.compareAlbumsByName);
if (specialAlbums.isEmpty) return SizedBox.shrink();
if (specialAlbums.isEmpty) return const SizedBox.shrink();
return Column(
children: [
Divider(),
const Divider(),
...specialAlbums.map((album) => AlbumTile(album)),
],
);
@ -213,19 +213,19 @@ class _AppDrawerState extends State<AppDrawer> {
// tiles
Widget get allCollectionTile => CollectionNavTile(
leading: Icon(AIcons.allCollection),
leading: const Icon(AIcons.allCollection),
title: context.l10n.drawerCollectionAll,
filter: null,
);
Widget get videoTile => CollectionNavTile(
leading: Icon(AIcons.video),
leading: const Icon(AIcons.video),
title: context.l10n.drawerCollectionVideos,
filter: MimeFilter.video,
);
Widget get favouriteTile => CollectionNavTile(
leading: Icon(AIcons.favourite),
leading: const Icon(AIcons.favourite),
title: context.l10n.drawerCollectionFavourites,
filter: FavouriteFilter.instance,
);

View file

@ -40,7 +40,7 @@ class CollectionNavTile extends StatelessWidget {
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(
settings: RouteSettings(name: CollectionPage.routeName),
settings: const RouteSettings(name: CollectionPage.routeName),
builder: (context) => CollectionPage(CollectionLens(
source: context.read<CollectionSource>(),
filters: [filter],

View file

@ -113,7 +113,7 @@ class AlbumPickAppBar extends StatelessWidget {
}
return SliverAppBar(
leading: BackButton(),
leading: const BackButton(),
title: SourceStateAwareAppBarTitle(
title: Text(title()),
source: source,
@ -123,7 +123,7 @@ class AlbumPickAppBar extends StatelessWidget {
),
actions: [
IconButton(
icon: Icon(AIcons.createAlbum),
icon: const Icon(AIcons.createAlbum),
onPressed: () async {
final newAlbum = await showDialog<String>(
context: context,
@ -173,7 +173,7 @@ class AlbumFilterBar extends StatelessWidget implements PreferredSizeWidget {
});
@override
Size get preferredSize => Size.fromHeight(preferredHeight);
Size get preferredSize => const Size.fromHeight(preferredHeight);
@override
Widget build(BuildContext context) {

View file

@ -109,7 +109,7 @@ class AlbumListPage extends StatelessWidget {
case AlbumChipGroupFactor.none:
return {
if (pinnedMapEntries.isNotEmpty || unpinnedMapEntries.isNotEmpty)
ChipSectionKey(): [
const ChipSectionKey(): [
...pinnedMapEntries,
...unpinnedMapEntries,
],

View file

@ -53,7 +53,7 @@ abstract class ChipSetActionDelegate {
Navigator.push(
context,
MaterialPageRoute(
settings: RouteSettings(name: StatsPage.routeName),
settings: const RouteSettings(name: StatsPage.routeName),
builder: (context) => StatsPage(
source: source,
),

View file

@ -73,7 +73,7 @@ class DecoratedFilterChip extends StatelessWidget {
);
}
default:
return SizedBox();
return const SizedBox();
}
},
);
@ -143,7 +143,7 @@ class DecoratedFilterChip extends StatelessWidget {
child: DecoratedIcon(
AIcons.pin,
color: FilterGridPage.detailColor,
shadows: [Constants.embossShadow],
shadows: Constants.embossShadows,
size: iconSize,
),
),
@ -154,7 +154,7 @@ class DecoratedFilterChip extends StatelessWidget {
child: DecoratedIcon(
AIcons.removableStorage,
color: FilterGridPage.detailColor,
shadows: [Constants.embossShadow],
shadows: Constants.embossShadows,
size: iconSize,
),
),

View file

@ -53,7 +53,7 @@ class FilterNavigationPage<T extends CollectionFilter> extends StatelessWidget {
Widget build(BuildContext context) {
final isMainMode = context.select<ValueNotifier<AppMode>, bool>((vn) => vn.value == AppMode.main);
return FilterGridPage<T>(
key: Key('filter-grid-page'),
key: const Key('filter-grid-page'),
appBar: SliverAppBar(
title: InteractiveAppBarTitle(
onTap: () => _goToSearch(context),
@ -73,13 +73,13 @@ class FilterNavigationPage<T extends CollectionFilter> extends StatelessWidget {
emptyBuilder: () => ValueListenableBuilder<SourceState>(
valueListenable: source.stateNotifier,
builder: (context, sourceState, child) {
return sourceState != SourceState.loading ? emptyBuilder() : SizedBox.shrink();
return sourceState != SourceState.loading ? emptyBuilder() : const SizedBox.shrink();
},
),
onTap: (filter) => Navigator.push(
context,
MaterialPageRoute(
settings: RouteSettings(name: CollectionPage.routeName),
settings: const RouteSettings(name: CollectionPage.routeName),
builder: (context) => CollectionPage(CollectionLens(
source: source,
filters: [filter],
@ -92,7 +92,7 @@ class FilterNavigationPage<T extends CollectionFilter> extends StatelessWidget {
void _showMenu(BuildContext context, T filter, Offset? tapPosition) async {
final overlay = Overlay.of(context)!.context.findRenderObject() as RenderBox;
final touchArea = Size(40, 40);
const touchArea = Size(40, 40);
final selectedAction = await showMenu<ChipAction>(
context: context,
position: RelativeRect.fromRect((tapPosition ?? Offset.zero) & touchArea, Offset.zero & overlay.size),
@ -113,11 +113,11 @@ class FilterNavigationPage<T extends CollectionFilter> extends StatelessWidget {
return [
CollectionSearchButton(source),
PopupMenuButton<ChipSetAction>(
key: Key('appbar-menu-button'),
key: const Key('appbar-menu-button'),
itemBuilder: (context) {
return [
PopupMenuItem(
key: Key('menu-sort'),
key: const Key('menu-sort'),
value: ChipSetAction.sort,
child: MenuRow(text: context.l10n.menuActionSort, icon: AIcons.sort),
),

View file

@ -34,10 +34,10 @@ class _ChipHighlightOverlayState extends State<ChipHighlightOverlay> {
return Sweeper(
builder: (context) => Container(
decoration: BoxDecoration(
border: Border.all(
border: Border.fromBorderSide(BorderSide(
color: Theme.of(context).accentColor,
width: widget.extent * .1,
),
)),
borderRadius: widget.borderRadius,
),
),

View file

@ -80,5 +80,5 @@ class StorageVolumeSectionKey extends ChipSectionKey {
StorageVolumeSectionKey(BuildContext context, this.volume) : super(title: volume?.getDescription(context) ?? context.l10n.sectionUnknown);
@override
Widget? get leading => (volume?.isRemovable ?? false) ? Icon(AIcons.removableStorage) : null;
Widget? get leading => (volume?.isRemovable ?? false) ? const Icon(AIcons.removableStorage) : null;
}

View file

@ -65,7 +65,7 @@ class CountryListPage extends StatelessWidget {
return {
if (pinnedMapEntries.isNotEmpty || unpinnedMapEntries.isNotEmpty)
ChipSectionKey(): [
const ChipSectionKey(): [
...pinnedMapEntries,
...unpinnedMapEntries,
],

View file

@ -65,7 +65,7 @@ class TagListPage extends StatelessWidget {
return {
if (pinnedMapEntries.isNotEmpty || unpinnedMapEntries.isNotEmpty)
ChipSectionKey(): [
const ChipSectionKey(): [
...pinnedMapEntries,
...unpinnedMapEntries,
],

View file

@ -50,7 +50,7 @@ class _HomePageState extends State<HomePage> {
}
@override
Widget build(BuildContext context) => Scaffold();
Widget build(BuildContext context) => const Scaffold();
Future<void> _setup() async {
final permissions = await [
@ -127,7 +127,7 @@ class _HomePageState extends State<HomePage> {
Route _getRedirectRoute(AppMode appMode) {
if (appMode == AppMode.view) {
return DirectMaterialPageRoute(
settings: RouteSettings(name: EntryViewerPage.routeName),
settings: const RouteSettings(name: EntryViewerPage.routeName),
builder: (_) => EntryViewerPage(
initialEntry: _viewerEntry!,
),
@ -146,7 +146,7 @@ class _HomePageState extends State<HomePage> {
switch (routeName) {
case AlbumListPage.routeName:
return DirectMaterialPageRoute(
settings: RouteSettings(name: AlbumListPage.routeName),
settings: const RouteSettings(name: AlbumListPage.routeName),
builder: (_) => AlbumListPage(),
);
case SearchPage.routeName:
@ -156,7 +156,7 @@ class _HomePageState extends State<HomePage> {
case CollectionPage.routeName:
default:
return DirectMaterialPageRoute(
settings: RouteSettings(name: CollectionPage.routeName),
settings: const RouteSettings(name: CollectionPage.routeName),
builder: (_) => CollectionPage(
CollectionLens(
source: source,

View file

@ -25,7 +25,7 @@ class ExpandableFilterRow extends StatelessWidget {
@override
Widget build(BuildContext context) {
if (filters.isEmpty) return SizedBox.shrink();
if (filters.isEmpty) return const SizedBox.shrink();
final hasTitle = title != null && title!.isNotEmpty;
@ -34,7 +34,7 @@ class ExpandableFilterRow extends StatelessWidget {
Widget? titleRow;
if (hasTitle) {
titleRow = Padding(
padding: EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
child: Row(
children: [
Text(
@ -55,7 +55,7 @@ class ExpandableFilterRow extends StatelessWidget {
final filterList = filters.toList();
final wrap = Container(
key: ValueKey('wrap$title'),
padding: EdgeInsets.symmetric(horizontal: horizontalPadding),
padding: const EdgeInsets.symmetric(horizontal: horizontalPadding),
// specify transparent as a workaround to prevent
// chip border clipping when the floating app bar is fading
color: Colors.transparent,
@ -73,12 +73,12 @@ class ExpandableFilterRow extends StatelessWidget {
height: AvesFilterChip.minChipHeight,
child: ListView.separated(
scrollDirection: Axis.horizontal,
physics: BouncingScrollPhysics(),
padding: EdgeInsets.symmetric(horizontal: horizontalPadding),
physics: const BouncingScrollPhysics(),
padding: const EdgeInsets.symmetric(horizontal: horizontalPadding),
itemBuilder: (context, index) {
return index < filterList.length ? _buildFilterChip(filterList[index]) : SizedBox();
return index < filterList.length ? _buildFilterChip(filterList[index]) : const SizedBox();
},
separatorBuilder: (context, index) => SizedBox(width: 8),
separatorBuilder: (context, index) => const SizedBox(width: 8),
itemCount: filterList.length,
),
);

View file

@ -13,8 +13,8 @@ class CollectionSearchButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return IconButton(
key: Key('search-button'),
icon: Icon(AIcons.search),
key: const Key('search-button'),
icon: const Icon(AIcons.search),
onPressed: () => _goToSearch(context),
tooltip: MaterialLocalizations.of(context).searchFieldLabel,
);

View file

@ -53,7 +53,7 @@ class CollectionSearchDelegate {
onPressed: () => _goBack(context),
tooltip: MaterialLocalizations.of(context).backButtonTooltip,
)
: CloseButton(
: const CloseButton(
onPressed: SystemNavigator.pop,
);
}
@ -62,7 +62,7 @@ class CollectionSearchDelegate {
return [
if (query.isNotEmpty)
IconButton(
icon: Icon(AIcons.clear),
icon: const Icon(AIcons.clear),
onPressed: () {
query = '';
showSuggestions(context);
@ -93,7 +93,7 @@ class CollectionSearchDelegate {
final history = settings.searchHistory.where(notHidden).toList();
return ListView(
padding: EdgeInsets.only(top: 8),
padding: const EdgeInsets.only(top: 8),
children: [
_buildFilterRow(
context: context,
@ -195,7 +195,7 @@ class CollectionSearchDelegate {
// and possibly trigger a rebuild here
_select(context, _buildQueryFilter(true));
});
return SizedBox.shrink();
return const SizedBox.shrink();
}
QueryFilter? _buildQueryFilter(bool colorful) {
@ -242,7 +242,7 @@ class CollectionSearchDelegate {
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(
settings: RouteSettings(name: CollectionPage.routeName),
settings: const RouteSettings(name: CollectionPage.routeName),
builder: (context) => CollectionPage(CollectionLens(
source: source,
filters: [filter],
@ -302,7 +302,7 @@ enum SearchBody { suggestions, results }
class SearchPageRoute<T> extends PageRoute<T> {
SearchPageRoute({
required this.delegate,
}) : super(settings: RouteSettings(name: SearchPage.routeName)) {
}) : super(settings: const RouteSettings(name: SearchPage.routeName)) {
assert(
delegate.route == null,
'The ${delegate.runtimeType} instance is currently used by another active '

View file

@ -93,13 +93,13 @@ class _SearchPageState extends State<SearchPage> {
switch (widget.delegate.currentBody) {
case SearchBody.suggestions:
body = KeyedSubtree(
key: ValueKey<SearchBody>(SearchBody.suggestions),
key: const ValueKey<SearchBody>(SearchBody.suggestions),
child: widget.delegate.buildSuggestions(context),
);
break;
case SearchBody.results:
body = KeyedSubtree(
key: ValueKey<SearchBody>(SearchBody.results),
key: const ValueKey<SearchBody>(SearchBody.results),
child: widget.delegate.buildResults(context),
);
break;

View file

@ -13,7 +13,7 @@ class StorageAccessTile extends StatelessWidget {
Navigator.push(
context,
MaterialPageRoute(
settings: RouteSettings(name: StorageAccessPage.routeName),
settings: const RouteSettings(name: StorageAccessPage.routeName),
builder: (context) => StorageAccessPage(),
),
);
@ -52,16 +52,16 @@ class _StorageAccessPageState extends State<StorageAccessPage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
child: Row(
children: [
Icon(AIcons.info),
SizedBox(width: 16),
const Icon(AIcons.info),
const SizedBox(width: 16),
Expanded(child: Text(context.l10n.settingsStorageAccessBanner)),
],
),
),
Divider(),
const Divider(),
Expanded(
child: FutureBuilder<List<String>>(
future: _pathLoader,
@ -70,7 +70,7 @@ class _StorageAccessPageState extends State<StorageAccessPage> {
return Text(snapshot.error.toString());
}
if (snapshot.connectionState != ConnectionState.done && _lastPaths == null) {
return SizedBox.shrink();
return const SizedBox.shrink();
}
_lastPaths = snapshot.data!..sort();
if (_lastPaths!.isEmpty) {
@ -85,7 +85,7 @@ class _StorageAccessPageState extends State<StorageAccessPage> {
title: Text(path),
dense: true,
trailing: IconButton(
icon: Icon(AIcons.clear),
icon: const Icon(AIcons.clear),
onPressed: () async {
await storageService.revokeDirectoryAccess(path);
_load();

View file

@ -45,7 +45,7 @@ class _EntryBackgroundSelectorState extends State<EntryBackgroundSelector> {
Widget? child;
switch (selected) {
case EntryBackground.transparent:
child = Icon(
child = const Icon(
Icons.clear,
size: 20,
color: Colors.white30,

View file

@ -16,7 +16,7 @@ class HiddenFilterTile extends StatelessWidget {
Navigator.push(
context,
MaterialPageRoute(
settings: RouteSettings(name: HiddenFilterPage.routeName),
settings: const RouteSettings(name: HiddenFilterPage.routeName),
builder: (context) => HiddenFilterPage(),
),
);
@ -39,19 +39,19 @@ class HiddenFilterPage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
child: Row(
children: [
Icon(AIcons.info),
SizedBox(width: 16),
const Icon(AIcons.info),
const SizedBox(width: 16),
Expanded(child: Text(context.l10n.settingsHiddenFiltersBanner)),
],
),
),
Divider(),
const Divider(),
Expanded(
child: Padding(
padding: EdgeInsets.all(8),
padding: const EdgeInsets.all(8),
child: Consumer<Settings>(
builder: (context, settings, child) {
final hiddenFilters = settings.hiddenFilters;

View file

@ -53,7 +53,7 @@ class AvailableActionPanel extends StatelessWidget {
return AnimatedBuilder(
animation: Listenable.merge([quickActionsChangeNotifier, draggedAvailableAction]),
builder: (context, child) => Padding(
padding: EdgeInsets.all(8),
padding: const EdgeInsets.all(8),
child: Wrap(
alignment: WrapAlignment.spaceEvenly,
spacing: 8,

View file

@ -18,16 +18,16 @@ class ActionPanel extends StatelessWidget {
return AnimatedContainer(
foregroundDecoration: BoxDecoration(
color: color.withOpacity(.2),
border: Border.all(
border: Border.fromBorderSide(BorderSide(
color: color,
width: highlight ? 2 : 1,
)),
borderRadius: const BorderRadius.all(Radius.circular(8)),
),
borderRadius: BorderRadius.circular(8),
),
margin: EdgeInsets.all(16),
margin: const EdgeInsets.all(16),
duration: Durations.quickActionHighlightAnimation,
child: ClipRRect(
borderRadius: BorderRadius.circular(8),
borderRadius: const BorderRadius.all(Radius.circular(8)),
child: child,
),
);
@ -54,7 +54,7 @@ class ActionButton extends StatelessWidget {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(height: padding),
const SizedBox(height: padding),
OverlayButton(
child: IconButton(
icon: Icon(action.getIcon()),
@ -62,7 +62,7 @@ class ActionButton extends StatelessWidget {
),
),
if (showCaption) ...[
SizedBox(height: padding),
const SizedBox(height: padding),
Text(
action.getText(context),
style: enabled ? textStyle : textStyle!.copyWith(color: textStyle.color!.withOpacity(.2)),
@ -71,7 +71,7 @@ class ActionButton extends StatelessWidget {
maxLines: 2,
),
],
SizedBox(height: padding),
const SizedBox(height: padding),
],
),
);

View file

@ -24,7 +24,7 @@ class QuickActionsTile extends StatelessWidget {
Navigator.push(
context,
MaterialPageRoute(
settings: RouteSettings(name: QuickActionEditorPage.routeName),
settings: const RouteSettings(name: QuickActionEditorPage.routeName),
builder: (context) => QuickActionEditorPage(),
),
);
@ -71,7 +71,7 @@ class _QuickActionEditorPageState extends State<QuickActionEditorPage> {
void _onQuickActionTargetLeave() {
_stopLeavingTimer();
final action = _draggedAvailableAction.value;
_targetLeavingTimer = Timer(Durations.quickActionListAnimation + Duration(milliseconds: 50), () {
_targetLeavingTimer = Timer(Durations.quickActionListAnimation + const Duration(milliseconds: 50), () {
_removeQuickAction(action);
_quickActionHighlight.value = false;
});
@ -111,18 +111,18 @@ class _QuickActionEditorPageState extends State<QuickActionEditorPage> {
child: ListView(
children: [
Padding(
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
child: Row(
children: [
Icon(AIcons.info),
SizedBox(width: 16),
const Icon(AIcons.info),
const SizedBox(width: 16),
Expanded(child: Text(context.l10n.settingsViewerQuickActionEditorBanner)),
],
),
),
Divider(),
const Divider(),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Text(
context.l10n.settingsViewerQuickActionEditorDisplayedButtons,
style: Constants.titleTextStyle,
@ -161,7 +161,7 @@ class _QuickActionEditorPageState extends State<QuickActionEditorPage> {
shrinkWrap: true,
padding: EdgeInsets.zero,
itemBuilder: (context, index, animation) {
if (index >= _quickActions.length) return SizedBox();
if (index >= _quickActions.length) return const SizedBox();
final action = _quickActions[index];
return QuickActionButton(
placement: QuickActionPlacement.action,
@ -186,14 +186,14 @@ class _QuickActionEditorPageState extends State<QuickActionEditorPage> {
style: Theme.of(context).textTheme.caption,
),
)
: SizedBox(),
: const SizedBox(),
),
],
),
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Text(
context.l10n.settingsViewerQuickActionEditorAvailableButtons,
style: Constants.titleTextStyle,
@ -278,7 +278,7 @@ class _QuickActionEditorPageState extends State<QuickActionEditorPage> {
axis: Axis.horizontal,
sizeFactor: animation,
child: Padding(
padding: EdgeInsets.symmetric(vertical: _QuickActionEditorPageState.quickActionVerticalPadding, horizontal: 4),
padding: const EdgeInsets.symmetric(vertical: _QuickActionEditorPageState.quickActionVerticalPadding, horizontal: 4),
child: OverlayButton(
child: IconButton(
icon: Icon(action.getIcon()),

View file

@ -52,7 +52,7 @@ class QuickActionButton extends StatelessWidget {
},
onAcceptWithDetails: (details) => _setPanelHighlight(false),
onLeave: (data) => onTargetLeave(),
builder: (context, accepted, rejected) => child ?? SizedBox(),
builder: (context, accepted, rejected) => child ?? const SizedBox(),
);
}

View file

@ -47,14 +47,14 @@ class _SettingsPageState extends State<SettingsPage> {
data: theme.copyWith(
textTheme: theme.textTheme.copyWith(
// dense style font for tile subtitles, without modifying title font
bodyText2: TextStyle(fontSize: 12),
bodyText2: const TextStyle(fontSize: 12),
),
),
child: SafeArea(
child: Consumer<Settings>(
builder: (context, settings, child) => AnimationLimiter(
child: ListView(
padding: EdgeInsets.all(8),
padding: const EdgeInsets.all(8),
children: AnimationConfiguration.toStaggeredList(
duration: Durations.staggeredAnimation,
delay: Durations.staggeredAnimationDelay,
@ -333,17 +333,17 @@ class _SettingsPageState extends State<SettingsPage> {
}
Widget _buildLeading(IconData icon, Color color) => Container(
padding: EdgeInsets.all(6),
padding: const EdgeInsets.all(6),
decoration: BoxDecoration(
border: Border.all(
border: Border.fromBorderSide(BorderSide(
color: color,
width: AvesFilterChip.outlineWidth,
),
)),
shape: BoxShape.circle,
),
child: DecoratedIcon(
icon,
shadows: [Constants.embossShadow],
shadows: Constants.embossShadows,
size: 18,
),
);

View file

@ -36,7 +36,7 @@ class FilterTable extends StatelessWidget {
final lineHeight = 16 * textScaleFactor;
return Padding(
padding: EdgeInsetsDirectional.only(start: AvesFilterChip.outlineWidth / 2 + 6, end: 8),
padding: const EdgeInsetsDirectional.only(start: AvesFilterChip.outlineWidth / 2 + 6, end: 8),
child: LayoutBuilder(
builder: (context, constraints) {
final showPercentIndicator = constraints.maxWidth - (chipWidth + countWidth) > percentIndicatorMinWidth;
@ -52,7 +52,7 @@ class FilterTable extends StatelessWidget {
// the `Table` `border` property paints on the cells and does not add margins,
// so we define margins here instead, but they should be symmetric
// to keep all cells vertically aligned on the center/middle
margin: EdgeInsets.symmetric(vertical: 4),
margin: const EdgeInsets.symmetric(vertical: 4),
alignment: AlignmentDirectional.centerStart,
child: AvesFilterChip(
filter: filter,
@ -69,20 +69,20 @@ class FilterTable extends StatelessWidget {
padding: EdgeInsets.symmetric(horizontal: lineHeight),
center: Text(
NumberFormat.percentPattern().format(percent),
style: TextStyle(shadows: [Constants.embossShadow]),
style: const TextStyle(shadows: Constants.embossShadows),
),
),
Text(
'$count',
style: TextStyle(color: Colors.white70),
style: const TextStyle(color: Colors.white70),
textAlign: TextAlign.end,
),
],
);
}).toList(),
columnWidths: {
0: MaxColumnWidth(IntrinsicColumnWidth(), FixedColumnWidth(chipWidth)),
2: MaxColumnWidth(IntrinsicColumnWidth(), FixedColumnWidth(countWidth)),
0: const MaxColumnWidth(IntrinsicColumnWidth(), FixedColumnWidth(chipWidth)),
2: const MaxColumnWidth(IntrinsicColumnWidth(), FixedColumnWidth(countWidth)),
},
defaultVerticalAlignment: TableCellVerticalAlignment.middle,
);

View file

@ -16,7 +16,6 @@ import 'package:aves/widgets/common/extensions/build_context.dart';
import 'package:aves/widgets/common/identity/empty.dart';
import 'package:aves/widgets/common/providers/media_query_data_provider.dart';
import 'package:aves/widgets/stats/filter_table.dart';
// ignore: import_of_legacy_library_into_null_safe
import 'package:charts_flutter/flutter.dart' as charts;
import 'package:collection/collection.dart';
@ -87,7 +86,7 @@ class StatsPage extends StatelessWidget {
final textScaleFactor = MediaQuery.textScaleFactorOf(context);
final lineHeight = 16 * textScaleFactor;
final locationIndicator = Padding(
padding: EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
child: Column(
children: [
LinearPercentIndicator(
@ -96,15 +95,15 @@ class StatsPage extends StatelessWidget {
backgroundColor: Colors.white24,
progressColor: Theme.of(context).accentColor,
animation: true,
leading: Icon(AIcons.location),
leading: const Icon(AIcons.location),
// right padding to match leading, so that inside label is aligned with outside label below
padding: EdgeInsets.symmetric(horizontal: lineHeight) + EdgeInsets.only(right: 24),
padding: EdgeInsets.symmetric(horizontal: lineHeight) + const EdgeInsets.only(right: 24),
center: Text(
NumberFormat.percentPattern().format(withGpsPercent),
style: TextStyle(shadows: [Constants.embossShadow]),
style: const TextStyle(shadows: Constants.embossShadows),
),
),
SizedBox(height: 8),
const SizedBox(height: 8),
Text(context.l10n.statsWithGps(withGpsCount)),
],
),
@ -132,7 +131,7 @@ class StatsPage extends StatelessWidget {
}
Widget _buildMimeDonut(BuildContext context, String Function(int) label, Map<String, int> byMimeTypes) {
if (byMimeTypes.isEmpty) return SizedBox.shrink();
if (byMimeTypes.isEmpty) return const SizedBox.shrink();
final sum = byMimeTypes.values.fold<int>(0, (prev, v) => prev + v);
@ -193,12 +192,12 @@ class StatsPage extends StatelessWidget {
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: Padding(
padding: EdgeInsetsDirectional.only(end: 8),
padding: const EdgeInsetsDirectional.only(end: 8),
child: Icon(AIcons.disc, color: d.color),
),
),
TextSpan(text: '${d.displayText} '),
TextSpan(text: '${d.entryCount}', style: TextStyle(color: Colors.white70)),
TextSpan(text: '${d.entryCount}', style: const TextStyle(color: Colors.white70)),
],
),
overflow: TextOverflow.fade,
@ -235,7 +234,7 @@ class StatsPage extends StatelessWidget {
return [
Padding(
padding: EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
child: Text(
title,
style: Constants.titleTextStyle,
@ -272,7 +271,7 @@ class StatsPage extends StatelessWidget {
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(
settings: RouteSettings(name: CollectionPage.routeName),
settings: const RouteSettings(name: CollectionPage.routeName),
builder: (context) => CollectionPage(CollectionLens(
source: source,
filters: [filter],

View file

@ -40,13 +40,13 @@ class _DbTabState extends State<DbTab> {
@override
Widget build(BuildContext context) {
return ListView(
padding: EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
children: [
FutureBuilder<DateMetadata?>(
future: _dbDateLoader,
builder: (context, snapshot) {
if (snapshot.hasError) return Text(snapshot.error.toString());
if (snapshot.connectionState != ConnectionState.done) return SizedBox.shrink();
if (snapshot.connectionState != ConnectionState.done) return const SizedBox.shrink();
final data = snapshot.data;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -60,12 +60,12 @@ class _DbTabState extends State<DbTab> {
);
},
),
SizedBox(height: 16),
const SizedBox(height: 16),
FutureBuilder<AvesEntry?>(
future: _dbEntryLoader,
builder: (context, snapshot) {
if (snapshot.hasError) return Text(snapshot.error.toString());
if (snapshot.connectionState != ConnectionState.done) return SizedBox.shrink();
if (snapshot.connectionState != ConnectionState.done) return const SizedBox.shrink();
final data = snapshot.data;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -89,12 +89,12 @@ class _DbTabState extends State<DbTab> {
);
},
),
SizedBox(height: 16),
const SizedBox(height: 16),
FutureBuilder<CatalogMetadata?>(
future: _dbMetadataLoader,
builder: (context, snapshot) {
if (snapshot.hasError) return Text(snapshot.error.toString());
if (snapshot.connectionState != ConnectionState.done) return SizedBox.shrink();
if (snapshot.connectionState != ConnectionState.done) return const SizedBox.shrink();
final data = snapshot.data;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -116,12 +116,12 @@ class _DbTabState extends State<DbTab> {
);
},
),
SizedBox(height: 16),
const SizedBox(height: 16),
FutureBuilder<AddressDetails?>(
future: _dbAddressLoader,
builder: (context, snapshot) {
if (snapshot.hasError) return Text(snapshot.error.toString());
if (snapshot.connectionState != ConnectionState.done) return SizedBox.shrink();
if (snapshot.connectionState != ConnectionState.done) return const SizedBox.shrink();
final data = snapshot.data;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,

View file

@ -21,16 +21,16 @@ class ViewerDebugPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final tabs = <Tuple2<Tab, Widget>>[
Tuple2(Tab(text: 'Entry'), _buildEntryTabView()),
if (context.select<ValueNotifier<AppMode>, bool>((vn) => vn.value != AppMode.view)) Tuple2(Tab(text: 'DB'), DbTab(entry: entry)),
Tuple2(Tab(icon: Icon(AIcons.android)), MetadataTab(entry: entry)),
Tuple2(Tab(icon: Icon(AIcons.image)), _buildThumbnailsTabView()),
Tuple2(const Tab(text: 'Entry'), _buildEntryTabView()),
if (context.select<ValueNotifier<AppMode>, bool>((vn) => vn.value != AppMode.view)) Tuple2(const Tab(text: 'DB'), DbTab(entry: entry)),
Tuple2(const Tab(icon: Icon(AIcons.android)), MetadataTab(entry: entry)),
Tuple2(const Tab(icon: Icon(AIcons.image)), _buildThumbnailsTabView()),
];
return DefaultTabController(
length: tabs.length,
child: Scaffold(
appBar: AppBar(
title: Text('Debug'),
title: const Text('Debug'),
bottom: TabBar(
tabs: tabs.map((t) => t.item1).toList(),
),
@ -54,7 +54,7 @@ class ViewerDebugPage extends StatelessWidget {
}
return ListView(
padding: EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
children: [
InfoRowGroup({
'uri': '${entry.uri}',
@ -66,13 +66,13 @@ class ViewerDebugPage extends StatelessWidget {
'sourceMimeType': '${entry.sourceMimeType}',
'mimeType': '${entry.mimeType}',
}),
Divider(),
const Divider(),
InfoRowGroup({
'dateModifiedSecs': toDateValue(entry.dateModifiedSecs, factor: 1000),
'sourceDateTakenMillis': toDateValue(entry.sourceDateTakenMillis),
'bestDate': '${entry.bestDate}',
}),
Divider(),
const Divider(),
InfoRowGroup({
'width': '${entry.width}',
'height': '${entry.height}',
@ -83,12 +83,12 @@ class ViewerDebugPage extends StatelessWidget {
'displayAspectRatio': '${entry.displayAspectRatio}',
'displaySize': '${entry.displaySize}',
}),
Divider(),
const Divider(),
InfoRowGroup({
'durationMillis': '${entry.durationMillis}',
'durationText': '${entry.durationText}',
}),
Divider(),
const Divider(),
InfoRowGroup({
'sizeBytes': '${entry.sizeBytes}',
'isFavourite': '${entry.isFavourite}',
@ -104,7 +104,7 @@ class ViewerDebugPage extends StatelessWidget {
'canRotateAndFlip': '${entry.canRotateAndFlip}',
'xmpSubjects': '${entry.xmpSubjects}',
}),
Divider(),
const Divider(),
InfoRowGroup({
'hasGps': '${entry.hasGps}',
'hasAddress': '${entry.hasAddress}',
@ -121,7 +121,7 @@ class ViewerDebugPage extends StatelessWidget {
if (entry.isSvg) {
const extent = 128.0;
children.addAll([
Text('SVG ($extent)'),
const Text('SVG ($extent)'),
SvgPicture(
UriPicture(
uri: entry.uri,
@ -140,12 +140,12 @@ class ViewerDebugPage extends StatelessWidget {
image: provider,
),
),
SizedBox(height: 16),
const SizedBox(height: 16),
]),
);
}
return ListView(
padding: EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
children: children,
);
}

View file

@ -65,7 +65,7 @@ class _MetadataTabState extends State<MetadataTab> {
children: [
if (data.isNotEmpty)
Padding(
padding: EdgeInsets.only(left: 8, right: 8, bottom: 8),
padding: const EdgeInsets.only(left: 8, right: 8, bottom: 8),
child: InfoRowGroup(
data,
maxValueLength: Constants.infoGroupMaxValueLength,
@ -77,12 +77,12 @@ class _MetadataTabState extends State<MetadataTab> {
Widget builderFromSnapshot(BuildContext context, AsyncSnapshot<Map> snapshot, String title) {
if (snapshot.hasError) return Text(snapshot.error.toString());
if (snapshot.connectionState != ConnectionState.done) return SizedBox.shrink();
if (snapshot.connectionState != ConnectionState.done) return const SizedBox.shrink();
return builderFromSnapshotData(context, snapshot.data!, title);
}
return ListView(
padding: EdgeInsets.all(8),
padding: const EdgeInsets.all(8),
children: [
FutureBuilder<Map>(
future: _bitmapFactoryLoader,
@ -109,7 +109,7 @@ class _MetadataTabState extends State<MetadataTab> {
future: _tiffStructureLoader,
builder: (context, snapshot) {
if (snapshot.hasError) return Text(snapshot.error.toString());
if (snapshot.connectionState != ConnectionState.done) return SizedBox.shrink();
if (snapshot.connectionState != ConnectionState.done) return const SizedBox.shrink();
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: snapshot.data!.entries.map((kv) => builderFromSnapshotData(context, kv.value as Map, 'TIFF ${kv.key}')).toList(),

View file

@ -156,7 +156,7 @@ class EntryActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAwareMix
final destinationAlbum = await Navigator.push(
context,
MaterialPageRoute<String>(
settings: RouteSettings(name: AlbumPickPage.routeName),
settings: const RouteSettings(name: AlbumPickPage.routeName),
builder: (context) => AlbumPickPage(source: source, moveType: MoveType.export),
),
);
@ -227,7 +227,7 @@ class EntryActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAwareMix
Navigator.push(
context,
MaterialPageRoute(
settings: RouteSettings(name: SourceViewerPage.routeName),
settings: const RouteSettings(name: SourceViewerPage.routeName),
builder: (context) => SourceViewerPage(
loader: () => imageFileService.getSvg(entry.uri, entry.mimeType).then(utf8.decode),
),
@ -239,7 +239,7 @@ class EntryActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAwareMix
Navigator.push(
context,
MaterialPageRoute(
settings: RouteSettings(name: ViewerDebugPage.routeName),
settings: const RouteSettings(name: ViewerDebugPage.routeName),
builder: (context) => ViewerDebugPage(entry: entry),
),
);

View file

@ -35,10 +35,10 @@ class _MultiEntryScrollerState extends State<MultiEntryScroller> with AutomaticK
return MagnifierGestureDetectorScope(
axis: [Axis.horizontal, Axis.vertical],
child: PageView.builder(
key: Key('horizontal-pageview'),
key: const Key('horizontal-pageview'),
scrollDirection: Axis.horizontal,
controller: widget.pageController,
physics: MagnifierScrollerPhysics(parent: BouncingScrollPhysics()),
physics: const MagnifierScrollerPhysics(parent: BouncingScrollPhysics()),
onPageChanged: widget.onPageChanged,
itemBuilder: (context, index) {
final entry = entries[index];
@ -77,7 +77,7 @@ class _MultiEntryScrollerState extends State<MultiEntryScroller> with AutomaticK
selector: (c, mq) => mq.size,
builder: (c, mqSize, child) {
return EntryPageView(
key: Key('imageview'),
key: const Key('imageview'),
mainEntry: mainEntry,
pageEntry: pageEntry ?? mainEntry,
viewportSize: mqSize,

View file

@ -82,7 +82,7 @@ class _ViewerVerticalPageViewState extends State<ViewerVerticalPageView> {
@override
Widget build(BuildContext context) {
// fake page for opacity transition between collection and viewer
final transitionPage = SizedBox();
const transitionPage = SizedBox();
final imagePage = hasCollection
? MultiEntryScroller(
@ -95,7 +95,7 @@ class _ViewerVerticalPageViewState extends State<ViewerVerticalPageView> {
? SingleEntryScroller(
entry: entry!,
)
: SizedBox();
: const SizedBox();
final infoPage = NotificationListener<BackUpNotification>(
onNotification: (notification) {
@ -130,10 +130,10 @@ class _ViewerVerticalPageViewState extends State<ViewerVerticalPageView> {
child: child,
),
child: PageView(
key: Key('vertical-pageview'),
key: const Key('vertical-pageview'),
scrollDirection: Axis.vertical,
controller: widget.verticalPager,
physics: MagnifierScrollerPhysics(parent: PageScrollPhysics()),
physics: const MagnifierScrollerPhysics(parent: PageScrollPhysics()),
onPageChanged: widget.onVerticalPageChanged,
children: pages,
),

View file

@ -101,7 +101,7 @@ class _EntryViewerStackState extends State<EntryViewerStack> with SingleTickerPr
// no bounce at the bottom, to avoid video controller displacement
curve: Curves.easeOutQuad,
);
_bottomOverlayOffset = Tween(begin: Offset(0, 1), end: Offset(0, 0)).animate(CurvedAnimation(
_bottomOverlayOffset = Tween(begin: const Offset(0, 1), end: const Offset(0, 0)).animate(CurvedAnimation(
parent: _overlayAnimationController,
curve: Curves.easeOutQuad,
));
@ -220,7 +220,7 @@ class _EntryViewerStackState extends State<EntryViewerStack> with SingleTickerPr
Widget child = ValueListenableBuilder<AvesEntry?>(
valueListenable: _entryNotifier,
builder: (context, mainEntry, child) {
if (mainEntry == null) return SizedBox.shrink();
if (mainEntry == null) return const SizedBox.shrink();
return ViewerTopOverlay(
mainEntry: mainEntry,
@ -276,7 +276,7 @@ class _EntryViewerStackState extends State<EntryViewerStack> with SingleTickerPr
Widget child = ValueListenableBuilder<AvesEntry?>(
valueListenable: _entryNotifier,
builder: (context, mainEntry, child) {
if (mainEntry == null) return SizedBox.shrink();
if (mainEntry == null) return const SizedBox.shrink();
Widget? _buildExtraBottomOverlay(AvesEntry pageEntry) {
// a 360 video is both a video and a panorama but only the video controls are displayed
@ -304,12 +304,12 @@ class _EntryViewerStackState extends State<EntryViewerStack> with SingleTickerPr
stream: multiPageController.infoStream,
builder: (context, snapshot) {
final multiPageInfo = multiPageController.info;
if (multiPageInfo == null) return SizedBox.shrink();
if (multiPageInfo == null) return const SizedBox.shrink();
return ValueListenableBuilder<int?>(
valueListenable: multiPageController.pageNotifier,
builder: (context, page, child) {
final pageEntry = multiPageInfo.getPageEntryByIndex(page);
return _buildExtraBottomOverlay(pageEntry) ?? SizedBox();
return _buildExtraBottomOverlay(pageEntry) ?? const SizedBox();
},
);
})
@ -380,7 +380,7 @@ class _EntryViewerStackState extends State<EntryViewerStack> with SingleTickerPr
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(
settings: RouteSettings(name: CollectionPage.routeName),
settings: const RouteSettings(name: CollectionPage.routeName),
builder: (context) {
return CollectionPage(
CollectionLens(
@ -606,7 +606,7 @@ class _EntryViewerStackState extends State<EntryViewerStack> with SingleTickerPr
// video decoding may fail or have initial artifacts when the player initializes
// during this widget initialization (because of the page transition and hero animation?)
// so we play after a delay for increased stability
await Future.delayed(Duration(milliseconds: 300) * timeDilation);
await Future.delayed(const Duration(milliseconds: 300) * timeDilation);
await videoController.play();

View file

@ -91,9 +91,9 @@ class BasicSection extends StatelessWidget {
...filters,
if (entry.isFavourite) FavouriteFilter.instance,
]..sort();
if (effectiveFilters.isEmpty) return SizedBox.shrink();
if (effectiveFilters.isEmpty) return const SizedBox.shrink();
return Padding(
padding: EdgeInsets.symmetric(horizontal: AvesFilterChip.outlineWidth / 2) + EdgeInsets.only(top: 8),
padding: const EdgeInsets.symmetric(horizontal: AvesFilterChip.outlineWidth / 2) + const EdgeInsets.only(top: 8),
child: Wrap(
spacing: 8,
runSpacing: 8,
@ -151,7 +151,7 @@ class _OwnerPropState extends State<OwnerProp> {
future: _ownerPackageFuture,
builder: (context, snapshot) {
final ownerPackage = snapshot.data;
if (ownerPackage == null) return SizedBox();
if (ownerPackage == null) return const SizedBox();
final appName = androidFileUtils.getCurrentAppName(ownerPackage) ?? ownerPackage;
// as of Flutter v1.22.6, `SelectableText` cannot contain `WidgetSpan`
// so we use a basic `Text` instead
@ -168,7 +168,7 @@ class _OwnerPropState extends State<OwnerProp> {
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 4),
padding: const EdgeInsets.symmetric(horizontal: 4),
child: Image(
image: AppIconImage(
packageName: ownerPackage,

View file

@ -13,7 +13,7 @@ class SectionRow extends StatelessWidget {
@override
Widget build(BuildContext context) {
const dim = 32.0;
Widget buildDivider() => SizedBox(
Widget buildDivider() => const SizedBox(
width: dim,
child: Divider(
thickness: AvesFilterChip.outlineWidth,
@ -25,7 +25,7 @@ class SectionRow extends StatelessWidget {
children: [
buildDivider(),
Padding(
padding: EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
child: Icon(
icon,
size: dim,
@ -45,7 +45,7 @@ class InfoRowGroup extends StatefulWidget {
static const keyValuePadding = 16;
static const linkColor = Colors.blue;
static const fontSize = 13.0;
static final baseStyle = TextStyle(fontSize: fontSize);
static const baseStyle = TextStyle(fontSize: fontSize);
static final keyStyle = baseStyle.copyWith(color: Colors.white70, height: 2.0);
static final linkStyle = baseStyle.copyWith(color: linkColor, decoration: TextDecoration.underline);
@ -70,7 +70,7 @@ class _InfoRowGroupState extends State<InfoRowGroup> {
@override
Widget build(BuildContext context) {
if (keyValues.isEmpty) return SizedBox.shrink();
if (keyValues.isEmpty) return const SizedBox.shrink();
// compute the size of keys and space in order to align values
final textScaleFactor = MediaQuery.textScaleFactorOf(context);
@ -143,7 +143,7 @@ class _InfoRowGroupState extends State<InfoRowGroup> {
span,
textDirection: TextDirection.ltr,
textScaleFactor: textScaleFactor,
)..layout(BoxConstraints(), parentUsesSize: true);
)..layout(const BoxConstraints(), parentUsesSize: true);
return para.getMaxIntrinsicWidth(double.infinity);
}
}

View file

@ -21,8 +21,8 @@ class InfoAppBar extends StatelessWidget {
Widget build(BuildContext context) {
return SliverAppBar(
leading: IconButton(
key: Key('back-button'),
icon: Icon(AIcons.goUp),
key: const Key('back-button'),
icon: const Icon(AIcons.goUp),
onPressed: onBackPressed,
tooltip: context.l10n.viewerInfoBackToViewerTooltip,
),
@ -32,7 +32,7 @@ class InfoAppBar extends StatelessWidget {
),
actions: [
IconButton(
icon: Icon(AIcons.search),
icon: const Icon(AIcons.search),
onPressed: () => _goToSearch(context),
tooltip: MaterialLocalizations.of(context).searchFieldLabel,
),

View file

@ -67,7 +67,7 @@ class _InfoPageState extends State<InfoPage> {
split: mqWidth > 600,
goToViewer: _goToViewer,
)
: SizedBox.shrink();
: const SizedBox.shrink();
},
);
},
@ -114,7 +114,7 @@ class _InfoPageState extends State<InfoPage> {
Navigator.push(
context,
TransparentMaterialPageRoute(
settings: RouteSettings(name: EntryViewerPage.routeName),
settings: const RouteSettings(name: EntryViewerPage.routeName),
pageBuilder: (c, a, sa) => EntryViewerPage(
initialEntry: tempEntry,
),
@ -175,7 +175,7 @@ class _InfoPageContentState extends State<_InfoPageContent> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child: basicSection),
SizedBox(width: 8),
const SizedBox(width: 8),
Expanded(child: locationSection),
],
),
@ -202,11 +202,11 @@ class _InfoPageContentState extends State<_InfoPageContent> {
onBackPressed: widget.goToViewer,
),
SliverPadding(
padding: horizontalPadding + EdgeInsets.only(top: 8),
padding: horizontalPadding + const EdgeInsets.only(top: 8),
sliver: basicAndLocationSliver,
),
SliverPadding(
padding: horizontalPadding + EdgeInsets.only(bottom: 8),
padding: horizontalPadding + const EdgeInsets.only(bottom: 8),
sliver: metadataSliver,
),
BottomPaddingSliver(),

Some files were not shown because too many files have changed in this diff Show more