CustomScaffold( body: [ const TableHeader(), Table( this code gives me this error…
- User
CustomScaffold( body: [ const TableHeader(), Table( this code gives me this error Another exception was thrown: Incorrect use of ParentDataWidget.
- Assistant
The error message "Incorrect use of ParentDataWidget" is usually related to the incorrect usage of a widget that requires a specific parent widget in its hierarchy.
In this case, it seems like you are trying to use the
Tablewidget directly without placing it inside aTableRowwidget. TheTablewidget only acceptsTableRowwidgets as its direct children.Here's an example of how you can use the
Tablewidget correctly within theCustomScaffold:dartCustomScaffold( body: Table( children: [ TableRow( children: [ TableHeader(), ], ), TableRow( children: [ TableCell( child: Text('Cell 1'), ), TableCell( child: Text('Cell 2'), ), ], ), // Add more TableRow widgets as needed ], ), )Make sure to adjust the example code according to your specific use case.
- User
Table( border: TableBorder.symmetric( inside: BorderSide( color: UIColors.aluminium, style: BorderStyle.solid, width: 2.w), ), children: [ TableRow( decoration: BoxDecoration( border: Border( top: BorderSide( color: UIColors.aluminium, style: BorderStyle.solid, width: 3.w), bottom: BorderSide( color: UIColors.aluminium, style: BorderStyle.solid, width: 3.w), right: BorderSide( color: UIColors.aluminium, style: BorderStyle.solid, width: 3.w), left: BorderSide( color: UIColors.aluminium, style: BorderStyle.solid, width: 3.w), )), children: [ Padding( padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 2.h), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ SizedBox( height: 10.h, ), Text('Price', style: TextStyle( fontSize: 20.sp, color: UIColors.darkGrey, fontWeight: FontWeight.w400)), SizedBox( height: 7.h, ), Text('Amount', style: TextStyle( fontSize: 24.sp, color: UIColors.darkGrey, fontWeight: FontWeight.w700)), SizedBox( height: 10.h, ) this is the code
- Assistant
The code you provided seems to be incomplete and missing some closing parentheses and brackets. However, based on the provided code, it appears that you are correctly using the widget and applying borders and decorations to the .
- User
- Assistant