mirror of
https://github.com/foss42/apidash.git
synced 2025-11-30 17:59:18 +08:00
feat: rearrange dashbot home buttons
This commit is contained in:
@@ -144,6 +144,10 @@ class DashbotWindow extends ConsumerWidget {
|
|||||||
.read(dashbotWindowNotifierProvider
|
.read(dashbotWindowNotifierProvider
|
||||||
.notifier)
|
.notifier)
|
||||||
.togglePopped();
|
.togglePopped();
|
||||||
|
ref
|
||||||
|
.read(dashbotWindowNotifierProvider
|
||||||
|
.notifier)
|
||||||
|
.toggleActive();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:apidash/providers/collection_providers.dart';
|
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/ai_ui_designer/generate_ui_dialog.dart';
|
||||||
import 'package:apidash/screens/common_widgets/agentic_ui_features/tool_generation/generate_tool_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/utils/dashbot_icons.dart';
|
||||||
import '../../../../core/providers/dashbot_window_notifier.dart';
|
import '../../../../core/providers/dashbot_window_notifier.dart';
|
||||||
@@ -22,11 +23,11 @@ class DashbotHomePage extends ConsumerStatefulWidget {
|
|||||||
class _DashbotHomePageState extends ConsumerState<DashbotHomePage> {
|
class _DashbotHomePageState extends ConsumerState<DashbotHomePage> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final hasOkResponse = ref.watch(
|
// final hasOkResponse = ref.watch(
|
||||||
selectedRequestModelProvider.select((req) =>
|
// selectedRequestModelProvider.select((req) =>
|
||||||
req?.httpResponseModel?.statusCode != null &&
|
// req?.httpResponseModel?.statusCode != null &&
|
||||||
req?.httpResponseModel?.statusCode == 200),
|
// req?.httpResponseModel?.statusCode == 200),
|
||||||
);
|
// );
|
||||||
|
|
||||||
// ref.listen(
|
// ref.listen(
|
||||||
// selectedRequestModelProvider,
|
// selectedRequestModelProvider,
|
||||||
@@ -54,6 +55,7 @@ class _DashbotHomePageState extends ConsumerState<DashbotHomePage> {
|
|||||||
spacing: 8,
|
spacing: 8,
|
||||||
runSpacing: 8,
|
runSpacing: 8,
|
||||||
children: [
|
children: [
|
||||||
|
if (kDebugMode) ...[
|
||||||
HomeScreenTaskButton(
|
HomeScreenTaskButton(
|
||||||
label: "🤖 Chat with Dashbot",
|
label: "🤖 Chat with Dashbot",
|
||||||
onPressed: () {
|
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(
|
HomeScreenTaskButton(
|
||||||
label: "🔎 Explain me this response",
|
label: "🔎 Explain me this response",
|
||||||
onPressed: () {
|
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(
|
HomeScreenTaskButton(
|
||||||
label: "🛠️ Generate Tool",
|
label: "🛠️ Generate Tool",
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
@@ -162,7 +164,6 @@ class _DashbotHomePageState extends ConsumerState<DashbotHomePage> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
],
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ class Dashboard extends ConsumerWidget {
|
|||||||
final railIdx = ref.watch(navRailIndexStateProvider);
|
final railIdx = ref.watch(navRailIndexStateProvider);
|
||||||
final isDashBotEnabled =
|
final isDashBotEnabled =
|
||||||
ref.watch(settingsProvider.select((value) => value.isDashBotEnabled));
|
ref.watch(settingsProvider.select((value) => value.isDashBotEnabled));
|
||||||
|
final isDashBotActive = ref
|
||||||
|
.watch(dashbotWindowNotifierProvider.select((value) => value.isActive));
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Row(
|
child: Row(
|
||||||
@@ -127,7 +129,7 @@ class Dashboard extends ConsumerWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
floatingActionButton: isDashBotEnabled
|
floatingActionButton: isDashBotEnabled && !isDashBotActive
|
||||||
? FloatingActionButton(
|
? FloatingActionButton(
|
||||||
backgroundColor: Theme.of(context).colorScheme.primaryContainer,
|
backgroundColor: Theme.of(context).colorScheme.primaryContainer,
|
||||||
onPressed: () => showDashbotWindow(context, ref),
|
onPressed: () => showDashbotWindow(context, ref),
|
||||||
|
|||||||
Reference in New Issue
Block a user