mirror of
https://github.com/foss42/apidash.git
synced 2025-06-17 11:54:51 +08:00
Migrate constraint check to utils
This commit is contained in:
@ -2,3 +2,4 @@ export 'ui_utils.dart';
|
|||||||
export 'convert_utils.dart';
|
export 'convert_utils.dart';
|
||||||
export 'http_utils.dart';
|
export 'http_utils.dart';
|
||||||
export 'file_utils.dart';
|
export 'file_utils.dart';
|
||||||
|
export 'window_utils.dart';
|
||||||
|
12
lib/utils/window_utils.dart
Normal file
12
lib/utils/window_utils.dart
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
bool showButtonLabelsInBodySuccess(int options, double maxWidth) {
|
||||||
|
switch (options) {
|
||||||
|
case 1:
|
||||||
|
return (maxWidth < 300) ? false : true;
|
||||||
|
case 2:
|
||||||
|
return (maxWidth < 400) ? false : true;
|
||||||
|
case 3:
|
||||||
|
return (maxWidth < 500) ? false : true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -400,18 +400,10 @@ class _BodySuccessState extends State<BodySuccess> {
|
|||||||
|
|
||||||
return LayoutBuilder(
|
return LayoutBuilder(
|
||||||
builder: (BuildContext context, BoxConstraints constraints) {
|
builder: (BuildContext context, BoxConstraints constraints) {
|
||||||
var showLabel = false;
|
var showLabel = showButtonLabelsInBodySuccess(
|
||||||
switch (widget.options.length) {
|
widget.options.length,
|
||||||
case 1:
|
constraints.maxWidth,
|
||||||
showLabel = (constraints.maxWidth < 300) ? false : true;
|
);
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
showLabel = (constraints.maxWidth < 400) ? false : true;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
showLabel = (constraints.maxWidth < 500) ? false : true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: kP10,
|
padding: kP10,
|
||||||
child: Column(
|
child: Column(
|
||||||
|
Reference in New Issue
Block a user