diff --git a/lib/app/modules/home/controllers/home_controller.dart b/lib/app/modules/home/controllers/home_controller.dart index afaf163..7d62645 100644 --- a/lib/app/modules/home/controllers/home_controller.dart +++ b/lib/app/modules/home/controllers/home_controller.dart @@ -21,6 +21,8 @@ class HomepageController extends GetxController late MangaandAnimeRepository mangaRepository; + late TextEditingController textController; + late MangaandAnimeRepository animeRepository; RxInt selectedIndex = 0.obs; @@ -43,6 +45,7 @@ class HomepageController extends GetxController @override void onInit() { + textController = TextEditingController(); mangaRepository = MangaandAnimeRepository( manga: true, type: 'MANGA', diff --git a/lib/app/modules/home/views/home_view.dart b/lib/app/modules/home/views/home_view.dart index f064237..ef3a6ac 100644 --- a/lib/app/modules/home/views/home_view.dart +++ b/lib/app/modules/home/views/home_view.dart @@ -24,7 +24,7 @@ class Homepage extends GetView { return SliverAppBar( backgroundColor: AppColors().background(context), surfaceTintColor: AppColors().background(context), - actions: actions(context, controller.manga), + actions: actions(context), floating: false, ); } diff --git a/lib/app/modules/home/widgets/hero_image.dart b/lib/app/modules/home/widgets/hero_image.dart index 8e25ee5..f8e67e5 100644 --- a/lib/app/modules/home/widgets/hero_image.dart +++ b/lib/app/modules/home/widgets/hero_image.dart @@ -10,6 +10,7 @@ class HeroImage extends StatelessWidget { required this.h, required this.w, this.logo = true, + this.hero = true, required this.dataProvider, }); @@ -17,6 +18,7 @@ class HeroImage extends StatelessWidget { final double w; final Media dataProvider; final bool logo; + final bool hero; @override Widget build(BuildContext context) { @@ -25,79 +27,82 @@ class HeroImage extends StatelessWidget { dataProvider.coverImage!.medium ?? 'https://convertingcolors.com/plain-1E2436.svg'; - return Hero( - tag: ObjectKey(dataProvider.idr), - child: Stack( - fit: StackFit.expand, - clipBehavior: Clip.none, - alignment: Alignment.bottomCenter, - children: [ - BuildImageWidget( - filterQuality: FilterQuality.medium, - imageUrl: imageUrl, - borderradius: logo ? 15 : 8, - fit: (GetPlatform.isWeb) - ? (MediaQuery.of(context).size.height >= 900) - ? BoxFit.cover - : BoxFit.cover - : BoxFit.cover, - ), - logo - ? const Positioned( - // width: 40, - // height: 40, - bottom: -0.5, - left: -0.5, - child: CardS( - height: 30, - width: 30, - borderRadius: BorderRadius.only( - topRight: Radius.circular(10), - bottomLeft: Radius.circular(7.5), + return HeroMode( + enabled: hero, + child: Hero( + tag: ObjectKey(dataProvider.idr), + child: Stack( + fit: StackFit.expand, + clipBehavior: Clip.none, + alignment: Alignment.bottomCenter, + children: [ + BuildImageWidget( + filterQuality: FilterQuality.medium, + imageUrl: imageUrl, + borderradius: logo ? 15 : 8, + fit: (GetPlatform.isWeb) + ? (MediaQuery.of(context).size.height >= 900) + ? BoxFit.cover + : BoxFit.cover + : BoxFit.cover, + ), + logo + ? const Positioned( + // width: 40, + // height: 40, + bottom: -0.5, + left: -0.5, + child: CardS( + height: 30, + width: 30, + borderRadius: BorderRadius.only( + topRight: Radius.circular(10), + bottomLeft: Radius.circular(7.5), + ), + image: true, ), - image: true, - ), - ) - : Container() + ) + : Container() - // : Positioned( - // bottom: -4.5, - // height: 70, - // width: w / 2.195, - // child: Opacity( - // opacity: 0.9, - // child: Card( - // shape: RoundedRectangleBorder( - // borderRadius: BorderRadius.circular(0.0), - // ), - // child: Padding( - // padding: const EdgeInsets.all(2.0), - // child: Column( - // textBaseline: TextBaseline.alphabetic, - // mainAxisAlignment: MainAxisAlignment.center, - // children: [ - // Text( - // title, - // textAlign: TextAlign.center, - // maxLines: 3, - // style: Theme.of(context) - // .textTheme - // .headline6! - // .copyWith( - // color: Colors.white, - // fontWeight: FontWeight.w600, - // fontSize: 14, - // ), - // textDirection: TextDirection.ltr, - // overflow: TextOverflow.ellipsis, - // ), - // ], - // ), - // ), - // ), - // ), - // ), - ], + // : Positioned( + // bottom: -4.5, + // height: 70, + // width: w / 2.195, + // child: Opacity( + // opacity: 0.9, + // child: Card( + // shape: RoundedRectangleBorder( + // borderRadius: BorderRadius.circular(0.0), + // ), + // child: Padding( + // padding: const EdgeInsets.all(2.0), + // child: Column( + // textBaseline: TextBaseline.alphabetic, + // mainAxisAlignment: MainAxisAlignment.center, + // children: [ + // Text( + // title, + // textAlign: TextAlign.center, + // maxLines: 3, + // style: Theme.of(context) + // .textTheme + // .headline6! + // .copyWith( + // color: Colors.white, + // fontWeight: FontWeight.w600, + // fontSize: 14, + // ), + // textDirection: TextDirection.ltr, + // overflow: TextOverflow.ellipsis, + // ), + // ], + // ), + // ), + // ), + // ), + // ), + ], + ), ), ); } diff --git a/lib/app/modules/home/widgets/item_builder/grid_2.dart b/lib/app/modules/home/widgets/item_builder/grid_2.dart index e411156..a40c908 100644 --- a/lib/app/modules/home/widgets/item_builder/grid_2.dart +++ b/lib/app/modules/home/widgets/item_builder/grid_2.dart @@ -33,14 +33,15 @@ Widget grid2(Media media, BuildContext context, double w, double h, int index) { } else if (flex >= 2 && flex <= 4) { flex = 12; return flex; - } else if (flex >= 5 && flex < 7) { + } else if (flex >= 5 && flex <= 6) { flex = 16; return flex; } else if (flex >= 7) { flex = 24; return flex; + } else { + flex = 24; } - flex = 24; return flex; } @@ -60,6 +61,7 @@ Widget grid2(Media media, BuildContext context, double w, double h, int index) { data: const Size(500, 400), child: HeroImage( logo: false, + hero: false, h: h, w: w, dataProvider: media, diff --git a/lib/app/modules/home/widgets/my_search_delegate.dart b/lib/app/modules/home/widgets/my_search_delegate.dart index 1aa7be0..eb547a2 100644 --- a/lib/app/modules/home/widgets/my_search_delegate.dart +++ b/lib/app/modules/home/widgets/my_search_delegate.dart @@ -2,11 +2,11 @@ import 'package:ani_search/app/data/api_graphql_media_model.dart'; import 'package:ani_search/app/data/repositories/search_repository.dart'; -import 'package:ani_search/app/modules/details/view/details_view.dart'; import 'package:ani_search/app/modules/home/controllers/home_controller.dart'; import 'package:ani_search/app/modules/home/widgets/hero_image.dart'; import 'package:ani_search/app/modules/home/widgets/hero_title.dart'; import 'package:ani_search/app/core/themes/app_colors.dart'; +import 'package:ani_search/app/routes/app_pages.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; @@ -107,6 +107,7 @@ class MySearchDelegate extends SearchDelegate { body: querym ? grid : LoadingMoreList( + key: PageStorageKey(searchRepository.isSuccess), ListConfig( autoLoadMore: false, autoRefresh: true, @@ -229,21 +230,9 @@ Widget _itemBuilder(BuildContext context, Media media, int index) { GestureDetector grid1(double h, double w, Media media, BuildContext context) { return GestureDetector( onTap: () { - const transitionDuration = Duration(milliseconds: 600); - Navigator.of(context).push( - PageRouteBuilder( - settings: RouteSettings( - arguments: media, - ), - transitionDuration: transitionDuration, - reverseTransitionDuration: transitionDuration, - pageBuilder: (_, animation, __) { - return FadeTransition( - opacity: animation, - child: const MangaDetailsR(), - ); - }, - ), + Get.toNamed( + Routes.details, + arguments: media, ); }, child: Padding( @@ -255,6 +244,7 @@ GestureDetector grid1(double h, double w, Media media, BuildContext context) { child: HeroImage( h: h, w: w, + hero: false, dataProvider: media, ), ), diff --git a/lib/app/modules/home/widgets/widgets_model_list.dart b/lib/app/modules/home/widgets/widgets_model_list.dart index 5f45500..b076de2 100644 --- a/lib/app/modules/home/widgets/widgets_model_list.dart +++ b/lib/app/modules/home/widgets/widgets_model_list.dart @@ -1,6 +1,6 @@ +import 'package:ani_search/app/core/themes/app_colors.dart'; import 'package:ani_search/app/modules/home/widgets/my_search_delegate.dart'; import 'package:flutter/material.dart'; -import 'package:get/get.dart'; Widget buildSheet() => Padding( padding: const EdgeInsets.symmetric(horizontal: 24), @@ -56,50 +56,53 @@ Widget buildSheet() => Padding( // ), // ]; -List actions(BuildContext context, RxBool manga) => [ - Padding( - padding: const EdgeInsets.only(right: 10.0), - child: Material( - type: MaterialType.button, - borderRadius: BorderRadius.circular(12), - color: Theme.of(context).colorScheme.background, - child: IconButton( - // autofocus: true, - onPressed: () { - showSearch( - context: context, - delegate: MySearchDelegate(), - ); - }, - icon: const Icon(Icons.search), - ), +List actions(BuildContext context) { + // final controller = Get.find(); + + return [ + Padding( + padding: const EdgeInsets.only(right: 10.0), + child: Material( + type: MaterialType.button, + borderRadius: BorderRadius.circular(12), + color: Theme.of(context).colorScheme.background, + child: IconButton( + autofocus: true, + onPressed: () { + showSearch( + context: context, + delegate: MySearchDelegate(), + ); + }, + icon: const Icon(Icons.search), ), ), - Padding( - padding: const EdgeInsets.only(right: 10.0), - child: Material( - clipBehavior: Clip.antiAlias, - type: MaterialType.button, - borderRadius: BorderRadius.circular(12), - color: Theme.of(context).colorScheme.background, - child: IconButton( - // autofocus: true, - onPressed: () { - showModalBottomSheet( - backgroundColor: Colors.transparent, - // isScrollControlled: true, - context: context, - // shape: const RoundedRectangleBorder( - // borderRadius: BorderRadius.vertical( - // top: Radius.circular(20), - // ), - // ), - // isScrollControlled: true, - builder: (context) => buildSheet(), - ); - }, - icon: const Icon(Icons.filter_list_rounded), - ), + ), + Padding( + padding: const EdgeInsets.only(right: 10.0), + child: Material( + type: MaterialType.button, + borderRadius: BorderRadius.circular(12), + color: AppColors().background(context), + child: IconButton( + // autofocus: true, + onPressed: () { + showModalBottomSheet( + backgroundColor: Colors.transparent, + // isScrollControlled: true, + context: context, + // shape: const RoundedRectangleBorder( + // borderRadius: BorderRadius.vertical( + // top: Radius.circular(20), + // ), + // ), + // isScrollControlled: true, + builder: (context) => buildSheet(), + ); + }, + icon: const Icon(Icons.filter_list_rounded), ), ), - ]; + ), + ]; +} diff --git a/pubspec.lock b/pubspec.lock index d186d7d..2608440 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -312,13 +312,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.0" - flutter_svg: - dependency: "direct main" - description: - name: flutter_svg - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.1+1" flutter_test: dependency: "direct dev" description: flutter @@ -513,13 +506,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "4.5.0" - lazy_load_scrollview: - dependency: "direct main" - description: - name: lazy_load_scrollview - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" lints: dependency: transitive description: @@ -625,20 +611,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.8.1" - path_drawing: - dependency: transitive - description: - name: path_drawing - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.0" - path_parsing: - dependency: transitive - description: - name: path_parsing - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.0" path_provider: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index c1627d3..2a12d65 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,9 +18,7 @@ dependencies: provider: ^6.0.3 get: ^4.6.5 sliver_tools: ^0.2.7 - flutter_svg: ^1.1.1+1 # get_it: ^7.2.0 - lazy_load_scrollview: 1.3.0 percent_indicator: ^4.0.1 flutter_layout_grid: ^2.0.1 boxy: ^2.0.6+1 @@ -65,6 +63,8 @@ dependencies: # id uuid: 3.0.6 + # searchbar_animation: ^0.0.2 + dev_dependencies: flutter_test: sdk: flutter