Skip to content

Commit

Permalink
Merge pull request #31 from joaojsrbr/dev
Browse files Browse the repository at this point in the history
initial commit
  • Loading branch information
joaojsrbr authored Jul 19, 2022
2 parents 6d1840d + e1d3dfa commit 7f2ea2b
Show file tree
Hide file tree
Showing 8 changed files with 139 additions and 164 deletions.
3 changes: 3 additions & 0 deletions lib/app/modules/home/controllers/home_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class HomepageController extends GetxController

late MangaandAnimeRepository mangaRepository;

late TextEditingController textController;

late MangaandAnimeRepository animeRepository;

RxInt selectedIndex = 0.obs;
Expand All @@ -43,6 +45,7 @@ class HomepageController extends GetxController

@override
void onInit() {
textController = TextEditingController();
mangaRepository = MangaandAnimeRepository(
manga: true,
type: 'MANGA',
Expand Down
2 changes: 1 addition & 1 deletion lib/app/modules/home/views/home_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Homepage extends GetView<HomepageController> {
return SliverAppBar(
backgroundColor: AppColors().background(context),
surfaceTintColor: AppColors().background(context),
actions: actions(context, controller.manga),
actions: actions(context),
floating: false,
);
}
Expand Down
147 changes: 76 additions & 71 deletions lib/app/modules/home/widgets/hero_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ class HeroImage extends StatelessWidget {
required this.h,
required this.w,
this.logo = true,
this.hero = true,
required this.dataProvider,
});

final double h;
final double w;
final Media dataProvider;
final bool logo;
final bool hero;

@override
Widget build(BuildContext context) {
Expand All @@ -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,
// ),
// ],
// ),
// ),
// ),
// ),
// ),
],
),
),
);
}
Expand Down
6 changes: 4 additions & 2 deletions lib/app/modules/home/widgets/item_builder/grid_2.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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,
Expand Down
22 changes: 6 additions & 16 deletions lib/app/modules/home/widgets/my_search_delegate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -107,6 +107,7 @@ class MySearchDelegate extends SearchDelegate {
body: querym
? grid
: LoadingMoreList(
key: PageStorageKey(searchRepository.isSuccess),
ListConfig<Media>(
autoLoadMore: false,
autoRefresh: true,
Expand Down Expand Up @@ -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(
Expand All @@ -255,6 +244,7 @@ GestureDetector grid1(double h, double w, Media media, BuildContext context) {
child: HeroImage(
h: h,
w: w,
hero: false,
dataProvider: media,
),
),
Expand Down
91 changes: 47 additions & 44 deletions lib/app/modules/home/widgets/widgets_model_list.dart
Original file line number Diff line number Diff line change
@@ -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),
Expand Down Expand Up @@ -56,50 +56,53 @@ Widget buildSheet() => Padding(
// ),
// ];

List<Widget> actions(BuildContext context, RxBool manga) => <Widget>[
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<Widget> actions(BuildContext context) {
// final controller = Get.find<HomepageController>();

return <Widget>[
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),
),
),
];
),
];
}
Loading

0 comments on commit 7f2ea2b

Please sign in to comment.