Skip to content

Commit

Permalink
Merge pull request #30 from joaojsrbr/dev
Browse files Browse the repository at this point in the history
initial commit
  • Loading branch information
joaojsrbr authored Jul 13, 2022
2 parents 08fa8fd + 1703cb7 commit 6d1840d
Show file tree
Hide file tree
Showing 8 changed files with 114 additions and 57 deletions.
67 changes: 67 additions & 0 deletions lib/app/core/themes/schemes/color_schemes.g.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import 'package:flutter/material.dart';

class RootCor {
ColorScheme lightColorScheme = const ColorScheme(
brightness: Brightness.light,
surfaceTint: Color(0xFF6750A4),
onErrorContainer: Color(0xFF410E0B),
onError: Color(0xFFFFFFFF),
errorContainer: Color(0xFFF9DEDC),
onTertiaryContainer: Color(0xFF31111D),
onTertiary: Color(0xFFFFFFFF),
tertiaryContainer: Color(0xFFFFD8E4),
tertiary: Color(0xFF7D5260),
shadow: Color(0xFF000000),
error: Color(0xFFB3261E),
outline: Color(0xFF79747E),
onBackground: Color(0xFF1C1B1F),
background: Color(0xFFFFFBFE),
onInverseSurface: Color(0xFFF4EFF4),
inverseSurface: Color(0xFF313033),
onSurfaceVariant: Color(0xFF49454F),
onSurface: Color(0xFF1C1B1F),
surfaceVariant: Color(0xFFE7E0EC),
surface: Color(0xFFFFFBFE),
onSecondaryContainer: Color(0xFF1D192B),
onSecondary: Color(0xFFFFFFFF),
secondaryContainer: Color(0xFFE8DEF8),
secondary: Color(0xFF625B71),
inversePrimary: Color(0xFFD0BCFF),
onPrimaryContainer: Color(0xFF21005D),
onPrimary: Color(0xFFFFFFFF),
primaryContainer: Color(0xFFEADDFF),
primary: Color(0xFF6750A4),
);

ColorScheme darkColorScheme = const ColorScheme(
brightness: Brightness.dark,
surfaceTint: Color(0xFFD0BCFF),
onErrorContainer: Color(0xFFF2B8B5),
onError: Color(0xFF601410),
errorContainer: Color(0xFF8C1D18),
onTertiaryContainer: Color(0xFFFFD8E4),
onTertiary: Color(0xFF492532),
tertiaryContainer: Color(0xFF633B48),
tertiary: Color(0xFFEFB8C8),
shadow: Color(0xFF000000),
error: Color(0xFFF2B8B5),
outline: Color(0xFF938F99),
onBackground: Color(0xFFE6E1E5),
background: Color(0xFF1C1B1F),
onInverseSurface: Color(0xFF313033),
inverseSurface: Color(0xFFE6E1E5),
onSurfaceVariant: Color(0xFFCAC4D0),
onSurface: Color(0xFFE6E1E5),
surfaceVariant: Color(0xFF49454F),
surface: Color(0xFF1C1B1F),
onSecondaryContainer: Color(0xFFE8DEF8),
onSecondary: Color(0xFF332D41),
secondaryContainer: Color(0xFF4A4458),
secondary: Color(0xFFCCC2DC),
inversePrimary: Color(0xFF6750A4),
onPrimaryContainer: Color(0xFFEADDFF),
onPrimary: Color(0xFF381E72),
primaryContainer: Color(0xFF4F378B),
primary: Color(0xFFD0BCFF),
);
}
2 changes: 1 addition & 1 deletion lib/app/modules/details/bindings/details_binding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import 'package:get/get.dart';
class DetailsBinding implements Bindings {
@override
void dependencies() {
Get.put(DetailsController());
Get.lazyPut(() => DetailsController());
}
}
22 changes: 21 additions & 1 deletion lib/app/modules/details/controllers/details_controller.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';

class DetailsController extends GetxController {}
class DetailsController extends GetxController
with GetTickerProviderStateMixin {
late TabController tabController;

@override
void onInit() {
tabController = TabController(
initialIndex: 0,
length: 5,
vsync: this,
);
super.onInit();
}

@override
void onClose() {
tabController.dispose();
super.onClose();
}
}
32 changes: 5 additions & 27 deletions lib/app/modules/details/view/details_view.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// ignore_for_file: public_member_api_docs, sort_constructors_first, must_be_immutable

import 'package:ani_search/app/core/utils/i18n/repositories/locale_provider.dart';
import 'package:ani_search/app/modules/details/controllers/details_controller.dart';
import 'package:ani_search/app/modules/home/widgets/home_export_widgets.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_layout_grid/flutter_layout_grid.dart';
import 'package:flutter_widget_from_html_core/flutter_widget_from_html_core.dart';
import 'package:get/get.dart';

import 'package:provider/provider.dart';

Expand All @@ -17,33 +19,9 @@ extension on num {
double get vh => _viewportSize.height * (this);
}

