Skip to content

Commit

Permalink
fix: dcm issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Ziedelth committed Sep 10, 2024
1 parent 5215f7f commit f299582
Show file tree
Hide file tree
Showing 20 changed files with 58 additions and 23 deletions.
5 changes: 5 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,8 @@ linter:

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
dart_code_metrics:
extends:
- package:dart_code_metrics_presets/flutter_all.yaml
- package:dart_code_metrics_presets/firebase_analytics.yaml
- package:dart_code_metrics_presets/intl.yaml
3 changes: 2 additions & 1 deletion lib/components/account_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class AccountCard extends StatelessWidget {
return DecoratedBox(
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.secondary.withOpacity(0.125),
borderRadius: BorderRadius.circular(Constant.borderRadius),
borderRadius:
const BorderRadius.all(Radius.circular(Constant.borderRadius)),
),
child: Padding(
padding: const EdgeInsets.all(16),
Expand Down
3 changes: 2 additions & 1 deletion lib/components/animes/followed_anime_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ class FollowedAnimeComponent extends StatelessWidget {
height: 640 / _ratio,
child: ImageComponent(
uuid: anime.uuid,
borderRadius: BorderRadius.circular(Constant.borderRadius),
borderRadius: const BorderRadius.all(
Radius.circular(Constant.borderRadius)),
),
),
const SizedBox(height: 4),
Expand Down
2 changes: 1 addition & 1 deletion lib/components/animes/missed_anime_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class MissedAnimeComponent extends StatelessWidget {
ImageComponent(
uuid: missedAnime.anime.uuid,
fit: BoxFit.cover,
borderRadius: BorderRadius.circular(360),
borderRadius: const BorderRadius.all(Radius.circular(360)),
),
Positioned(
top: 0,
Expand Down
9 changes: 6 additions & 3 deletions lib/components/card_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ class _CustomCardState extends State<CustomCard> {
height: 100,
child: DecoratedBox(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(Constant.borderRadius),
borderRadius: const BorderRadius.all(
Radius.circular(Constant.borderRadius)),
color: widget.layerColor!.withOpacity(0.5),
),
),
Expand All @@ -65,15 +66,17 @@ class _CustomCardState extends State<CustomCard> {
height: 100,
child: DecoratedBox(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(Constant.borderRadius),
borderRadius: const BorderRadius.all(
Radius.circular(Constant.borderRadius)),
color: widget.layerColor!,
),
),
),
],
DecoratedBox(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(Constant.borderRadius),
borderRadius: const BorderRadius.all(
Radius.circular(Constant.borderRadius)),
color: widget.backgroundColor ?? withOpacity,
),
child: GestureDetector(
Expand Down
3 changes: 2 additions & 1 deletion lib/components/episodes/episode_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ class EpisodeImage extends StatelessWidget {
bottom: 5,
right: 5,
child: ClipRRect(
borderRadius: BorderRadius.circular(Constant.borderRadius),
borderRadius: const BorderRadius.all(
Radius.circular(Constant.borderRadius)),
child: ColoredBox(
color: Colors.black.withOpacity(0.5),
child: Padding(
Expand Down
3 changes: 2 additions & 1 deletion lib/components/episodes/followed_episode_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class FollowedEpisodeComponent extends StatelessWidget {
child: EpisodeImage(
episode: episode,
fit: BoxFit.fill,
borderRadius: BorderRadius.circular(Constant.borderRadius),
borderRadius: const BorderRadius.all(
Radius.circular(Constant.borderRadius)),
showDuration: false,
),
),
Expand Down
11 changes: 8 additions & 3 deletions lib/components/member_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,19 @@ class MemberImage extends StatelessWidget {

return Container(
decoration: hasBorder
? BoxDecoration(
? const BoxDecoration(
shape: BoxShape.circle,
border: Border.all(color: Colors.white, width: 2),
border: Border.fromBorderSide(
BorderSide(
color: Colors.white,
width: 2,
),
),
)
: null,
padding: const EdgeInsets.all(1),
child: ClipRRect(
borderRadius: BorderRadius.circular(360),
borderRadius: const BorderRadius.all(Radius.circular(360)),
child: showDefaultImage
? defaultImage
: CachedNetworkImage(
Expand Down
2 changes: 1 addition & 1 deletion lib/components/platforms/platform_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class PlatformComponent extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ClipRRect(
borderRadius: BorderRadius.circular(360),
borderRadius: const BorderRadius.all(Radius.circular(360)),
child: CachedNetworkImage(
imageUrl: '${Constant.baseUrl}/assets/img/platforms/${platform.image}',
filterQuality: FilterQuality.high,
Expand Down
9 changes: 9 additions & 0 deletions lib/controllers/followed_anime_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ class FollowedAnimeController {
});
}

void dispose() {
animes.clear();

page = 1;
isLoading = false;
canLoadMore = true;
nextPage();
}

Future<void> nextPage() async {
if (isLoading) {
return;
Expand Down
9 changes: 9 additions & 0 deletions lib/controllers/followed_episode_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ class FollowedEpisodeController {
});
}

void dispose() {
episodes.clear();

page = 1;
isLoading = false;
canLoadMore = true;
nextPage();
}

Future<void> nextPage() async {
if (isLoading) {
return;
Expand Down
2 changes: 0 additions & 2 deletions lib/views/account_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ class FollowedAnimesRow extends StatelessWidget {
scrollDirection: Axis.horizontal,
addAutomaticKeepAlives: false,
addRepaintBoundaries: false,
shrinkWrap: true,
itemCount: snapshot.data!.length,
itemBuilder: (context, index) =>
FollowedAnimeComponent(
Expand Down Expand Up @@ -419,7 +418,6 @@ class FollowedEpisodesRow extends StatelessWidget {
scrollDirection: Axis.horizontal,
addAutomaticKeepAlives: false,
addRepaintBoundaries: false,
shrinkWrap: true,
itemCount: snapshot.data!.length,
itemBuilder: (context, index) =>
FollowedEpisodeComponent(
Expand Down
1 change: 0 additions & 1 deletion lib/views/calendar_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ class _CalendarViewState extends State<CalendarView> {
child: ListView.builder(
addAutomaticKeepAlives: false,
addRepaintBoundaries: false,
shrinkWrap: true,
controller: AnimeWeeklyController.instance.scrollController,
itemCount: children.length,
itemBuilder: (context, index) => children[index],
Expand Down
3 changes: 1 addition & 2 deletions lib/views/followed_animes_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class _FollowedAnimesViewState extends State<FollowedAnimesView> {

@override
void dispose() {
FollowedAnimeController.instance.init();
FollowedAnimeController.instance.dispose();
super.dispose();
}

Expand Down Expand Up @@ -62,7 +62,6 @@ class _FollowedAnimesViewState extends State<FollowedAnimesView> {
return ListView.builder(
addAutomaticKeepAlives: false,
addRepaintBoundaries: false,
shrinkWrap: true,
controller: FollowedAnimeController.instance.scrollController,
itemCount: list.length,
itemBuilder: (context, index) => list[index],
Expand Down
3 changes: 1 addition & 2 deletions lib/views/followed_episodes_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class _FollowedEpisodesViewState extends State<FollowedEpisodesView> {

@override
void dispose() {
FollowedEpisodeController.instance.init();
FollowedEpisodeController.instance.dispose();
super.dispose();
}

Expand All @@ -40,7 +40,6 @@ class _FollowedEpisodesViewState extends State<FollowedEpisodesView> {
return ListView.builder(
addAutomaticKeepAlives: false,
addRepaintBoundaries: false,
shrinkWrap: true,
controller: FollowedEpisodeController.instance.scrollController,
itemCount: snapshot.data!.length,
itemBuilder: (context, index) =>
Expand Down
2 changes: 0 additions & 2 deletions lib/views/home_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class HomeView extends StatelessWidget {
child: ListView.builder(
addAutomaticKeepAlives: false,
addRepaintBoundaries: false,
shrinkWrap: true,
controller: EpisodeController.instance.scrollController,
itemCount: snapshot.data!.length + 1,
itemBuilder: (context, index) => index == 0
Expand Down Expand Up @@ -86,7 +85,6 @@ class MissedAnimesRow extends StatelessWidget {
scrollDirection: Axis.horizontal,
addAutomaticKeepAlives: false,
addRepaintBoundaries: false,
shrinkWrap: true,
controller:
MissedAnimeController.instance.scrollController,
itemCount: snapshot.data!.length,
Expand Down
1 change: 0 additions & 1 deletion lib/views/search_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ class _SearchViewState extends State<SearchView> {
return ListView.builder(
addAutomaticKeepAlives: false,
addRepaintBoundaries: false,
shrinkWrap: true,
controller: AnimeSearchController.instance.scrollController,
itemCount: list.length,
itemBuilder: (context, index) => list[index],
Expand Down
1 change: 0 additions & 1 deletion lib/views/simulcast_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class SimulcastView extends StatelessWidget {
child: ListView.builder(
addAutomaticKeepAlives: false,
addRepaintBoundaries: false,
shrinkWrap: true,
controller: AnimeController.instance.scrollController,
itemCount: list.length + 1,
itemBuilder: (context, index) => index == 0
Expand Down
8 changes: 8 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.0"
dart_code_metrics_presets:
dependency: "direct dev"
description:
name: dart_code_metrics_presets
sha256: "2a889a92995fadaf770ee9d08792dd04ae0259029600be55554b6790f1b5da38"
url: "https://pub.dev"
source: hosted
version: "2.16.0"
dart_style:
dependency: transitive
description:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ dependencies:

dev_dependencies:
build_runner: ^2.4.12
dart_code_metrics_presets: ^2.16.0
flutter_launcher_icons: ^0.13.1
flutter_lints: ^4.0.0
flutter_native_splash: ^2.4.1
Expand Down

0 comments on commit f299582

Please sign in to comment.