Skip to content

Instantly share code, notes, and snippets.

@Zfinix
Created March 26, 2020 13:16
Show Gist options
  • Select an option

  • Save Zfinix/8e4823cf73464e5d94d2d463a3ea260a to your computer and use it in GitHub Desktop.

Select an option

Save Zfinix/8e4823cf73464e5d94d2d463a3ea260a to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
class XMargin extends StatelessWidget {
final double x;
const XMargin(this.x);
@override
Widget build(BuildContext context) {
return SizedBox(width: x);
}
}
class YMargin extends StatelessWidget {
final double y;
const YMargin(this.y);
@override
Widget build(BuildContext context) {
return SizedBox(height: y);
}
}
double screenHeight(BuildContext context, {double percent = 1}) =>
MediaQuery.of(context).size.height * percent;
double screenWidth(BuildContext context, {double percent = 1}) =>
MediaQuery.of(context).size.width * percent;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment