-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ef9f4eb
commit 704fad6
Showing
12 changed files
with
149 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
sealed class AppStrings { | ||
static const String appName = "CimaCima"; | ||
static const String home = "Home"; | ||
static const String bookmarks = "Bookmarks"; | ||
static const String nowShowing = "Now Showing"; | ||
static const String popular = "Popular"; | ||
static const String upcoming = "Upcoming"; | ||
static const String trending = "Trending"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
lib/features/movies/presentation/screens/trending_screen.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
import 'package:movies_riverpod/app/app_dimensions.dart'; | ||
import 'package:movies_riverpod/app/app_strings.dart'; | ||
import 'package:movies_riverpod/features/movies/presentation/providers/movies_state_notifier_provider.dart'; | ||
import 'package:movies_riverpod/features/movies/presentation/widgets/custom_screen_title.dart'; | ||
import 'package:movies_riverpod/features/movies/presentation/widgets/trending_movies.dart'; | ||
|
||
import 'package:movies_riverpod/features/movies/presentation/widgets/upcomig_movies.dart'; | ||
import 'package:movies_riverpod/shared/network/network_values.dart'; | ||
|
||
class TrendingScreen extends ConsumerStatefulWidget { | ||
const TrendingScreen({super.key}); | ||
|
||
@override | ||
ConsumerState<ConsumerStatefulWidget> createState() => _TrendingScreenState(); | ||
} | ||
|
||
class _TrendingScreenState extends ConsumerState<TrendingScreen> { | ||
@override | ||
void initState() { | ||
super.initState(); | ||
Future(() { | ||
ref | ||
.read(trendingMoviesStateNotifier.notifier) | ||
.getMovies(type: EndPoints.trending); | ||
}); | ||
trendingControl.addListener(trendingScrollListener); | ||
} | ||
|
||
@override | ||
void dispose() { | ||
super.dispose(); | ||
trendingControl.removeListener(trendingScrollListener); | ||
} | ||
|
||
ScrollController trendingControl = ScrollController(); | ||
|
||
void trendingScrollListener() { | ||
if (trendingControl.position.maxScrollExtent == trendingControl.offset) { | ||
ref | ||
.read(trendingMoviesStateNotifier.notifier) | ||
.getMovies(type: EndPoints.trending); | ||
} | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
body: CustomScrollView(controller: trendingControl, slivers: const [ | ||
SliverToBoxAdapter( | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [CustomScreenTtle(screentitle: AppStrings.trending)], | ||
), | ||
), | ||
const TrendingMovies() | ||
]), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
lib/features/movies/presentation/widgets/custom_screen_title.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
import '../../../../app/app_dimensions.dart'; | ||
|
||
class CustomScreenTtle extends StatelessWidget { | ||
const CustomScreenTtle({super.key, required this.screentitle}); | ||
|
||
final String screentitle; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Padding( | ||
padding: EdgeInsets.only( | ||
left: AppDimensions.p18, | ||
bottom: AppDimensions.p24, | ||
), | ||
child: Text( | ||
screentitle, | ||
style: Theme.of(context).textTheme.titleMedium, | ||
), | ||
); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
lib/features/movies/presentation/widgets/trending_movies.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
import 'package:movies_riverpod/features/movies/presentation/providers/movies_state_notifier_provider.dart'; | ||
|
||
import 'package:movies_riverpod/features/movies/presentation/widgets/popular_card.dart'; | ||
import 'package:movies_riverpod/features/movies/presentation/widgets/shimmer/movies_vertical_shimmer.dart'; | ||
import 'package:movies_riverpod/features/movies/presentation/widgets/custom_movie_card.dart'; | ||
import 'package:movies_riverpod/routes/app_router.dart'; | ||
import 'package:go_router/go_router.dart'; | ||
|
||
class TrendingMovies extends ConsumerWidget { | ||
const TrendingMovies({super.key}); | ||
|
||
|
||
@override | ||
Widget build(BuildContext context, WidgetRef ref) { | ||
final trendingMoviesState = ref.watch(trendingMoviesStateNotifier); | ||
return trendingMoviesState.hasData | ||
? SliverList( | ||
delegate: SliverChildBuilderDelegate((context, index) { | ||
if (index < trendingMoviesState.movies.length) { | ||
final movie = trendingMoviesState.movies[index]; | ||
return GestureDetector( | ||
onTap: () { | ||
context.pushNamed(Routes.movieDetail.name, | ||
extra: movie.id); | ||
}, | ||
child: CustomMovieCard(movie: movie)); | ||
} | ||
else { | ||
return const Center(child: CircularProgressIndicator()); | ||
} | ||
}, childCount: trendingMoviesState.movies.length + 1)) | ||
: const SliverFillRemaining(hasScrollBody: true,child: MoviesVerticalListShimmer()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.