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