feat: rearrange dashbot home buttons

This commit is contained in:
Udhay-Adithya
2025-09-24 14:23:31 +05:30
parent 4292169c90
commit 1a26380be3
3 changed files with 74 additions and 67 deletions

View File

@@ -144,6 +144,10 @@ class DashbotWindow extends ConsumerWidget {
.read(dashbotWindowNotifierProvider
.notifier)
.togglePopped();
ref
.read(dashbotWindowNotifierProvider
.notifier)
.toggleActive();
},
),
IconButton(

View File

@@ -1,6 +1,7 @@
import 'package:apidash/providers/collection_providers.dart';
import 'package:apidash/screens/common_widgets/agentic_ui_features/ai_ui_designer/generate_ui_dialog.dart';
import 'package:apidash/screens/common_widgets/agentic_ui_features/tool_generation/generate_tool_dialog.dart';
import 'package:flutter/foundation.dart';
import '../../../../core/utils/dashbot_icons.dart';
import '../../../../core/providers/dashbot_window_notifier.dart';
@@ -22,11 +23,11 @@ class DashbotHomePage extends ConsumerStatefulWidget {
class _DashbotHomePageState extends ConsumerState<DashbotHomePage> {
@override
Widget build(BuildContext context) {
final hasOkResponse = ref.watch(
selectedRequestModelProvider.select((req) =>
req?.httpResponseModel?.statusCode != null &&
req?.httpResponseModel?.statusCode == 200),
);
// final hasOkResponse = ref.watch(
// selectedRequestModelProvider.select((req) =>
// req?.httpResponseModel?.statusCode != null &&
// req?.httpResponseModel?.statusCode == 200),
// );
// ref.listen(
// selectedRequestModelProvider,
@@ -54,6 +55,7 @@ class _DashbotHomePageState extends ConsumerState<DashbotHomePage> {
spacing: 8,
runSpacing: 8,
children: [
if (kDebugMode) ...[
HomeScreenTaskButton(
label: "🤖 Chat with Dashbot",
onPressed: () {
@@ -62,24 +64,7 @@ class _DashbotHomePageState extends ConsumerState<DashbotHomePage> {
);
},
),
HomeScreenTaskButton(
label: "📥 Import cURL",
onPressed: () {
Navigator.of(context).pushNamed(
DashbotRoutes.dashbotChat,
arguments: ChatMessageType.importCurl,
);
},
),
HomeScreenTaskButton(
label: "📄 Import OpenAPI",
onPressed: () {
Navigator.of(context).pushNamed(
DashbotRoutes.dashbotChat,
arguments: ChatMessageType.importOpenApi,
);
},
),
],
HomeScreenTaskButton(
label: "🔎 Explain me this response",
onPressed: () {
@@ -125,7 +110,24 @@ class _DashbotHomePageState extends ConsumerState<DashbotHomePage> {
);
},
),
if (hasOkResponse) ...[
HomeScreenTaskButton(
label: "📥 Import cURL",
onPressed: () {
Navigator.of(context).pushNamed(
DashbotRoutes.dashbotChat,
arguments: ChatMessageType.importCurl,
);
},
),
HomeScreenTaskButton(
label: "📄 Import OpenAPI",
onPressed: () {
Navigator.of(context).pushNamed(
DashbotRoutes.dashbotChat,
arguments: ChatMessageType.importOpenApi,
);
},
),
HomeScreenTaskButton(
label: "🛠️ Generate Tool",
onPressed: () async {
@@ -162,7 +164,6 @@ class _DashbotHomePageState extends ConsumerState<DashbotHomePage> {
},
),
],
],
),
],
),

View File

@@ -19,6 +19,8 @@ class Dashboard extends ConsumerWidget {
final railIdx = ref.watch(navRailIndexStateProvider);
final isDashBotEnabled =
ref.watch(settingsProvider.select((value) => value.isDashBotEnabled));
final isDashBotActive = ref
.watch(dashbotWindowNotifierProvider.select((value) => value.isActive));
return Scaffold(
body: SafeArea(
child: Row(
@@ -127,7 +129,7 @@ class Dashboard extends ConsumerWidget {
],
),
),
floatingActionButton: isDashBotEnabled
floatingActionButton: isDashBotEnabled && !isDashBotActive
? FloatingActionButton(
backgroundColor: Theme.of(context).colorScheme.primaryContainer,
onPressed: () => showDashbotWindow(context, ref),