From 1ba6a3fa67afe5554b4b03b26db266862ffaa49d Mon Sep 17 00:00:00 2001 From: Ashita Prasad Date: Sat, 17 May 2025 22:49:25 +0530 Subject: [PATCH] Update dashbot.dart --- lib/dashbot/dashbot.dart | 62 +--------------------------------------- 1 file changed, 1 insertion(+), 61 deletions(-) diff --git a/lib/dashbot/dashbot.dart b/lib/dashbot/dashbot.dart index 07bc6b7f..9454aa85 100644 --- a/lib/dashbot/dashbot.dart +++ b/lib/dashbot/dashbot.dart @@ -1,61 +1 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:apidash/dashbot/widgets/dashbot_widget.dart'; - -final dashBotVisibilityProvider = StateProvider((ref) => false); -final dashBotMinimizedProvider = StateProvider((ref) => false); - -void showDashBotBottomSheet(BuildContext context) { - showModalBottomSheet( - context: context, - isScrollControlled: true, - builder: (context) => const Padding( - padding: EdgeInsets.all(16.0), - child: DashBotWidget(), - ), - ); -} - -void toggleDashBotOverlay(WidgetRef ref) { - ref.read(dashBotVisibilityProvider.notifier).state = true; - ref.read(dashBotMinimizedProvider.notifier).state = false; -} - -class DashBotOverlay extends ConsumerWidget { - const DashBotOverlay({super.key}); - - @override - Widget build(BuildContext context, WidgetRef ref) { - final isMinimized = ref.watch(dashBotMinimizedProvider); - - return Material( - elevation: 8, - borderRadius: BorderRadius.circular(12), - child: SizedBox( - width: 400, - height: isMinimized ? 120 : 450, - child: const DashBotWidget(), - ), - ); - } -} - -class DashBotFAB extends ConsumerWidget { - final bool useOverlay; - - const DashBotFAB({this.useOverlay = true, super.key}); - - @override - Widget build(BuildContext context, WidgetRef ref) { - return FloatingActionButton( - onPressed: () { - if (useOverlay) { - toggleDashBotOverlay(ref); - } else { - showDashBotBottomSheet(context); - } - }, - child: const Icon(Icons.help_outline), - ); - } -} +export 'widgets/dashbot_widget.dart';