Fix View Code Pane Overflow

This commit is contained in:
Ankit Mahato
2023-07-20 01:54:16 +05:30
parent bf49a56c0f
commit 2276fcfe1a
2 changed files with 49 additions and 38 deletions

View File

@ -10,3 +10,7 @@ bool showButtonLabelsInBodySuccess(int options, double maxWidth) {
return false; return false;
} }
} }
bool showButtonLabelsInViewCodePane(double maxWidth) {
return (maxWidth < 400) ? false : true;
}

View File

@ -135,6 +135,11 @@ class _ViewCodePaneState extends State<ViewCodePane> {
borderRadius: kBorderRadius8, borderRadius: kBorderRadius8,
); );
return LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
var showLabel = showButtonLabelsInViewCodePane(
constraints.maxWidth,
);
return Padding( return Padding(
padding: kP10, padding: kP10,
child: Column( child: Column(
@ -144,19 +149,19 @@ class _ViewCodePaneState extends State<ViewCodePane> {
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
child: Text( child: DropdownButtonCodegenLanguage(
"Code",
style: Theme.of(context).textTheme.titleMedium,
),
),
DropdownButtonCodegenLanguage(
codegenLanguage: widget.codegenLanguage, codegenLanguage: widget.codegenLanguage,
onChanged: widget.onChangedCodegenLanguage, onChanged: widget.onChangedCodegenLanguage,
), ),
CopyButton(toCopy: widget.code), ),
CopyButton(
toCopy: widget.code,
showLabel: showLabel,
),
SaveInDownloadsButton( SaveInDownloadsButton(
content: stringToBytes(widget.code), content: stringToBytes(widget.code),
mimeType: "application/vnd.dart", mimeType: "application/vnd.dart",
showLabel: showLabel,
) )
], ],
), ),
@ -178,5 +183,7 @@ class _ViewCodePaneState extends State<ViewCodePane> {
], ],
), ),
); );
},
);
} }
} }