Skip to content

Commit

Permalink
Fix resize problems
Browse files Browse the repository at this point in the history
  • Loading branch information
hazarbelge committed Sep 5, 2021
1 parent 622d46d commit 78be39b
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 108 deletions.
2 changes: 1 addition & 1 deletion lib/controllers/detail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class DetailPageController extends SuperController<Map<String, dynamic>> {

@override
void onInactive() {
debugPrint('onInative called');
debugPrint('onInactive called');
}

@override
Expand Down
2 changes: 1 addition & 1 deletion lib/controllers/home_movie/home_movie.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class HomeMovieScreenController extends SuperController<dynamic> {

@override
void onInactive() {
debugPrint('onInative called');
debugPrint('onInactive called');
}

@override
Expand Down
2 changes: 1 addition & 1 deletion lib/controllers/home_tv/home_tv.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class HomeTvScreenController extends SuperController<dynamic> {

@override
void onInactive() {
debugPrint('onInative called');
debugPrint('onInactive called');
}

@override
Expand Down
110 changes: 57 additions & 53 deletions lib/ui/screens/detail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,62 +13,66 @@ class DetailPage extends GetView<DetailPageController> {
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Get.isDarkMode ? Colors.black : Colors.white,
body: SingleChildScrollView(
child: Stack(
children: <Widget>[
if (controller.isMovie == null)
const SizedBox()
else if (controller.isMovie!)
Column(
children: <Widget>[
HeaderDetail(
title: controller.movie!.title ?? "",
imageBanner: 'https://image.tmdb.org/t/p/original${controller.movie!.backdropPath ?? ""}',
imagePoster: 'https://image.tmdb.org/t/p/w185${controller.movie!.posterPath ?? ""}',
rating: double.parse(controller.movie!.voteAverage ?? "0"),
genre: controller.movie!.genreIds?.take(3).map(createGenreContainer).toList() ?? <Widget>[],
movieId: controller.movie!.id,
isMovie: true,
),
Padding(
padding: const EdgeInsets.all(20.0),
child: Overview(
overview: controller.movie!.overview ?? "",
body: SizedBox(
height: double.infinity,
width: double.infinity,
child: SingleChildScrollView(
child: Stack(
children: <Widget>[
if (controller.isMovie == null)
const SizedBox()
else if (controller.isMovie!)
Column(
children: <Widget>[
HeaderDetail(
title: controller.movie!.title ?? "",
imageBanner: 'https://image.tmdb.org/t/p/original${controller.movie!.backdropPath ?? ""}',
imagePoster: 'https://image.tmdb.org/t/p/w185${controller.movie!.posterPath ?? ""}',
rating: double.parse(controller.movie!.voteAverage ?? "0"),
genre: controller.movie!.genreIds?.take(3).map(createGenreContainer).toList() ?? <Widget>[],
movieId: controller.movie!.id,
isMovie: true,
),
),
const SizedBox(height: 50.0),
],
)
else
Column(
children: <Widget>[
HeaderDetail(
title: controller.tvSeries!.name ?? "",
imageBanner: 'https://image.tmdb.org/t/p/original${controller.tvSeries!.backdropPath ?? ""}',
imagePoster: 'https://image.tmdb.org/t/p/w185${controller.tvSeries!.posterPath ?? ""}',
rating: double.parse(controller.tvSeries!.voteAverage ?? "0"),
genre: controller.tvSeries!.genreIds?.take(3).map(createGenreContainer).toList() ?? <Widget>[],
movieId: controller.tvSeries!.id,
isMovie: false,
),
Padding(
padding: const EdgeInsets.all(20.0),
child: Overview(
overview: controller.tvSeries!.overview ?? "",
Padding(
padding: const EdgeInsets.all(20.0),
child: Overview(
overview: controller.movie!.overview ?? "",
),
),
),
const SizedBox(height: 50.0),
],
),
Positioned(
top: 20,
left: 5,
child: IconButton(
icon: const Icon(Icons.arrow_back, size: 36),
onPressed: () => Get.back(),
const SizedBox(height: 50.0),
],
)
else
Column(
children: <Widget>[
HeaderDetail(
title: controller.tvSeries!.name ?? "",
imageBanner: 'https://image.tmdb.org/t/p/original${controller.tvSeries!.backdropPath ?? ""}',
imagePoster: 'https://image.tmdb.org/t/p/w185${controller.tvSeries!.posterPath ?? ""}',
rating: double.parse(controller.tvSeries!.voteAverage ?? "0"),
genre: controller.tvSeries!.genreIds?.take(3).map(createGenreContainer).toList() ?? <Widget>[],
movieId: controller.tvSeries!.id,
isMovie: false,
),
Padding(
padding: const EdgeInsets.all(20.0),
child: Overview(
overview: controller.tvSeries!.overview ?? "",
),
),
const SizedBox(height: 50.0),
],
),
Positioned(
top: 20,
left: 5,
child: IconButton(
icon: const Icon(Icons.arrow_back, size: 36),
onPressed: () => Get.back(),
),
),
),
],
],
),
),
),
);
Expand Down
5 changes: 3 additions & 2 deletions lib/ui/screens/start.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ class StartScreen extends GetView<StartScreenController> {
return Scaffold(
backgroundColor: Get.isDarkMode ? Colors.black : Colors.white,
body: SizedBox(
height: Get.context?.height ?? Get.height,
width: Get.context?.width ?? Get.width,
height: double.infinity,
width: double.infinity,
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: const <Widget>[
StartIcon(),
HomeButtons(),
Expand Down
100 changes: 56 additions & 44 deletions lib/ui/widgets/header_detail.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'index.dart';

Expand Down Expand Up @@ -26,59 +28,69 @@ class HeaderDetail extends StatelessWidget {
Widget build(BuildContext context) {
return Stack(
children: <Widget>[
BannerImage(imageUrl: imageBanner),
Container(
width: double.infinity,
height: double.infinity,
color: Colors.black38,
child: BannerImage(imageUrl: imageBanner),
),
Positioned(
bottom: 10.0,
left: 16.0,
right: 16.0,
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Poster(
posterUrl: imagePoster,
height: 180.0,
),
const SizedBox(width: 16.0),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
padding: const EdgeInsets.all(10),
decoration: const BoxDecoration(
color: Colors.black38,
borderRadius: BorderRadius.all(Radius.circular(15)),
),
child: Text(
title,
style: const TextStyle(
color: Colors.white,
fontSize: 20,
fontWeight: FontWeight.bold,
child: SizedBox(
width: Get.context?.width ?? Get.width - 16,
height: 200,
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Poster(
posterUrl: imagePoster,
height: 200,
),
const SizedBox(width: 16.0),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
padding: const EdgeInsets.all(10),
decoration: const BoxDecoration(
color: Colors.black38,
borderRadius: BorderRadius.all(Radius.circular(15)),
),
child: Text(
title,
style: const TextStyle(
color: Colors.white,
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
const SizedBox(height: 8.0),
RatingRow(
rating: rating,
id: movieId,
isMovie: isMovie,
),
),
const SizedBox(height: 8.0),
RatingRow(
rating: rating,
id: movieId,
isMovie: isMovie,
),
const SizedBox(height: 12.0),
Padding(
padding: const EdgeInsets.only(right: 8.0),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: genre,
const SizedBox(height: 12.0),
Padding(
padding: const EdgeInsets.only(right: 8.0),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: genre,
),
),
),
),
],
],
),
),
),
],
],
),
),
),
],
Expand Down
17 changes: 11 additions & 6 deletions lib/ui/widgets/rating_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,23 @@ class _RatingRowState extends State<RatingRow> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
height: 40,
padding: const EdgeInsets.all(10),
decoration: const BoxDecoration(
color: Colors.black38,
borderRadius: BorderRadius.all(Radius.circular(15)),
),
child: Text(
widget.rating.toString(),
style: const TextStyle(
fontWeight: FontWeight.w400,
color: Colors.white,
child: Center(
child: Text(
widget.rating.toString(),
style: const TextStyle(
fontWeight: FontWeight.w400,
color: Colors.white,
),
),
),
),
const SizedBox(height: 4.0),
const SizedBox(height: 5),
Container(
padding: const EdgeInsets.all(10),
decoration: const BoxDecoration(
Expand Down Expand Up @@ -111,6 +114,7 @@ class _RatingRowState extends State<RatingRow> {
),
],
),
const SizedBox(height: 5),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Expand All @@ -128,6 +132,7 @@ class _RatingRowState extends State<RatingRow> {
),
),
),
const SizedBox(width: 15),
if (isRated)
SizedBox(
height: 25,
Expand Down

0 comments on commit 78be39b

Please sign in to comment.