Skip to content

Commit 1ba6a3f

Browse files
committed
Update dashbot.dart
1 parent 6e3441f commit 1ba6a3f

File tree

1 file changed

+1
-61
lines changed

1 file changed

+1
-61
lines changed

lib/dashbot/dashbot.dart

Lines changed: 1 addition & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1 @@
1-
import 'package:flutter/material.dart';
2-
import 'package:flutter_riverpod/flutter_riverpod.dart';
3-
import 'package:apidash/dashbot/widgets/dashbot_widget.dart';
4-
5-
final dashBotVisibilityProvider = StateProvider<bool>((ref) => false);
6-
final dashBotMinimizedProvider = StateProvider<bool>((ref) => false);
7-
8-
void showDashBotBottomSheet(BuildContext context) {
9-
showModalBottomSheet(
10-
context: context,
11-
isScrollControlled: true,
12-
builder: (context) => const Padding(
13-
padding: EdgeInsets.all(16.0),
14-
child: DashBotWidget(),
15-
),
16-
);
17-
}
18-
19-
void toggleDashBotOverlay(WidgetRef ref) {
20-
ref.read(dashBotVisibilityProvider.notifier).state = true;
21-
ref.read(dashBotMinimizedProvider.notifier).state = false;
22-
}
23-
24-
class DashBotOverlay extends ConsumerWidget {
25-
const DashBotOverlay({super.key});
26-
27-
@override
28-
Widget build(BuildContext context, WidgetRef ref) {
29-
final isMinimized = ref.watch(dashBotMinimizedProvider);
30-
31-
return Material(
32-
elevation: 8,
33-
borderRadius: BorderRadius.circular(12),
34-
child: SizedBox(
35-
width: 400,
36-
height: isMinimized ? 120 : 450,
37-
child: const DashBotWidget(),
38-
),
39-
);
40-
}
41-
}
42-
43-
class DashBotFAB extends ConsumerWidget {
44-
final bool useOverlay;
45-
46-
const DashBotFAB({this.useOverlay = true, super.key});
47-
48-
@override
49-
Widget build(BuildContext context, WidgetRef ref) {
50-
return FloatingActionButton(
51-
onPressed: () {
52-
if (useOverlay) {
53-
toggleDashBotOverlay(ref);
54-
} else {
55-
showDashBotBottomSheet(context);
56-
}
57-
},
58-
child: const Icon(Icons.help_outline),
59-
);
60-
}
61-
}
1+
export 'widgets/dashbot_widget.dart';

0 commit comments

Comments
 (0)