-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update deps add timeago update user search ui fixes
- Loading branch information
1 parent
cc7b23e
commit 6e75967
Showing
10 changed files
with
264 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
lib/src/presentation/pages/anime_details/widgets/details_fab.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
import '../../../../domain/models/anime.dart'; | ||
import '../../../../domain/models/animes.dart'; | ||
import 'user_anime_rate.dart'; | ||
|
||
class AnimeDetailsFAB extends StatelessWidget { | ||
final Anime data; | ||
final Animes animeData; | ||
|
||
const AnimeDetailsFAB( | ||
{super.key, required this.data, required this.animeData}); | ||
|
||
String getStatus(String value, int? c) { | ||
String status; | ||
|
||
const map = { | ||
'planned': 'В планах', | ||
'watching': 'Смотрю', | ||
'rewatching': 'Пересматриваю', | ||
'completed': 'Просмотрено', | ||
'on_hold': 'Отложено', | ||
'dropped': 'Брошено' | ||
}; | ||
|
||
status = map[value] ?? ''; | ||
|
||
return (c != 0 && value == 'watching') ? '$status (Серия $c)' : status; | ||
} | ||
|
||
IconData getIcon(String value) { | ||
IconData icon; | ||
|
||
const map = { | ||
'planned': Icons.event_available, | ||
'watching': Icons.remove_red_eye, | ||
'rewatching': Icons.refresh, | ||
'completed': Icons.done_all, | ||
'on_hold': Icons.pause, | ||
'dropped': Icons.close | ||
}; | ||
|
||
icon = map[value] ?? Icons.edit; | ||
|
||
return icon; | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return FloatingActionButton.extended( | ||
onPressed: () => showModalBottomSheet<void>( | ||
context: context, | ||
constraints: BoxConstraints( | ||
maxWidth: | ||
MediaQuery.of(context).size.width >= 700 ? 700 : double.infinity, | ||
), | ||
useRootNavigator: true, | ||
isScrollControlled: true, | ||
enableDrag: false, | ||
useSafeArea: true, | ||
builder: (context) { | ||
return SafeArea( | ||
child: AnimeUserRateBottomSheet( | ||
data: data, | ||
anime: animeData, | ||
), | ||
); | ||
}, | ||
), | ||
label: data.userRate == null | ||
? const Text('Добавить в список') | ||
: Text(getStatus( | ||
data.userRate!.status ?? 'Изменить', data.userRate!.episodes)), | ||
icon: data.userRate == null | ||
? const Icon(Icons.add) | ||
: Icon(getIcon(data.userRate!.status ?? '')), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.