mirror of
https://github.com/foss42/apidash.git
synced 2025-05-22 08:46:33 +08:00
Fix View Code Pane Overflow
This commit is contained in:
@ -10,3 +10,7 @@ bool showButtonLabelsInBodySuccess(int options, double maxWidth) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool showButtonLabelsInViewCodePane(double maxWidth) {
|
||||||
|
return (maxWidth < 400) ? false : true;
|
||||||
|
}
|
||||||
|
@ -135,48 +135,55 @@ class _ViewCodePaneState extends State<ViewCodePane> {
|
|||||||
borderRadius: kBorderRadius8,
|
borderRadius: kBorderRadius8,
|
||||||
);
|
);
|
||||||
|
|
||||||
return Padding(
|
return LayoutBuilder(
|
||||||
padding: kP10,
|
builder: (BuildContext context, BoxConstraints constraints) {
|
||||||
child: Column(
|
var showLabel = showButtonLabelsInViewCodePane(
|
||||||
children: [
|
constraints.maxWidth,
|
||||||
SizedBox(
|
);
|
||||||
height: kHeaderHeight,
|
return Padding(
|
||||||
child: Row(
|
padding: kP10,
|
||||||
children: [
|
child: Column(
|
||||||
Expanded(
|
children: [
|
||||||
child: Text(
|
SizedBox(
|
||||||
"Code",
|
height: kHeaderHeight,
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: DropdownButtonCodegenLanguage(
|
||||||
|
codegenLanguage: widget.codegenLanguage,
|
||||||
|
onChanged: widget.onChangedCodegenLanguage,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
CopyButton(
|
||||||
|
toCopy: widget.code,
|
||||||
|
showLabel: showLabel,
|
||||||
|
),
|
||||||
|
SaveInDownloadsButton(
|
||||||
|
content: stringToBytes(widget.code),
|
||||||
|
mimeType: "application/vnd.dart",
|
||||||
|
showLabel: showLabel,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
kVSpacer10,
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
width: double.maxFinite,
|
||||||
|
padding: kP8,
|
||||||
|
decoration: textContainerdecoration,
|
||||||
|
child: CodeGenPreviewer(
|
||||||
|
code: widget.code,
|
||||||
|
theme: codeTheme,
|
||||||
|
language: 'dart',
|
||||||
|
textStyle: kCodeStyle,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
DropdownButtonCodegenLanguage(
|
|
||||||
codegenLanguage: widget.codegenLanguage,
|
|
||||||
onChanged: widget.onChangedCodegenLanguage,
|
|
||||||
),
|
|
||||||
CopyButton(toCopy: widget.code),
|
|
||||||
SaveInDownloadsButton(
|
|
||||||
content: stringToBytes(widget.code),
|
|
||||||
mimeType: "application/vnd.dart",
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
kVSpacer10,
|
|
||||||
Expanded(
|
|
||||||
child: Container(
|
|
||||||
width: double.maxFinite,
|
|
||||||
padding: kP8,
|
|
||||||
decoration: textContainerdecoration,
|
|
||||||
child: CodeGenPreviewer(
|
|
||||||
code: widget.code,
|
|
||||||
theme: codeTheme,
|
|
||||||
language: 'dart',
|
|
||||||
textStyle: kCodeStyle,
|
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
],
|
);
|
||||||
),
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user