class MangaDetailsR extends StatefulWidget {
class MangaDetailsR extends GetView<DetailsController> {
const MangaDetailsR({super.key});

@override
State<MangaDetailsR> createState() => _MangaDetailsRState();
}

class _MangaDetailsRState extends State<MangaDetailsR>
with TickerProviderStateMixin {
late TabController tabController;

@override
void initState() {
tabController = TabController(
initialIndex: 0,
length: 5,
vsync: this,
);
super.initState();
}

@override
void dispose() {
tabController.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
return LayoutBuilder(
Expand Down Expand Up @@ -76,7 +54,7 @@ class _MangaDetailsRState extends State<MangaDetailsR>
bottom: TabBar(
indicatorWeight: 1,
isScrollable: true,
controller: tabController,
controller: controller.tabController,
tabs: value.tabs
.map(
(e) => Tab(
Expand Down Expand Up @@ -158,7 +136,7 @@ class _MangaDetailsRState extends State<MangaDetailsR>
},
body: TabBarView(
physics: const NeverScrollableScrollPhysics(),
controller: tabController,
controller: controller.tabController,
children: [
Container(),
Container(),
Expand Down
14 changes: 6 additions & 8 deletions lib/app/modules/home/widgets/item_builder/grid_1.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import 'package:ani_search/app/data/api_graphql_media_model.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/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/routes/app_pages.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

Widget grid1(double h, double w, Media media, BuildContext context, int index) {
final controller = Get.find<HomepageController>();
// final controller = Get.find<HomepageController>();
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Column(
Expand All @@ -16,12 +17,9 @@ Widget grid1(double h, double w, Media media, BuildContext context, int index) {
Flexible(
child: GestureDetector(
onTap: () {
Get.to(
() => const MangaDetailsR(),
Get.toNamed(
Routes.details,
arguments: media,
curve: Curves.linear,
duration: controller.transitionDuration,
transition: Transition.native,
);
},
child: HeroImage(
Expand Down
12 changes: 4 additions & 8 deletions lib/app/modules/home/widgets/item_builder/grid_2.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import 'package:ani_search/app/data/api_graphql_media_model.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/routes/app_pages.dart';
import 'package:boxy/boxy.dart';
import 'package:boxy/flex.dart';
import 'package:flutter/material.dart';
Expand All @@ -15,7 +14,7 @@ Widget grid2(Media media, BuildContext context, double w, double h, int index) {
color: Colors.white,
);

final controller = Get.find<HomepageController>();
// final controller = Get.find<HomepageController>();

final publishing = 'Publishing'.i18n();

Expand Down Expand Up @@ -47,12 +46,9 @@ Widget grid2(Media media, BuildContext context, double w, double h, int index) {

return GestureDetector(
onTap: () {
Get.to(
() => const MangaDetailsR(),
Get.toNamed(
Routes.details,
arguments: media,
curve: Curves.linear,
duration: controller.transitionDuration,
transition: Transition.native,
);
},
child: CustomBoxy(
Expand Down
15 changes: 3 additions & 12 deletions lib/app/my_app.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:ani_search/app/core/themes/schemes/color_schemes.g.dart';
import 'package:ani_search/app/core/themes/text_theme.dart';
import 'package:ani_search/app/core/utils/scrollbehavior.dart';
import 'package:ani_search/app/modules/home/bindings/home_binding.dart';
Expand Down Expand Up @@ -51,18 +52,8 @@ class MyApp extends StatelessWidget {

darkColorScheme = darkDynamic.harmonized();
} else {
lightColorScheme = ColorScheme.fromSeed(
seedColor: const Color.fromARGB(255, 231, 129, 6),
background: const Color.fromRGBO(35, 36, 54, 1),
surfaceTint: const Color.fromRGBO(35, 36, 54, 1),
brightness: Brightness.light,
);
darkColorScheme = ColorScheme.fromSeed(
seedColor: const Color.fromARGB(255, 231, 197, 6),
background: const Color.fromRGBO(35, 36, 54, 1),
surfaceTint: const Color.fromRGBO(35, 36, 54, 1),
brightness: Brightness.dark,
);
lightColorScheme = RootCor().lightColorScheme;
darkColorScheme = RootCor().darkColorScheme;
}
return GetMaterialApp(
color: Theme.of(context).colorScheme.background,
Expand Down
7 changes: 7 additions & 0 deletions lib/app/routes/app_pages.dart
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
import 'package:ani_search/app/modules/details/bindings/details_binding.dart';
import 'package:ani_search/app/modules/details/view/details_view.dart';
import 'package:ani_search/app/modules/home/views/home_view.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
part 'app_routes.dart';

class AppPages {
AppPages._();
static final routes = [
GetPage(
curve: Curves.linear,
transitionDuration: const Duration(milliseconds: 600),
transition: Transition.native,
name: _Paths.home,
page: () => const Homepage(),
// binding: HomePageBinding(),
),
GetPage(
curve: Curves.linear,
transitionDuration: const Duration(milliseconds: 600),
transition: Transition.native,
name: _Paths.details,
page: () => const MangaDetailsR(),
binding: DetailsBinding(),
Expand Down

0 comments on commit 6d1840d

Please sign in to comment.