mirror of
https://github.com/foss42/apidash.git
synced 2025-06-02 07:46:10 +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 'http_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(
|
||||
builder: (BuildContext context, BoxConstraints constraints) {
|
||||
var showLabel = false;
|
||||
switch (widget.options.length) {
|
||||
case 1:
|
||||
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;
|
||||
}
|
||||
var showLabel = showButtonLabelsInBodySuccess(
|
||||
widget.options.length,
|
||||
constraints.maxWidth,
|
||||
);
|
||||
return Padding(
|
||||
padding: kP10,
|
||||
child: Column(
|
||||
|
Reference in New Issue
Block a user