I am learning to build a custom widget adding one thing at a time.
Im at adding a container with height, weight, color,
and a single basic line of text inside the containerHowever,
I am getting an unknown error and yet the widget works. Any ideas?
// Automatic FlutterFlow imports
import '/backend/schema/structs/index.dart';
import '/backend/supabase/supabase.dart';
import '/actions/actions.dart' as action_blocks;
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 '/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!
class CodeVisualizerV1Widget extends StatefulWidget {
const CodeVisualizerV1Widget({
super.key,
this.width,
this.height,
this.customColor,
this.data,
});
final double? width;
final double? height;
final Color? customColor;
final String? data;
@override
State<CodeVisualizerV1Widget> createState() => _CodeVisualizerV1WidgetState();
}
class _CodeVisualizerV1WidgetState extends State<CodeVisualizerV1Widget> {
@override
Widget build(BuildContext context) {
return Container(
width: widget.width ?? 100.0,
height: widget.height ?? 100.0,
color: widget.customColor ?? Colors.blue,
child: Center(
child: Text(widget.data ?? 'No Data'),
),
);
}
}
Unknown error in custom widget... widget still works?
Custom Code
ChatGPT, Docs, farting around
Yes
2 replies