Phase 3.1: Complete client_app Riverpod migration (all blocs)
- Migrate SessionClosureBloc → SessionClosureNotifier (@riverpod) - Migrate PairingBloc → PairingNotifier (@riverpod, WebSocket + timer) - Migrate ChatBloc → ChatNotifier (@riverpod, WebSocket + message state) - Remove all flutter_bloc usage from client_app screens and main.dart - MultiBlocProvider fully removed from client_app - All screens now use ConsumerWidget/ConsumerStatefulWidget + ref Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import '../../../core/pairing/pairing_bloc.dart';
|
||||
import '../../../core/pairing/pairing_notifier.dart';
|
||||
|
||||
class BestieFoundScreen extends StatelessWidget {
|
||||
class BestieFoundScreen extends ConsumerWidget {
|
||||
final String sessionId;
|
||||
final String mitraName;
|
||||
|
||||
@@ -14,36 +14,35 @@ class BestieFoundScreen extends StatelessWidget {
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocListener<PairingBloc, PairingState>(
|
||||
listener: (context, state) {
|
||||
if (state is PairingActive) {
|
||||
context.go('/chat/session/${state.sessionId}', extra: state.mitraName);
|
||||
}
|
||||
},
|
||||
child: Scaffold(
|
||||
body: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(32),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(Icons.check_circle, size: 80, color: Colors.green),
|
||||
const SizedBox(height: 24),
|
||||
const Text(
|
||||
'Bestie ditemukan!',
|
||||
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'Menghubungkan kamu ke $mitraName',
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(fontSize: 16, color: Colors.grey),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const CircularProgressIndicator(),
|
||||
],
|
||||
),
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
ref.listen(pairingProvider, (prev, next) {
|
||||
if (next is PairingActiveData) {
|
||||
context.go('/chat/session/${next.sessionId}', extra: next.mitraName);
|
||||
}
|
||||
});
|
||||
|
||||
return Scaffold(
|
||||
body: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(32),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(Icons.check_circle, size: 80, color: Colors.green),
|
||||
const SizedBox(height: 24),
|
||||
const Text(
|
||||
'Bestie ditemukan!',
|
||||
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'Menghubungkan kamu ke $mitraName',
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(fontSize: 16, color: Colors.grey),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const CircularProgressIndicator(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import '../../../core/chat/chat_bloc.dart';
|
||||
import '../../../core/chat/session_closure_bloc.dart';
|
||||
import '../../../core/chat/chat_notifier.dart';
|
||||
import '../../../core/chat/session_closure_notifier.dart';
|
||||
import '../../../core/constants.dart';
|
||||
import '../widgets/pricing_bottom_sheet.dart';
|
||||
|
||||
class ChatScreen extends StatefulWidget {
|
||||
class ChatScreen extends ConsumerStatefulWidget {
|
||||
final String sessionId;
|
||||
final String mitraName;
|
||||
|
||||
const ChatScreen({super.key, required this.sessionId, required this.mitraName});
|
||||
|
||||
@override
|
||||
State<ChatScreen> createState() => _ChatScreenState();
|
||||
ConsumerState<ChatScreen> createState() => _ChatScreenState();
|
||||
}
|
||||
|
||||
class _ChatScreenState extends State<ChatScreen> {
|
||||
class _ChatScreenState extends ConsumerState<ChatScreen> {
|
||||
final _messageController = TextEditingController();
|
||||
final _scrollController = ScrollController();
|
||||
Timer? _typingThrottle;
|
||||
@@ -25,12 +25,12 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
context.read<ChatBloc>().add(ConnectChat(widget.sessionId));
|
||||
ref.read(chatProvider.notifier).connect(widget.sessionId);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
context.read<ChatBloc>().add(DisconnectChat());
|
||||
ref.read(chatProvider.notifier).disconnect();
|
||||
_messageController.dispose();
|
||||
_scrollController.dispose();
|
||||
_typingThrottle?.cancel();
|
||||
@@ -51,122 +51,100 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
|
||||
void _onTextChanged(String text) {
|
||||
if (_typingThrottle?.isActive ?? false) return;
|
||||
context.read<ChatBloc>().add(SendTyping());
|
||||
ref.read(chatProvider.notifier).sendTyping();
|
||||
_typingThrottle = Timer(const Duration(seconds: 2), () {});
|
||||
}
|
||||
|
||||
void _sendMessage() {
|
||||
final text = _messageController.text.trim();
|
||||
if (text.isEmpty) return;
|
||||
context.read<ChatBloc>().add(SendMessage(text));
|
||||
ref.read(chatProvider.notifier).sendMessage(text);
|
||||
_messageController.clear();
|
||||
_scrollToBottom();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MultiBlocListener(
|
||||
listeners: [
|
||||
BlocListener<ChatBloc, ChatState>(
|
||||
listenWhen: (prev, curr) {
|
||||
if (prev is ChatConnected && curr is ChatConnected) {
|
||||
return prev.sessionExpired != curr.sessionExpired ||
|
||||
prev.sessionClosing != curr.sessionClosing ||
|
||||
prev.sessionPaused != curr.sessionPaused ||
|
||||
prev.messages.length != curr.messages.length;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
listener: (context, state) {
|
||||
if (state is ChatConnected) {
|
||||
// Only trigger goodbye if closing AND not expired (expired shows extend dialog first)
|
||||
if (state.sessionClosing && !state.sessionExpired) {
|
||||
final closureState = context.read<SessionClosureBloc>().state;
|
||||
if (closureState is ClosureInitial) {
|
||||
context.read<SessionClosureBloc>().add(DeclineExtension());
|
||||
}
|
||||
}
|
||||
// Extension accepted — reset closure bloc to go back to chat
|
||||
if (!state.sessionPaused && !state.sessionExpired && !state.sessionClosing) {
|
||||
final closureState = context.read<SessionClosureBloc>().state;
|
||||
if (closureState is! ClosureInitial) {
|
||||
context.read<SessionClosureBloc>().add(ResetClosure());
|
||||
}
|
||||
}
|
||||
_scrollToBottom();
|
||||
// Auto-mark received messages as read
|
||||
final unread = state.messages
|
||||
.where((m) => m.senderType == UserType.mitra && m.status != MessageStatus.read)
|
||||
.map((m) => m.id)
|
||||
.toList();
|
||||
if (unread.isNotEmpty) {
|
||||
context.read<ChatBloc>().add(MarkMessagesRead(unread));
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
BlocListener<SessionClosureBloc, SessionClosureState>(
|
||||
listener: (context, state) {
|
||||
if (state is ClosureComplete) {
|
||||
context.go('/home');
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(widget.mitraName),
|
||||
automaticallyImplyLeading: false,
|
||||
actions: [
|
||||
BlocBuilder<ChatBloc, ChatState>(
|
||||
builder: (context, state) {
|
||||
if (state is ChatConnected && state.remainingSeconds != null) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(right: 16),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'${state.remainingSeconds}s',
|
||||
style: TextStyle(
|
||||
color: state.remainingSeconds! < 30 ? Colors.red : null,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
return const SizedBox.shrink();
|
||||
},
|
||||
final chatState = ref.watch(chatProvider);
|
||||
final closureState = ref.watch(sessionClosureProvider);
|
||||
|
||||
// Listen for closure complete to navigate home
|
||||
ref.listen(sessionClosureProvider, (prev, next) {
|
||||
if (next is ClosureCompleteData) {
|
||||
context.go('/home');
|
||||
}
|
||||
});
|
||||
|
||||
// Listen for chat state changes to manage closure state
|
||||
ref.listen(chatProvider, (prev, next) {
|
||||
if (next is ChatConnectedData) {
|
||||
if (next.sessionClosing && !next.sessionExpired) {
|
||||
final closure = ref.read(sessionClosureProvider);
|
||||
if (closure is ClosureInitialData) {
|
||||
ref.read(sessionClosureProvider.notifier).declineExtension();
|
||||
}
|
||||
}
|
||||
if (!next.sessionPaused && !next.sessionExpired && !next.sessionClosing) {
|
||||
final closure = ref.read(sessionClosureProvider);
|
||||
if (closure is! ClosureInitialData) {
|
||||
ref.read(sessionClosureProvider.notifier).reset();
|
||||
}
|
||||
}
|
||||
_scrollToBottom();
|
||||
final unread = next.messages
|
||||
.where((m) => m.senderType == UserType.mitra && m.status != MessageStatus.read)
|
||||
.map((m) => m.id)
|
||||
.toList();
|
||||
if (unread.isNotEmpty) {
|
||||
ref.read(chatProvider.notifier).markRead(unread);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(widget.mitraName),
|
||||
automaticallyImplyLeading: false,
|
||||
actions: [
|
||||
if (chatState is ChatConnectedData && chatState.remainingSeconds != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 16),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'${chatState.remainingSeconds}s',
|
||||
style: TextStyle(
|
||||
color: chatState.remainingSeconds! < 30 ? Colors.red : null,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
body: BlocBuilder<ChatBloc, ChatState>(
|
||||
builder: (context, state) {
|
||||
if (state is ChatConnecting) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
if (state is ChatError) {
|
||||
return Center(child: Text(state.message));
|
||||
}
|
||||
if (state is ChatConnected) {
|
||||
return _buildChatBody(context, state);
|
||||
}
|
||||
return const SizedBox.shrink();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
body: _buildBody(chatState, closureState),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildChatBody(BuildContext context, ChatConnected state) {
|
||||
// Show goodbye input (takes priority — user already decided to close)
|
||||
final closureState = context.watch<SessionClosureBloc>().state;
|
||||
if (closureState is ClosureShowGoodbye || closureState is ClosureSubmitting) {
|
||||
return _buildGoodbyeView(context, closureState);
|
||||
Widget _buildBody(ChatData chatState, SessionClosureData closureState) {
|
||||
if (chatState is ChatConnectingData) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
if (chatState is ChatErrorData) {
|
||||
return Center(child: Text(chatState.message));
|
||||
}
|
||||
if (chatState is ChatConnectedData) {
|
||||
return _buildChatBody(chatState, closureState);
|
||||
}
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
|
||||
Widget _buildChatBody(ChatConnectedData state, SessionClosureData closureState) {
|
||||
if (closureState is ClosureShowGoodbyeData || closureState is ClosureSubmittingData) {
|
||||
return _buildGoodbyeView(closureState);
|
||||
}
|
||||
|
||||
// Show session expired dialog (extend or close?)
|
||||
if (state.sessionExpired) {
|
||||
return _buildExpiredView(context);
|
||||
return _buildExpiredView();
|
||||
}
|
||||
|
||||
if (state.sessionPaused) {
|
||||
@@ -195,7 +173,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
child: Text('Bestie sedang mengetik...', style: TextStyle(color: Colors.grey, fontSize: 12)),
|
||||
),
|
||||
),
|
||||
_buildInputBar(context, state),
|
||||
_buildInputBar(),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -250,7 +228,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildInputBar(BuildContext context, ChatConnected state) {
|
||||
Widget _buildInputBar() {
|
||||
return SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
@@ -280,7 +258,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildExpiredView(BuildContext context) {
|
||||
Widget _buildExpiredView() {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(32),
|
||||
@@ -289,9 +267,8 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
duration: const Duration(seconds: 300),
|
||||
builder: (context, remaining, _) {
|
||||
if (remaining <= 0) {
|
||||
// Auto-decline when countdown reaches 0
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
context.read<SessionClosureBloc>().add(DeclineExtension());
|
||||
ref.read(sessionClosureProvider.notifier).declineExtension();
|
||||
});
|
||||
}
|
||||
final minutes = remaining ~/ 60;
|
||||
@@ -320,7 +297,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
TextButton(
|
||||
onPressed: () => context.read<SessionClosureBloc>().add(DeclineExtension()),
|
||||
onPressed: () => ref.read(sessionClosureProvider.notifier).declineExtension(),
|
||||
child: const Text('Tidak, akhiri sesi'),
|
||||
),
|
||||
],
|
||||
@@ -331,7 +308,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildGoodbyeView(BuildContext context, SessionClosureState closureState) {
|
||||
Widget _buildGoodbyeView(SessionClosureData closureState) {
|
||||
final controller = TextEditingController();
|
||||
return SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(32),
|
||||
@@ -354,17 +331,17 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton(
|
||||
onPressed: closureState is ClosureSubmitting
|
||||
onPressed: closureState is ClosureSubmittingData
|
||||
? null
|
||||
: () {
|
||||
final text = controller.text.trim();
|
||||
if (text.isNotEmpty) {
|
||||
context.read<SessionClosureBloc>().add(
|
||||
SubmitGoodbye(sessionId: widget.sessionId, message: text),
|
||||
ref.read(sessionClosureProvider.notifier).submitGoodbye(
|
||||
widget.sessionId, text,
|
||||
);
|
||||
}
|
||||
},
|
||||
child: closureState is ClosureSubmitting
|
||||
child: closureState is ClosureSubmittingData
|
||||
? const SizedBox(width: 20, height: 20, child: CircularProgressIndicator(strokeWidth: 2))
|
||||
: const Text('Kirim & Selesai'),
|
||||
),
|
||||
|
||||
@@ -1,52 +1,51 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import '../../../core/pairing/pairing_bloc.dart';
|
||||
import '../../../core/pairing/pairing_notifier.dart';
|
||||
|
||||
class SearchingScreen extends StatelessWidget {
|
||||
class SearchingScreen extends ConsumerWidget {
|
||||
const SearchingScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocListener<PairingBloc, PairingState>(
|
||||
listener: (context, state) {
|
||||
if (state is PairingBestieFound) {
|
||||
context.go('/chat/found', extra: {
|
||||
'sessionId': state.sessionId,
|
||||
'mitraName': state.mitraName,
|
||||
});
|
||||
} else if (state is PairingNoBestie) {
|
||||
context.go('/chat/no-bestie');
|
||||
} else if (state is PairingCancelled) {
|
||||
context.go('/home');
|
||||
}
|
||||
},
|
||||
child: Scaffold(
|
||||
body: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(32),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const CircularProgressIndicator(),
|
||||
const SizedBox(height: 32),
|
||||
const Text(
|
||||
'Mencari Bestie...',
|
||||
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
const Text(
|
||||
'Tunggu sebentar ya, kami sedang mencarikan Bestie untukmu',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 16, color: Colors.grey),
|
||||
),
|
||||
const SizedBox(height: 48),
|
||||
OutlinedButton(
|
||||
onPressed: () => context.read<PairingBloc>().add(CancelPairing()),
|
||||
child: const Text('Batalkan'),
|
||||
),
|
||||
],
|
||||
),
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
ref.listen(pairingProvider, (prev, next) {
|
||||
if (next is PairingBestieFoundData) {
|
||||
context.go('/chat/found', extra: {
|
||||
'sessionId': next.sessionId,
|
||||
'mitraName': next.mitraName,
|
||||
});
|
||||
} else if (next is PairingNoBestieData) {
|
||||
context.go('/chat/no-bestie');
|
||||
} else if (next is PairingCancelledData) {
|
||||
context.go('/home');
|
||||
}
|
||||
});
|
||||
|
||||
return Scaffold(
|
||||
body: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(32),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const CircularProgressIndicator(),
|
||||
const SizedBox(height: 32),
|
||||
const Text(
|
||||
'Mencari Bestie...',
|
||||
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
const Text(
|
||||
'Tunggu sebentar ya, kami sedang mencarikan Bestie untukmu',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 16, color: Colors.grey),
|
||||
),
|
||||
const SizedBox(height: 48),
|
||||
OutlinedButton(
|
||||
onPressed: () => ref.read(pairingProvider.notifier).cancelPairing(),
|
||||
child: const Text('Batalkan'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../../../core/chat/chat_opening_provider.dart';
|
||||
import '../../../core/chat/session_closure_bloc.dart';
|
||||
import '../../../core/pairing/pairing_bloc.dart';
|
||||
import '../../../core/chat/session_closure_notifier.dart';
|
||||
import '../../../core/pairing/pairing_notifier.dart';
|
||||
|
||||
class PricingBottomSheet extends ConsumerWidget {
|
||||
/// If set, the bottom sheet is in "extension" mode — selecting a tier extends the session.
|
||||
@@ -16,12 +15,7 @@ class PricingBottomSheet extends ConsumerWidget {
|
||||
return showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
builder: (_) => MultiBlocProvider(
|
||||
providers: [
|
||||
BlocProvider.value(value: context.read<PairingBloc>()),
|
||||
],
|
||||
child: const PricingBottomSheet(),
|
||||
),
|
||||
builder: (_) => const PricingBottomSheet(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -30,12 +24,7 @@ class PricingBottomSheet extends ConsumerWidget {
|
||||
return showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
builder: (_) => MultiBlocProvider(
|
||||
providers: [
|
||||
BlocProvider.value(value: context.read<SessionClosureBloc>()),
|
||||
],
|
||||
child: PricingBottomSheet(extensionSessionId: sessionId),
|
||||
),
|
||||
builder: (_) => PricingBottomSheet(extensionSessionId: sessionId),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -90,7 +79,7 @@ class PricingBottomSheet extends ConsumerWidget {
|
||||
trailing: const Icon(Icons.arrow_forward_ios, size: 16),
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
_startPairing(context, isFreeTrial: true);
|
||||
_startPairing(ref, isFreeTrial: true);
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -107,14 +96,14 @@ class PricingBottomSheet extends ConsumerWidget {
|
||||
Navigator.of(context).pop();
|
||||
if (isExtension) {
|
||||
_requestExtension(
|
||||
context,
|
||||
ref,
|
||||
sessionId: extensionSessionId!,
|
||||
durationMinutes: tier.durationMinutes,
|
||||
price: tier.price,
|
||||
);
|
||||
} else {
|
||||
_startPairing(
|
||||
context,
|
||||
ref,
|
||||
durationMinutes: tier.durationMinutes,
|
||||
price: tier.price,
|
||||
);
|
||||
@@ -130,19 +119,19 @@ class PricingBottomSheet extends ConsumerWidget {
|
||||
);
|
||||
}
|
||||
|
||||
void _startPairing(BuildContext context, {bool isFreeTrial = false, int? durationMinutes, int? price}) {
|
||||
context.read<PairingBloc>().add(RequestPairingWithTier(
|
||||
void _startPairing(WidgetRef ref, {bool isFreeTrial = false, int? durationMinutes, int? price}) {
|
||||
ref.read(pairingProvider.notifier).requestPairingWithTier(
|
||||
durationMinutes: durationMinutes,
|
||||
price: price,
|
||||
isFreeTrial: isFreeTrial,
|
||||
));
|
||||
);
|
||||
}
|
||||
|
||||
void _requestExtension(BuildContext context, {required String sessionId, required int durationMinutes, required int price}) {
|
||||
context.read<SessionClosureBloc>().add(RequestExtension(
|
||||
sessionId: sessionId,
|
||||
void _requestExtension(WidgetRef ref, {required String sessionId, required int durationMinutes, required int price}) {
|
||||
ref.read(sessionClosureProvider.notifier).requestExtension(
|
||||
sessionId,
|
||||
durationMinutes: durationMinutes,
|
||||
price: price,
|
||||
));
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user