diff --git a/lib/components/utils/debounce.dart b/lib/components/utils/debounce.dart index a523827..6b10be1 100644 --- a/lib/components/utils/debounce.dart +++ b/lib/components/utils/debounce.dart @@ -12,7 +12,7 @@ class Debounce { static void run ( VoidCallback action, { - Duration delay = const Duration(milliseconds: 5000), + Duration delay = const Duration(milliseconds: 2000), }) { _timer?.cancel(); _timer = Timer(delay, action); diff --git a/lib/data/dtos/cats_dto.dart b/lib/data/dtos/cats_dto.dart index 375b949..2c8fff2 100644 --- a/lib/data/dtos/cats_dto.dart +++ b/lib/data/dtos/cats_dto.dart @@ -19,7 +19,7 @@ class CatDataDto { final String? origin; final String? length; - const CatDataDto({this.id, this.imageLink, this.name, this.origin, this.length}); + const CatDataDto({this.imageLink, this.name, this.origin, this.length}); factory CatDataDto.fromJson(Map json) => _$CatDataDtoFromJson(json); } \ No newline at end of file diff --git a/lib/data/dtos/cats_dto.g.dart b/lib/data/dtos/cats_dto.g.dart index 7fac819..a9c1a94 100644 --- a/lib/data/dtos/cats_dto.g.dart +++ b/lib/data/dtos/cats_dto.g.dart @@ -13,7 +13,6 @@ CatsDto _$CatsDtoFromJson(List json) => CatsDto( ); CatDataDto _$CatDataDtoFromJson(Map json) => CatDataDto( - id: json['id'] as String?, imageLink: json['image_link'] as String?, name: json['name'] as String?, origin: json['origin'] as String?, diff --git a/lib/main.dart b/lib/main.dart index 97cbb47..ddb4135 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; +import 'package:pmu/data/repositories/cats_repository.dart'; import 'package:pmu/presentation/home_page/home_page.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:pmu/presentation/home_page/bloc/bloc.dart'; -import 'data/repositories/cats_repository.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; void main() { runApp(const MyApp()); diff --git a/lib/presentation/home_page/home_page.dart b/lib/presentation/home_page/home_page.dart index 3411680..7cd86c2 100644 --- a/lib/presentation/home_page/home_page.dart +++ b/lib/presentation/home_page/home_page.dart @@ -1,10 +1,9 @@ -import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter/material.dart'; import 'package:pmu/components/utils/debounce.dart'; -import 'package:pmu/data/repositories/cats_repository.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:pmu/domain/models/card.dart'; -import 'package:pmu/main.dart'; +import 'package:pmu/data/repositories/cats_repository.dart'; import 'package:pmu/presentation/details_page/details_page.dart'; import 'package:pmu/presentation/home_page/bloc/bloc.dart'; import 'package:pmu/presentation/home_page/bloc/events.dart'; @@ -23,10 +22,9 @@ class MyHomePage extends StatefulWidget { } class _MyHomePageState extends State { - @override Widget build(BuildContext context) { - return const Scaffold(body: Body()); + return Scaffold(body: Body()); } } @@ -34,10 +32,10 @@ class Body extends StatefulWidget { const Body(); @override - State createState() => BodyState(); + State createState() => _BodyState(); } -class BodyState extends State { +class _BodyState extends State { final searchController = TextEditingController(); final scrollController = ScrollController(); @@ -48,6 +46,7 @@ class BodyState extends State { }); scrollController.addListener(_onNextPageListener); + super.initState(); } @@ -89,7 +88,7 @@ class BodyState extends State { builder: (context, state) => state.error != null ? Text( state.error ?? '', - style: Theme.of(context).textTheme.headlineSmall?.copyWith(color: Colors.deepPurple), + style: Theme.of(context).textTheme.headlineSmall?.copyWith(color: Colors.red), ) : state.isLoading ? const CircularProgressIndicator() @@ -144,9 +143,8 @@ class BodyState extends State { 'You ${isLiked ? 'like!' : 'disliked :('} $title ', style: Theme.of(context).textTheme.bodyLarge, ), - backgroundColor: Colors.purpleAccent, + backgroundColor: Colors.deepPurple.shade600, duration: const Duration(seconds: 1), )); }); - } -} \ No newline at end of file + }} \ No newline at end of file