My name is Vigo Walker
I am making a web app, similar to ChatGPT just that with vertex AI from google and image gen with DALL-E and midjourney, I want to make the vertex AI response render as markdown for now I have this:
dart
// Automatic FlutterFlow imports
import '/backend/backend.dart';
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/custom_code/widgets/index.dart'; // Imports other custom widgets
import '/custom_code/actions/index.dart'; // Imports custom actions
import '/flutter_flow/custom_functions.dart'; // Imports custom functions
import 'package:flutter/material.dart';
// Begin custom widget code
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!
import 'package:markdown_widget/markdown_widget.dart';
class MarkDownCustomWidget extends StatefulWidget {
const MarkDownCustomWidget({
Key? key,
this.width,
this.height,
required this.content,
}) : super(key: key);
final double? width;
final double? height;
final String content;
@override
_MarkDownCustomWidgetState createState() => _MarkDownCustomWidgetState();
}
class _MarkDownCustomWidgetState extends State<MarkDownCustomWidget> {
Widget buildMarkdown(BuildContext context) {
final isDark = Theme.of(context).brightness == Brightness.dark;
return MarkdownWidget(
data: widget.content, // <-- use widget.content instead of content
config:
isDark ? MarkdownConfig.darkConfig : MarkdownConfig.defaultConfig);
}
@override
Widget build(BuildContext context) {
return Card(
child: Column(
children: [Expanded(child: buildMarkdown(context))],
));
}
}
This code works fine, just that it is not resisable, so if the response is large, it does not make the card bigger.
I tried asking ChatGPT and he did not knew anything looked like.