Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/components/advanced_search_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ class AdvancedSearchCard extends StatelessWidget {
@override
Widget build(final BuildContext context) => CustomCard(
child: Column(
spacing: 8,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
AppLocalizations.of(context)!.advancedSearch,
style: Theme.of(context).textTheme.titleMedium,
),
const SizedBox(height: 8),
Center(
child: Wrap(
alignment: WrapAlignment.center,
Expand All @@ -65,7 +65,6 @@ class AdvancedSearchCard extends StatelessWidget {
],
),
),
const SizedBox(height: 8),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Expand Down
4 changes: 2 additions & 2 deletions lib/components/animes/calendar_anime_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class CalendarAnimeComponent extends StatelessWidget {
AnimeController.instance.onLongPress(context, release.anime, details);
},
child: Column(
spacing: 8,
children: <Widget>[
Stack(
children: <Widget>[
Expand All @@ -78,7 +79,6 @@ class CalendarAnimeComponent extends StatelessWidget {
),
],
),
const SizedBox(height: 8),
IntrinsicHeight(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
Expand Down Expand Up @@ -120,6 +120,7 @@ class CalendarAnimeComponent extends StatelessWidget {
LangTypeComponent(langType: langType),
const SizedBox(height: 8),
Flex(
spacing: 8,
direction: Axis.horizontal,
children: <Widget>[
if ((!isReleased || isMultipleReleased) &&
Expand All @@ -135,7 +136,6 @@ class CalendarAnimeComponent extends StatelessWidget {
isCalendar: true,
simple: true,
),
const SizedBox(width: 8),
WatchButton(
url: release.mappings?.first.variants?.first.url,
simple: true,
Expand Down
2 changes: 1 addition & 1 deletion lib/components/animes/followed_anime_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class FollowedAnimeComponent extends StatelessWidget {
);
},
child: Column(
spacing: 4,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
SizedBox(
Expand All @@ -43,7 +44,6 @@ class FollowedAnimeComponent extends StatelessWidget {
),
),
),
const SizedBox(height: 4),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 4),
child: Text(
Expand Down
23 changes: 13 additions & 10 deletions lib/components/animes/missed_anime_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class MissedAnimeComponent extends StatelessWidget {
child: SizedBox(
width: 100,
child: Column(
spacing: 8,
children: <Widget>[
SizedBox(
width: 80,
Expand All @@ -55,16 +56,18 @@ class MissedAnimeComponent extends StatelessWidget {
],
),
),
const SizedBox(height: 8),
Text(
missedAnime.anime.shortName,
style: Theme.of(context)
.textTheme
.bodySmall
?.copyWith(fontWeight: FontWeight.bold),
overflow: TextOverflow.ellipsis,
maxLines: 1,
textAlign: TextAlign.center,
Padding(
padding: const EdgeInsets.symmetric(horizontal: 4),
child: Text(
missedAnime.anime.shortName,
style: Theme.of(context)
.textTheme
.bodySmall
?.copyWith(fontWeight: FontWeight.bold),
overflow: TextOverflow.ellipsis,
maxLines: 1,
textAlign: TextAlign.center,
),
),
],
),
Expand Down
35 changes: 35 additions & 0 deletions lib/components/elevated_async_button.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import 'package:flutter/material.dart';

class ElevatedAsyncButton extends StatefulWidget {
const ElevatedAsyncButton({required this.child, super.key, this.onPressed});

final Future<void> Function()? onPressed;
final Widget child;

@override
State<ElevatedAsyncButton> createState() => _ElevatedAsyncButtonState();
}

class _ElevatedAsyncButtonState extends State<ElevatedAsyncButton> {
bool _isRunning = false;

@override
Widget build(final BuildContext context) => ElevatedButton(
onPressed: !_isRunning
? () async {
setState(() {
_isRunning = true;
});

if (widget.onPressed != null) {
await widget.onPressed!();
}

setState(() {
_isRunning = false;
});
}
: null,
child: widget.child,
);
}
12 changes: 4 additions & 8 deletions lib/components/elevated_dropdown_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class ElevatedDropdownButton<T> extends StatelessWidget {
});
},
child: Flex(
spacing: 8,
direction: Axis.horizontal,
children: <Widget>[
if (child != null)
Expand All @@ -63,10 +64,7 @@ class ElevatedDropdownButton<T> extends StatelessWidget {
orElse: () => items.first,
)
.child,
if (showIcon) ...<Widget>[
const SizedBox(width: 8),
const Icon(Icons.arrow_drop_down),
],
if (showIcon) const Icon(Icons.arrow_drop_down),
],
),
);
Expand All @@ -83,13 +81,11 @@ class ElevatedPopupMenuItem<T> {
PopupMenuItem<T> build({final bool selected = false}) => PopupMenuItem<T>(
value: value,
child: Flex(
spacing: 8,
direction: Axis.horizontal,
children: <Widget>[
child,
if (selected) ...<Widget>[
const SizedBox(width: 8),
const Icon(Icons.check),
],
if (selected) const Icon(Icons.check),
],
),
);
Expand Down
2 changes: 1 addition & 1 deletion lib/components/episodes/anime_episode_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class AnimeEpisodeComponent extends StatelessWidget {
child: SizedBox(
height: 170,
child: Row(
spacing: 8,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
Expand All @@ -31,7 +32,6 @@ class AnimeEpisodeComponent extends StatelessWidget {
fit: BoxFit.cover,
),
),
const SizedBox(width: 8),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
Expand Down
5 changes: 2 additions & 3 deletions lib/components/episodes/episode_action_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@ class EpisodeActionBar extends StatelessWidget {

@override
Widget build(final BuildContext context) => Flex(
spacing: 8,
direction: Axis.horizontal,
children: <Widget>[
if (showWatchlist) ...<Widget>[
if (showWatchlist)
WatchlistButton(
episode: episode,
simple: simple,
),
const SizedBox(width: 8),
],
WatchButton(
url: episode.variants?.first.url,
simple: simple,
Expand Down
2 changes: 1 addition & 1 deletion lib/components/episodes/episode_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class EpisodeImage extends StatelessWidget {
child: ClipRRect(
borderRadius: const BorderRadius.all(Radius.circular(4)),
child: ColoredBox(
color: Colors.black.withOpacity(0.5),
color: Colors.black.withValues(alpha: 0.5),
child: Padding(
padding: const EdgeInsets.all(4),
child: Text(
Expand Down
90 changes: 47 additions & 43 deletions lib/components/episodes/followed_episode_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,53 +17,57 @@ class FollowedEpisodeComponent extends StatelessWidget {
final EpisodeMappingDto episode;

@override
Widget build(final BuildContext context) => SizedBox(
width: 640 / _ratio + 10,
child: GestureDetector(
onTap: () {
if (episode.anime == null) {
return;
}
Widget build(final BuildContext context) {
final double width = 640 / _ratio;

Analytics.instance.logSelectContent('anime', episode.anime!.uuid);
return SizedBox(
width: width + 10,
child: GestureDetector(
onTap: () {
if (episode.anime == null) {
return;
}

Navigator.of(context).push(
MaterialPageRoute<void>(
builder: (final BuildContext context) => AnimeDetailsView(
anime: episode.anime!,
),
Analytics.instance.logSelectContent('anime', episode.anime!.uuid);

Navigator.of(context).push(
MaterialPageRoute<void>(
builder: (final BuildContext context) => AnimeDetailsView(
anime: episode.anime!,
),
);
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
SizedBox(
width: 640 / _ratio,
height: 360 / _ratio,
child: EpisodeImage(
episode: episode,
borderRadius: const BorderRadius.all(
Radius.circular(Constant.borderRadius),
),
showDuration: false,
),
);
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
SizedBox(
width: width,
height: 360 / _ratio,
child: EpisodeImage(
episode: episode,
borderRadius: const BorderRadius.all(
Radius.circular(Constant.borderRadius),
),
showDuration: false,
),
const SizedBox(height: 4),
Text(
episode.anime?.shortName ?? Constant.defaultText,
style: Theme.of(context)
.textTheme
.bodySmall
?.copyWith(fontWeight: FontWeight.bold),
overflow: TextOverflow.ellipsis,
maxLines: 1,
textAlign: TextAlign.center,
),
EpisodeInformation(episode: episode),
],
),
),
const SizedBox(height: 4),
Text(
episode.anime?.shortName ?? Constant.defaultText,
style: Theme.of(context)
.textTheme
.bodySmall
?.copyWith(fontWeight: FontWeight.bold),
overflow: TextOverflow.ellipsis,
maxLines: 1,
textAlign: TextAlign.center,
),
EpisodeInformation(episode: episode),
],
),
);
),
);
}
}
2 changes: 1 addition & 1 deletion lib/components/lang_type_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class LangTypeComponent extends StatelessWidget {
final TextStyle? textStyle = Theme.of(context).textTheme.bodyMedium;

return Flex(
spacing: 4,
direction: Axis.horizontal,
children: <Widget>[
if (langType == 'SUBTITLES')
Expand All @@ -39,7 +40,6 @@ class LangTypeComponent extends StatelessWidget {
size: 16,
color: textStyle?.color,
),
const SizedBox(width: 4),
Text(
getLangTypeTranslation(context, langType),
style: textStyle,
Expand Down
6 changes: 2 additions & 4 deletions lib/components/watch_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@ class WatchButton extends StatelessWidget {
);
},
child: Flex(
spacing: 8,
direction: Axis.horizontal,
children: <Widget>[
const Icon(Icons.live_tv_outlined),
if (!simple) ...<Widget>[
const SizedBox(width: 8),
Text(AppLocalizations.of(context)!.watch),
],
if (!simple) Text(AppLocalizations.of(context)!.watch),
],
),
);
Expand Down
Loading
Loading