-
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
5fd71a0
commit 29dc4e0
Showing
9 changed files
with
291 additions
and
318 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
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
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
33 changes: 33 additions & 0 deletions
33
lib/features/movies/presentation/screens/search_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,33 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
import 'package:movies_riverpod/core/responsive/responsive.dart'; | ||
import 'package:movies_riverpod/features/movie_detail/presentation/provider/movie_detail_state_notifier.dart'; | ||
import 'package:movies_riverpod/features/movie_detail/presentation/provider/state/movie_detail_state.dart'; | ||
import 'package:movies_riverpod/features/movie_detail/presentation/widget/desktop_movie_detail_body.dart'; | ||
import 'package:movies_riverpod/features/movie_detail/presentation/widget/mobile_movie_detail_body.dart'; | ||
import 'package:movies_riverpod/features/movie_detail/presentation/widget/mobile_movie_detail_header.dart'; | ||
import 'package:movies_riverpod/features/movies/presentation/providers/movies_state_notifier_provider.dart'; | ||
|
||
class SearchScreen extends ConsumerStatefulWidget { | ||
const SearchScreen({super.key}); | ||
|
||
@override | ||
ConsumerState<ConsumerStatefulWidget> createState() => _SearchScreenState(); | ||
} | ||
|
||
class _SearchScreenState extends ConsumerState<SearchScreen> { | ||
final TextEditingController _controller = TextEditingController(); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
body: Column( | ||
children: [ | ||
TextField( | ||
controller: _controller, | ||
onSubmitted: (value) {}, | ||
) | ||
], | ||
)); | ||
} | ||
} |
121 changes: 121 additions & 0 deletions
121
lib/features/notifications/presentation/screen/desktop_notification_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,121 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
import 'package:movies_riverpod/core/extensions/build_context_extensions.dart'; | ||
|
||
import '../../../../core/app/app_dimensions.dart'; | ||
import '../provider/notification_provider.dart'; | ||
import '../widget/notification_item.dart'; | ||
|
||
void desktopNotificationSideSheet(BuildContext context) { | ||
// double height = MediaQuery.sizeOf(context).height; | ||
double width = MediaQuery.sizeOf(context).width; | ||
showGeneralDialog( | ||
context: context, | ||
barrierColor: Colors.black.withOpacity(0.5), | ||
barrierDismissible: true, | ||
barrierLabel: '', | ||
transitionBuilder: (context, animation, secondaryAnimation, child) { | ||
const begin = Offset(1.0, 0.0); | ||
const end = Offset(0.0, 0.0); | ||
const curve = Curves.easeInOut; | ||
var tween = Tween(begin: begin, end: end).chain(CurveTween(curve: curve)); | ||
|
||
var offsetAnimation = animation.drive(tween); | ||
return SlideTransition(position: offsetAnimation, child: child); | ||
}, | ||
transitionDuration: const Duration(milliseconds: 400), | ||
pageBuilder: (context, animation, secondaryAnimation) { | ||
return Align( | ||
alignment: Alignment.centerRight, | ||
child: SizedBox( | ||
width: width * .25, | ||
child: Material( | ||
child: Consumer( | ||
builder: (context, ref, child) { | ||
Future(() { | ||
ref | ||
.read(notificationStateProvider.notifier) | ||
.getAllNotifications(); | ||
}); | ||
final notificationsNotifier = | ||
ref.watch(notificationStateProvider); | ||
return ClipRRect( | ||
borderRadius: | ||
BorderRadius.vertical(top: Radius.circular(20.0)), | ||
child: CustomScrollView( | ||
slivers: [ | ||
SliverToBoxAdapter( | ||
child: Column( | ||
children: [ | ||
const SizedBox(height: 8), | ||
Container( | ||
width: 40, | ||
height: 4, | ||
decoration: BoxDecoration( | ||
color: Colors.grey[300], | ||
borderRadius: BorderRadius.circular(2), | ||
), | ||
), | ||
Padding( | ||
padding: const EdgeInsets.all(16.0), | ||
child: Text( | ||
'Notifications', | ||
style: context.textTheme.titleMedium, | ||
), | ||
), | ||
Align( | ||
alignment: Alignment.topRight, | ||
child: InkWell( | ||
onTap: () { | ||
if (notificationsNotifier | ||
.notifications.isNotEmpty) { | ||
ref | ||
.read( | ||
notificationStateProvider.notifier) | ||
.clearNotifications(); | ||
} | ||
}, | ||
child: Padding( | ||
padding: EdgeInsets.only( | ||
top: AppDimensions.p10, | ||
right: AppDimensions.p12, | ||
bottom: AppDimensions.p12, | ||
left: AppDimensions.p12, | ||
), | ||
child: Text('Clear All', | ||
style: context.textTheme.bodySmall), | ||
), | ||
), | ||
), | ||
], | ||
), | ||
), | ||
notificationsNotifier.notifications.isNotEmpty | ||
? SliverList( | ||
delegate: SliverChildBuilderDelegate( | ||
(context, index) { | ||
return NotificationItem( | ||
notificationModel: notificationsNotifier | ||
.notifications[index], | ||
); | ||
}, | ||
childCount: | ||
notificationsNotifier.notifications.length, | ||
), | ||
) | ||
: const SliverFillRemaining( | ||
child: Center( | ||
child: Text('No notification available'), | ||
), | ||
), | ||
], | ||
), | ||
); | ||
}, | ||
), | ||
), | ||
), | ||
); | ||
}, | ||
); | ||
} |
101 changes: 101 additions & 0 deletions
101
lib/features/notifications/presentation/screen/mobile_notification_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,101 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
import 'package:movies_riverpod/core/extensions/build_context_extensions.dart'; | ||
import 'package:movies_riverpod/features/notifications/presentation/provider/notification_provider.dart'; | ||
import 'package:movies_riverpod/features/notifications/presentation/widget/notification_item.dart'; | ||
|
||
import '../../../../core/app/app_dimensions.dart'; | ||
import '../../../../core/responsive/responsive.dart'; | ||
|
||
void mobileNotificationBottomSheet(BuildContext context) { | ||
double height = MediaQuery.sizeOf(context).height; | ||
double width = MediaQuery.sizeOf(context).width; | ||
showModalBottomSheet<void>( | ||
context: context, | ||
isScrollControlled: true, | ||
constraints: Responsive.isDesktop(context) | ||
? BoxConstraints(maxHeight: height * 0.85, maxWidth: width * 0.7) | ||
: const BoxConstraints(), | ||
shape: const RoundedRectangleBorder( | ||
borderRadius: BorderRadius.vertical(top: Radius.circular(20.0)), | ||
), | ||
builder: (BuildContext context) { | ||
return Consumer( | ||
builder: (context, ref, child) { | ||
Future(() { | ||
ref.read(notificationStateProvider.notifier).getAllNotifications(); | ||
}); | ||
final notificationsNotifier = ref.watch(notificationStateProvider); | ||
return ClipRRect( | ||
borderRadius: | ||
const BorderRadius.vertical(top: Radius.circular(20.0)), | ||
child: SizedBox( | ||
height: height * 0.7, | ||
child: CustomScrollView(slivers: [ | ||
SliverToBoxAdapter( | ||
child: Column( | ||
children: [ | ||
const SizedBox(height: 8), | ||
Container( | ||
width: 40, | ||
height: 4, | ||
decoration: BoxDecoration( | ||
color: Colors.grey[300], | ||
borderRadius: BorderRadius.circular(2), | ||
), | ||
), | ||
Padding( | ||
padding: const EdgeInsets.all(16.0), | ||
child: Text( | ||
'Notifications', | ||
style: context.textTheme.titleMedium, | ||
), | ||
), | ||
Align( | ||
alignment: Alignment.topRight, | ||
child: InkWell( | ||
onTap: () { | ||
if (notificationsNotifier | ||
.notifications.isNotEmpty) { | ||
ref | ||
.read(notificationStateProvider.notifier) | ||
.clearNotifications(); | ||
} | ||
}, | ||
child: Padding( | ||
padding: EdgeInsets.only( | ||
top: AppDimensions.p10, | ||
right: AppDimensions.p12, | ||
bottom: AppDimensions.p12, | ||
left: AppDimensions.p12), | ||
child: Text('Clear All', | ||
style: context.textTheme.bodySmall), | ||
)), | ||
) | ||
], | ||
), | ||
), | ||
notificationsNotifier.notifications.isNotEmpty | ||
? SliverList( | ||
delegate: SliverChildBuilderDelegate( | ||
(context, index) { | ||
return NotificationItem( | ||
notificationModel: | ||
notificationsNotifier.notifications[index]); | ||
}, | ||
childCount: | ||
notificationsNotifier.notifications.length, | ||
)) | ||
: const SliverFillRemaining( | ||
child: Center( | ||
child: Text('No notification available'), | ||
), | ||
) | ||
])), | ||
); | ||
}, | ||
); | ||
}, | ||
); | ||
} | ||
|
Oops, something went wrong.