mirror of
https://github.com/foss42/apidash.git
synced 2025-12-02 18:57:05 +08:00
refactor: move generate buttons to dashbot
This commit is contained in:
@@ -16,7 +16,7 @@ class DashbotWindowNotifier extends StateNotifier<DashbotWindowModel> {
|
|||||||
final newWidth =
|
final newWidth =
|
||||||
(state.width - dx).clamp(300, screenSize.width - state.right);
|
(state.width - dx).clamp(300, screenSize.width - state.right);
|
||||||
final newHeight =
|
final newHeight =
|
||||||
(state.height - dy).clamp(350, screenSize.height - state.bottom);
|
(state.height - dy).clamp(460, screenSize.height - state.bottom);
|
||||||
|
|
||||||
state = state.copyWith(
|
state = state.copyWith(
|
||||||
width: newWidth.toDouble(),
|
width: newWidth.toDouble(),
|
||||||
|
|||||||
@@ -1,3 +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 '../../../../core/utils/dashbot_icons.dart';
|
import '../../../../core/utils/dashbot_icons.dart';
|
||||||
|
|
||||||
import '../../../../core/routes/dashbot_routes.dart';
|
import '../../../../core/routes/dashbot_routes.dart';
|
||||||
@@ -16,13 +20,22 @@ 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 currentRequest = ref.watch(selectedRequestModelProvider);
|
||||||
|
|
||||||
|
// ref.listen(
|
||||||
|
// selectedRequestModelProvider,
|
||||||
|
// (current, next) {
|
||||||
|
// if (current?.id != next?.id) {
|
||||||
|
// Navigator.pop(context);
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// );
|
||||||
return Container(
|
return Container(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
kVSpacer16,
|
kVSpacer16,
|
||||||
DashbotIcons.getDashbotIcon1(width: 60),
|
DashbotIcons.getDashbotIcon1(width: 60),
|
||||||
|
|
||||||
kVSpacer16,
|
kVSpacer16,
|
||||||
Text(
|
Text(
|
||||||
'Hello there,',
|
'Hello there,',
|
||||||
@@ -70,21 +83,31 @@ class _DashbotHomePageState extends ConsumerState<DashbotHomePage> {
|
|||||||
),
|
),
|
||||||
child: const Text("🔎 Explain me this response"),
|
child: const Text("🔎 Explain me this response"),
|
||||||
),
|
),
|
||||||
// TextButton(
|
|
||||||
// onPressed: () {},
|
|
||||||
// style: TextButton.styleFrom(
|
|
||||||
// side: BorderSide(
|
|
||||||
// color: Theme.of(context).colorScheme.primary,
|
|
||||||
// ),
|
|
||||||
// padding: const EdgeInsets.symmetric(
|
|
||||||
// vertical: 0,
|
|
||||||
// horizontal: 16,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// child: const Text("🐞 Help me debug this error"),
|
|
||||||
// ),
|
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {},
|
onPressed: () {
|
||||||
|
Navigator.of(context).pushNamed(
|
||||||
|
DashbotRoutes.dashbotChat,
|
||||||
|
arguments: ChatMessageType.debugError,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
style: TextButton.styleFrom(
|
||||||
|
side: BorderSide(
|
||||||
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
),
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
vertical: 0,
|
||||||
|
horizontal: 16,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: const Text("🐞 Help me debug this error"),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pushNamed(
|
||||||
|
DashbotRoutes.dashbotChat,
|
||||||
|
arguments: ChatMessageType.general,
|
||||||
|
);
|
||||||
|
},
|
||||||
style: TextButton.styleFrom(
|
style: TextButton.styleFrom(
|
||||||
side: BorderSide(
|
side: BorderSide(
|
||||||
color: Theme.of(context).colorScheme.primary,
|
color: Theme.of(context).colorScheme.primary,
|
||||||
@@ -117,19 +140,15 @@ class _DashbotHomePageState extends ConsumerState<DashbotHomePage> {
|
|||||||
),
|
),
|
||||||
child: const Text("📝 Generate Tests"),
|
child: const Text("📝 Generate Tests"),
|
||||||
),
|
),
|
||||||
// TextButton(
|
if (currentRequest?.httpResponseModel?.statusCode != null &&
|
||||||
// onPressed: () {},
|
currentRequest?.httpResponseModel?.statusCode == 200) ...[
|
||||||
// style: TextButton.styleFrom(
|
Expanded(
|
||||||
// side: BorderSide(
|
child: GenerateToolButton(),
|
||||||
// color: Theme.of(context).colorScheme.primary,
|
),
|
||||||
// ),
|
Expanded(
|
||||||
// padding: const EdgeInsets.symmetric(
|
child: AIGenerateUIButton(),
|
||||||
// vertical: 0,
|
),
|
||||||
// horizontal: 16,
|
],
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// child: const Text("📊 Generate Visualizations"),
|
|
||||||
// ),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user