diff --git a/lib/data/dtos/characters_dto.g.dart b/lib/data/dtos/characters_dto.g.dart new file mode 100644 index 0000000..bd8c5d9 --- /dev/null +++ b/lib/data/dtos/characters_dto.g.dart @@ -0,0 +1,33 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'characters_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CharactersDto _$CharactersDtoFromJson(Map json) => + CharactersDto( + data: (json['data'] as List?) + ?.map((e) => CharacterDataDto.fromJson(e as Map)) + .toList(), + ); + +CharacterDataDto _$CharacterDataDtoFromJson(Map json) => + CharacterDataDto( + id: json['id'] as String?, + type: json['type'] as String?, + attributes: json['attributes'] == null + ? null + : CharacterAttributesDataDto.fromJson( + json['attributes'] as Map), + ); + +CharacterAttributesDataDto _$CharacterAttributesDataDtoFromJson( + Map json) => + CharacterAttributesDataDto( + name: json['name'] as String?, + born: json['born'] as String?, + died: json['died'] as String?, + image: json['image'] as String?, + ); diff --git a/lib/view/home_page/home_page.dart b/lib/view/home_page/home_page.dart index ad1e539..736257d 100644 --- a/lib/view/home_page/home_page.dart +++ b/lib/view/home_page/home_page.dart @@ -84,6 +84,12 @@ class _BodyState extends State { super.initState(); } + @override + void dispose() { + searchController.dispose(); + super.dispose(); + } + @override Widget build(BuildContext context) { return Padding( @@ -108,17 +114,19 @@ class _BodyState extends State { builder: (context, snapshot) => SingleChildScrollView( child: snapshot.hasData ? Column( - mainAxisAlignment: MainAxisAlignment.center, - children: snapshot.data?.map((data) { - return _Comment.fromData( - data, - onAction: (String nickname, bool isLiked, bool isDisliked) => - _showSnackBar(context, nickname, isLiked, isDisliked), - onTap: () => _navToDetails(context, data), - ); - }).toList() ?? - [], - ) + mainAxisAlignment: MainAxisAlignment.center, + children: snapshot.data?.map((data) { + return _Comment.fromData( + data, + onAction: (String nickname, bool isLiked, + bool isDisliked) => + _showSnackBar(context, nickname, isLiked, + isDisliked), + onTap: () => _navToDetails(context, data), + ); + }).toList() ?? + [], + ) : const CircularProgressIndicator(), ), ),